mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix #2980. Minor cleanup to polish array panel UI.
This commit is contained in:
@@ -42,7 +42,7 @@ class AddArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
"z": 0.0,
|
||||
"use_local_space": True,
|
||||
"sync_children": False,
|
||||
"dimension_input_type": "Increment",
|
||||
"method": "OFFSET",
|
||||
}
|
||||
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
@@ -91,7 +91,7 @@ class EnableEditingArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
props.z = data["z"]
|
||||
props.use_local_space = data.get("use_local_space", False)
|
||||
props.sync_children = data.get("sync_children", False)
|
||||
props.dimension_input_type = data.get("dimension_input_type", "Increment")
|
||||
props.method = data.get("method", "OFFSET")
|
||||
props.is_editing = self.item
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -117,7 +117,7 @@ class EditArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
"z": props.z,
|
||||
"use_local_space": props.use_local_space,
|
||||
"sync_children": props.sync_children,
|
||||
"dimension_input_type": props.dimension_input_type,
|
||||
"method": props.method,
|
||||
}
|
||||
|
||||
props.is_editing = -1
|
||||
|
||||
@@ -156,18 +156,15 @@ class BIMArrayProperties(PropertyGroup):
|
||||
description="Use local space for array items offset instead of world space",
|
||||
default=True,
|
||||
)
|
||||
dimension_input_type: bpy.props.EnumProperty(
|
||||
items=(
|
||||
("Increment", "Increment", ""),
|
||||
("Total", "Total", ""),
|
||||
),
|
||||
name="Type of input dimension",
|
||||
default="Increment",
|
||||
method: bpy.props.EnumProperty(
|
||||
items=(("OFFSET", "Offset", ""), ("DISTRIBUTE", "Distribute", "")),
|
||||
name="Method",
|
||||
default="OFFSET",
|
||||
)
|
||||
sync_children: bpy.props.BoolProperty(
|
||||
name="Sync Children",
|
||||
description="Keep children objects in sync with parent object",
|
||||
default = False,
|
||||
description="Regenerate all children based on the parent object",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class BIM_PT_array(bpy.types.Panel):
|
||||
row.operator("bim.edit_array", icon="CHECKMARK", text="").item = i
|
||||
row.operator("bim.disable_editing_array", icon="CANCEL", text="")
|
||||
row = box.row(align=True)
|
||||
row.prop(props, "dimension_input_type")
|
||||
row.prop(props, "method")
|
||||
row = box.row(align=True)
|
||||
row.prop(props, "use_local_space")
|
||||
row.prop(props, "sync_children")
|
||||
@@ -185,18 +185,15 @@ class BIM_PT_array(bpy.types.Panel):
|
||||
row = col.row(align=True)
|
||||
row.prop(props, "z")
|
||||
row.operator("bim.input_cursor_z_array", icon="CURSOR", text="")
|
||||
|
||||
else:
|
||||
row = box.row(align=True)
|
||||
row.label(text=f"{array['count']} Items", icon="MOD_ARRAY")
|
||||
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
|
||||
row.operator("bim.remove_array", icon="X", text="").item = i
|
||||
row = box.row(align=True)
|
||||
row.label(text=f"Dimension input type: {array.get('dimension_input_type', 'Increment')}")
|
||||
row = box.row(align=True)
|
||||
row.label(text=f"Use Local Space: {array.get('use_local_space', False)}")
|
||||
row = box.row(align=True)
|
||||
row.label(text=f"X: {array['x']}")
|
||||
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"Y: {array['y']}")
|
||||
row.label(text=f"Z: {array['z']}")
|
||||
else:
|
||||
|
||||
@@ -421,13 +421,14 @@ class Model(blenderbim.core.tool.Model):
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if obj:
|
||||
tool.Geometry.delete_ifc_object(obj)
|
||||
array["children"].clear()
|
||||
|
||||
child_i = 0
|
||||
existing_children = set(array["children"])
|
||||
total_existing_children = len(array["children"])
|
||||
children_elements = []
|
||||
children_objs = []
|
||||
if array["dimension_input_type"] == "Total":
|
||||
if array["method"] == "DISTRIBUTE":
|
||||
divider = 1 if ((array["count"] - 1) == 0) else (array["count"] - 1)
|
||||
base_offset = Vector([array["x"] / divider, array["y"] / divider, array["z"] / divider]) * unit_scale
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user