remove multiline

This commit is contained in:
2025-10-12 12:11:59 +02:00
parent e3eb1c8d48
commit c9a404d634
10 changed files with 55 additions and 174 deletions

View File

@@ -139,7 +139,7 @@ else:
# Conditionally import text editor operators (PRO feature)
try:
from .operators import (
TEXT_TEXTURE_OT_edit_multiline_text,
TEXT_TEXTURE_OT_edit_text,
)
TEXT_EDITOR_OPERATORS_AVAILABLE = True
except ImportError as e:
@@ -148,7 +148,7 @@ except ImportError as e:
print(f"WARNING: text_editor_ops import failed: {e}", file=sys.stderr)
traceback.print_exc()
# Free version - use mock operator
TEXT_TEXTURE_OT_edit_multiline_text = MockOperator
TEXT_TEXTURE_OT_edit_text = MockOperator
TEXT_EDITOR_OPERATORS_AVAILABLE = False
# Import UI panels and functions
@@ -182,7 +182,7 @@ classes = (
TEXT_TEXTURE_OT_duplicate_overlay,
TEXT_TEXTURE_OT_delete_overlay,
TEXT_TEXTURE_OT_move_overlay,
TEXT_TEXTURE_OT_edit_multiline_text,
TEXT_TEXTURE_OT_edit_text,
TEXT_TEXTURE_OT_open_panel,
TEXT_TEXTURE_OT_save_preset,
TEXT_TEXTURE_OT_save_preset_enter,

View File

@@ -46,10 +46,10 @@ try:
pass
from .text_editor_ops import *
from .text_editor_ops import (
TEXT_TEXTURE_OT_edit_multiline_text,
TEXT_TEXTURE_OT_edit_text,
)
TEXT_EDITOR_OPERATORS = [
'TEXT_TEXTURE_OT_edit_multiline_text',
'TEXT_TEXTURE_OT_edit_text',
]
except ImportError as e:
import sys

View File

@@ -1,19 +1,19 @@
import bpy
from bpy.types import Operator
from bpy.props import StringProperty
from ..utils.constants import has_multiline_text
from ..utils.constants import has_text_editor
class TEXT_TEXTURE_OT_edit_multiline_text(Operator):
"""Open a text editor for single-line input"""
bl_idname = "text_texture.edit_multiline_text"
class TEXT_TEXTURE_OT_edit_text(Operator):
"""Open a text editor for text input"""
bl_idname = "text_texture.edit_text"
bl_label = "Edit Text"
bl_description = "Open a text editor for single-line input"
bl_description = "Open a text editor for text input"
bl_options = {'REGISTER', 'UNDO'}
temp_text: StringProperty(
name="Text",
description="Single line text only - multiline not supported",
description="Text input",
default="",
maxlen=4096
)
@@ -21,7 +21,7 @@ class TEXT_TEXTURE_OT_edit_multiline_text(Operator):
@classmethod
def poll(cls, context):
"""Only available in PRO version"""
return has_multiline_text()
return has_text_editor()
def invoke(self, context, event):
"""Copy current text to temp storage and open dialog"""
@@ -30,36 +30,24 @@ class TEXT_TEXTURE_OT_edit_multiline_text(Operator):
return context.window_manager.invoke_props_dialog(self, width=700)
def draw(self, context):
"""Draw the dialog UI with single-line input"""
"""Draw the dialog UI"""
layout = self.layout
max_chars = 4096
current_chars = len(self.temp_text)
# Main column
col = layout.column()
col.label(text="Edit Text (Single Line Only):", icon='EDITMODE_HLT')
col.label(text="Edit Text:", icon='EDITMODE_HLT')
# Make the text input larger
text_row = col.row()
text_row.scale_y = 2.0
text_row.prop(self, "temp_text", text="")
# Warning box
col.separator()
info_box = col.box()
info_box.scale_y = 0.8
info_box.label(text="⚠️ Single Line Only:", icon='ERROR')
row = info_box.row()
row.label(text="• Multiline text is not supported")
# Statistics
col.separator()
stats_row = col.row()
stats_row.label(text=f"📝 Characters: {current_chars}/{max_chars}", icon='FONT_DATA')
# Warnings
if current_chars > max_chars:
col.separator()
warning_box = col.box()
@@ -67,25 +55,17 @@ class TEXT_TEXTURE_OT_edit_multiline_text(Operator):
warning_box.label(text=f"⚠ Exceeds character limit! Will be trimmed to {max_chars} chars", icon='ERROR')
def execute(self, context):
"""Save temp text back to main property - reject if contains newlines"""
"""Save temp text back to main property"""
props = context.scene.text_texture_props
# Check for newlines and reject
if '\n' in self.temp_text:
self.report({'ERROR'}, "Multiline text not supported. Please use single line only.")
return {'CANCELLED'}
max_chars = 4096
# Enforce character limit
text = self.temp_text[:max_chars]
props.text = text
return {'FINISHED'}
classes = (TEXT_TEXTURE_OT_edit_multiline_text,)
classes = (TEXT_TEXTURE_OT_edit_text,)
def register():

View File

@@ -12,7 +12,7 @@ from ..utils.constants import (
get_feature_availability_text, get_version_info_details,
has_image_overlays, has_basic_utilities, has_presets,
has_normal_maps, has_batch_processing, has_advanced_utilities,
has_advanced_styling, has_text_fitting, has_multiline_text
has_advanced_styling, has_text_fitting, has_text_editor
)
@@ -203,7 +203,7 @@ def draw_text_input_section(layout, props):
# Add multiline text editor button
row = layout.row()
if has_multiline_text():
if has_text_editor():
row.operator("text_texture.edit_multiline_text", text="Edit Multiline Text", icon='TEXT')
else:
row.enabled = False

View File

@@ -20,7 +20,7 @@ ENABLED_FEATURES = ["basic", "preview"] if VERSION_TYPE == "free" else [
"basic", "preview", "presets", "normal_maps", "batch_processing",
"image_overlays", "basic_utilities", "advanced_utilities", "advanced_styling",
"stroke_effects", "blur_effects", "shadow_glow_effects", "shader_generation",
"text_fitting", "multiline_text"
"text_fitting", "text_editor"
]
# Version-specific limits (applied at build time through file exclusions)
@@ -114,9 +114,9 @@ def has_text_fitting():
"""Check if text fitting is available"""
return has_feature("text_fitting")
def has_multiline_text():
"""Check if multiline text feature is available."""
return has_feature("multiline_text")
def has_text_editor():
"""Check if text editor feature is available."""
return has_feature("text_editor")
def get_max_resolution():
"""Get maximum texture resolution based on version"""
@@ -139,7 +139,7 @@ def should_show_feature_lock(feature_name):
'shadow_glow_effects': has_shadow_glow_effects,
'shader_generation': has_shader_generation,
'text_fitting': has_text_fitting,
'multiline_text': has_multiline_text
'text_editor': has_text_editor
}
if is_full_version():