2025-12-01
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import bpy
|
||||
from .. Functions import node_functions
|
||||
|
||||
def apply_transform_on_linked():
|
||||
bpy.ops.object.select_linked(type='OBDATA')
|
||||
bpy.ops.object.make_single_user(type='SELECTED_OBJECTS', object=True, obdata=True, material=False, animation=False)
|
||||
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
|
||||
bpy.ops.object.make_links_data(type='OBDATA')
|
||||
|
||||
def select_object(self, obj):
|
||||
C = bpy.context
|
||||
O = bpy.ops
|
||||
try:
|
||||
O.object.select_all(action='DESELECT')
|
||||
C.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
except:
|
||||
self.report({'INFO'}, "Object not in View Layer")
|
||||
|
||||
def select_obj_by_mat(mat,self=None):
|
||||
D = bpy.data
|
||||
result = []
|
||||
for obj in D.objects:
|
||||
if obj.type == "MESH":
|
||||
object_materials = [slot.material for slot in obj.material_slots]
|
||||
if mat in object_materials:
|
||||
result.append(obj)
|
||||
if (self):
|
||||
select_object(self, obj)
|
||||
|
||||
return result
|
||||
|
||||
# TODO - save objects in array, unlink objects, apply scale and link them back
|
||||
def apply_scale_on_multiuser():
|
||||
O = bpy.ops
|
||||
O.object.transform_apply(location=False, rotation=False, scale=True)
|
||||
Reference in New Issue
Block a user