gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
give me a blender script create a rigged small dog
- User
give me a blender script create a rigged small dog
- Assistant
give me a blender script create a rigged small dog
Sure! Here's a simple Blender script to create a rigged small dog model:
import bpy
# Clear existing data
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
# Create dog body
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0))
dog_body = bpy.context.object
# Create dog head
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.7, location=(0, 0, 1.5))
dog_head = bpy.context.object
# Create dog legs
bpy.ops.mesh.primitive_cube_add(size=0.3, location=(-1, -1, 0))
leg_1 = bpy.context.object
bpy.ops.mesh.primitive_cube_add(size=0.3, location=(1, -1, 0))
leg_2 = bpy.context.object
bpy.ops.mesh.primitive_cube_add(size=0.3, location=(-1, 1, 0))
leg_3 = bpy.context.object
bpy.ops.mesh.primitive_cube_add(size=0.3, location=(1, 1, 0))
leg_4 = bpy.context.object
# Parent legs to the body
dog_body.select_set(True)
leg_1.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.parent_set(type='ARMATURE_AUTO')
dog_body.select_set(False)
leg_1.select_set(False)
dog_body.select_set(True)
leg_2.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.parent_set(type='ARMATURE_AUTO')
dog_body.select_set(False)
leg_2.select_set(False)
dog_body.select_set(True)
leg_3.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.parent_set(type='ARMATURE_AUTO')
dog_body.select_set(False)
leg_3.select_set(False)
dog_body.select_set(True)
leg_4.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.parent_set(type='ARMATURE_AUTO')
dog_body.select_set(False)
leg_4.select_set(False)
# Create armature (bones)
bpy.ops.object.armature_add()
armature = bpy.context.object
armature.select_set(True)
bpy.ops.object.mode_set(mode='EDIT')
bone = armature.data.edit_bones.new('Bone')
bone.head = (0, 0, 0)
bone.tail = (0, 0, 1.5)
bpy.ops.object.mode_set(mode='POSE')
# Bind armature to the dog body and head
bpy.ops.object.select_all(action='DESELECT')
armature.select_set(True)
dog_body.select_set(True)
dog_head.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.parent_set(type='ARMATURE')
bpy.ops.object.mode_set(mode='OBJECT')
# Set up armature constraints for legs
for leg in [leg_1, leg_2, leg_3, leg_4]:
leg.select_set(True)
bpy.context.view_layer.objects.active = leg
bpy.ops.object.modifier_add(type='ARMATURE')
leg.modifiers['Armature'].object = armature
bpy.ops.object.select_all(action='DESELECT')
# Apply smooth shading to the dog
bpy.ops.object.select_all(action='DESELECT')
dog_body.select_set(True)
dog_head.select_set(True)
bpy.context.view_layer.objects.active = dog_body
bpy.ops.object.shade_smooth()
print("Small dog model created successfully!")
This script will create a small dog model with a body, head, and four legs. The legs will be rigged to an armature, allowing you to manipulate the dog's pose easily.
Not yet included in a published release.