Code Monkey home page Code Monkey logo

scenegraph's Introduction

SceneGraph

Alt text

SceneGraph is a fast & flexible framework for visualizing node graphs in visual effects CC applications using PySide. Scenes can be saved and loaded in a variety of environments, and users can easily extend the toolset to include their own node types.

Requirements

Installation

Clone the repository and ensure that the directory is included on your PYTHONPATH:

git clone [email protected]:mfessenden/SceneGraph.git

For Linux/macOS, symlink the launcher bin/SceneGraph somewhere on your PATH. For Windows, symlink bin/SceneGraph.bat.

Usage

To launch the UI via the command line (Linux/macOS), simply call:

$ SceneGraph

(For Windows, double-click the SceneGraph.bat shortcut).

SceneGraph API

from SceneGraph import scenegraph

# show the UI
sgui = scenegraph.SceneGraphUI()
sgui.show()

# access the node graph instance
graph = sgui.graph

# list all node names
node_names = graph.node_names()

# query all of the node widgets from the `GraphicsScene`
scene = sgui.view.scene()
nodes = scene.nodes()

# query all of the current DAG nodes
dags = graph.nodes()

# return a named DAG node
dagnode = graph.get_node('node1')

# query node attributes
dagnode.getNodeAttributes()

# set arbitrary attributes
dagnode.setNodeAttributes(env='maya', version='2014')

# querying widgets

# get an output connection widget
c_output=n1.get_connection('output')

# query an edge
e1=scene.get_edge('node1.output', 'node2.input')[0]

# get edge source item (Connection)
e1.source_item

# get connected nodes from an edge
e1.listConnections()

Maya Usage

from SceneGraph import scenegraph_maya
scenegraph_maya.main()

Nuke Usage

from SceneGraph import scenegraph_nuke
scenegraph_nuke.main()

API

# create a graph
from SceneGraph import core
g = core.Graph()

# query the currently loaded node types
node_types = g.node_types()

# add some default nodes
n1 = g.add_node('default', name='node1')
n2 = g.add_node('default', name='node2')

# query node connections
if n1.is_input_connection:
    conn = n1.output_connections()

# add a new input and output attribute
n1.add_input(name='fileIn')

# connect the nodes (default output/inputs assumed)
e1 = g.add_edge(n1, n2)

# connect two nodes via a connection string
e1 = g.connect('node1.output', 'node2.input')

# write the current graph to disk
g.write('~/graphs/my_graph.json')

# dump all nodes in the graph
print g.nodes()

# dump all node names
print g.node_names()

# dump all connections
print g.connections()

# updating attributes
d1 = g.add_node('default')
m1 = g.add_node('merge')

# connect two nodes via a named attribute
g.add_edge(d1, m1, dest_attr='inputA')

# change the input name
m1.rename_connection('inputA', 'newInput')

# add attributes to a dag node & flag it as an input connection
attr = n1.addAttr('env', value='maya', input=True)

# set an attribute value via the node
n1.env = 'nuke'

# set an attribute value via the attribute instance
attr.value = 'houdini'

scenegraph's People

Contributors

mfessenden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.