mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
WIP port constraints module. See #1222.
This commit is contained in:
@@ -202,67 +202,6 @@ class RemoveMaterialPset(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AddConstraint(bpy.types.Operator):
|
||||
bl_idname = "bim.add_constraint"
|
||||
bl_label = "Add Constraint"
|
||||
|
||||
def execute(self, context):
|
||||
constraint = bpy.context.scene.BIMProperties.constraints.add()
|
||||
constraint.name = "New Constraint"
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class RemoveConstraint(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_constraint"
|
||||
bl_label = "Remove Constraint"
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.BIMProperties.constraints.remove(self.index)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AssignConstraint(bpy.types.Operator):
|
||||
bl_idname = "bim.assign_constraint"
|
||||
bl_label = "Assign Constraint"
|
||||
|
||||
def execute(self, context):
|
||||
identification = bpy.context.scene.BIMProperties.constraints[
|
||||
bpy.context.scene.BIMProperties.active_constraint_index
|
||||
].name
|
||||
for obj in bpy.context.selected_objects:
|
||||
if obj.BIMObjectProperties.constraints.get(identification):
|
||||
continue
|
||||
constraint = obj.BIMObjectProperties.constraints.add()
|
||||
constraint.name = identification
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class UnassignConstraint(bpy.types.Operator):
|
||||
bl_idname = "bim.unassign_constraint"
|
||||
bl_label = "Unassign Constraint"
|
||||
|
||||
def execute(self, context):
|
||||
identification = bpy.context.scene.BIMProperties.constraints[
|
||||
bpy.context.scene.BIMProperties.active_constraint_index
|
||||
].name
|
||||
for obj in bpy.context.selected_objects:
|
||||
index = obj.BIMObjectProperties.constraints.find(identification)
|
||||
if index >= 0:
|
||||
obj.BIMObjectProperties.constraints.remove(index)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class RemoveObjectConstraint(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_object_constraint"
|
||||
bl_label = "Remove Object Constraint"
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.active_object.BIMObjectProperties.constraints.remove(self.index)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AddMaterialAttribute(bpy.types.Operator):
|
||||
bl_idname = "bim.add_material_attribute"
|
||||
bl_label = "Add Material Attribute"
|
||||
|
||||
Reference in New Issue
Block a user