Ui improvment

This commit is contained in:
2023-03-17 22:55:06 +01:00
parent c518ccf2b4
commit 3e8cfec634
3 changed files with 70 additions and 11 deletions
+48 -9
View File
@@ -39,7 +39,7 @@ from vse_toolbox.sequencer_utils import (
set_channels,
)
from vse_toolbox.bl_utils import get_addon_prefs, get_settings
from vse_toolbox.file_utils import install_module, norm_str
from vse_toolbox.file_utils import install_module, norm_name, norm_str
class VSETB_OT_export_csv(Operator):
bl_idname = "sequencer.export_csv"
@@ -102,8 +102,34 @@ class VSETB_OT_auto_select_files(Operator):
return {'FINISHED'}
class VSETB_OT_import(Operator):
bl_idname = "sequencer.import"
# class VSETB_OT_select_file(Operator):
# bl_idname = "import.select_file"
# bl_label = "Select File"
# bl_description = "Select Active as File"
# bl_options = {"REGISTER", "UNDO"}
# type : StringProperty('')
# @classmethod
# def poll(cls, context):
# return True
# def execute(self, context):
# params = context.space_data.params
# print(params.filename)
# if self.type == 'edit':
# bpy.ops.sequencer.import_files(edit=params.filename)
# elif self.type == 'movie':
# bpy.ops.sequencer.import_files(movie=params.filename)
# elif self.type == 'sound':
# bpy.ops.sequencer.import_files(sound=params.filename)
# return {'FINISHED'}
class VSETB_OT_import_files(Operator):
bl_idname = "sequencer.import_files"
bl_label = "Import"
bl_description = "Import Edit"
bl_options = {"REGISTER", "UNDO"}
@@ -116,7 +142,6 @@ class VSETB_OT_import(Operator):
subtype='FILE_PATH',
)
files : CollectionProperty(type=bpy.types.OperatorFileListElement)
clean_sequencer : BoolProperty(
name="Clean Sequencer",
default=False,
@@ -149,21 +174,27 @@ class VSETB_OT_import(Operator):
row = self.layout.row(heading="Import Edit", align=True)
row.prop(self, 'import_edit')
sub = row.row()
sub = row.row(align=True)
sub.active = self.import_edit
sub.prop(self, 'edit')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'edit'
row = self.layout.row(heading="Import Movie", align=True)
row.prop(self, 'import_movie')
sub = row.row()
sub.active = self.import_movie
sub.prop(self, 'movie')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'movie'
row = self.layout.row(heading="Import Sound", align=True)
row.prop(self, 'import_sound')
sub = row.row()
sub.active = self.import_sound
sub.prop(self, 'sound')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'sound'
col = layout.column()
col.separator()
@@ -230,10 +261,16 @@ class VSETB_OT_load_assets(Operator):
def get_items(self, items=[]):
if not items:
return [('NONE', 'None', '', 0)]
item_sorted = [(e.name, e.name, '', i) for i, e in enumerate(sorted(items, key=lambda x:x.name))]
return item_sorted
icons = {
'camera':'CAMERA_DATA',
'chars':'COMMUNITY',
'props':'OBJECT_DATAMODE',
'sets':'SMOOTHCURVE',
}
# return [(e.name, e.norm_name, '', i) for i, e in enumerate(items)]
return [(e.name, e.name, '', icons[e.asset_type], i) for i, e in enumerate(items)]
def execute(self, context):
settings = get_settings()
prefs = get_addon_prefs()
@@ -249,6 +286,7 @@ class VSETB_OT_load_assets(Operator):
for asset_data in assets:
asset = project.assets.add()
asset.name = asset_data['name']
# asset.norm_name = norm_name(asset_data['name'], separator=' ', format=str.title)
asset.id = asset_data['id']
asset.asset_type = asset_data['asset_type']
@@ -578,13 +616,14 @@ classes=(
VSETB_OT_casting_add,
VSETB_OT_casting_actions,
VSETB_OT_export_csv,
VSETB_OT_import,
VSETB_OT_import_files,
VSETB_OT_load_assets,
VSETB_OT_load_projects,
VSETB_OT_new_episode,
VSETB_OT_reload_addon,
VSETB_OT_rename,
VSETB_OT_render,
# VSETB_OT_select_file,
VSETB_OT_set_scene,
)