blendify.internal package

Submodules

blendify.internal.io module

class blendify.internal.io.catch_stdout(skip=False, logfile=None)[source]

Bases: object

Stdout hook to ignore or reroute the blender output

release_hook()[source]
set_hook()[source]

blendify.internal.parser module

blendify.internal.parser.move_collection(parent, collection)[source]
blendify.internal.parser.parse_camera_from_blendfile(obj: Object, resolution: ndarray)[source]

Parse camera parameters from blender object. :param obj: Blender object with camera data :type obj: bpy.types.Object :param resolution: array of [resolution_x, resolution_y] :type resolution: np.ndarray

Returns:

ORTHO, PRESP or NONE camera_dict (dict): dictionary with camera parameters

Return type:

camera_type (str)

blendify.internal.parser.parse_light_from_blendfile(obj: Object)[source]

blendify.internal.positionable module

class blendify.internal.positionable.Positionable(tag: str, blender_object: Collection | Object, rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] | None = None, translation: ndarray | Tuple[float, float, float] = (0, 0, 0))[source]

Bases: ABC

Base class for all classes that wrap Blender objects with location in space (Camera, Light, Renderable)

property quaternion
set_position(rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] | None = None, translation: ndarray | Tuple[float, float, float] | None = None)[source]

Sets the position of the object in the scene

Parameters:
  • rotation_mode (str) – type of rotation representation. Can be one of the following: - “quaternionWXYZ” - WXYZ quaternion - “quaternionXYZW” - XYZW quaternion - “rotvec” - axis-angle representation of rotation - “rotmat” - 3x3 rotation matrix - “euler<mode>” - Euler angles with the specified order of rotation, e.g. XYZ, xyz, ZXZ, etc. Refer to scipy.spatial.transform.Rotation.from_euler for details. - “look_at” - look at rotation, the rotation is defined by the point to look at and, optional, the rotation around the forward direction vector (a single float value in tuple or list)

  • rotation (RotationParams) – rotation parameters according to the rotation_mode - for “quaternionWXYZ” and “quaternionXYZW” - Vec4d - for “rotvec” - Vec3d - for “rotmat” - Mat3x3 - for “euler<mode>” - Vec3d - for “look_at” - Vec3d, Positionable or Tuple[Vec3d/Positionable, float], where float is the rotation around the forward direction vector in degrees

  • translation (Vector3d) – translation vector

property tag
property translation

blendify.internal.singleton module

class blendify.internal.singleton.Singleton[source]

Bases: type

An implementation of the singleton metaclass. This is a metaclass which allows only one instance of the class to exist. Useful to handle an object which should not be duplicated (such as Blender scene).

blendify.internal.texture module

MIT License

Copyright (c) 2018 Sebastian Bullinger Copyright (c) 2021 Vladimir Guzov and Ilya Petrov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

blendify.internal.texture.compute_particle_color_texture(colors, name='ParticleColor')[source]

blendify.internal.types module

Module contents