mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Materials UI - suggest MODEL_VIEW context for assigning material style by default
Probably makes more sense than just "Model".
This commit is contained in:
@@ -798,8 +798,13 @@ class EnableEditingMaterialStyle(bpy.types.Operator):
|
||||
if not 0 <= props.active_material_index < len(props.materials):
|
||||
return {"FINISHED"}
|
||||
|
||||
material = tool.Ifc.get().by_id(props.materials[props.active_material_index].ifc_definition_id)
|
||||
ifc_file = tool.Ifc.get()
|
||||
material = ifc_file.by_id(props.materials[props.active_material_index].ifc_definition_id)
|
||||
if not material.HasRepresentation:
|
||||
# MODEL_VIEW is probably the one that's used with the styles most frequently.
|
||||
context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
|
||||
if context:
|
||||
props.contexts = str(context.id())
|
||||
return {"FINISHED"}
|
||||
|
||||
rep = material.HasRepresentation[0].Representations[0] # IfcStyledRepresentation
|
||||
|
||||
Reference in New Issue
Block a user