synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions

Module for RelaxCollisions synth chain step.

Module Contents

Classes

RelaxCollisions

SynthChainStep to relax collisions between objects of a set, using Blenders

Functions

_convert_to_mesh_recursively(→ None)

Recursively iterate through a tree of blender objects, and starting from

_apply_transforms_recursively(→ None)

Recursively apply a transform to a Blender object and all its children.

synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions._convert_to_mesh_recursively(blender_object: bpy.types.Object) None

Recursively iterate through a tree of blender objects, and starting from the leaves and working up to the root, convert the objects to meshes. Unfortunately, this breaks parent/child relations, so we have an option to restore them _and_ it also breaks the references to blender objects, so we set the context object to the ultimate parent.

Args:
blender_object (bpy.types.Object): Blender object (potentially with children) to

convert to mesh.

class synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions.RelaxCollisions

Bases: synthpic2.recipe.synth_chain.feature_generation_steps.set_based_mixin.SetBasedMixin, synthpic2.recipe.synth_chain.feature_generation_steps.base.FeatureGenerationStep

SynthChainStep to relax collisions between objects of a set, using Blenders bullet physics engine.

damping: float | None
angular_damping: float | None
linear_damping: float | None
friction: float = 1
restitution: float = 1
mass: float = 1.0
collision_shape: str = 'MESH'
mesh_source: str = 'FINAL'
num_frames: int = 100
use_gravity: bool = False
gravity: Tuple[float, float, float] = (0, 0)
collision_margin: float = 1e-06
time_scale: float = 1.0
substeps_per_frame: int = 10
solver_iterations: int = 10
dry_run: bool = False
__call__(runtime_state: synthpic2.recipe.synth_chain.state.RuntimeState) synthpic2.recipe.synth_chain.state.RuntimeState

NotImplemented

synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions._apply_transforms_recursively(blender_object: bpy.types.Object, transforms: dict[str, mathutils.Matrix]) None

Recursively apply a transform to a Blender object and all its children.

Args:

blender_object (bpy.types.Object): Blender object to apply the transform to. transform (np.ndarray): Transform to apply.