mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 21:39:59 +00:00
removed total_items from the operator
This commit is contained in:
committed by
Dion Moult
parent
1afcec2005
commit
0ee5e3887b
@@ -142,13 +142,9 @@ class RemoveArray(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Remove Array"
|
bl_label = "Remove Array"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
item: bpy.props.IntProperty()
|
item: bpy.props.IntProperty()
|
||||||
total_items: bpy.props.IntProperty()
|
|
||||||
keep_objs: bpy.props.BoolProperty(name="Keep Objects", default=False)
|
keep_objs: bpy.props.BoolProperty(name="Keep Objects", default=False)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
if (self.keep_objs) & (self.item < (self.total_items - 1)):
|
|
||||||
self.report({"INFO"}, "Keeping the objects is only allowed when you are removing the last Array of the object")
|
|
||||||
return {"FINISHED"}
|
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
props = obj.BIMArrayProperties
|
props = obj.BIMArrayProperties
|
||||||
@@ -156,6 +152,10 @@ class RemoveArray(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||||
data = json.loads(pset["Data"])
|
data = json.loads(pset["Data"])
|
||||||
data[self.item]["count"] = 1
|
data[self.item]["count"] = 1
|
||||||
|
|
||||||
|
if (self.keep_objs) & (self.item < (len(data) - 1)):
|
||||||
|
self.report({"INFO"}, "Keeping the objects is only allowed when you are removing the last Array of the object")
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
props.is_editing = -1
|
props.is_editing = -1
|
||||||
|
|
||||||
|
|||||||
@@ -219,9 +219,7 @@ class BIM_PT_array(bpy.types.Panel):
|
|||||||
name = f"{array['count']} Items ({array.get('method', 'OFFSET').capitalize()})"
|
name = f"{array['count']} Items ({array.get('method', 'OFFSET').capitalize()})"
|
||||||
row.label(text=name, icon="MOD_ARRAY")
|
row.label(text=name, icon="MOD_ARRAY")
|
||||||
row.operator("bim.enable_editing_array", icon="GREASEPENCIL", text="").item = i
|
row.operator("bim.enable_editing_array", icon="GREASEPENCIL", text="").item = i
|
||||||
op = row.operator("bim.remove_array", icon="X", text="")
|
row.operator("bim.remove_array", icon="X", text="").item = i
|
||||||
op.item = i
|
|
||||||
op.total_items = len(ArrayData.data["parameters"]["data_dict"])
|
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
icon = "EMPTY_ARROWS" if array.get("use_local_space", False) else "EMPTY_AXIS"
|
icon = "EMPTY_ARROWS" if array.get("use_local_space", False) else "EMPTY_AXIS"
|
||||||
row.label(text=f"X: {array['x']}", icon=icon)
|
row.label(text=f"X: {array['x']}", icon=icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user