lib/glitch3d/bpy/rendering.py in glitch3d-0.1.2 vs lib/glitch3d/bpy/rendering.py in glitch3d-0.1.4
- old
+ new
@@ -17,10 +17,11 @@
file = args.file
mode = args.mode
shots_number = int(args.shots_number)
context = bpy.context
+texture_folder_path = str(args.path) + '/../fixtures/textures/'
# Scene
new_scene = bpy.data.scenes.new("Automated Render Scene")
bpy.ops.scene.delete() # Delete old scene
context.screen.scene = new_scene # selects the new scene as the current one
@@ -36,22 +37,18 @@
context.scene.render.image_settings.color_mode ='RGBA'
context.scene.render.image_settings.file_format='PNG'
if mode == 'high':
context.scene.render.image_settings.compression = 90
- context.scene.cycles.samples = 100
+ context.scene.cycles.samples = 400
context.scene.render.resolution_percentage = 100
# Add background to world
-texture_path = os.path.expanduser('fixtures/textures/checkered_texture.jpg')
world = bpy.data.worlds[0]
world.use_nodes = True
world_node_tree = world.node_tree
-output_node = world_node_tree.nodes['Background']
-texture_node = world_node_tree.nodes.new('ShaderNodeTexImage')
-world_node_tree.links.new(texture_node.outputs['Color'], output_node.inputs['Color'])
-texture_node.image = bpy.data.images.load(texture_path)
+world_node_tree.nodes['Background'].inputs[0].default_value = rand_color_vector()
# Delete current objects
for index, obj in enumerate(bpy.data.objects):
bpy.data.objects.remove(obj)
@@ -126,29 +123,22 @@
new_object = duplicate_object(cube)
props.append(new_object)
new_object.location = rand_location()
texture_object(new_object)
-for index in range(1, int(PROPS_NUMBER)):
- new_object = duplicate_object(torus)
+# Import guns
+for index in range(1, 5):
+ new_object = duplicate_object(m4a1)
props.append(new_object)
- new_object.location = rand_location()
+ shuffle(new_object)
texture_object(new_object)
-for index in range(1, int(PROPS_NUMBER)):
- new_object = duplicate_object(cone)
+for index in range(1, len(WORDS)):
+ new_object = spawn_text()
props.append(new_object)
+ new_object.scale = (0.75, 0.75, 0.75)
new_object.location = rand_location()
- texture_object(new_object)
-
-# Import guns
-for index in range(1, 5):
- new_object = duplicate_object(m4a1)
- props.append(new_object)
- new_object.location = rand_location()
- new_object.scale = rand_scale_vector()
new_object.rotation_euler = rand_rotation()
- texture_object(new_object)
for model in bpy.data.objects:
unwrap_model(model)
# ------