Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def CLONE_SOURCE_OBJECT (tile_object, source_plane):
- bpy.ops.object.select_all(action='DESELECT')
- bpy.data.objects[source_plane].select = True
- bpy.context.scene.objects.active = bpy.data.objects[source_plane]
- SPD_x, SPD_y, SPD_z = bpy.context.active_object.dimensions
- bpy.ops.object.select_all(action='DESELECT')
- bpy.data.objects[tile_object].select = True
- bpy.context.scene.objects.active = bpy.data.objects[tile_object]
- scn = bpy.context.scene
- src_obj = bpy.data.objects[tile_object]
- new_obj = src_obj.copy()
- new_obj.data = src_obj.data.copy()
- new_obj = src_obj.copy()
- new_obj.data = src_obj.data.copy()
- new_obj.animation_data_clear()
- new_obj_name = tile_object+'_SOURCE_COPY'
- new_obj.name = new_obj_name
- NOD_x, NOD_y, NOD_z = bpy.context.active_object.dimensions
- NOL_x = (NOD_x)/2
- NOL_y = (NOD_y)/2
- NOL_z = (SPD_z)
- new_obj.location = (NOL_x,NOL_y,NOL_z)
- scn.objects.link(new_obj)
- CLONED_SOURCE_OBJECT_NAME = new_obj_name
- return (CLONED_SOURCE_OBJECT_NAME)
- #Определяем количество обьектов по Х и У для этого слоя
- def X_Y_COUNT (tile_object, source_plane):
- bpy.ops.object.select_all(action='DESELECT')
- bpy.data.objects[tile_object].select = True
- bpy.context.scene.objects.active = bpy.data.objects[tile_object]
- NOD_x, NOD_y, NOD_z = bpy.context.active_object.dimensions
- print (NOD_x, NOD_y, NOD_z)
- bpy.ops.object.select_all(action='DESELECT')
- bpy.data.objects[source_plane].select = True
- bpy.context.scene.objects.active = bpy.data.objects[source_plane]
- SPD_x, SPD_y, SPD_z = bpy.context.active_object.dimensions
- print (SPD_x, SPD_y, SPD_z)
- count_x = (SPD_x // NOD_x) +1
- count_y = (SPD_y // NOD_y) +1
- print (count_x, count_y)
- CLONE_NUMBER_X = count_x
- CLONE_NUMBER_Y = count_y
- def CLONE_TILES_FROM_SOURCE_OBJECT (CLONED_SOURCE_OBJECT_NAME, source_plane,CLONE_NUMBER_X,CLONE_NUMBER_Y):
- bpy.ops.object.select_all(action='DESELECT')
- bpy.data.objects[CLONED_SOURCE_OBJECT_NAME].select = True
- bpy.context.scene.objects.active = bpy.data.objects[CLONED_SOURCE_OBJECT_NAME]
- NOD_x, NOD_y, NOD_z = bpy.context.active_object.dimensions
- scn = bpy.context.scene
- src_obj = bpy.data.objects[CLONED_SOURCE_OBJECT_NAME]
- i_x = 0
- i_y = 0
- while (i_x != CLONE_NUMBER_X):
- new_obj = src_obj.copy()
- new_obj.data = src_obj.data.copy()
- new_obj = src_obj.copy()
- new_obj.data = src_obj.data.copy()
- new_obj.animation_data_clear()
- new_obj_name = tile_object+'_COPY_'+i_x
- new_obj.name = new_obj_name
- NOL_x = ((NOD_x)*2)+0.003
- NOL_y = (NOD_y)
- NOL_z = (NOD_z)
- new_obj.location = (NOL_x,NOL_y,NOL_z)
- i_x=i_x+1
- scn.objects.link(new_obj)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement