wip
This commit is contained in:
@@ -341,18 +341,30 @@ class TEXT_TEXTURE_OT_refresh_presets(Operator):
|
||||
|
||||
class TEXT_TEXTURE_OT_add_overlay(Operator):
|
||||
pass
|
||||
"""Add new image overlay"""
|
||||
"""Add new composition component"""
|
||||
bl_idname = "text_texture.add_overlay"
|
||||
bl_label = "Add Overlay"
|
||||
bl_description = "Add new image overlay"
|
||||
bl_label = "Add Component"
|
||||
bl_description = "Add new composition component"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
placement_mode: EnumProperty(
|
||||
name="Placement Mode",
|
||||
items=[
|
||||
('ABSOLUTE', "Absolute", ""),
|
||||
('PREPEND', "Prepend", ""),
|
||||
('APPEND', "Append", "")
|
||||
],
|
||||
default='ABSOLUTE'
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
pass
|
||||
props = context.scene.text_texture_props
|
||||
|
||||
overlay = props.image_overlays.add()
|
||||
overlay.name = f"Overlay {len(props.image_overlays)}"
|
||||
overlay.name = f"Component {len(props.image_overlays)}"
|
||||
overlay.placement_mode = self.placement_mode
|
||||
overlay.component_type = 'TEXT' if self.placement_mode in {'PREPEND', 'APPEND'} else 'IMAGE'
|
||||
props.active_overlay_index = len(props.image_overlays) - 1
|
||||
|
||||
# Force UI redraw
|
||||
@@ -360,7 +372,7 @@ class TEXT_TEXTURE_OT_add_overlay(Operator):
|
||||
pass
|
||||
area.tag_redraw()
|
||||
|
||||
self.report({'INFO'}, f"Added overlay: {overlay.name}")
|
||||
self.report({'INFO'}, f"Added component: {overlay.name}")
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -435,10 +447,10 @@ class TEXT_TEXTURE_OT_sync_margins(Operator):
|
||||
|
||||
class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
pass
|
||||
"""Duplicate image overlay"""
|
||||
"""Duplicate a composition component"""
|
||||
bl_idname = "text_texture.duplicate_overlay"
|
||||
bl_label = "Duplicate Overlay"
|
||||
bl_description = "Duplicate this image overlay"
|
||||
bl_label = "Duplicate Component"
|
||||
bl_description = "Duplicate this composition component"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
overlay_index: IntProperty()
|
||||
@@ -457,7 +469,9 @@ class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
|
||||
# Copy all properties with explicit verification
|
||||
new_overlay.name = f"{source_overlay.name} Copy"
|
||||
new_overlay.component_type = source_overlay.component_type
|
||||
new_overlay.image_path = source_overlay.image_path
|
||||
new_overlay.text_content = source_overlay.text_content
|
||||
new_overlay.x_position = source_overlay.x_position
|
||||
new_overlay.y_position = source_overlay.y_position
|
||||
new_overlay.scale = source_overlay.scale
|
||||
@@ -465,7 +479,7 @@ class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
# Fix z-index assignment for duplicated overlays to ensure proper visibility
|
||||
# For PREPEND/APPEND overlays, increment z_index to ensure duplicate appears above original
|
||||
# This prevents the duplicate from being rendered behind the original overlay
|
||||
if source_overlay.positioning_mode in ['PREPEND', 'APPEND']:
|
||||
if source_overlay.placement_mode in ['PREPEND', 'APPEND']:
|
||||
pass
|
||||
# Increment z_index to ensure proper layering order for duplicated overlay
|
||||
new_overlay.z_index = min(source_overlay.z_index + 1, 10) # Cap at max z_index value
|
||||
@@ -473,7 +487,7 @@ class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
pass
|
||||
# For ABSOLUTE overlays, keep same z_index (different positions so no overlap issue)
|
||||
new_overlay.z_index = source_overlay.z_index
|
||||
new_overlay.positioning_mode = source_overlay.positioning_mode
|
||||
new_overlay.placement_mode = source_overlay.placement_mode
|
||||
new_overlay.text_spacing = source_overlay.text_spacing
|
||||
new_overlay.image_spacing = source_overlay.image_spacing
|
||||
new_overlay.enabled = source_overlay.enabled
|
||||
@@ -517,7 +531,7 @@ class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
props.is_updating = False
|
||||
|
||||
|
||||
self.report({'INFO'}, f"✅ Duplicated overlay: {source_overlay.name}")
|
||||
self.report({'INFO'}, f"✅ Duplicated component: {source_overlay.name}")
|
||||
else:
|
||||
pass
|
||||
self.report({'ERROR'}, "Invalid overlay index")
|
||||
@@ -528,10 +542,10 @@ class TEXT_TEXTURE_OT_duplicate_overlay(Operator):
|
||||
|
||||
class TEXT_TEXTURE_OT_delete_overlay(Operator):
|
||||
pass
|
||||
"""Delete image overlay"""
|
||||
"""Delete a composition component"""
|
||||
bl_idname = "text_texture.delete_overlay"
|
||||
bl_label = "Delete Overlay"
|
||||
bl_description = "Delete this image overlay"
|
||||
bl_label = "Delete Component"
|
||||
bl_description = "Delete this composition component"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
overlay_index: IntProperty()
|
||||
@@ -567,7 +581,7 @@ class TEXT_TEXTURE_OT_delete_overlay(Operator):
|
||||
pass
|
||||
area.tag_redraw()
|
||||
|
||||
self.report({'INFO'}, f"Deleted overlay: {overlay_name}")
|
||||
self.report({'INFO'}, f"Deleted component: {overlay_name}")
|
||||
else:
|
||||
pass
|
||||
self.report({'ERROR'}, "Invalid overlay index")
|
||||
@@ -578,10 +592,10 @@ class TEXT_TEXTURE_OT_delete_overlay(Operator):
|
||||
|
||||
class TEXT_TEXTURE_OT_move_overlay(Operator):
|
||||
pass
|
||||
"""Move image overlay up or down in the list"""
|
||||
"""Move a composition component within its placement group"""
|
||||
bl_idname = "text_texture.move_overlay"
|
||||
bl_label = "Move Overlay"
|
||||
bl_description = "Move overlay up or down in the list"
|
||||
bl_label = "Move Component"
|
||||
bl_description = "Move component up or down within its placement group"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
overlay_index: IntProperty()
|
||||
@@ -601,12 +615,15 @@ class TEXT_TEXTURE_OT_move_overlay(Operator):
|
||||
pass
|
||||
current_index = self.overlay_index
|
||||
new_index = current_index
|
||||
target_mode = props.image_overlays[current_index].placement_mode
|
||||
|
||||
if self.direction == 'UP' and current_index > 0:
|
||||
pass
|
||||
new_index = current_index - 1
|
||||
elif self.direction == 'DOWN' and current_index < len(props.image_overlays) - 1:
|
||||
new_index = current_index + 1
|
||||
step = -1 if self.direction == 'UP' else 1
|
||||
probe = current_index + step
|
||||
while 0 <= probe < len(props.image_overlays):
|
||||
if props.image_overlays[probe].placement_mode == target_mode:
|
||||
new_index = probe
|
||||
break
|
||||
probe += step
|
||||
|
||||
if new_index != current_index:
|
||||
pass
|
||||
@@ -622,10 +639,10 @@ class TEXT_TEXTURE_OT_move_overlay(Operator):
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
self.report({'INFO'}, f"Moved overlay {self.direction.lower()}")
|
||||
self.report({'INFO'}, f"Moved component {self.direction.lower()}")
|
||||
else:
|
||||
pass
|
||||
self.report({'INFO'}, f"Overlay is already at {self.direction.lower()} edge")
|
||||
self.report({'INFO'}, f"Component is already at {self.direction.lower()} edge")
|
||||
else:
|
||||
pass
|
||||
self.report({'ERROR'}, "Invalid overlay index")
|
||||
@@ -647,4 +664,4 @@ __all__ = [
|
||||
'TEXT_TEXTURE_OT_duplicate_overlay',
|
||||
'TEXT_TEXTURE_OT_delete_overlay',
|
||||
'TEXT_TEXTURE_OT_move_overlay',
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user