Add geometry to the sceneΒΆ
Create a reference on a geometry archive
Use the Modifier.createref function to create a reference on any supported geometry format:
-- Start the modification
local mod = Document:modify ()
-- Create a reference on the samples teapot
mod.createref ("teapot", "$(SAMPLES)/teapot/teapot.abc")
mod.finish ()
Create a reference on a Guerilla export or scene
Also use the Modifier.createref function to create a reference on a Guerilla project or a scene export using the Maya to Guerilla plugin:
-- Start the modification
local mod = Document:modify ()
-- Create a reference on the samples teapot
mod.createref ("Geo", "$(SAMPLES)/SSS.ghostproject")
mod.finish ()
Options
The default behaviour of the createref function is to mimic the Maya references way of loading (that is using a prefix and loading the content of the reference at the root of the scene.) There are various options to control how References and ArchReferences are loaded:
prefixnodes
When enabled (default), the referenced nodes are prefixed with the reference name. When disabled, the referenced nodes are not prefixed. In this case there may be name clashes between existing nodes and referenced nodes.
containschildren
When enabled, the referenced nodes are loaded inside the Reference node as children. When disabled (default), the referenced nodes are loaded along the Reference node as sibblings.
Loading a Reference within a parent node
Use mod.createref (refname,filename,parent)
where
parent is a node, instead of nil, to load the Reference and
its content inside the parent node.
Examples
mod.createref ("REF","$(SAMPLES)/Alembic Workflow/teapot/teapot.abc",nil,{prefixnodes=true,containschildren=false})
produces:
- REF
- REF:geom
- REF:geomShape
mod.createref ("REF","$(SAMPLES)/Alembic Workflow/teapot/teapot.abc",nil,{prefixnodes=false,containschildren=true})
produces:
- REF
- geom
- geomShape