MCPcopy Create free account
hub / github.com/openai/point-e / create_light

Function create_light

point_e/evals/scripts/blender_script.py:163–176  ·  view source on GitHub ↗
(location, energy=1.0, angle=0.5 * math.pi / 180)

Source from the content-addressed store, hash-verified

161
162
163def create_light(location, energy=1.0, angle=0.5 * math.pi / 180):
164 # https://blender.stackexchange.com/questions/215624/how-to-create-a-light-with-the-python-api-in-blender-2-92
165 light_data = bpy.data.lights.new(name="Light", type="SUN")
166 light_data.energy = energy
167 light_data.angle = angle
168 light_object = bpy.data.objects.new(name="Light", object_data=light_data)
169
170 direction = -location
171 rot_quat = direction.to_track_quat("-Z", "Y")
172 light_object.rotation_euler = rot_quat.to_euler()
173 bpy.context.view_layer.update()
174
175 bpy.context.collection.objects.link(light_object)
176 light_object.location = location
177
178
179def create_random_lights(count=4, distance=2.0, energy=1.5):

Callers 3

create_random_lightsFunction · 0.85
create_camera_lightFunction · 0.85
create_uniform_lightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected