feat: enhance generation engine and preset management system
This commit is contained in:
@@ -261,9 +261,32 @@ def _iter_components_by_placement(props, placement_mode):
|
||||
overlays = list(props.image_overlays)
|
||||
except TypeError:
|
||||
overlays = props.image_overlays
|
||||
|
||||
scene_name = getattr(bpy.context.scene, "name", "UNKNOWN")
|
||||
print(f"DEBUG: _iter_components_by_placement [Scene: {scene_name}] - TOTAL overlays in collection: {len(overlays)} (Checking for mode: {placement_mode})")
|
||||
|
||||
# Detailed dumping of EVERY component regardless of filter
|
||||
for i, comp in enumerate(overlays):
|
||||
name = getattr(comp, "name", "unnamed")
|
||||
pmode = getattr(comp, "placement_mode", "NONE")
|
||||
ctype = getattr(comp, "component_type", "NONE")
|
||||
enabled = getattr(comp, "enabled", False)
|
||||
print(f" -> Collection Item {i}: Name='{name}', Mode='{pmode}', Type='{ctype}', Enabled={enabled}")
|
||||
|
||||
for index, component in enumerate(overlays):
|
||||
if getattr(component, "placement_mode", 'ABSOLUTE') == placement_mode:
|
||||
comp_name = getattr(component, "name", f"Overlay {index}")
|
||||
comp_placement = getattr(component, "placement_mode", 'ABSOLUTE')
|
||||
|
||||
if not comp_placement or comp_placement not in ('ABSOLUTE', 'PREPEND', 'APPEND'):
|
||||
print(f"DEBUG: Component '{comp_name}' has invalid placement '{comp_placement}'. Forcing to ABSOLUTE.")
|
||||
comp_placement = 'ABSOLUTE'
|
||||
|
||||
if comp_placement == placement_mode:
|
||||
print(f"DEBUG: MATCH FOUND for '{comp_name}' (Index: {index}, Type: {getattr(component, 'component_type', 'UNKNOWN')})")
|
||||
yield index, component
|
||||
else:
|
||||
# Only log skips if there were actually components to skip
|
||||
print(f"DEBUG: Skipping '{comp_name}' (Placement '{comp_placement}' != requested '{placement_mode}')")
|
||||
|
||||
|
||||
def _draw_component_header(row, component):
|
||||
@@ -346,7 +369,9 @@ def draw_component_section(layout, props, placement_mode, title, icon):
|
||||
add_op.placement_mode = placement_mode
|
||||
|
||||
components = list(_iter_components_by_placement(props, placement_mode))
|
||||
print(f"DEBUG: draw_component_section for {placement_mode} - found {len(components)} components")
|
||||
if not components:
|
||||
section.label(text="No components added", icon='INFO')
|
||||
return
|
||||
|
||||
for index, component in components:
|
||||
@@ -357,20 +382,42 @@ def draw_component_section(layout, props, placement_mode, title, icon):
|
||||
_draw_component_details(box, component)
|
||||
|
||||
def draw_composition_section(layout, props):
|
||||
pass
|
||||
"""Draw combined composition controls for text and image components."""
|
||||
if not has_image_overlays():
|
||||
pass
|
||||
draw_feature_lock_indicator(layout, 'image_overlays')
|
||||
# Bulletproof Visibility: Even if locked, show header with count if data exists
|
||||
has_overlays = has_image_overlays()
|
||||
total_count = len(props.image_overlays)
|
||||
if not has_overlays:
|
||||
if total_count > 0:
|
||||
layout.label(text=f"Composition ({total_count}) 🔒 PRO", icon='LOCKED')
|
||||
layout.label(text="Upgrade to edit existing components")
|
||||
else:
|
||||
draw_feature_lock_indicator(layout, 'image_overlays')
|
||||
return
|
||||
|
||||
content = layout.column(align=True)
|
||||
content.use_property_split = False
|
||||
content.use_property_decorate = False
|
||||
|
||||
draw_component_section(content, props, 'ABSOLUTE', "Absolute Components", 'CURSOR')
|
||||
draw_component_section(content, props, 'PREPEND', "Prepended Components", 'TRIA_LEFT_BAR')
|
||||
draw_component_section(content, props, 'APPEND', "Appended Components", 'TRIA_RIGHT_BAR')
|
||||
# Enhanced Header with Counter
|
||||
count_abs = len(list(_iter_components_by_placement(props, 'ABSOLUTE')))
|
||||
count_pre = len(list(_iter_components_by_placement(props, 'PREPEND')))
|
||||
count_app = len(list(_iter_components_by_placement(props, 'APPEND')))
|
||||
|
||||
draw_component_section(content, props, 'ABSOLUTE', f"Absolute Components ({count_abs})", 'CURSOR')
|
||||
draw_component_section(content, props, 'PREPEND', f"Prepended Components ({count_pre})", 'TRIA_LEFT_BAR')
|
||||
draw_component_section(content, props, 'APPEND', f"Appended Components ({count_app})", 'TRIA_RIGHT_BAR')
|
||||
|
||||
# Recovery Utility (Safety Net)
|
||||
content.separator(factor=1.5)
|
||||
diag_box = content.box()
|
||||
diag_row = diag_box.row(align=True)
|
||||
diag_row.label(text="Data Status:", icon='INFO')
|
||||
if total_count > 0:
|
||||
diag_row.label(text="✓ OK", icon='CHECKMARK')
|
||||
else:
|
||||
diag_row.label(text="⚠ EMPTY", icon='ERROR')
|
||||
|
||||
diag_box.operator("text_texture.recover_data", text="Scan for Lost Components", icon='FILE_REFRESH')
|
||||
|
||||
def draw_positioning_section(layout, props):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user