am trying to copy the cache sequence modifiers from one mesh to another. The character with shaders and the character with the alembic sequence modifiers share parts of their names, example "BODY_GEO" and "AX_EP998_PUN02_ANIM_V010_ESC05_PL018_C01_ALUX_00_BODY_GEO". my goal is for this python script to select everything with a 'for' that doesnt contain "AX_" in the name, that select all meshes from the shader character, and then i select the matching pair with a nested 'for' like this:
bpy.ops.object.select_all(action='DESELECT')
for sel in bpy.context.visible_objects:
if sel.type == 'MESH' and ('AX_' not in sel.name):
for ob in bpy.context.visible_objects:
if ob.type == 'MESH' and ('_'+sel.name in ob.name):
print (sel, ob)
sel.select_set(1)
ob.select_set(1)
bpy.ops.object.make_links_data(type='MODIFIERS')
else:
bpy.ops.object.select_all(action='DESELECT')
But that code seems to apply the same modifier to every mesh in the outliner.
if I do this:
bpy.data.objects['BODY_GEO'].select_set(1)
bpy.data.objects['AX_EP998_PUN02_ANIM_V010_ESC05_PL018_C01_ALUX_00_BODY_GEO'].select_set(1)
bpy.ops.object.make_links_data(type='MODIFIERS')
It works perfect, but the name of the mesh on the alembic will change with every shoot so it wont work that easy.
What em i doing wrong, i now that i may have to use a break to stop the second for once finds the pair but i get errors when i try.
Im very new to blender and i know that selecting things is terrible difficult, please help me with this.
