bpy_extras submodule (bpy_extras.io_utils)
- bpy_extras.io_utils.orientation_helper(axis_forward='Y', axis_up='Z')
A decorator for import/export classes, generating properties needed by the axis conversion system and IO helpers, with specified default values (axes).
- bpy_extras.io_utils.axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z')
Each argument us an axis in [‘X’, ‘Y’, ‘Z’, ‘-X’, ‘-Y’, ‘-Z’] where the first 2 are a source and the second 2 are the target.
- bpy_extras.io_utils.axis_conversion_ensure(operator, forward_attr, up_attr)
Function to ensure an operator has valid axis conversion settings, intended to be used from
bpy.types.Operator.check
.- Parameters
operator (
bpy.types.Operator
) – the operator to access axis attributes from.forward_attr (string) – attribute storing the forward axis
up_attr (string) – attribute storing the up axis
- Returns
True if the value was modified.
- Return type
boolean
- bpy_extras.io_utils.create_derived_objects(depsgraph, objects)
This function takes a sequence of objects, returning their instances.
- Parameters
depsgraph (
bpy.types.Depsgraph
) – The evaluated depsgraph.objects (sequence of
bpy.types.Object
) – A sequencer of objects.
- Returns
A dictionary where each key is an object from objects, values are lists of (
bpy.types.Object
,mathutils.Matrix
) tuples representing instances.- Return type
dict
- bpy_extras.io_utils.unpack_list(list_of_tuples)
- bpy_extras.io_utils.unpack_face_list(list_of_tuples)
- bpy_extras.io_utils.path_reference(filepath, base_src, base_dst, mode='AUTO', copy_subdir='', copy_set=None, library=None)
Return a filepath relative to a destination directory, for use with exporters.
- Parameters
filepath (string) – the file path to return, supporting blenders relative ‘//’ prefix.
base_src (string) – the directory the filepath is relative too (normally the blend file).
base_dst (string) – the directory the filepath will be referenced from (normally the export path).
mode (string) – the method used get the path in [‘AUTO’, ‘ABSOLUTE’, ‘RELATIVE’, ‘MATCH’, ‘STRIP’, ‘COPY’]
copy_subdir (string) – the subdirectory of base_dst to use when mode=’COPY’.
copy_set (set) – collect from/to pairs when mode=’COPY’, pass to path_reference_copy when exporting is done.
library (
bpy.types.Library
or None) – The library this path is relative to.
- Returns
the new filepath.
- Return type
string
- bpy_extras.io_utils.path_reference_copy(copy_set, report=<built-in function print>)
Execute copying files of path_reference
- Parameters
copy_set (set) – set of (from, to) pairs to copy.
report (function) – function used for reporting warnings, takes a string argument.
- bpy_extras.io_utils.unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep='.')
Helper function for storing unique names which may have special characters stripped and restricted to a maximum length.
- Parameters
key (any hashable object associated with the name.) – unique item this name belongs to, name_dict[key] will be reused when available. This can be the object, mesh, material, etc instance itself.
name (string) – The name used to create a unique value in name_dict.
name_dict (dict) – This is used to cache namespace to ensure no collisions occur, this should be an empty dict initially and only modified by this function.
clean_func (function) – Function to call on name before creating a unique value.
sep (string) – Separator to use when between the name and a number when a duplicate name is found.