End to End Example¶
Creating Assets¶
Repository Path¶
Creating assets requires a repository path to be set. This change lasts during the duration of the current application (or python process), so it is needed only once.
>>> import tempfile
>>> from pathlib import Path
>>> from grill import cook
>>> cook.Repository.set(Path(tempfile.mkdtemp()))
<Token var=<ContextVar name='Repository' at 0x00000213A46FF900> at 0x00000213C6A9F0C0>
>>> cook.Repository.get()
WindowsPath('C:/Users/CHRIST~1/AppData/Local/Temp/tmp767wqaya')
GUI: Repository Path
If not set, a dialog to set it will be prompted upon creation request on any relevant widget (e.g. Create Assets
, Taxonomy Editor
).
To set the repository path at any point, go to Grill -> Preferences -> Repository Path
:
Defining Taxonomy¶
For asset organization, The Grill
uses the concept of asset taxonomy. This is a hierarchy for organizing assets into groups (Taxa
) where members of each individual group (Taxon
) share characteristics (e.g. Characters
, Props
and Shots
are common organizational groups found on Film
and Animation
projects).
API: grill.cook.define_taxon()
Hint
For quick prototyping, grill.names.UsdAsset.get_anonymous()
can be used to get temporary but valid grill
identifiers.
>>> stage = cook.fetch_stage(cook.UsdAsset.get_anonymous())
>>> character = cook.define_taxon(stage, "Character")
>>> character
Usd.Prim(</Taxonomy/Character>)
>>> cook.define_taxon(stage, "SecondaryCharacter", references=(character,))
Usd.Prim(</Taxonomy/SecondaryCharacter>)
GUI: Taxonomy Editor
On the upper left, all existing taxa
in the current stage are listed. On the lower left, a graph with ancestors and successors of selected existing taxa
is displayed. On the right, details for new taxa
to be created. The following are optional:
References
provides a selection dialog for newtaxa
to inherit properties from existing ones. This helps compose and extend assettaxonomy
.ID Fields
are additional key=value asset field identifiers.
By default, the amount of new taxa
to be created is one, but any number can be created at the same time by changing the Amount
field at the top:
Creating Asset Units¶
An Asset Unit
is considered to be a meaningful, unique member for each taxon
. A taxon
can contain any number of individual units
.
>>> cook.create_unit(character, "Hero01", label="Hero 01 🦸")
Usd.Prim(</Character/Hero01>)
GUI: Create Assets
In the example below, 240 City
assets are created, copied from a CSV file and pasted directly on the Create Assets
table.
All created asset units are saved to disk on the current repository path.
Modifying Assets¶
Attention
Creation of assets on Houdini via the GUIs should be considered experimental at the moment.
Any USD
application should be able to modify the grill
assets.
In the example below, an asset defined on USDView (on the right) is opened and modified in Maya (on the left). Once Maya changes are saved, USDView can pickup the edits. In a similar way, asset taxonomy is modified in Maya, then USDView loads the updates.
Following the above, both a new taxon
and new asset units
are created, this time in Houdini:
Important
Note how same rules apply (e.g. the Repository
path must be set before any creation action).