@@ -103,6 +103,7 @@ def __init__(self, name, var_class, var_value, var_visible_in_editor, var_displa
103103 self .ui .show_child .clicked .connect (self .show_child )
104104
105105 self .init_ui ()
106+ self .update_colors ()
106107
107108 def _initialize_var_instance (self , var_class ):
108109 if var_class == 'Int' :
@@ -137,7 +138,7 @@ def _initialize_var_instance(self, var_class):
137138 )
138139 elif var_class in ['CoordinateSpace' , 'GridPlacementMode' , 'GridOriginMode' , 'PickMode' , 'ScaleMode' ,
139140 'TraceNoHit' , 'ApplyColorMode' , 'ChoiceSelectionMode' , 'RadiusPlacementMode' ,
140- 'DistributionMode' , 'PathPositions' ]:
141+ 'DistributionMode' , 'PathPositions' , 'Direction' ]:
141142 from src .editors .smartprop_editor .variables .combobox import Var_class_combobox
142143 elements = self ._get_combobox_elements (var_class )
143144 self .var_int_instance = Var_class_combobox (
@@ -161,6 +162,40 @@ def _initialize_var_instance(self, var_class):
161162 def _get_combobox_elements (self , var_class ):
162163 return CompletionUtils .get_combobox_elements (var_class )
163164
165+ def update_colors (self ):
166+ color_map = {
167+ 'String' : '#E67E22' ,
168+ 'Model' : '#E67E22' ,
169+ 'Material' : '#E67E22' ,
170+ 'MaterialGroup' : '#E67E22' ,
171+ 'Bool' : '#C0392B' ,
172+ 'Float' : '#2980B9' ,
173+ 'Int' : '#2471A3' ,
174+ 'Vector2D' : '#8E44AD' ,
175+ 'Vector3D' : '#8E44AD' ,
176+ 'Vector4D' : '#8E44AD' ,
177+ 'Angles' : '#8E44AD' ,
178+ 'Color' : '#1B5E20' ,
179+ }
180+
181+ enum_types = [
182+ 'Direction' , 'CoordinateSpace' , 'GridPlacementMode' , 'GridOriginMode' ,
183+ 'PickMode' , 'ScaleMode' , 'TraceNoHit' , 'ApplyColorMode' ,
184+ 'ChoiceSelectionMode' , 'RadiusPlacementMode' , 'DistributionMode' , 'PathPositions'
185+ ]
186+
187+ target_color = color_map .get (self .var_class , '#242424' )
188+ if self .var_class in enum_types :
189+ target_color = '#1D8348'
190+
191+ style = self .ui .label .styleSheet ()
192+ import re
193+ if 'background-color:' in style :
194+ style = re .sub (r'background-color:\s*[^;]+;' , f'background-color: { target_color } ;' , style )
195+ else :
196+ style += f'\n background-color: { target_color } ;'
197+ self .ui .label .setStyleSheet (style )
198+
164199 def _setup_hide_expression_completer (self ):
165200 """Setup completer for hide expression input with filtered type-aware completions."""
166201 # For hide expressions, only show Bool, Int, and Float variables
@@ -216,6 +251,7 @@ def set_class(self, var_class):
216251 self .var_int_instance .edited .connect (self .on_changed )
217252 self .ui .layout .insertWidget (2 , self .var_int_instance )
218253 # Emit content_changed directly (pre_change was already emitted above)
254+ self .update_colors ()
219255 self .content_changed .emit ()
220256
221257 def get_classes (self ):
0 commit comments