mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 13:04:49 +00:00
Fix error messages when using the search operator on blank file (F3)
This commit is contained in:
@@ -768,6 +768,8 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
|||||||
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
||||||
props = context.scene.BCFProperties
|
props = context.scene.BCFProperties
|
||||||
blender_topic = props.active_topic
|
blender_topic = props.active_topic
|
||||||
|
if blender_topic is None:
|
||||||
|
return False
|
||||||
topic = bcfxml.topics[blender_topic.name]
|
topic = bcfxml.topics[blender_topic.name]
|
||||||
return topic.viewpoints
|
return topic.viewpoints
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ def getBcfViewpoints(self, context, force_update=False):
|
|||||||
props = context.scene.BCFProperties
|
props = context.scene.BCFProperties
|
||||||
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
||||||
topic = props.active_topic
|
topic = props.active_topic
|
||||||
viewpoints = bcfxml.get_viewpoints(topic.name)
|
viewpoints = bcfxml.get_viewpoints(topic.name) if topic else {}
|
||||||
bcfviewpoints_enum.extend([(v, f"Viewpoint {i+1}", "") for i, v in enumerate(viewpoints.keys())])
|
bcfviewpoints_enum.extend([(v, f"Viewpoint {i+1}", "") for i, v in enumerate(viewpoints.keys())])
|
||||||
return bcfviewpoints_enum
|
return bcfviewpoints_enum
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class UpdateRepresentation(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object.mode == "OBJECT"
|
return context.active_object and context.active_object.mode == "OBJECT"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
@@ -240,7 +240,7 @@ class UpdateParametricRepresentation(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object.mode == "OBJECT"
|
return context.active_object and context.active_object.mode == "OBJECT"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
|
|||||||
Reference in New Issue
Block a user