mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Move material classification into scene tab. No more panels in the material tab!
This commit is contained in:
@@ -117,12 +117,16 @@ class MaterialClassificationsData(ReferencesData):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def references(cls):
|
def references(cls):
|
||||||
results = []
|
results = []
|
||||||
element = tool.Ifc.get_entity(bpy.context.active_object.active_material)
|
|
||||||
if element:
|
props = bpy.context.scene.BIMMaterialProperties
|
||||||
for reference in ifcopenshell.util.classification.get_references(element):
|
if props.materials and props.active_material_index < len(props.materials):
|
||||||
data = reference.get_info()
|
material = props.materials[props.active_material_index]
|
||||||
del data["ReferencedSource"]
|
if material.ifc_definition_id:
|
||||||
results.append(data)
|
element = tool.Ifc.get().by_id(material.ifc_definition_id)
|
||||||
|
for reference in ifcopenshell.util.classification.get_references(element):
|
||||||
|
data = reference.get_info()
|
||||||
|
del data["ReferencedSource"]
|
||||||
|
results.append(data)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ class BIM_PT_classifications(Panel):
|
|||||||
class ReferenceUI:
|
class ReferenceUI:
|
||||||
def draw_ui(self, context):
|
def draw_ui(self, context):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
self.oprops = obj.BIMObjectProperties
|
|
||||||
self.sprops = context.scene.BIMClassificationProperties
|
self.sprops = context.scene.BIMClassificationProperties
|
||||||
self.bprops = context.scene.BIMBSDDProperties
|
self.bprops = context.scene.BIMBSDDProperties
|
||||||
self.props = obj.BIMClassificationReferenceProperties
|
self.props = obj.BIMClassificationReferenceProperties
|
||||||
@@ -295,22 +294,25 @@ class BIM_PT_material_classifications(Panel, ReferenceUI):
|
|||||||
bl_options = {"DEFAULT_CLOSED"}
|
bl_options = {"DEFAULT_CLOSED"}
|
||||||
bl_space_type = "PROPERTIES"
|
bl_space_type = "PROPERTIES"
|
||||||
bl_region_type = "WINDOW"
|
bl_region_type = "WINDOW"
|
||||||
bl_context = "material"
|
bl_context = "scene"
|
||||||
|
bl_parent_id = "BIM_PT_materials"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not tool.Ifc.get():
|
if not tool.Ifc.get():
|
||||||
return False
|
return False
|
||||||
try:
|
props = context.scene.BIMMaterialProperties
|
||||||
return bool(context.active_object.active_material.BIMObjectProperties.ifc_definition_id)
|
if props.materials and props.active_material_index < len(props.materials):
|
||||||
except:
|
material = props.materials[props.active_material_index]
|
||||||
return False
|
if material.ifc_definition_id:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not MaterialClassificationsData.is_loaded:
|
if not MaterialClassificationsData.is_loaded:
|
||||||
MaterialClassificationsData.load()
|
MaterialClassificationsData.load()
|
||||||
self.data = MaterialClassificationsData
|
self.data = MaterialClassificationsData
|
||||||
self.obj = context.active_object.active_material.name
|
self.obj = ""
|
||||||
self.obj_type = "Material"
|
self.obj_type = "Material"
|
||||||
self.draw_ui(context)
|
self.draw_ui(context)
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ class BIM_PT_material_psets(Panel):
|
|||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
prop_with_search(row, props, "pset_name", text="")
|
prop_with_search(row, props, "pset_name", text="")
|
||||||
op = row.operator("bim.add_pset", icon="ADD", text="")
|
op = row.operator("bim.add_pset", icon="ADD", text="")
|
||||||
op.obj = context.active_object.name
|
op.obj = ""
|
||||||
op.obj_type = "Material"
|
op.obj_type = "Material"
|
||||||
|
|
||||||
if not props.active_pset_id and props.active_pset_name and props.active_pset_type == "PSET":
|
if not props.active_pset_id and props.active_pset_name and props.active_pset_type == "PSET":
|
||||||
|
|||||||
Reference in New Issue
Block a user