blendersynth.blender.material
- class blendersynth.blender.material.Material(name='NewMaterial', shader_type='ShaderNodeBsdfPrincipled', mat=None)[source]
BlenderSynth Material class. Will always be a node material.
- add_source(image_loc, input_name='Base Color', use_global_scale=True, allow_duplicate=False)[source]
Add an image texture node to the material node tree, and connect it to the specified input of the Shader. :type image_loc:
str
:param image_loc: Image location :type input_name:str
:param input_name: Input socket name of the Shader to connect the image texture node to :type use_global_scale:bool
:param use_global_scale: Flag to scale the image texture node by the global scale :type allow_duplicate:bool
:param allow_duplicate: Flag to allow duplicate image texture nodes (by default, a node to the same input will overwrite any previous) :return:
- animate_path(frames=(0, 250), fracs=(0, 1))
Animate object along path.
- Parameters:
frames (
tuple
) – tuple of keyframes to animate at - length Nfracs (
tuple
) – tuple of fractions along path to animate at - length N
- property axes: ndarray
Return 3x3 rotation matrix (normalized) to represent axes
- follow_path(path, zero=True, animate=True, frames=(0, 250), fracs=(0, 1))
Follow path, with optional animation setting.
- Parameters:
path (
Curve
) – Curve objectzero (
bool
) – If True, set camera location to (0, 0, 0) [aligns camera with path]animate (
bool
) – If True, animate camera along pathframes (
tuple
) – tuple of keyframes to animate at - length Nfracs (
tuple
) – tuple of fractions along path to animate at - length N
- classmethod from_image(image_loc, name='ImageMaterials', shader_type='ShaderNodeBsdfPrincipled', use_global_scale=True)[source]
Create a new material from an image texture. :type image_loc: :param image_loc: Location of the image :type name: :param name: Name of the material :type shader_type: :param shader_type: Shader type :type use_global_scale: :param use_global_scale: Flag to scale the image texture node by the global scale :rtype:
Material
:return: New Material instance
- property location: mathutils.Vector
Location of object
- property matrix_world
Return world matrix of object(s).
- path_keyframe(frame, offset)
Set keyframe for camera path offset
- Parameters:
frame (
int
) – Frame numberoffset (
float
) – Offset fraction (0-1)
- remove()
Delete .obj from bpy.data if it exists
- render_visibility(value, frame=None)
Show/hide object in render
- Parameters:
value (
bool
) – True to show, False to hideframe (
int
) – Optional frame for animating
- rotate_by(rotation)
Add a rotation to the object. Must be in XYZ order, euler angles, radians.
- property rotation_euler: mathutils.Euler
Rotation in euler XYZ angles
- scale_by(scale)
Scale object
- set_dimensions(dimensions, frame=None)
Set dimensions of object.
- Parameters:
dimensions (
VectorLikeOrScalar
) – Dimensions to set. Either single value or 3 long vectorframe (
int
) – Optional frame for animating
- set_location(location, frame=None)
Set location of object.
- Parameters:
location (
VectorLike
) – Location vector to setframe (
int
) – Optional frame for animating
- set_rotation_euler(rotation, frame=None)
Set euler rotation of object.
- Parameters:
rotation (
VectorLike
) – Rotation vectorframe (
int
) – Optional frame for animating
- set_scale(scale, frame=None)
Set scale of object.
- Parameters:
scale (
VectorLikeOrScalar
) – Scale to set. Either single value or 3 long vectorframe (
int
) – Optional frame for animating
- track_to(obj)
Track to object.
- Parameters:
obj (
Union
[BsynObject
,Object
]) – BsynObject or Blender Object to track to
- translate(translation)
Translate object
- untrack()
Remove track to constraint from object
- viewport_visibility(value, frame=None)
Show/hide object in viewport
- Parameters:
value (
bool
) – True to show, False to hideframe (
int
) – Optional frame for animating