chore(auto_export): preferences/properties cleanups

This commit is contained in:
kaosat.dev 2024-04-26 23:02:09 +02:00
parent 74b12b9b06
commit f0d7ccd454
3 changed files with 43 additions and 44 deletions

View File

@ -1,22 +1,22 @@
import bpy import bpy
class SceneLink(bpy.types.PropertyGroup): class SceneLink(bpy.types.PropertyGroup):
name: bpy.props.StringProperty(name="") name: bpy.props.StringProperty(name="") # type: ignore
scene: bpy.props.PointerProperty(type=bpy.types.Scene) scene: bpy.props.PointerProperty(type=bpy.types.Scene) # type: ignore
class SceneLinks(bpy.types.PropertyGroup): class SceneLinks(bpy.types.PropertyGroup):
name = bpy.props.StringProperty(name="List of scenes to export", default="Unknown") name = bpy.props.StringProperty(name="List of scenes to export", default="Unknown")
items: bpy.props.CollectionProperty(type = SceneLink) items: bpy.props.CollectionProperty(type = SceneLink) # type: ignore
class CUSTOM_PG_sceneName(bpy.types.PropertyGroup): class CUSTOM_PG_sceneName(bpy.types.PropertyGroup):
name: bpy.props.StringProperty() name: bpy.props.StringProperty() # type: ignore
display: bpy.props.BoolProperty() display: bpy.props.BoolProperty() # type: ignore
class CollectionToExport(bpy.types.PropertyGroup): class CollectionToExport(bpy.types.PropertyGroup):
name: bpy.props.StringProperty(name="") name: bpy.props.StringProperty(name="") # type: ignore
class BlueprintsToExport(bpy.types.PropertyGroup): class BlueprintsToExport(bpy.types.PropertyGroup):
name = bpy.props.StringProperty(name="List of collections to export", default="Unknown") name = bpy.props.StringProperty(name="List of collections to export", default="Unknown")
items: bpy.props.CollectionProperty(type = CollectionToExport) items: bpy.props.CollectionProperty(type = CollectionToExport) # type: ignore

View File

@ -27,28 +27,31 @@ class AutoExportGLTF(Operator, AutoExportGltfAddonPreferences):#, ExportHelper):
#filename_ext = '' #filename_ext = ''
#filepath: bpy.props.StringProperty(subtype="FILE_PATH", default="") # type: ignore #filepath: bpy.props.StringProperty(subtype="FILE_PATH", default="") # type: ignore
# Filters folders
filter_folder: BoolProperty(
default=True,
options={"HIDDEN"}
) # type: ignore
#list of settings (other than purely gltf settings) whose change should trigger a re-generation of gltf files #list of settings (other than purely gltf settings) whose change should trigger a re-generation of gltf files
white_list = ['auto_export', white_list = [
'auto_export',
'export_root_folder',
'export_output_folder', 'export_output_folder',
'export_library_scene_name',
'export_change_detection', 'export_change_detection',
'export_scene_settings',
'main_scenes',
'library_scenes',
'main_scenes_index',
'library_scenes_index',
'main_scene_names',
'library_scene_names',
'export_blueprints', 'export_blueprints',
'export_blueprints_path', 'export_blueprints_path',
'export_marked_assets', 'export_marked_assets',
'collection_instances_combine_mode', 'collection_instances_combine_mode',
'export_levels_path',
'export_separate_dynamic_and_static_objects', 'export_separate_dynamic_and_static_objects',
'export_materials_library', 'export_materials_library',
'export_materials_path', 'export_materials_path',
'export_scene_settings'
] ]
@classmethod @classmethod
@ -369,9 +372,10 @@ class AutoExportGLTF(Operator, AutoExportGltfAddonPreferences):#, ExportHelper):
section = layout.box() section = layout.box()
section.enabled = controls_enabled section.enabled = controls_enabled
section.prop(self, "root_folder") section.prop(self, "export_root_folder")
section.prop(operator, "export_output_folder", text="Export Folder relative to root") section.prop(operator, "export_output_folder", text="Export Folder relative to root")
section.prop(operator, "export_scene_settings") section.prop(operator, "export_scene_settings")
section.prop(operator, "export_change_detection")
"""header, panel = layout.panel("my_panel_id", default_closed=False) """header, panel = layout.panel("my_panel_id", default_closed=False)
header.label(text="Hello World") header.label(text="Hello World")
if panel: if panel:

View File

@ -11,39 +11,38 @@ from bpy.props import (BoolProperty,
from .internals import (CUSTOM_PG_sceneName) from .internals import (CUSTOM_PG_sceneName)
AutoExportGltfPreferenceNames = [ AutoExportGltfPreferenceNames = [
'will_save_settings',
'direct_mode',# specific to main auto_export operator
'auto_export', 'auto_export',
'export_root_folder',
'export_output_folder', 'export_output_folder',
'export_library_scene_name',
'export_change_detection', 'export_change_detection',
'export_blueprints',
'export_blueprints_path',
'export_marked_assets',
'collection_instances_combine_mode',
'export_separate_dynamic_and_static_objects',
'export_materials_library',
'export_materials_path',
'export_scene_settings', 'export_scene_settings',
'main_scenes', 'main_scenes',
'library_scenes', 'library_scenes',
'main_scenes_index', 'main_scenes_index',
'library_scenes_index', 'library_scenes_index',
'direct_mode',# specific to main auto_export operator
'main_scene_names', 'main_scene_names',
'library_scene_names', 'library_scene_names',
'previous_export_settings',
'will_save_settings', 'export_blueprints',
'export_blueprints_path',
'export_marked_assets',
'collection_instances_combine_mode',
'export_levels_path',
'export_separate_dynamic_and_static_objects',
'export_materials_library',
'export_materials_path',
] ]
def on_export_output_folder_updated(self, context): def on_export_output_folder_updated(self, context):
#self.root_folder = os.path.relpath(self.root_folder) #self.export_root_folder = os.path.relpath(self.export_root_folder)
#self.export_output_folder = os.path.join(self.root_folder, self.export_output_folder) #self.export_output_folder = os.path.join(self.export_root_folder, self.export_output_folder)
print("on_foo_updated", self.root_folder, self.export_output_folder) print("on_foo_updated", self.export_root_folder, self.export_output_folder)
class AutoExportGltfAddonPreferences(AddonPreferences): class AutoExportGltfAddonPreferences(AddonPreferences):
# this must match the add-on name, use '__package__' # this must match the add-on name, use '__package__'
@ -78,7 +77,7 @@ class AutoExportGltfAddonPreferences(AddonPreferences):
default=True default=True
) # type: ignore ) # type: ignore
root_folder: StringProperty( export_root_folder: StringProperty(
name = "Project Root Path", name = "Project Root Path",
description="The root folder of your (Bevy) project (not assets!)", description="The root folder of your (Bevy) project (not assets!)",
subtype='DIR_PATH', subtype='DIR_PATH',
@ -102,16 +101,12 @@ class AutoExportGltfAddonPreferences(AddonPreferences):
default=True default=True
) # type: ignore ) # type: ignore
export_library_scene_name: StringProperty(
name='Library scene',
description='The name of the library scene to auto export',
default='Library'
) # type: ignore
export_change_detection: BoolProperty( export_change_detection: BoolProperty(
name='Change detection', name='Change detection',
description='Use change detection to determine what/if should be exported', description='Use change detection to determine what/if should be exported',
default=True default=True
) # type: ignore ) # type: ignore
# scene components # scene components
export_scene_settings: BoolProperty( export_scene_settings: BoolProperty(
name='Export scene settings', name='Export scene settings',