A read only wrappedGraph that can be used as a resource similar to a shader or an image.
GraphObject are managed through the graph objects explorer. They can be imported from all formats otherwise supported in GroIMP and the Graph structure in the background will be stored in the format of the importation. So if a qsm file was imported in the GraphObject explorer it is added as a qsm file to the project and read as a graph the first time its needed.
A GraphObject can be viewed in 2D and 3D by selecting it in the explorer and pressing view3d or view2d in the attribute editor. The changes done in the views will only last until the project is reloaded, since the graph structure is read only.
Each GraphObject added to the explorer can be referenced from RGG using the function graphobject(“<name>”). This function returns an GraphObjectRef object and can be used to interact with the loaded graph structure.
If a GraphObjectRef or a GraphObject is added to a RGG production it will automatically return an instance of the graph structure, similar to an instantiation rule.
This code fore example will display the entire tree.qsm file but adds only one node to the graph.
protected void init()[ Axiom ==> graphobject("tree.qsm"); ]
This works in any RGG production e.g. replacement- or instantiation-rules.
It is also possible to use the GraphObject as source for the graph structure, in this case the cloneGraph(); function is used.
For example this code will add all shoots from the tree.qsm as cylinders to the graph.
protected void init()[ Axiom ==> graphobject("tree.qsm").cloneGraph(); ]
The cloned objects are fully independent from the original GrpahObject.
It is possible to query the GraphObject or the GraphObjectRef in the same way as the project graph to retrieve information. This can be useful to compare or adjust the project to a imported structure. The Syntax for this queries is similar to the one on the main Graph. For example to count the number of shoots on GrpahObject called tree.qsm:
println(count(graphobject("tree.qsm").(*F*));
The query it self, the part in the (*…*) brackets is identical and only the graph that it is applied on is specified before hand.
It would also be possible to use this to assign values:
graphobject("tree.qsm").(*F*)[diameter] =2;
But once again this is read only so it will not be stored when the project is closed.