Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rhinolayer = model.Layers.FindIndex(attr.LayerIndex)
if not rhinolayer.Visible and not import_hidden_layers:
continue
# Create object name
if attr.Name == "" or attr.Name is None:
n = str(og.ObjectType).split(".")[1]+" " + str(attr.Id)
else:
n = attr.Name
# Get render material
mat_index = ob.Attributes.MaterialIndex
if ob.Attributes.MaterialSource == r3d.ObjectMaterialSource.MaterialFromLayer:
mat_index = rhinolayer.RenderMaterialIndex
rhino_material = model.Materials.FindIndex(mat_index)
# Handle default material and fetch associated Blender material
if rhino_material.Name == "":
matname = converters.material.DEFAULT_RHINO_MATERIAL
else:
matname = converters.material_name(rhino_material)
# Handle object view color
if ob.Attributes.ColorSource == r3d.ObjectColorSource.ColorFromLayer:
view_color = rhinolayer.Color
else:
view_color = ob.Attributes.ObjectColor