bpy_extras submodule (bpy_extras.io_utils)

bpy_extras.io_utils.orientation_helper_factory(name, axis_forward='Y', axis_up='Z')
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(scene, ob)
bpy_extras.io_utils.free_derived_objects(ob)
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 its self.
  • 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.
bpy_extras.io_utils.path_reference_mode

constant value (<built-in function EnumProperty>, {‘attr’: ‘path_mode’, ‘name’: ‘Path Mode’, ‘default’: ‘AUTO’, ‘items’: ((‘AUTO’, ‘Auto’, ‘Use Relative paths with subdirectories only’), (‘ABSOLUTE’, ‘Absolute’, ‘Always write absolute paths’), (‘RELATIVE’, ‘Relative’, ‘Always write relative paths (where possible)’), (‘MATCH’, ‘Match’, ‘Match Absolute/Relative setting with input path’), (‘STRIP’, ‘Strip Path’, ‘Filename only’), (‘COPY’, ‘Copy’, ‘Copy the file to the destination path (or subdirectory)’)), ‘description’: ‘Method used to reference paths’})

class bpy_extras.io_utils.ExportHelper
check(context)
invoke(context, event)
class bpy_extras.io_utils.ImportHelper
check(context)
invoke(context, event)