Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. def CLONE_SOURCE_OBJECT (tile_object, source_plane):
  2.     new_obj_name = tile_object+'_SOURCE_COPY'
  3.     if not (tile_object in CLONE_SOURCE_OBJECT.Items):
  4.         bpy.ops.object.select_all(action='DESELECT')
  5.         bpy.data.objects[source_plane].select = True
  6.         bpy.context.scene.objects.active = bpy.data.objects[source_plane]
  7.         SPD_x, SPD_y, SPD_z = bpy.context.active_object.dimensions
  8.         bpy.ops.object.select_all(action='DESELECT')
  9.         bpy.data.objects[tile_object].select = True
  10.         bpy.context.scene.objects.active = bpy.data.objects[tile_object]
  11.         scn = bpy.context.scene
  12.         src_obj = bpy.data.objects[tile_object]
  13.         new_obj = src_obj.copy()
  14.         new_obj.data = src_obj.data.copy()
  15.         new_obj = src_obj.copy()
  16.         new_obj.data = src_obj.data.copy()
  17.         new_obj.animation_data_clear()
  18.         new_obj.name = new_obj_name
  19.         NOD_x, NOD_y, NOD_z = bpy.context.active_object.dimensions
  20.         NOL_x = (NOD_x)/2
  21.         NOL_y = (NOD_y)/2
  22.         NOL_z = (SPD_z)
  23.         new_obj.location = (NOL_x,NOL_y,NOL_z)
  24.         scn.objects.link(new_obj)
  25.         CLONE_SOURCE_OBJECT.Items[tile_object] = new_obj_name
  26.     return new_obj_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement