Welcome on the getLogicalUpstreamNodes
(glun) module documentation.
You just need to quickly list nodes in the ScriptEditor :
- just add
__test()
at the end. - Select source node.
- Run in the script editor
- Check result in script editor console.
You can optionaly modify __test()
to filter even more the result.
The file getLogicalUpstreamNodes.py can be used as it is as a python module for any of your projects.
In that case you can delete the __test() function
Basic process is :
- Build your parsing settings using
ParseSettings()
special dict. - Instance
SceneParser()
- Set the instance's settings
- run
yourInstance.get_upstream_nodes(...)
to get the results
Check the __test()
function and the bottom API documentation for more details.
Used to configure the output result of the scene parsing.
A regular dictionary object with a fixed structure. Structure is verified
through validate()
method.
You can set the keys using the regular dict["keyName"]
syntax or use the
properties mentioned under.
The class support all the regular methods supported by dict
.
When creating a new instance of the class, you can leave it empty and build the key one by one, or pass a dictionnary which have already ALL the keys.
Exemple :
setting_dict = {
"include_groups": True,
"excluded": {
"asGroupsNodeType": ["GafferThree", "Importomatic"]
},
"logical": True
}
settings = ParseSettings(setting_dict)
dict: see under for the keys
List of node type to exclude from being considered as Group
. This mean it's
content will not be visited.
This can be the case for a GafferThree
which is a subclass of a Group node, but
you might not want to visit all the nodes inside. So for this you can pass
["GafferThree"]
list of str: str are node types. (Node.getType())
If the node visited is a Group (or a subclass) and this is set to True
, it's
added to the output.
This just cover the case where you might want to visit a Group's content, but
you don't care about the group itself.
bool
If True
, only node that contribute to building the scene are visited. For
example, a switch node will only yield one input that contribute to build the
scene.
bool
Set the ParseSettings["excluded"]["asGroupsNodeType"]
key.
Verify the structure of self and raise an AssertionError if a key is not build properly/missing.
Raises:
AssertionError: if self is not built properly.
The class with the method you want. (to do what the script is supposed to do)
At some point you will need to specify the starting point for the parsing. (source
)
You have 3 way to do it as detailed below.
Args:
source(None or NodegraphAPI.Node or NodegraphAPI.Port):
Set the nodegraph object used as a start point for parsing.
Dictionary of options for the scene parsing
ParseSettings
Set the nodegraph object used as a start point for parsing.
Can also be set in ParseSettings.get_upstream_nodes
source
argument
None or NodegraphAPI.Node or NodegraphAPI.Port
Return a list of node upstream of the given nodegraph object using the pre-configured settings.
Make sure the settings attributes is set accordingly before calling.
Args:
source(None or NodegraphAPI.Node or NodegraphAPI.Port):
source nodegraph object from where to start the upstream parsing
You also can use SceneParser.source to set it. (and pass None here)
Returns:
list of NodegraphAPI.Node:
Order of visit is respected but being a 1D list
this might not be the order you except.