vray.GeomUtils¶
- class vray.GeomUtils¶
Bases:
objectA group of utility methods related to variuos geometry source plugins. Below is a description of the mapping types used.
ScatterReadParams: A mapping type with the necessary parameters for reading the data in a preset config file (.mbc)Keys:
* fileName - Obligatory (string) Scatter preset config file (.mbc) * scatterPlugin - Obligatory (Plugin) A GeomScatter plugin instance to be filled by the Scatter preset config * unitRescale - Optional (float) Rescale to specific callers units setup, e.g. the default Cosmos asset units are centimeters, but the scatter presets data might be in meters * isYAxisUp - Optional (bool) If true - process as if Y is up axis and otherwise default to Z
Methods
__init__()readGaussianData(self,gaussian)Reads the data contained in the property GeomGaussians.file of the given plugin or in the given file.
readGeomHairData(self, nodePlugin, countHint)Returns hair data which could be used to create a preview of the generated GeomHair.
readScatterData(self, scatterPlugin)Returns the generated scatter transforms and source topology data, corresponding to the plugin parameter config.
readScatterPreset(self, params, …)Fills the parameters in the given scatterPlugin with the data provided from the preset config file (.mbc)
- static readGaussianData(self, gaussian: Plugin | str) tuple[tuple[Vector, Vector], VectorList, ColorList]¶
Reads the data contained in the property GeomGaussians.file of the given plugin or in the given file.
- Arguments:
gaussian - A
GeomGaussiansplugin instance or a Gaussian file name (.ply)
- Returns a tuple (bbox, positions, colors) or None on failure:
bbox (Tuple) - The preview bounding box of the model, calculated using the Gaussian primitive positions only
positions (VectorList) - Full array of positions of the Gaussian primitives
colors (ColorList) - Full array of average colors of the Gaussian primitives
- static readGeomHairData(self, nodePlugin: Plugin, countHint: int | None = None) tuple[VectorList, IntList]¶
Returns hair data which could be used to create a preview of the generated GeomHair.
- Arguments:
nodePlugin - Obligatory. A
Nodeplugin instance containingGeomHairas a geometry source plugin.countHint - Optional. (int) The number of hair strands to get. If countHint is not specified, all generated data is returned.
- Returns a tuple (vertices, lengths) or None on failure:
vertices, VectorList - Output vertex preview data. Consecutive vertices form hair strands. The i-th strand has lengths[i] consecutive vertices.
lengths, IntList - Output hair strand length data. Each strand can have a different number of vertices.
- static readScatterData(self, scatterPlugin: Plugin) tuple[TransformList, IntList]¶
Returns the generated scatter transforms and source topology data, corresponding to the plugin parameter config.
- Arguments:
scatterPlugin - A
GeomScatterplugin instance (the scatter data generation is triggered depending on the plugin parameter config)
- Returns a tuple (transforms, topo) or None on failure:
transforms, TransformList - Full output transforms data
topo, IntList - Full output source topology data. The indices are corresponding to the sources list in GeomScatter::models
- static readScatterPreset(self, params: dict, userCallback: Callable[[Renderer, str, Vector], Plugin] | None = None) bool¶
- Fills the parameters in the given scatterPlugin with the data provided from the preset config file (.mbc)
The user callback could be used to import Cosmos assets and other relevant plugins to the scene.
- Arguments:
params - Obligatory - a mapping type object containing the necessary parameters for reading the data in a preset config file (.mbc). See the GeomUtils doc
ScatterReadParamsfor keys description.userCallback - Optional - function(VRayRenderer, string, Vector) -> Plugin Arguments: - renderer (VRayRenderer) - The renderer which produced the event - assetId (string) - Cosmos assetId to be imported(string) - importPosition (Vector) - the position where the asset should be imported to the scene A function to be called during reading the preset config, responsible for creating the plugins corresponding to the imported asset The callback should return the the newly added model(plugin to be scattered) corresponding to the assetId
Returns false if an error ocurred.