artellapipe.utils.alembic module¶
Module that contains utilities functions to work with Alembics
-
artellapipe.utils.alembic.export_alembic(alembic_file, euler_filter=False, no_normals=False, pre_roll=False, renderable_only=False, selection=False, uv_write=False, write_color_sets=False, write_face_sets=False, whole_frame_geo=False, world_space=False, write_visibility=False, write_uv_sets=False, write_creases=False, data_format='Ogawa', step=1.0, mel_per_frame_callback='', mel_post_job_callback='', python_per_frame_callback='', python_post_job_callback='', user_attr=None, user_attr_prefix=None, attr=None, attr_prefix=None, root=None, frame_relative_sample=None, frame_range=None, strip_namespaces=-1, dont_skip_unwritten_frames=False, verbose=False, pre_roll_start_frame=0)¶ Exports Alembic file with given attributes
- Parameters
alembic_file (str) – File location to write the Alembic data.
euler_filter (bool, optional) – Apply Euler filter while sampling rotations. Defaults to False.
no_normals (bool, optional) – Present normal data for Alembic poly meshes will not be written. Defaults to False.
pre_roll (bool, optional) – his frame range will not be sampled. Defaults to False.
renderable_only (bool, optional) – Non-renderable hierarchy (invisible, or template) will not be written out. Defaults to False.
selection (bool, optional) – Write out all all selected nodes from the active selection list that are descendents of the roots specified with -root. Defaults to False.
uv_write – Uv data for PolyMesh and SubD shapes will be written to the Alembic file. Only the current uv map is used. Defaults to False.
write_color_sets (bool, optional) – Write all color sets on MFnMeshes as color 3 or color 4 indexed geometry parameters with face varying scope. Defaults to False.
write_face_sets (bool, optional) – Write all Face sets on MFnMeshes. Defaults to False.
whole_frame_geo (bool, optional) – Data for geometry will only be written out on whole frames. Defaults to False.
world_space (bool, optional) – Any root nodes will be stored in world space. Defaults to False.
write_visibility (bool, optional) – Visibility state will be stored in the Alembic file. Otherwise everything written out is treated as visible. Defaults to False.
write_uv_sets (bool, optional) – Write all uv sets on MFnMeshes as vector 2 indexed geometry parameters with face varying scope. Defaults to False.
write_creases (str, optional) – If the mesh has crease edges or crease vertices, the mesh (OPolyMesh) would now be written out as an OSubD and crease info will be stored in the Alembic file. Otherwise, creases info won’t be preserved in Alembic file unless a custom Boolean attribute SubDivisionMesh has been added to mesh node and its value is true. Defaults to False.
data_format – The data format to use to write the file. Can be either “HDF” or “Ogawa”. Defaults to “Ogawa”.
step (float, optional) – The time interval (expressed in frames) at which the frame range is sampled. Additional samples around each frame can be specified with -frs. Defaults to 1.0.
mel_per_frame_callback (str, optional) – When each frame (and the static frame) is evaluated the string specified is evaluated as a Mel command. See below for special processing rules. Defaults to “”.
mel_post_job_callback (str, optional) – When the translation has finished the string specified is evaluated as a Mel command. See below for special processing rules. Defaults to “”.
python_per_frame_callback (str, optional) – When each frame (and the static frame) is evaluated the string specified is evaluated as a python command. See below for special processing rules. Defaults to “”.
python_post_job_callback (str, optional) – When the translation has finished the string specified is evaluated as a python command. See below for special processing rules. Defaults to “”.
user_attr (list(str), optional) – Specific user attributes to write out. Defaults to [].
user_attr_prefix (list(str), optional) – Prefix filter for determining which user attributes to write out. Defaults to [].
attr (list(str), optional) – A specific geometric attribute to write out. Defaults to [].
attr_prefix (str, optional) – Prefix filter for determining which geometric attributes to write out. Defaults to [“ABC_”].
root (list(str), optional) – Maya dag path which will be parented to the root of the Alembic file. Defaults to [], which means the entire scene will be written out.
frame_relative_sample (list(float), optional) – Frame relative sample that will be written out along the frame range. Defaults to [].
frame_range (list(list(float, float), optional) – The frame range to write. Each list of two floats defines a new frame range. step or frameRelativeSample will affect the current frame range only.
strip_namespaces (int, optional) – Namespaces will be stripped off of the node before being written to Alembic. The int specifies how many namespaces will be stripped off of the node name. Be careful that the new stripped name does not collide with other sibling node names. Defaults to -1, which means namespaces will be preserved.
Tip
taco:foo:bar would be written as just bar with stripNamespaces=0
taco:foo:bar would be written as foo:bar with stripNamespaces=1
- Parameters
optional dont_skip_unwritten_frames (bool,) – When evaluating multiple translate jobs, this decides whether to evaluate frames between jobs when there is a gap in their frame ranges. Defaults to False.
optional verbose (bool,) – Prints the current frame that is being evaluated. Defaults to False.
optional pre_roll_start_frame (float,) – The frame to start scene evaluation at. This is used to set the starting frame for time dependent translations and can be used to evaluate run-up that isn’t actually translated. Defaults to 0.
- Returns
Whether the Alembic operation was successful or not
- Return type
bool
Note
Special callback information: On the callbacks, special tokens are replaced with other data, these tokens and what they are replaced with are as follows: #FRAME# replaced with the frame number being evaluated. #FRAME# is ignored in the post callbacks. #BOUNDS# replaced with a string holding bounding box values in minX minY minZ maxX maxY maxZ space separated order. #BOUNDSARRAY# replaced with the bounding box values as above, but in array form. In Mel: {minX, minY, minZ, maxX, maxY, maxZ} In Python: [minX, minY, minZ, maxX, maxY, maxZ]
-
artellapipe.utils.alembic.import_alembic(project, alembic_file, mode='import', nodes=None, parent=None, fix_path=False)¶ Imports Alembic into current DCC scene
- Parameters
project (ArtellaProject) – Project this Alembic will belong to
alembic_file (str) – file we want to load
mode (str) – mode we want to use to import the Alembic File
nodes (list(str)) – optional list of nodes to import
parent –
fix_path – bool, whether to fix path or not
- Returns
-
artellapipe.utils.alembic.load_alembic_plugin()¶ Forces the loading of the Alembic plugin if it is not already loaded
-
artellapipe.utils.alembic.reference_alembic(project, alembic_file, namespace=None, fix_path=False)¶ References given alembic file in current DCC scene
- Parameters
project (artellapipe.core.ArtellaProject) – Project this Alembic belongs to
alembic_file (str) –
optional namespace (str,) –
optional fix_path (bool,) –
- Returns