Export

This example covers how to export and import some elements in Guerilla.

Exporting a RenderGraph (or a RenderPass, a Light…)

import os
from guerilla import pynode
rg = pynode('RenderGraph')
rgfilename = os.path.join(os.path.expanduser('~'), 'test.grendergraph')
rg.savefile(rgfilename)
print 'Saving render graph to %s' % rgfilename

Note

For a render pass, use a ‘.glayer’ extension. For a light, use ‘.glight’

Importing a RenderGraph

from guerilla import Document, pynode
d = Document()
rgfilename = os.path.join(os.path.expanduser('~'), 'test.grendergraph')
loaded = d.loadfile(rgfilename)
if loaded:
    rg = loaded[0]
    print 'new render graph node: %s' % loaded[0].name
else:
    print 'Unable to load %s' % rgfilename

Note

loadfile can be called from a SceneGraphNode (or a Node) too.

Going further

  • Try the next example in Examples
  • Explore the API documentation