mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Array children are now transforme-locked after editing the array
I have yet to find how to set it on ifc load though
This commit is contained in:
@@ -135,6 +135,7 @@ class EditArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
data = json.dumps(data)
|
||||
ifcopenshell.api.run("pset.edit_pset", tool.Ifc.get(), pset=pset, properties={"Data": data})
|
||||
|
||||
tool.Blender.Modifier.Array.lock_children_transform(element, True)
|
||||
tool.Blender.Modifier.Array.constrain_children_to_parent(element)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -532,6 +532,14 @@ class Blender:
|
||||
) or child.constraints.new("CHILD_OF")
|
||||
constraint.target = parent_obj
|
||||
|
||||
@classmethod
|
||||
def lock_children_transform(cls, parent_element, lock_state=True):
|
||||
for child_obj in cls.get_all_children_objects(parent_element):
|
||||
for prop in ("lock_location", "lock_rotation", "lock_scale"):
|
||||
attr = getattr(child_obj, prop)
|
||||
for axis_idx in range(3):
|
||||
attr[axis_idx] = lock_state
|
||||
|
||||
@classmethod
|
||||
def get_all_objects(cls, parent_element):
|
||||
parent_obj = tool.Ifc.get_object(parent_element)
|
||||
|
||||
Reference in New Issue
Block a user