ddg.visualization.blender.props module
- ddg.visualization.blender.props.add_props_with_callback_from_constructors(callback: Callable[[...], Any], positional_labels_constructors: dict[str, Callable[..., Any]], keyword_labels_constructors: dict[str, Callable[..., Any]]) None[source]
A more advanced version of
add_props_with_callback().Unlike
add_props_with_callback(), this function doesn’t infer what kind of Blender property to add. Instead, property constructors must be explicitly specified, which allows for control over the minimum and maximum value, step sizes and other property types.- Parameters:
- callbackCallable
This function is called whenever the properties’ value change.
- positional_labels_constructorsdict[str, Callable[…, Any]]
The keys are the labels of the properties. The values are Blender property constructors whose values will be passed to
callbackas positional arguments.- keyword_labels_constructorsdict[str, Callable[…, Any]]
The keys are the labels of the properties. The values are Blender property constructors whose values will be passed to
callbackas keyword arguments.
- Returns:
- None
- Raises:
- ValueError
If the labels aren’t unique.
See also
Examples
See Finer control over properties in the user’s guide.
- ddg.visualization.blender.props.add_props_with_callback(callback: Callable[[...], Any], arg_labels: Sequence[str], *default_args: Any, **default_kwargs: Any) None[source]
Add Blender properties with a callback.
- Parameters:
- callbackCallable
This function is called whenever the properties’ value change.
- arg_labelsSequence[str]
Labels for the properties. The number of labels must equal the number of positional arguments of callback.
- *default_args
Default positional arguments for callback
- *default_kwargs
Default keyword arguments for callback
- Returns:
- None
- Raises:
- ValueError
If the length of
arg_labelsisn’t equal to the number of positional arguments ofcallback.
Examples
See Interactive plotting and Blender properties in the user’s guide.
- ddg.visualization.blender.props.overwrite_callback(collection_name: str, blender_objects: Callable[[P], Sequence[Any]]) Callable[[P], None][source]
Overwrite existing objects.
The returned function will either - link new Blender objects if the collection doesn’t exist or is empty and otherwise - overwrite the
dataof existing Blender objects in the collection- Parameters:
- collectionstr
Name of a Blender collection
- blender_objectsCallable
Returns a sequence of unlinked Blender objects
- Returns:
- Callable
- ddg.visualization.blender.props.hide_callback(collection_name: str, blender_objects: Callable[[P], Sequence[Any]]) Callable[[P], None][source]
Hide old objects before displaying new objects.
The returned function hides every object in the collection and then displays objects computed by
blender_objects. It creates subcollections for each tuple of properties/parameters.It is possible to delete the parent collection or any number of subcollections; they are recreated when necessary.
- Parameters:
- collectionstr
Name of a Blender collection
- blender_objectsCallable
Returns a sequence of unlinked Blender objects
- Returns:
- Callable
- ddg.visualization.blender.props.clear_callback(collection_name: str, blender_objects: Callable[[P], Sequence[Any]]) Callable[[P], None][source]
Clear collection before linking new objects.
The returned function unlinks every object in the collection and then links new objects computed by
blender_objects.- Parameters:
- collectionstr
Name of a Blender collection
- blender_objectsCallable
Returns a sequence of unlinked Blender objects
- Returns:
- Callable
- ddg.visualization.blender.props.add_panel(prop_names: Sequence[str], text: str = '', panel_label: str = 'DDG Panel', idname: str = 'VIEW3D_PT_DDG', category: str = 'DDG')[source]
Create a Blender panel in the 3DViewport containing the properties.
- Parameters:
- prop_names: Sequence of strings, the properties’ names to be added to the panel.
- text: String to be added at the beginning of the panel.
- panel_label: String used as the visible title of the panel.
- idname: String used internally to identify the panel. Must begin with ‘VIEW3D_PT_’.
- category: String used as the name of the tab.
- ddg.visualization.blender.props.update_func(callback: Callable[[...], Any], arg_names: Sequence[str], kwarg_names: Sequence[str]) Callable[[Any, Any], None][source]
Turn a function into a property update function.
- Parameters:
- callbackCallable which will be called when the properties value change
- arg_namesSequence[str]
The names of the properties corresponding to positional arguments of callback
- arg_namesSequence[str]
The names of the properties corresponding to keyword arguments of callback
- Returns:
- updateCallable
A function to be used in e.g. bpy.props.IntProperty(update=update)