Tråd: Open AI
View Single Post
Sitat av Quakecry Vis innlegg

Kode

import bpy

# Set the render resolution
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080

# Add a plane for the ground
bpy.ops.mesh.primitive_plane_add(size=20, location=(0, 0, 0))

# Add a cube for the figure
bpy.ops.mesh.primitive_cube_add(size=1, location=(0, 0, 1))

# Add a cylinder for the waterfall
bpy.ops.mesh.primitive_cylinder_add(radius=5, depth=10, location=(-5, 0, 0))

# Add a series of particles to represent the birds
bpy.ops.mesh.primitive_uv_sphere_add(size=0.1, location=(5, 0, 5))
bpy.ops.object.particle_system_add()
bpy.context.object.particle_system.point_density_radius = 0.5
bpy.context.object.particle_system.settings.count = 1000

# Set the background image
bpy.context.scene.world.background_image = bpy.data.images.load("image_file.jpg")

# Animate the figure
bpy.context.object.animation_data_create()
bpy.context.object.animation_data.action = bpy.data.actions.new(name="Figure Action")

# Create a keyframe for the start of the animation
bpy.context.object.animation_data.action.fcurves.new(data_path="location", index=1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points.add(1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[0].co = (0, 0, 1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[0].interpolation = 'LINEAR'

# Create a keyframe for the end of the animation
bpy.context.object.animation_data.action.fcurves[0].keyframe_points.add(25)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[1].co = (0, 0, 2)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[1].interpolation = 'LINEAR'

# Render the animation
bpy.ops.render.render(animation=True)
Vis hele sitatet...
Litt som jeg nevnte i posten min over, dette er et script som ikke vil kjøre i blender. Det er knapt nok et skjellet. Har ikke prøvd å kjøre det, men som jeg leser det så vil det lage en kube, en sylinder og en bakgrunn, uten noe mer form enn det, det gjøres også et forsøk på animering.

Her finnes det også avhengigheter, ser blant annet at det refereres til en bildefil i bakgrunnen.

Definitivt et godt utgangspunkt hvis det ikke hadde krevd for mye å fikse scriptet.