blenderproc.python.modules.manipulators.WorldManipulator module

class blenderproc.python.modules.manipulators.WorldManipulator.WorldManipulator(config)[source]

Bases: blenderproc.python.modules.main.Module.Module

Allows manipulation of the current World in the scene via specifying one or more {attr name/custom prop. name/ custom function name: value} pairs.

Example 1: Sets the World’s custom property category_id to 123.

{
  "module": "manipulators.WorldManipulator",
  "config": {
    "cp_category_id": 123
  }
}

Example 2: Sets the color and the strength of the light emitted by the background surface.

{
  "module": "manipulators.WorldManipulator",
  "config": {
    "cf_bg_surface_color": [1, 1, 1, 1],
    "cf_bg_surface_strength": 100
  }
}

Example 3: Disables shader node tree of the background surface and sets a solid color to the background surface.

{
  "module": "manipulators.WorldManipulator",
  "config": {
    "use_nodes": False,
    "color": [0.5, 0.5, 0.5]
  }
}

Configuration:

Parameter Description Type
key Name of the attribute/custom property to change or a name of a custom function to perform on objects. In order to specify, what exactly one wants to modify (e.g. attribute, custom property, etc.): For attribute: key of the pair must be a valid attribute name of the world. For custom property: key of the pair must start with cp_ prefix. For calling custom function: key of the pair must start with cf_ prefix. See table below for supported custom function names. string
value Value of the attribute/custom prop. to set or input value(s) for a custom function. string, list/Vector, int, bool or float

Custom functions:

Parameter Description Type
cf_bg_surface_color Sets the RGBA color of the light emitted by the background. mathutils.Vector
cf_bg_surface_strength Sets the strength of the light emitted by the background. float
cf_set_world_category_id Sets the category_id of the background. int
_set_bg_surface_color(world, color)[source]

Sets the color of the emitted light by the background surface.

Parameters:
  • world – World to modify. Type: bpy.types.World.
  • color – RGBA color of the emitted light. Type: mathutils.Vector.
_set_bg_surface_strength(world, strength)[source]

Sets the strength of the emitted light by the background surface.

Parameters:
  • world – World to modify. Type: bpy.types.World.
  • strength – Strength of the emitted light. Type: float.
run()[source]

Assigns user-defined values to World’s attributes, custom properties, or manipulates the state of the world. 1. Selects current active World. 2. Change World’s state via setting user-defined values to it’s attributes, custom properties, etc.