import bpy # Delete the 'Dual Node Background' world if it exists if 'Dual Node Background' in bpy.data.worlds: world_to_delete = bpy.data.worlds['Dual Node Background'] bpy.data.worlds.remove(world_to_delete, do_unlink=True) # Create new world new_world = bpy.data.worlds.new(name="World") # Set world color to pure white (#FFFFFFFF) new_world.use_nodes = True nodes = new_world.node_tree.nodes links = new_world.node_tree.links # Clear existing nodes nodes.clear() # Create background node background_node = nodes.new(type='ShaderNodeBackground') background_node.inputs[0].default_value = (1.0, 1.0, 1.0, 1.0) # Pure white RGBA # Create output node output_node = nodes.new(type='ShaderNodeOutputWorld') # Link background to output links.new(background_node.outputs[0], output_node.inputs[0]) # Set as active world bpy.context.scene.world = new_world # Purge orphaned data bpy.ops.outliner.orphans_purge() # Enable transparent film rendering bpy.context.scene.render.film_transparent = True print("World 'Dual Node Background' deleted and new white world created successfully!") print("Orphaned data purged and transparent film rendering enabled.")