mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Array children are now transform-unlocked & unconstrained when the array is applied
This commit is contained in:
@@ -171,6 +171,10 @@ class RemoveArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
tool.Model.regenerate_array(parent, data, self.keep_objs)
|
||||
|
||||
if self.keep_objs:
|
||||
tool.Blender.Modifier.Array.unconstrain_children_from_parent(element)
|
||||
tool.Blender.Modifier.Array.lock_children_transform(element, False)
|
||||
|
||||
pset = tool.Ifc.get().by_id(pset["id"])
|
||||
if len(data) == 1:
|
||||
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), pset=pset)
|
||||
|
||||
@@ -532,6 +532,14 @@ class Blender:
|
||||
) or child.constraints.new("CHILD_OF")
|
||||
constraint.target = parent_obj
|
||||
|
||||
@classmethod
|
||||
def unconstrain_children_from_parent(cls, parent_element):
|
||||
children = cls.get_all_children_objects(parent_element)
|
||||
for child in children:
|
||||
constraint = next((c for c in child.constraints if c.type == "CHILD_OF"), None)
|
||||
if constraint:
|
||||
child.constraints.remove(constraint)
|
||||
|
||||
@classmethod
|
||||
def lock_children_transform(cls, parent_element, lock_state=True):
|
||||
for child_obj in cls.get_all_children_objects(parent_element):
|
||||
|
||||
Reference in New Issue
Block a user