mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 21:38:12 +00:00
Fix bug where panels for psets/qtos/classifications/types were showing up on irrelevant objects (e.g. grid axes)
This commit is contained in:
@@ -282,7 +282,11 @@ class BIM_PT_classification_references(Panel, ReferenceUI):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return bool((obj := context.active_object) and tool.Ifc.get_entity(obj))
|
return (
|
||||||
|
(obj := tool.Blender.get_active_object())
|
||||||
|
and (element := tool.Ifc.get_entity(obj))
|
||||||
|
and element.is_a("IfcObjectDefinition")
|
||||||
|
)
|
||||||
|
|
||||||
def get_object_name(self, context: bpy.types.Context) -> str:
|
def get_object_name(self, context: bpy.types.Context) -> str:
|
||||||
assert (obj := context.active_object)
|
assert (obj := context.active_object)
|
||||||
|
|||||||
@@ -242,14 +242,11 @@ class BIM_PT_object_psets(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not (obj := context.active_object):
|
return (
|
||||||
return False
|
(obj := tool.Blender.get_active_object())
|
||||||
ifc_id = tool.Blender.get_ifc_definition_id(obj)
|
and (element := tool.Ifc.get_entity(obj))
|
||||||
if not ifc_id:
|
and element.is_a("IfcObjectDefinition")
|
||||||
return False
|
)
|
||||||
if not tool.Ifc.get_object_by_identifier(ifc_id):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not ObjectPsetsData.is_loaded:
|
if not ObjectPsetsData.is_loaded:
|
||||||
@@ -388,14 +385,11 @@ class BIM_PT_object_qtos(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not (obj := context.active_object):
|
return (
|
||||||
return False
|
(obj := tool.Blender.get_active_object())
|
||||||
ifc_id = tool.Blender.get_ifc_definition_id(obj)
|
and (element := tool.Ifc.get_entity(obj))
|
||||||
if not ifc_id:
|
and element.is_a("IfcObjectDefinition")
|
||||||
return False
|
)
|
||||||
if not tool.Ifc.get_object_by_identifier(ifc_id):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not ObjectQtosData.is_loaded:
|
if not ObjectQtosData.is_loaded:
|
||||||
|
|||||||
@@ -34,14 +34,11 @@ class BIM_PT_type(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not context.active_object:
|
return (
|
||||||
return False
|
(obj := tool.Blender.get_active_object())
|
||||||
element = tool.Ifc.get_entity(context.active_object)
|
and (element := tool.Ifc.get_entity(obj))
|
||||||
if not element:
|
and (element.is_a("IfcObject") or element.is_a("IfcTypeObject"))
|
||||||
return False
|
)
|
||||||
if not element.is_a("IfcProduct") and not element.is_a("IfcTypeProduct"):
|
|
||||||
return True
|
|
||||||
return True
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not TypeData.is_loaded:
|
if not TypeData.is_loaded:
|
||||||
|
|||||||
Reference in New Issue
Block a user