add comments panel
parent
571f7d5807
commit
10f9824ac2
|
@ -103,21 +103,26 @@ class VSETB_OT_load_projects(Operator):
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def hex_to_rgb(hex_value):
|
||||||
|
print(hex_value)
|
||||||
|
b = (hex_value & 0xFF) / 255.0
|
||||||
|
g = ((hex_value >> 8) & 0xFF) / 255.0
|
||||||
|
r = ((hex_value >> 16) & 0xFF) / 255.0
|
||||||
|
return r, g, b
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def hex_to_rgb(color_str):
|
||||||
|
# supports '123456', '#123456' and '0x123456'
|
||||||
|
(r,g,b), a = map(lambda component: component / 255, bytes.fromhex(color_str[-6:])), 1.0
|
||||||
|
return (r,g,b,a)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
settings = get_scene_settings()
|
settings = get_scene_settings()
|
||||||
prefs = get_addon_prefs()
|
prefs = get_addon_prefs()
|
||||||
tracker = prefs.tracker
|
tracker = prefs.tracker
|
||||||
|
prev_project_name = settings.project_name
|
||||||
|
|
||||||
prev_project_name = settings.project_name#.replace(' ', '_').upper()
|
|
||||||
print("prev_project_name", prev_project_name)
|
|
||||||
|
|
||||||
# old_episode_name = None
|
|
||||||
# if settings.active_project:
|
|
||||||
# old_episode_name = settings.active_project.episode_name.replace(' ', '_').upper()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#settings.projects.clear()
|
|
||||||
tracker.connect()
|
tracker.connect()
|
||||||
|
|
||||||
project_datas = tracker.get_projects()
|
project_datas = tracker.get_projects()
|
||||||
|
@ -175,6 +180,9 @@ class VSETB_OT_load_projects(Operator):
|
||||||
for task_type_data in tracker.get_shot_task_types(project_data):
|
for task_type_data in tracker.get_shot_task_types(project_data):
|
||||||
task_type = project.task_types.add()
|
task_type = project.task_types.add()
|
||||||
task_type.name = task_type_data['name']
|
task_type.name = task_type_data['name']
|
||||||
|
task_type.color = self.hex_to_rgb(task_type_data['color'])[:3]
|
||||||
|
|
||||||
|
project.set_shot_tasks()
|
||||||
|
|
||||||
project.asset_types.clear()
|
project.asset_types.clear()
|
||||||
for asset_type_data in tracker.get_asset_types(project_data):
|
for asset_type_data in tracker.get_asset_types(project_data):
|
||||||
|
|
|
@ -126,6 +126,7 @@ class Kitsu(Tracker):
|
||||||
def get_shot_task_types(self, project=None):
|
def get_shot_task_types(self, project=None):
|
||||||
project = self.get_project(project)
|
project = self.get_project(project)
|
||||||
task_types = gazu.task.all_task_types_for_project(project)
|
task_types = gazu.task.all_task_types_for_project(project)
|
||||||
|
task_types.sort(key=lambda x: x['priority'])
|
||||||
return [t for t in task_types if t['for_entity'].lower() == 'shot']
|
return [t for t in task_types if t['for_entity'].lower() == 'shot']
|
||||||
|
|
||||||
def get_metadata_types(self, project=None):
|
def get_metadata_types(self, project=None):
|
||||||
|
|
98
ui/panels.py
98
ui/panels.py
|
@ -216,14 +216,22 @@ class VSETB_PT_exports(VSETB_main, Panel):
|
||||||
layout.operator('vse_toolbox.export_edl', text='Export edl', icon='SEQ_SEQUENCER')
|
layout.operator('vse_toolbox.export_edl', text='Export edl', icon='SEQ_SEQUENCER')
|
||||||
|
|
||||||
|
|
||||||
class VSETB_PT_casting(VSETB_main, Panel):
|
|
||||||
bl_label = "Casting"
|
class VSETB_PT_tracker(VSETB_main, Panel):
|
||||||
|
bl_label = "Tracker"
|
||||||
bl_parent_id = "VSETB_PT_main"
|
bl_parent_id = "VSETB_PT_main"
|
||||||
|
|
||||||
def draw_header_preset(self, context):
|
def draw_header_preset(self, context):
|
||||||
active_strip = context.scene.sequence_editor.active_strip
|
active_strip = context.scene.sequence_editor.active_strip
|
||||||
self.layout.label(text=active_strip.name)
|
self.layout.label(text=active_strip.name)
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
return
|
||||||
|
|
||||||
|
class VSETB_PT_casting(VSETB_main, Panel):
|
||||||
|
bl_label = "Casting"
|
||||||
|
bl_parent_id = "VSETB_PT_tracker"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
strip = context.scene.sequence_editor.active_strip
|
strip = context.scene.sequence_editor.active_strip
|
||||||
|
@ -277,33 +285,33 @@ class VSETB_PT_casting(VSETB_main, Panel):
|
||||||
|
|
||||||
class VSETB_PT_metadata(VSETB_main, Panel):
|
class VSETB_PT_metadata(VSETB_main, Panel):
|
||||||
bl_label = "Shot Metadata"
|
bl_label = "Shot Metadata"
|
||||||
bl_parent_id = "VSETB_PT_casting"
|
bl_parent_id = "VSETB_PT_tracker"
|
||||||
#bl_options = {"DEFAULT_CLOSED"}
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.scene.sequence_editor.active_strip and get_scene_settings().active_project
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
|
||||||
scn = context.scene
|
|
||||||
active_strip = scn.sequence_editor.active_strip
|
|
||||||
|
|
||||||
if not active_strip:
|
|
||||||
return
|
|
||||||
|
|
||||||
settings = get_scene_settings()
|
|
||||||
strip_settings = get_strip_settings()
|
strip_settings = get_strip_settings()
|
||||||
|
project = get_scene_settings().active_project
|
||||||
|
|
||||||
project = settings.active_project
|
layout = self.layout
|
||||||
|
row = layout.row(align=True)
|
||||||
if not project:
|
label_col = row.column(align=True)
|
||||||
return
|
label_col.alignment = 'RIGHT'
|
||||||
|
field_col = row.column(align=True)
|
||||||
col = layout.column(align=True)
|
|
||||||
col.prop(strip_settings, 'description', text='DESCRIPTION')
|
|
||||||
|
|
||||||
for metadata_type in project.metadata_types:
|
for metadata_type in project.metadata_types:
|
||||||
if metadata_type.entity_type == 'SHOT':
|
if metadata_type.entity_type != 'SHOT':
|
||||||
#row = layout.row(align=False)
|
continue
|
||||||
|
|
||||||
metadata_key = metadata_type.field_name
|
metadata_key = metadata_type.field_name
|
||||||
metadata_label = metadata_key.upper()
|
metadata_label = metadata_key.title()
|
||||||
|
|
||||||
|
label_col.label(text=metadata_label)
|
||||||
|
field_row = field_col.row(align=True)
|
||||||
|
field_row.separator()
|
||||||
|
|
||||||
if metadata_type.choices:
|
if metadata_type.choices:
|
||||||
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
||||||
|
@ -314,13 +322,51 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
||||||
else:
|
else:
|
||||||
icon = 'ADD'
|
icon = 'ADD'
|
||||||
|
|
||||||
col.prop_search(strip_settings.metadata, metadata_key, metadata_type, 'choices',
|
field_row.prop_search(strip_settings.metadata, metadata_key, metadata_type, 'choices',
|
||||||
results_are_suggestions=True, icon=icon, text=metadata_label)
|
results_are_suggestions=True, icon=icon, text='')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
col.prop(strip_settings.metadata, metadata_key, text=metadata_label)
|
field_row.prop(strip_settings.metadata, metadata_key, text='')
|
||||||
|
|
||||||
|
|
||||||
|
class VSETB_PT_comments(VSETB_main, Panel):
|
||||||
|
bl_label = "Comments"
|
||||||
|
bl_parent_id = "VSETB_PT_tracker"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.scene.sequence_editor.active_strip and get_scene_settings().active_project
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
label_col = row.column(align=True)
|
||||||
|
label_col.alignment = 'RIGHT'
|
||||||
|
field_col = row.column(align=True)
|
||||||
|
|
||||||
|
strip_settings = get_strip_settings()
|
||||||
|
project = get_scene_settings().active_project
|
||||||
|
|
||||||
|
|
||||||
|
for task_type in project.task_types:
|
||||||
|
|
||||||
|
if not hasattr(strip_settings.tasks, task_type.name):
|
||||||
|
continue
|
||||||
|
|
||||||
|
label_col.label(text=task_type.name)
|
||||||
|
|
||||||
|
row = field_col.row(align=True)
|
||||||
|
row.separator()
|
||||||
|
sub = row.row(align=True)
|
||||||
|
sub.alignment = 'LEFT'
|
||||||
|
sub.scale_x = 0.15
|
||||||
|
|
||||||
|
sub.prop(task_type, 'color', text='')
|
||||||
|
sub.enabled = False
|
||||||
|
|
||||||
|
row.prop(getattr(strip_settings.tasks, task_type.name), 'comment', text='')
|
||||||
|
|
||||||
#row.operator('vse_toolbox.copy_metadata', icon='PASTEDOWN', text='', emboss=False).metadata = metadata_key
|
|
||||||
|
|
||||||
def context_menu_prop(self, context):
|
def context_menu_prop(self, context):
|
||||||
if not hasattr(context, 'button_prop') or context.space_data.type != 'SEQUENCE_EDITOR':
|
if not hasattr(context, 'button_prop') or context.space_data.type != 'SEQUENCE_EDITOR':
|
||||||
|
@ -343,8 +389,10 @@ classes = (
|
||||||
VSETB_PT_main,
|
VSETB_PT_main,
|
||||||
VSETB_PT_imports,
|
VSETB_PT_imports,
|
||||||
VSETB_PT_sequencer,
|
VSETB_PT_sequencer,
|
||||||
|
VSETB_PT_tracker,
|
||||||
VSETB_PT_casting,
|
VSETB_PT_casting,
|
||||||
VSETB_PT_metadata,
|
VSETB_PT_metadata,
|
||||||
|
VSETB_PT_comments,
|
||||||
VSETB_PT_presets,
|
VSETB_PT_presets,
|
||||||
VSETB_PT_exports,
|
VSETB_PT_exports,
|
||||||
VSETB_PT_strip
|
VSETB_PT_strip
|
||||||
|
|
|
@ -12,6 +12,7 @@ from bpy.props import (
|
||||||
IntProperty,
|
IntProperty,
|
||||||
PointerProperty,
|
PointerProperty,
|
||||||
StringProperty,
|
StringProperty,
|
||||||
|
FloatVectorProperty
|
||||||
)
|
)
|
||||||
from bpy.types import PropertyGroup, UIList
|
from bpy.types import PropertyGroup, UIList
|
||||||
from pprint import pprint as pp
|
from pprint import pprint as pp
|
||||||
|
@ -106,7 +107,7 @@ class MetadataType(PropertyGroup):
|
||||||
|
|
||||||
|
|
||||||
class TaskType(PropertyGroup):
|
class TaskType(PropertyGroup):
|
||||||
__annotations__ = {}
|
color : FloatVectorProperty(subtype='COLOR')
|
||||||
|
|
||||||
|
|
||||||
class TaskStatus(PropertyGroup):
|
class TaskStatus(PropertyGroup):
|
||||||
|
@ -117,6 +118,14 @@ class Metadata(CollectionPropertyGroup):
|
||||||
__annotations__ = {}
|
__annotations__ = {}
|
||||||
|
|
||||||
|
|
||||||
|
class ShotTasks(PropertyGroup):
|
||||||
|
__annotations__ = {}
|
||||||
|
|
||||||
|
|
||||||
|
class ShotTask(PropertyGroup):
|
||||||
|
comment : StringProperty()
|
||||||
|
|
||||||
|
|
||||||
class Episode(PropertyGroup):
|
class Episode(PropertyGroup):
|
||||||
id : StringProperty(default='')
|
id : StringProperty(default='')
|
||||||
|
|
||||||
|
@ -358,7 +367,12 @@ class Project(PropertyGroup):
|
||||||
Metadata.__annotations__[field_name] = prop
|
Metadata.__annotations__[field_name] = prop
|
||||||
setattr(Metadata, field_name, prop)
|
setattr(Metadata, field_name, prop)
|
||||||
|
|
||||||
|
def set_shot_tasks(self):
|
||||||
|
for task_type in self.task_types:
|
||||||
|
prop = bpy.props.PointerProperty(type=ShotTask)
|
||||||
|
|
||||||
|
ShotTasks.__annotations__[task_type.name] = prop
|
||||||
|
setattr(ShotTasks, task_type.name, prop)
|
||||||
|
|
||||||
|
|
||||||
class VSETB_UL_casting(UIList):
|
class VSETB_UL_casting(UIList):
|
||||||
|
@ -561,6 +575,7 @@ class VSETB_PGT_strip_settings(PropertyGroup):
|
||||||
source_name : StringProperty(name='')
|
source_name : StringProperty(name='')
|
||||||
metadata : PointerProperty(type=Metadata)
|
metadata : PointerProperty(type=Metadata)
|
||||||
description : StringProperty()
|
description : StringProperty()
|
||||||
|
tasks: PointerProperty(type=ShotTasks)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_casting(self):
|
def active_casting(self):
|
||||||
|
@ -600,6 +615,8 @@ classes = (
|
||||||
Metadata,
|
Metadata,
|
||||||
MetadataType,
|
MetadataType,
|
||||||
TaskType,
|
TaskType,
|
||||||
|
ShotTasks,
|
||||||
|
ShotTask,
|
||||||
SpreadsheetImport,
|
SpreadsheetImport,
|
||||||
SpreadsheetExport,
|
SpreadsheetExport,
|
||||||
Project,
|
Project,
|
||||||
|
|
Loading…
Reference in New Issue