Console Bits: nodes in Action

Nodes in action:

update: 2019/02/17

A few bits of code related to nodes in action:
– Lists of available nodes in action
– Create (add) a new action node (my_action)
– Add (create) new nodes in my_action
– Lists nodes found in my_action and list their attributes

You’ll have to replace the Flame version in:
my_action.import_fbx(“/opt/Autodesk/presets/2019.2/models/FBX/Hypershade_Teapot.fbx”, cameras = False, lights = False)
… where 2019.2 is the version

import flame

# #############################
# CREATE A NEW ACTION
my_action1 = flame.batch.create_node("Action")
my_action1.name = "MY_ACTION1"
my_action1.pos_x = -500
my_action1.pos_y = -200

# ALL AVAILABLE NODES in action
print "Available action node types: "
print ''

for n in my_action1.node_types:
    print n

# #############################
# CREATE A NEW ACTION
my_action2 = flame.batch.create_node("Action")
my_action2.name = "MY_ACTION2"
my_action2.pos_x = -500
my_action2.pos_y = 0

# CREATE SOME NODES (a bunch of different ones)
myCamera = my_action2.create_node("Camera 3D")
myLight = my_action2.create_node("Light")
myShadow = my_action2.create_node("Shadow Cast")
myGeom = my_action2.import_fbx("/opt/Autodesk/presets/2019.2/models/FBX/Hypershade_Teapot.fbx", cameras = False, lights = False)
myShader = my_action2.create_node("Shader")
myIBL = my_action2.create_node("IBL")
myMatchbox = my_action2.create_node("Matchbox")

# PRINTS NODE'S ATTRIBUTES (nodes found in my_action)
print " "
print "-"*30
for node in my_action2.nodes:
    print str(node.type) + ': ' + str(node.attributes)

# Organize schematic
my_action2.organize()

# #############################
# CREATE A NEW ACTION
my_action3 = flame.batch.create_node("Action")
my_action3.name = "MY_ACTION3"
my_action3.pos_x = -500
my_action3.pos_y = 200

print "All Possible nodes:"
print ''
for n in my_action3.node_types:
    print n

print " "
print "-"*30

print 'Excepting some nodes (Lightbox, Matchbox, Surface: '
print ''
for node in my_action3.node_types:
    if  str(node) != "Lightbox" and str(node) != "Surface" :
        print node
        my_action3.create_node(node)


# PRINTS FOUND NODE'S ATTRIBUTES
print " "
print "-"*30
print "Nodes Attributes: "
print " "

for node in my_action3.nodes:
    print str(node.type) + ': ' + str(node.attributes)

# Organize schematic
my_action3.organize()

One Reply to “Console Bits: nodes in Action”

Leave a Reply