Created
April 21, 2020 12:44
-
-
Save openroomxyz/b564537d1e92c898b15f472e34d78bb3 to your computer and use it in GitHub Desktop.
Blender Python : How to duplicate linked object and give it a name?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def making_object_active(name): | |
obj_to_make_active = bpy.data.objects[name] | |
bpy.context.view_layer.objects.active = obj_to_make_active | |
def duplicating_linked_object_with_name(name, new_object_name): | |
bpy.ops.object.select_all(action='DESELECT') | |
bpy.ops.object.select_pattern(pattern=name) | |
bpy.ops.object.duplicate_move_linked(OBJECT_OT_duplicate={"linked":True}) | |
bpy.ops.object.select_all(action='DESELECT') | |
making_object_active(name + ".001") | |
bpy.context.object.name = new_object_name | |
bpy.ops.object.select_all(action='DESELECT') | |
duplicating_linked_object_with_name("PEPE", "PIPI") | |
duplicating_linked_object_with_name("PIPI", "ROXI") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment