maxon.VolumeInterface¶
Description¶
maxon.VolumeInterface
represents a core volume object in cinema.
Methods Signature¶
|
Converts a vector-valued grid to world or local space depending on the bool input.
|
|
Creates a new volume from a .vdb file. |
Retrieve the active voxel count. |
|
Retrieve the active voxel dimensions. |
|
Retrieve the background value of the grid. |
|
Retrieve the grid class of this grid. |
|
Retrieve the grid name for this grid. |
|
Retrieve the grid transform for this grid. |
|
Retrieve the datatype of this grid. |
|
Returns the amount of memory in bytes used by this volume. |
|
|
Returns the Min and Max values of the volume.
|
Retrieve the bounding box of all active voxels of this grid. |
|
|
Retrieve if a grid is attached to this volume. |
Returns True if the voxel values are already in world space.
|
|
|
Loads a grid from .vdb file into this volume object. |
|
Merges two volumes of same Type and Class. |
|
Set the grid class for this grid. |
|
Set the grid name for this grid. |
|
Set the grid transform for this grid. |
|
Writes the attached grid to a .vdb file. |
Methods Definition¶
-
VolumeInterface.
ConvertToSpace
(worldSpace)¶ - Converts a vector-valued grid to world or local space depending on the bool input.World-space means that the actual values of the grid are in world space and do not need to be additionallytransformed when reading the data, but they need to be kept in sync with the grid’s transform.
Note
No matter the underlying space, the returned values from the GridAccessor and GridIterator will be in world space.
- Parameters
worldSpace (bool) – True to convert the vector grid values to world space, else local space.
-
static
VolumeInterface.
CreateFromFile
(url, scale, gridIndex)¶ Creates a new volume from a .vdb file.
- Parameters
url (
maxon.Url
) – The url of the file.scale (float) – The scale to load the volume with.
gridIndex (int) – The index of the grid in the file.
- Returns
The created volume.
- Return type
-
VolumeInterface.
GetActiveVoxelCount
()¶ Retrieve the active voxel count.
- Returns
The amount of active voxels in this volume.
- Return type
int
-
VolumeInterface.
GetActiveVoxelDim
()¶ Retrieve the active voxel dimensions.
- Returns
The active voxel dimensions of this volume.
- Return type
-
VolumeInterface.
GetBackground
()¶ Retrieve the background value of the grid.
- Returns
The background value of the grid.
- Return type
-
VolumeInterface.
GetGridClass
()¶ Retrieve the grid class of this grid.
- Returns
The GRIDCLASS of this volume.
- Return type
-
VolumeInterface.
GetGridName
()¶ Retrieve the grid name for this grid.
- Returns
The name of this volume.
- Return type
str
-
VolumeInterface.
GetGridTransform
()¶ Retrieve the grid transform for this grid.
- Returns
The transformation matrix of this volume.
- Return type
-
VolumeInterface.
GetGridType
()¶ Retrieve the datatype of this grid.
- Returns
The GRIDTYPE of this volume.
- Return type
-
VolumeInterface.
GetMemUsage
()¶ Returns the amount of memory in bytes used by this volume.
- Returns
The memory usage in bytes.
- Return type
int
-
VolumeInterface.
GetMinMaxValues
(includeBackground=False)¶ - Returns the Min and Max values of the volume.If it is the first time being called the resulting values are being cached.Only works for numerical gridtypes.If the volume is a vector volume, the magnitude of the vectors will be used.
- Parameters
includeBackground (bool) – If true the volume background will be part of the
maxon.Range
, otherwise not.- Returns
The Minimum and Maximum Value of this volume.
- Returns
maxon.Range
(maxon.Float
)
-
VolumeInterface.
GetWorldBoundingBox
()¶ Retrieve the bounding box of all active voxels of this grid.
- Returns
The bounding box of the active voxels of this volume.
- Return type
maxon.Range
(maxon.Vector
)
-
VolumeInterface.
HasGrid
()¶ Retrieve if a grid is attached to this volume.
- Returns
True if this volume holds a grid.
- Return type
bool
-
VolumeInterface.
IsInWorldSpace
()¶ - Returns True if the voxel values are already in world space.Return False if they are in local space (only relevant for vector grids).
- Return type
bool
-
VolumeInterface.
LoadFromFile
(url, scale, gridIndex)¶ Loads a grid from .vdb file into this volume object.
- Parameters
url (
maxon.Url
) – The url of the file.scale (float) – The scale to load the volume with.
gridIndex (int) – The index of the grid in the file.
-
VolumeInterface.
MergeVolume
(otherVolume, keepOldVolume=False)¶ Merges two volumes of same Type and Class.
- Parameters
otherVolume (
maxon.VolumeRef
) – The volume to merge into the current one.keepOldVolume (bool) – If False the otherVolume will be flushed/emptied.
-
VolumeInterface.
SetGridClass
(gridClass)¶ Set the grid class for this grid.
- Parameters
gridClass (
maxon.GRIDCLASS
) – The GRIDCLASS to set for this volume.
-
VolumeInterface.
SetGridName
(name)¶ Set the grid name for this grid.
- Parameters
name (str) – The name to set for this volume.
-
VolumeInterface.
SetGridTransform
(newTransform)¶ Set the grid transform for this grid.
- Parameters
newTransform (
maxon.Matrix
) – The transformation matrix to set for this volume.
-
VolumeInterface.
WriteToFile
(url, scale, metaData)¶ Writes the attached grid to a .vdb file.
- Parameters
url (
maxon.Url
) – The url of the file.scale (float) – The scale to write the volume with.
metaData (
maxon.DataDictionary
) –Optional meta data to write to the file.
These need to be stored with a string key in the data dictionary.
metaData –