File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -510,8 +510,26 @@ private static object CreateMaterial(JObject @params)
510510
511511 // Apply color param during creation (keeps Python tool signature and C# implementation consistent).
512512 // If "properties" already contains a color property, let properties win.
513- if ( colorToken != null && ( properties == null || ( ! properties . ContainsKey ( "_BaseColor" ) && ! properties . ContainsKey ( "_Color" )
514- && ( string . IsNullOrEmpty ( colorProperty ) || ! properties . ContainsKey ( colorProperty ) ) ) ) )
513+ bool shouldApplyColor = false ;
514+ if ( colorToken != null )
515+ {
516+ if ( properties == null )
517+ {
518+ shouldApplyColor = true ;
519+ }
520+ else if ( ! string . IsNullOrEmpty ( colorProperty ) )
521+ {
522+ // If colorProperty is specified, only check that specific property.
523+ shouldApplyColor = ! properties . ContainsKey ( colorProperty ) ;
524+ }
525+ else
526+ {
527+ // If colorProperty is not specified, check fallback properties.
528+ shouldApplyColor = ! properties . ContainsKey ( "_BaseColor" ) && ! properties . ContainsKey ( "_Color" ) ;
529+ }
530+ }
531+
532+ if ( shouldApplyColor )
515533 {
516534 Color color ;
517535 try
You can’t perform that action at this time.
0 commit comments