This commit is contained in:
2025-10-13 12:56:15 +02:00
parent 065ab855c1
commit 2494897360
17 changed files with 572 additions and 140 deletions

View File

@@ -199,8 +199,21 @@ def draw_version_info_section(layout, props):
def draw_text_input_section(layout, props):
pass
"""Draw the main text input field"""
layout.prop(props, "text", text="")
"""Draw the main text input field with dimensions."""
content = layout.column(align=True)
content.use_property_split = False
content.use_property_decorate = False
row = content.row(align=True)
text_col = row.column(align=True)
text_col.prop(props, "text", text="")
dimensions_col = row.column(align=True)
dimensions_col.use_property_split = False
dimensions_col.use_property_decorate = False
dim_row = dimensions_col.row(align=True)
dim_row.prop(props, "texture_width", text="")
dim_row.prop(props, "texture_height", text="")
def draw_font_dropdown_section(layout, props):
pass
@@ -216,17 +229,22 @@ def draw_generate_button(layout):
row.scale_y = 1.5
row.operator("text_texture.generate", text="Generate Text Texture", icon='IMAGE_DATA')
def draw_image_overlays_section(layout, props):
def draw_composition_image_section(layout, props):
pass
"""Draw image overlays controls with collapsible individual overlays"""
"""Draw image overlay controls for the composition panel."""
section = layout.box()
section.use_property_split = False
section.use_property_decorate = False
section.label(text="Image Elements", icon='IMAGE_DATA')
# Check if image overlays are available
if not has_image_overlays():
pass
draw_feature_lock_indicator(layout, 'image_overlays')
draw_feature_lock_indicator(section, 'image_overlays')
return
# Add overlay button - use safe operator call
row = layout.row()
row = section.row()
safe_operator_call(row, "text_texture.add_overlay",
lambda layout: draw_feature_lock_indicator(layout, 'image_overlays'),
text="Add Image Overlay", icon='ADD')
@@ -234,12 +252,12 @@ def draw_image_overlays_section(layout, props):
# Individual overlay controls
if props.image_overlays:
pass
layout.separator()
section.separator()
for i, overlay in enumerate(props.image_overlays):
pass
# Create collapsible box for each overlay
box = layout.box()
box = section.box()
# Header row with controls
header_row = box.row(align=True)
@@ -315,92 +333,146 @@ def draw_image_overlays_section(layout, props):
trans_row.prop(overlay, "rotation", text="Rotation")
trans_row.prop(overlay, "z_index", text="Z-Level")
def draw_text_composition_section(layout, props):
pass
"""Draw additional text controls consolidated in the composition panel."""
section = layout.box()
section.use_property_split = False
section.use_property_decorate = False
section.label(text="Text Elements", icon='OUTLINER_OB_FONT')
layout_row = section.row(align=True)
layout_row.prop(props, "prepend_append_layout", text="Layout")
section.separator(factor=0.6)
def draw_text_block(label_text, icon, text_prop, margin_prop):
block = section.box()
block.use_property_split = False
block.use_property_decorate = False
header = block.row(align=True)
header.label(text=label_text, icon=icon)
text_row = block.row(align=True)
text_row.prop(props, text_prop, text="")
spacing_row = block.row(align=True)
spacing_row.enabled = bool(getattr(props, text_prop).strip())
spacing_row.prop(props, margin_prop, text="Spacing", slider=True)
draw_text_block("Prepend Text", 'TRIA_RIGHT', "prepend_text", "prepend_margin")
section.separator(factor=0.4)
draw_text_block("Append Text", 'TRIA_LEFT', "append_text", "append_margin")
def draw_composition_section(layout, props):
pass
"""Draw combined composition controls for text and images."""
content = layout.column(align=True)
content.use_property_split = False
content.use_property_decorate = False
tabs_row = content.row(align=True)
tabs_row.prop(props, "composition_active_tab", expand=True)
content.separator(factor=0.6)
if props.composition_active_tab == 'IMAGE':
pass
if not has_image_overlays():
pass
draw_feature_lock_indicator(content, 'image_overlays')
return
draw_composition_image_section(content, props)
else:
pass
draw_text_composition_section(content, props)
def draw_positioning_section(layout, props):
pass
"""Draw positioning and alignment controls"""
"""Draw positioning and alignment controls with streamlined spacing."""
from ..utils.system import get_anchor_point_matrix
# Dimensions moved here from top level
layout.label(text="Dimensions:", icon='SETTINGS')
row = layout.row(align=True)
row.prop(props, "texture_width", text="Width")
row.prop(props, "texture_height", text="Height")
content = layout.column(align=True)
content.use_property_split = True
content.use_property_decorate = False
layout.separator()
# Prepend/Append Text Section
layout.label(text="Additional Text:", icon='TEXT')
# Compact layout selector
layout.prop(props, "prepend_append_layout", text="Layout")
# Minimal prepend/append controls
row = layout.row(align=True)
row.prop(props, "prepend_text", text="Prepend")
if props.prepend_text.strip():
pass
row.prop(props, "prepend_margin", text="", slider=True)
row = layout.row(align=True)
row.prop(props, "append_text", text="Append")
if props.append_text.strip():
pass
row.prop(props, "append_margin", text="", slider=True)
layout.separator()
layout.prop(props, "position_mode", text="Mode")
content.label(text="Placement Mode", icon='ANCHOR_CENTER')
content.prop(props, "position_mode", text="")
content.separator(factor=0.6)
if props.position_mode == 'PRESET':
pass
layout.separator()
layout.label(text="Anchor Point:", icon='ANCHOR_TOP')
# Anchor selection grid
anchor_box = content.box()
anchor_box.use_property_split = False
anchor_box.use_property_decorate = False
anchor_box.label(text="Anchor Point", icon='ANCHOR_TOP')
anchor_matrix = get_anchor_point_matrix()
for row_idx, row in enumerate(anchor_matrix):
for row in anchor_matrix:
pass
grid_row = layout.row(align=True)
grid_row.scale_y = 1.2
for col_idx, anchor in enumerate(row):
grid_row = anchor_box.row(align=True)
grid_row.scale_y = 1.15
for anchor in row:
pass
if anchor == props.anchor_point:
premium_lock = create_premium_lock_function()
op = safe_operator_call(grid_row, "text_texture.set_anchor_point", premium_lock,
text="", depress=True)
else:
premium_lock = create_premium_lock_function()
op = safe_operator_call(grid_row, "text_texture.set_anchor_point", premium_lock,
text="")
premium_lock = create_premium_lock_function()
is_active = anchor == props.anchor_point
op = safe_operator_call(
grid_row,
"text_texture.set_anchor_point",
premium_lock,
text="" if is_active else "",
depress=is_active
)
if op:
op.anchor_point = anchor
# Margins
layout.separator()
margin_row = layout.row(align=True)
margin_row.label(text="Margins:")
margin_row.prop(props, "margins_linked", text="", icon='LINKED' if props.margins_linked else 'UNLINKED', toggle=True)
anchor_box.separator(factor=0.6)
margins_row = layout.row(align=True)
# Margin controls
margin_box = content.box()
margin_box.use_property_split = True
margin_box.use_property_decorate = False
header_row = margin_box.row(align=True)
header_row.label(text="Margins", icon='ARROW_LEFTRIGHT')
header_row.prop(
props,
"margins_linked",
text="",
icon='LINKED' if props.margins_linked else 'UNLINKED',
toggle=True
)
margins_row = margin_box.row(align=True)
margins_row.prop(props, "margin_x", text="X")
if not props.margins_linked:
pass
margins_row.prop(props, "margin_y", text="Y")
y_col = margins_row.row(align=True)
y_col.enabled = not props.margins_linked
y_col.prop(props, "margin_y", text="Y")
# Offsets
layout.separator()
layout.label(text="Fine-tune (pixels):")
offset_row = layout.row(align=True)
margin_box.separator(factor=0.6)
# Pixel offsets
offset_box = content.box()
offset_box.use_property_split = True
offset_box.use_property_decorate = False
offset_box.label(text="Fine-tune (pixels)", icon='DRIVER_DISTANCE')
offset_row = offset_box.row(align=True)
offset_row.prop(props, "offset_x", text="X")
offset_row.prop(props, "offset_y", text="Y")
else: # MANUAL mode
layout.separator()
layout.prop(props, "manual_position_unit", text="Unit")
manual_row = layout.row(align=True)
else:
pass
manual_box = content.box()
manual_box.use_property_split = True
manual_box.use_property_decorate = False
manual_box.label(text="Manual Placement", icon='DRIVER_TRANSFORM')
manual_box.prop(props, "manual_position_unit", text="Unit")
manual_row = manual_box.row(align=True)
manual_row.prop(props, "manual_position_x", text="X")
manual_row.prop(props, "manual_position_y", text="Y")
layout.separator()
layout.prop(props, "constrain_to_canvas")
content.separator(factor=0.6)
content.prop(props, "constrain_to_canvas")
def draw_font_settings_section(layout, props):
pass
@@ -537,7 +609,7 @@ def draw_presets_section(layout, props):
persistent_count = total_presets - blend_count
summary_row = col.row(align=True)
summary_row.label(text=f"{total_presets} presets", icon='PRESET_HLT')
summary_row.label(text=f"{total_presets} presets", icon='PRESET')
summary_row.label(text=f"{blend_count} project", icon='FILE_BLEND')
summary_row.label(text=f"{persistent_count} global", icon='FILE_CACHE')
@@ -957,25 +1029,10 @@ class TEXT_TEXTURE_PT_panel(Panel):
if shader_expanded:
draw_shader_options_only(shader_expanded, props)
# Image Overlays Section (collapsed by default) - Show with premium indicator
overlay_header_row = layout.row(align=True)
# Gray out header if locked and prevent expansion
from ..utils.constants import has_image_overlays
if not has_image_overlays():
overlay_header_row.enabled = False
# Don't allow expansion for locked features
overlay_expanded = None
# Show lock indicator instead of expandable header
lock_header = overlay_header_row.row()
lock_header.label(text="Image Overlays", icon='IMAGE_DATA')
lock_header.label(text="🔒 PRO", icon='LOCKED')
else:
overlay_expanded = draw_collapsible_header(overlay_header_row, "expand_image_overlays", "Image Overlays", 'IMAGE_DATA')
# Only show content if available and expanded
if overlay_expanded:
draw_image_overlays_section(overlay_expanded, props)
# Composition Section (collapsed by default)
composition_section = draw_collapsible_header(layout, "expand_composition", "Composition", 'SEQ_PREVIEW')
if composition_section:
draw_composition_section(composition_section, props)
# Stroke Section (collapsed by default) - Show with premium indicator
@@ -1169,25 +1226,10 @@ class TEXT_TEXTURE_PT_panel_3d(Panel):
if shader_expanded:
draw_shader_options_only(shader_expanded, props)
# Image Overlays Section (collapsed by default) - Show with premium indicator
overlay_header_row = layout.row(align=True)
# Gray out header if locked and prevent expansion
from ..utils.constants import has_image_overlays
if not has_image_overlays():
overlay_header_row.enabled = False
# Don't allow expansion for locked features
overlay_expanded = None
# Show lock indicator instead of expandable header
lock_header = overlay_header_row.row()
lock_header.label(text="Image Overlays", icon='IMAGE_DATA')
lock_header.label(text="🔒 PRO", icon='LOCKED')
else:
overlay_expanded = draw_collapsible_header(overlay_header_row, "expand_image_overlays", "Image Overlays", 'IMAGE_DATA')
# Only show content if available and expanded
if overlay_expanded:
draw_image_overlays_section(overlay_expanded, props)
# Composition Section (collapsed by default)
composition_section = draw_collapsible_header(layout, "expand_composition", "Composition", 'SEQ_PREVIEW')
if composition_section:
draw_composition_section(composition_section, props)
# Stroke Section (collapsed by default) - Show with premium indicator
@@ -1361,25 +1403,10 @@ class TEXT_TEXTURE_PT_panel_properties(Panel):
# === PREMIUM FEATURES ===
# Image Overlays Section (collapsed by default) - Show with premium indicator
overlay_header_row = layout.row(align=True)
# Gray out header if locked and prevent expansion
from ..utils.constants import has_image_overlays
if not has_image_overlays():
overlay_header_row.enabled = False
# Don't allow expansion for locked features
overlay_expanded = None
# Show lock indicator instead of expandable header
lock_header = overlay_header_row.row()
lock_header.label(text="Image Overlays", icon='IMAGE_DATA')
lock_header.label(text="🔒 PRO", icon='LOCKED')
else:
overlay_expanded = draw_collapsible_header(overlay_header_row, "expand_image_overlays", "Image Overlays", 'IMAGE_DATA')
# Only show content if available and expanded
if overlay_expanded:
draw_image_overlays_section(overlay_expanded, props)
# Composition Section (collapsed by default)
composition_section = draw_collapsible_header(layout, "expand_composition", "Composition", 'SEQ_PREVIEW')
if composition_section:
draw_composition_section(composition_section, props)
# Stroke Section (collapsed by default) - Show with premium indicator