:py:mod:`synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions` ================================================================================ .. py:module:: synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions .. autoapi-nested-parse:: Module for RelaxCollisions synth chain step. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions.RelaxCollisions Functions ~~~~~~~~~ .. autoapisummary:: synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions._convert_to_mesh_recursively synthpic2.recipe.synth_chain.feature_generation_steps.relax_collisions._apply_transforms_recursively .. py:function:: _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. .. py:class:: RelaxCollisions Bases: :py:obj:`synthpic2.recipe.synth_chain.feature_generation_steps.set_based_mixin.SetBasedMixin`, :py:obj:`synthpic2.recipe.synth_chain.feature_generation_steps.base.FeatureGenerationStep` SynthChainStep to relax collisions between objects of a set, using Blenders bullet physics engine. .. py:attribute:: damping :type: Optional[float] .. py:attribute:: angular_damping :type: Optional[float] .. py:attribute:: linear_damping :type: Optional[float] .. py:attribute:: friction :type: float :value: 1 .. py:attribute:: restitution :type: float :value: 1 .. py:attribute:: mass :type: float :value: 1.0 .. py:attribute:: collision_shape :type: str :value: 'MESH' .. py:attribute:: mesh_source :type: str :value: 'FINAL' .. py:attribute:: num_frames :type: int :value: 100 .. py:attribute:: use_gravity :type: bool :value: False .. py:attribute:: gravity :type: Tuple[float, float, float] :value: (0, 0) .. py:attribute:: collision_margin :type: float :value: 1e-06 .. py:attribute:: time_scale :type: float :value: 1.0 .. py:attribute:: substeps_per_frame :type: int :value: 10 .. py:attribute:: solver_iterations :type: int :value: 10 .. py:attribute:: dry_run :type: bool :value: False .. py:method:: __call__(runtime_state: synthpic2.recipe.synth_chain.state.RuntimeState) -> synthpic2.recipe.synth_chain.state.RuntimeState NotImplemented .. py:function:: _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.