示例#1
0
 def execute(self, context):
     # In this override, we don't check self.hierarchy. This effectively
     # makes Delete and Delete Hierarchy identical. This is on purpose, since
     # non-hierarchical deletion may imply a whole bunch of potentially
     # unintended IFC spatial modifications. To make life less confusing for
     # the user, Delete means Delete. End of story.
     # Deep magick from the dawn of time
     if IfcStore.get_file():
         return IfcStore.execute_ifc_operator(self, context)
     # https://blender.stackexchange.com/questions/203729/python-get-selected-objects-in-outliner
     objects_to_delete = set()
     collections_to_delete = set()
     for item in context.selected_ids:
         if item.bl_rna.identifier == "Collection":
             collection = bpy.data.collections.get(item.name)
             collection_data = self.get_collection_objects_and_children(collection)
             print(collection_data)
             objects_to_delete |= collection_data["objects"]
             collections_to_delete |= collection_data["children"]
             collections_to_delete.add(collection)
         elif item.bl_rna.identifier == "Object":
             objects_to_delete.add(bpy.data.objects.get(item.name))
     for obj in objects_to_delete:
         bpy.data.objects.remove(obj)
     for collection in collections_to_delete:
         bpy.data.collections.remove(collection)
     return {"FINISHED"}
示例#2
0
 def execute(self, context):
     # Deep magick from the dawn of time
     if IfcStore.get_file():
         return IfcStore.execute_ifc_operator(self, context)
     for obj in context.selected_objects:
         bpy.data.objects.remove(obj)
     return {"FINISHED"}
示例#3
0
    def execute(self, context):
        # Deep magick from the dawn of time
        if IfcStore.get_file():
            IfcStore.execute_ifc_operator(self, context)
            if self.new_active_obj:
                context.view_layer.objects.active = self.new_active_obj
            return {"FINISHED"}

        new_active_obj = None
        for obj in context.selected_objects:
            new_obj = obj.copy()
            if obj == context.active_object:
                new_active_obj = new_obj
            for collection in obj.users_collection:
                collection.objects.link(new_obj)
            obj.select_set(False)
            new_obj.select_set(True)
        if new_active_obj:
            context.view_layer.objects.active = new_active_obj
        bpy.ops.transform.translate("INVOKE_DEFAULT")
        return {"FINISHED"}
示例#4
0
 def execute(self, context):
     IfcStore.execute_ifc_operator(self, context)
     blenderbim.bim.handler.refresh_ui_data()
     return {"FINISHED"}
示例#5
0
 def execute(self, context):
     return IfcStore.execute_ifc_operator(self, context)