presets gui

This commit is contained in:
2025-10-09 12:18:33 +02:00
parent a1556ebce3
commit a14f3af0a1
11 changed files with 8 additions and 65 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -122,8 +122,7 @@ if PRESETS_AVAILABLE:
TEXT_TEXTURE_OT_delete_preset,
TEXT_TEXTURE_OT_refresh_presets,
TEXT_TEXTURE_OT_export_presets,
TEXT_TEXTURE_OT_import_presets,
TEXT_TEXTURE_OT_show_migration_report
TEXT_TEXTURE_OT_import_presets
)
else:
pass
@@ -144,7 +143,6 @@ else:
TEXT_TEXTURE_OT_refresh_presets = MockOperator
TEXT_TEXTURE_OT_export_presets = MockOperator
TEXT_TEXTURE_OT_import_presets = MockOperator
TEXT_TEXTURE_OT_show_migration_report = MockOperator
# Import UI panels and functions
from .ui import (
@@ -188,7 +186,6 @@ classes = (
TEXT_TEXTURE_OT_refresh_presets,
TEXT_TEXTURE_OT_export_presets,
TEXT_TEXTURE_OT_import_presets,
TEXT_TEXTURE_OT_show_migration_report,
TEXT_TEXTURE_PT_panel,
TEXT_TEXTURE_PT_panel_3d,
TEXT_TEXTURE_PT_panel_properties,

View File

@@ -821,36 +821,6 @@ class TEXT_TEXTURE_OT_import_presets(Operator):
layout.prop(self, "import_mode")
layout.prop(self, "import_to_blend")
class TEXT_TEXTURE_OT_show_migration_report(Operator):
pass
"""Show migration report with backup and upgrade information"""
bl_idname = "text_texture.show_migration_report"
bl_label = "Show Migration Report"
bl_description = "Display information about preset migration and backups"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
pass
return {'FINISHED'}
def invoke(self, context, event):
pass
return context.window_manager.invoke_props_dialog(self, width=400)
def draw(self, context):
pass
layout = self.layout
layout.label(text="Migration Report", icon='INFO')
layout.separator()
layout.label(text="This addon has been upgraded to the new preset system.")
layout.label(text="Your existing presets have been preserved.")
layout.separator()
layout.label(text="Features:", icon='CHECKMARK')
layout.label(text="• Presets saved in blend files")
layout.label(text="• Cross-file preset sharing")
layout.label(text="• Automatic backup system")
layout.separator()
# Export all operator classes for wildcard imports
__all__ = [
'TEXT_TEXTURE_OT_save_preset',
@@ -860,5 +830,4 @@ __all__ = [
'TEXT_TEXTURE_OT_refresh_presets',
'TEXT_TEXTURE_OT_export_presets',
'TEXT_TEXTURE_OT_import_presets',
'TEXT_TEXTURE_OT_show_migration_report',
]

View File

@@ -647,7 +647,7 @@ class TEXT_TEXTURE_Properties(PropertyGroup):
# Save with blend file checkbox
save_with_blend_file: BoolProperty(
name="Save with .blend file",
name="Project-specific (only available in this .blend file)",
description="Save this preset with the current .blend file instead of persistent storage",
default=False
)

View File

@@ -471,7 +471,7 @@ def draw_presets_section(layout, props):
text="Save", icon='FILE_NEW')
# Save with blend file checkbox
layout.prop(props, "save_with_blend_file")
layout.prop(props, "save_with_blend_file", text="Project-specific (only available in this .blend file)")
layout.separator()
@@ -489,19 +489,16 @@ def draw_presets_section(layout, props):
utility_row = layout.row(align=True)
refresh_lock = create_premium_lock_function()
migration_lock = create_premium_lock_function()
safe_operator_call(utility_row, "text_texture.refresh_presets", refresh_lock,
text="Refresh", icon='FILE_REFRESH')
safe_operator_call(utility_row, "text_texture.show_migration_report", migration_lock,
text="Migration Report", icon='INFO')
layout.separator()
# Load presets section - unified list
if props.presets:
pass
layout.label(text=f"📁 Available Presets ({len(props.presets)}):", icon='PRESET')
layout.label(text="Presets", icon='PRESET')
# Sort presets alphabetically for consistent display
sorted_presets = sorted(props.presets, key=lambda p: p.name.lower())
@@ -511,18 +508,10 @@ def draw_presets_section(layout, props):
row = layout.row(align=True)
row.scale_y = 0.9
# Storage indicator icon
if preset.source == 'BLEND_FILE':
pass
icon = '📄' # Blend file indicator
else:
pass
icon = '🏠' # Persistent storage indicator
# Load button with indicator - use safe operator call
# Load button - use safe operator call
load_lock = create_premium_lock_function()
load_btn = safe_operator_call(row, "text_texture.load_preset", load_lock,
text=f"{icon} {preset.name}")
text=preset.name)
if load_btn:
load_btn.preset_name = preset.name
@@ -541,22 +530,10 @@ def draw_presets_section(layout, props):
if delete_btn:
delete_btn.preset_name = preset.name
# Legend for storage indicators
layout.separator()
legend_box = layout.box()
legend_box.scale_y = 0.8
legend_box.label(text="Storage Indicators:", icon='INFO')
legend_box.label(text="🏠 Persistent (survives addon updates)")
legend_box.label(text="📄 Blend file (travels with .blend file)")
else:
pass
layout.label(text="📂 No presets saved yet", icon='INFO')
layout.label(text="💡 Save your first preset above!", icon='LIGHT_DATA')
layout.separator()
info_box = layout.box()
info_box.label(text=" Presets: Persistent by default, blend file optional", icon='INFO')
info_box.label(text="Check the box to save with your .blend file!")
layout.label(text="No presets yet")
layout.label(text="Save your settings above to create your first preset.")
def draw_shader_section(layout, props):
pass