mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +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_options = {"REGISTER", "UNDO"}
|
||||
item: bpy.props.IntProperty()
|
||||
total_items: bpy.props.IntProperty()
|
||||
keep_objs: bpy.props.BoolProperty(name="Keep Objects", default=False)
|
||||
|
||||
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
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMArrayProperties
|
||||
@@ -156,6 +152,10 @@ class RemoveArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
data = json.loads(pset["Data"])
|
||||
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
|
||||
|
||||
|
||||
@@ -219,9 +219,7 @@ class BIM_PT_array(bpy.types.Panel):
|
||||
name = f"{array['count']} Items ({array.get('method', 'OFFSET').capitalize()})"
|
||||
row.label(text=name, icon="MOD_ARRAY")
|
||||
row.operator("bim.enable_editing_array", icon="GREASEPENCIL", text="").item = i
|
||||
op = row.operator("bim.remove_array", icon="X", text="")
|
||||
op.item = i
|
||||
op.total_items = len(ArrayData.data["parameters"]["data_dict"])
|
||||
row.operator("bim.remove_array", icon="X", text="").item = i
|
||||
row = box.row(align=True)
|
||||
icon = "EMPTY_ARROWS" if array.get("use_local_space", False) else "EMPTY_AXIS"
|
||||
row.label(text=f"X: {array['x']}", icon=icon)
|
||||
|
||||
Reference in New Issue
Block a user