mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
reveal element filters and drawing underlay panels just if drawing is active
Those two panels were requiring drawing's camera to be active object which was a bit confusing since "Active Drawing" section above worked fine without selecting camera explicitly. https://i.imgur.com/wcmA73Z.png
This commit is contained in:
@@ -1779,7 +1779,7 @@ class SaveDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
if self.index:
|
if self.index:
|
||||||
index = int(self.index)
|
index = int(self.index)
|
||||||
else:
|
else:
|
||||||
index = context.active_object.data.BIMCameraProperties.active_drawing_style_index
|
index = context.scene.camera.data.BIMCameraProperties.active_drawing_style_index
|
||||||
scene.DocProperties.drawing_styles[index].raster_style = json.dumps(style)
|
scene.DocProperties.drawing_styles[index].raster_style = json.dumps(style)
|
||||||
|
|
||||||
bpy.ops.bim.save_drawing_styles_data()
|
bpy.ops.bim.save_drawing_styles_data()
|
||||||
@@ -2678,8 +2678,9 @@ class EditElementFilter(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
filter_mode: bpy.props.StringProperty()
|
filter_mode: bpy.props.StringProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.active_object.data.BIMCameraProperties
|
|
||||||
obj = bpy.context.scene.camera
|
obj = bpy.context.scene.camera
|
||||||
|
assert obj
|
||||||
|
props = obj.data.BIMCameraProperties
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
pset = tool.Pset.get_element_pset(element, "EPset_Drawing")
|
pset = tool.Pset.get_element_pset(element, "EPset_Drawing")
|
||||||
if self.filter_mode == "INCLUDE":
|
if self.filter_mode == "INCLUDE":
|
||||||
|
|||||||
@@ -106,11 +106,7 @@ class BIM_PT_element_filters(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (
|
return bool((camera := context.scene.camera) and tool.Ifc.get_entity(camera))
|
||||||
context.scene.camera
|
|
||||||
and context.active_object
|
|
||||||
and hasattr(context.active_object.data, "BIMCameraProperties")
|
|
||||||
)
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not ElementFiltersData.is_loaded:
|
if not ElementFiltersData.is_loaded:
|
||||||
@@ -160,17 +156,15 @@ class BIM_PT_drawing_underlay(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (
|
return bool((camera := context.scene.camera) and tool.Ifc.get_entity(camera))
|
||||||
context.scene.camera
|
|
||||||
and context.active_object
|
|
||||||
and hasattr(context.active_object.data, "BIMCameraProperties")
|
|
||||||
)
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
|
camera = context.scene.camera
|
||||||
|
assert camera
|
||||||
dprops = context.scene.DocProperties
|
dprops = context.scene.DocProperties
|
||||||
props = context.active_object.data.BIMCameraProperties
|
props = camera.data.BIMCameraProperties
|
||||||
drawing_index_is_valid = props.active_drawing_style_index < len(dprops.drawing_styles)
|
drawing_index_is_valid = props.active_drawing_style_index < len(dprops.drawing_styles)
|
||||||
|
|
||||||
if not DrawingsData.is_loaded:
|
if not DrawingsData.is_loaded:
|
||||||
|
|||||||
Reference in New Issue
Block a user