@@ -46,8 +46,8 @@ private bool HandleModelObject(ModelObject modelObject)
46
46
// get layer, props, color, and mat
47
47
SpeckleCollectionWrapper ? collection = GetLayerCollectionFromModelObject ( modelObject ) ;
48
48
SpecklePropertyGroupGoo ? props = GetPropsFromModelObjectAndAssignToBase ( modelObject , converted ) ;
49
- Color ? color = GetColorFromModelObject ( modelObject ) ;
50
49
SpeckleMaterialWrapper ? material = GetMaterialFromModelObject ( modelObject ) ;
50
+ Color ? color = GetColorFromModelObject ( modelObject , material ) ;
51
51
52
52
// get the definition if this is an instance
53
53
SpeckleBlockDefinitionWrapper ? definition = GetBlockDefinition ( geometryBase ) ;
@@ -270,7 +270,7 @@ private SpecklePropertyGroupGoo GetPropsFromModelObjectAndAssignToBase(ModelObje
270
270
return null ;
271
271
}
272
272
273
- private Color ? GetColorFromModelObject ( ModelObject modelObject )
273
+ private Color ? GetColorFromModelObject ( ModelObject modelObject , SpeckleMaterialWrapper ? material )
274
274
{
275
275
// we need to retrieve the actual color by the color source (otherwise will return default color for anything other than by object)
276
276
int ? argb = null ;
@@ -283,8 +283,10 @@ private SpecklePropertyGroupGoo GetPropsFromModelObjectAndAssignToBase(ModelObje
283
283
argb = modelObject . Display . Color ? . Color . ToArgb ( ) ;
284
284
break ;
285
285
case ObjectColorSource . ColorFromMaterial :
286
- Rhino . Render . RenderMaterial ? mat = GetRenderMaterial ( modelObject ) ;
287
- argb = mat ? . ToMaterial ( Rhino . Render . RenderTexture . TextureGeneration . Skip ) ? . DiffuseColor . ToArgb ( ) ;
286
+ if ( material is not null )
287
+ {
288
+ argb = material . Material . diffuse ;
289
+ }
288
290
break ;
289
291
default :
290
292
break ;
0 commit comments