blenderproc.python.modules.utility.Config module¶
-
class
blenderproc.python.modules.utility.Config.
Config
(data)[source]¶ Bases:
object
-
_get_value
(name, block=None, allow_invoke_provider=False, global_check=True)[source]¶ Returns the value of the parameter with the given name inside the given block.
Basically just a recursive dict lookup, making sure the parameter exists, otherwise an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- block – A dict containing the configuration. If none, the whole data of this config object will be used.
- allow_invoke_provider – If set to True, then a provider is automatically invoked if the parameter value is a dict.
Returns: The value of the parameter.
-
_get_value_with_fallback
(name, fallback=<object object>, allow_invoke_provider=False)[source]¶ Returns the value of the given parameter with the given name.
If the parameter does not exist, the given fallback value is returned. If Config.no_fallback as fallback is given, an error is thrown in such a case.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value.
- allow_invoke_provider – If set to True, then a provider is automatically invoked if the parameter value is a dict.
Returns: The value of the parameter.
-
get_bool
(name, fallback=<object object>)[source]¶ Returns the boolean value stored at the given parameter path.
If the value is no boolean, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The boolean value.
-
get_float
(name, fallback=<object object>)[source]¶ Returns the float value stored at the given parameter path.
If the value is no float, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The float value.
-
get_int
(name, fallback=<object object>)[source]¶ Returns the integer value stored at the given parameter path.
If the value is no integer, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The integer value.
-
get_list
(name, fallback=<object object>)[source]¶ Returns the list stored at the given parameter path.
If the value is no list, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The list.
-
get_matrix
(name, fallback=<object object>, dimensions=None)[source]¶ Returns the matrix stored at the given parameter path.
If the value cannot be converted to mathutils matrix, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
- dimensions – If not None, specifies the required number of dimensions. If the configured matrix has not exactly this dimensional, an error is thrown.
Returns: The matrix.
-
get_matrix_2x2
(name, fallback=<object object>)[source]¶ Returns the 2x2 matrix stored at the given parameter path.
If the value cannot be converted to an mathutils matrix, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The matrix.
-
get_matrix_3x3
(name, fallback=<object object>)[source]¶ Returns the 3x3 matrix stored at the given parameter path.
If the value cannot be converted to an mathutils matrix, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The matrix.
-
get_matrix_4x4
(name, fallback=<object object>)[source]¶ Returns the 3x3 matrix stored at the given parameter path.
If the value cannot be converted to an mathutils matrix, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The matrix.
-
get_raw_dict
(name, fallback=<object object>)[source]¶ Returns the complete dict stored at the given parameter path.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The dict.
-
get_raw_value
(name, fallback=<object object>)[source]¶ Returns the raw value stored at the given parameter path. If a provider is specified at the given parameter path, then the provider is first invoked and the result is directly returned.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The raw value.
-
get_string
(name, fallback=<object object>)[source]¶ Returns the string value stored at the given parameter path.
If the value is no string, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The string value.
-
get_vector
(name, fallback=<object object>, dimensions=None)[source]¶ Returns the vector stored at the given parameter path.
If the value cannot be converted to mathutils.Vector, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
- dimensions – If not None, specifies the required number of dimensions. If the configured vector has not exactly this number of dimensions, an error is thrown.
Returns: The vector.
-
get_vector2d
(name, fallback=<object object>)[source]¶ Returns the vector stored at the given parameter path.
If the value cannot be converted to an mathutils.Vector, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The vector.
-
get_vector3d
(name, fallback=<object object>)[source]¶ Returns the vector stored at the given parameter path.
If the value cannot be converted to an mathutils.Vector, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The vector.
-
get_vector4d
(name, fallback=<object object>)[source]¶ Returns the vector stored at the given parameter path.
If the value cannot be converted to an mathutils.Vector, an error is thrown.
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations]
- fallback – The fallback value, returned if the parameter does not exist. If Config.no_fallback is given, an exception is thrown in such cases.
Returns: The vector.
-
has_param
(name, block=None)[source]¶ Check if parameter is defined in config
Parameters: - name – The name of the parameter. “/” can be used to represent nested parameters (e.q. “render/iterations” results in [“render”][“iterations”]
- block – A dict containing the configuration. If none, the whole data of this config object will be used.
Returns: True if parameter exists, False if not
-
is_empty
()[source]¶ Checks if the config contains no parameters.
Returns: True, if the config is empty
-
no_fallback
= <object object>¶
-