wip
This commit is contained in:
@@ -2,26 +2,39 @@
|
||||
Constants and metadata for the Text Texture Generator addon.
|
||||
"""
|
||||
|
||||
# Version information
|
||||
VERSION_TYPE = "free" # "free" or "full"
|
||||
|
||||
bl_info = {
|
||||
"name": "Text Texture Generator",
|
||||
"name": "Text Texture Generator" + (" Free" if VERSION_TYPE == "free" else " Full"),
|
||||
"author": "Marc Mintel <marc@mintel.me>",
|
||||
"version": (1, 0, 0),
|
||||
"blender": (4, 0, 0),
|
||||
"location": "3D View > Sidebar (N) > Tool Tab | Shader Editor > Sidebar > Tool Tab",
|
||||
"description": "Generate image textures from text with accurate dimensions and instant live preview",
|
||||
"description": "Generate image textures from text with accurate dimensions and instant live preview" + (" - Free Version (Limited Features)" if VERSION_TYPE == "free" else " - Full Version"),
|
||||
"category": "Material",
|
||||
}
|
||||
|
||||
# Version information
|
||||
VERSION_TYPE = "full" # "free" or "full"
|
||||
# Feature configuration based on version type
|
||||
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"
|
||||
]
|
||||
|
||||
# Version-specific limits (applied at build time through file exclusions)
|
||||
def get_version_limits():
|
||||
"""Get version-specific limits."""
|
||||
return {
|
||||
"max_texture_size": 4096,
|
||||
"max_concurrent_operations": 4
|
||||
}
|
||||
if VERSION_TYPE == "free":
|
||||
return {
|
||||
"max_texture_size": 1024,
|
||||
"max_concurrent_operations": 1
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"max_texture_size": 4096,
|
||||
"max_concurrent_operations": 4
|
||||
}
|
||||
|
||||
def is_free_version():
|
||||
"""Check if this is the free version."""
|
||||
@@ -31,37 +44,116 @@ def is_full_version():
|
||||
"""Check if this is the full version."""
|
||||
return VERSION_TYPE == "full"
|
||||
|
||||
def sync_margin_values(props, margin_type='all'):
|
||||
"""Synchronize margin values across properties
|
||||
# UI Helper Functions for Version Display
|
||||
def get_version_badge_text():
|
||||
"""Get version badge text for UI display."""
|
||||
return "FREE" if is_free_version() else "PRO"
|
||||
|
||||
def get_version_badge_icon():
|
||||
"""Get appropriate icon for version badge."""
|
||||
return 'GIFT' if is_free_version() else 'STAR'
|
||||
|
||||
def get_upgrade_hint_text(feature_name):
|
||||
"""Get contextual upgrade hint text for specific features."""
|
||||
if not is_free_version():
|
||||
return ""
|
||||
|
||||
return f"Upgrade to Pro version to access {feature_name}"
|
||||
|
||||
# Feature availability functions
|
||||
def has_feature(feature_name):
|
||||
"""Check if a specific feature is available."""
|
||||
return feature_name in ENABLED_FEATURES
|
||||
|
||||
def has_image_overlays():
|
||||
"""Check if image overlay features are available"""
|
||||
return has_feature("image_overlays")
|
||||
|
||||
def has_basic_utilities():
|
||||
"""Check if basic utility operations are available"""
|
||||
return has_feature("basic_utilities")
|
||||
|
||||
def has_presets():
|
||||
"""Check if preset features are available"""
|
||||
return has_feature("presets")
|
||||
|
||||
def has_normal_maps():
|
||||
"""Check if normal map generation is available"""
|
||||
return has_feature("normal_maps")
|
||||
|
||||
def has_batch_processing():
|
||||
"""Check if batch processing is available"""
|
||||
return has_feature("batch_processing")
|
||||
|
||||
def has_advanced_utilities():
|
||||
"""Check if advanced utility operations are available"""
|
||||
return has_feature("advanced_utilities")
|
||||
|
||||
def has_advanced_styling():
|
||||
"""Check if advanced styling options are available"""
|
||||
return has_feature("advanced_styling")
|
||||
|
||||
def has_stroke_effects():
|
||||
"""Check if stroke effects are available"""
|
||||
return has_feature("stroke_effects")
|
||||
|
||||
def has_blur_effects():
|
||||
"""Check if blur effects are available"""
|
||||
return has_feature("blur_effects")
|
||||
|
||||
def has_shadow_glow_effects():
|
||||
"""Check if shadow and glow effects are available"""
|
||||
return has_feature("shadow_glow_effects")
|
||||
|
||||
def has_shader_generation():
|
||||
"""Check if shader generation is available"""
|
||||
return has_feature("shader_generation")
|
||||
|
||||
def get_max_resolution():
|
||||
"""Get maximum texture resolution based on version"""
|
||||
limits = get_version_limits()
|
||||
return limits.get("max_texture_size", 1024)
|
||||
|
||||
def should_show_feature_lock(feature_name):
|
||||
"""Check if feature lock indicator should be shown."""
|
||||
# Map feature names to their availability functions
|
||||
feature_checks = {
|
||||
'presets': has_presets,
|
||||
'normal_maps': has_normal_maps,
|
||||
'batch_processing': has_batch_processing,
|
||||
'advanced_utilities': has_advanced_utilities,
|
||||
'advanced_styling': has_advanced_styling,
|
||||
'image_overlays': has_image_overlays,
|
||||
'basic_utilities': has_basic_utilities,
|
||||
'stroke_effects': has_stroke_effects,
|
||||
'blur_effects': has_blur_effects,
|
||||
'shadow_glow_effects': has_shadow_glow_effects,
|
||||
'shader_generation': has_shader_generation
|
||||
}
|
||||
|
||||
Args:
|
||||
props: Properties object containing margin values
|
||||
margin_type: Type of margin sync ('all', 'horizontal', 'vertical')
|
||||
"""
|
||||
if not props:
|
||||
return
|
||||
|
||||
try:
|
||||
# Get base margin value
|
||||
base_margin = getattr(props, 'text_fitting_margin', 10.0)
|
||||
|
||||
if margin_type == 'all':
|
||||
# Sync all margins to base margin
|
||||
if hasattr(props, 'prepend_margin'):
|
||||
props.prepend_margin = base_margin
|
||||
if hasattr(props, 'append_margin'):
|
||||
props.append_margin = base_margin
|
||||
|
||||
elif margin_type == 'horizontal':
|
||||
# Sync horizontal margins
|
||||
if hasattr(props, 'prepend_margin') and hasattr(props, 'append_margin'):
|
||||
avg_margin = (props.prepend_margin + props.append_margin) / 2
|
||||
props.prepend_margin = avg_margin
|
||||
props.append_margin = avg_margin
|
||||
|
||||
elif margin_type == 'vertical':
|
||||
# Sync vertical margins (if any exist in future)
|
||||
pass
|
||||
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to sync margin values: {e}")
|
||||
if is_full_version():
|
||||
return False
|
||||
|
||||
# For free version, show lock if feature is not available
|
||||
if feature_name in feature_checks:
|
||||
return not feature_checks[feature_name]()
|
||||
|
||||
return True # Show lock for unknown features
|
||||
|
||||
def get_feature_availability_text():
|
||||
"""Get text describing current feature availability."""
|
||||
if is_free_version():
|
||||
return "Free version - Basic features available"
|
||||
return "Pro version - All features available"
|
||||
|
||||
def get_version_info_details():
|
||||
"""Get detailed version information for display."""
|
||||
limits = get_version_limits()
|
||||
info = {
|
||||
'version_type': VERSION_TYPE.upper(),
|
||||
'max_texture_size': limits.get('max_texture_size', 'Unlimited'),
|
||||
'max_concurrent_operations': limits.get('max_concurrent_operations', 'Unlimited'),
|
||||
'features_enabled': len(ENABLED_FEATURES),
|
||||
'upgrade_available': is_free_version()
|
||||
}
|
||||
return info
|
||||
Reference in New Issue
Block a user