3

I have created a number of python nodes inside my own tree. I have one node that takes one input and has a button called "Simulate". This is an operator that is held in another file. Currently all it does is print some text.

The code for my output node is:

class SimulateNode(Node, CrowdMasterTreeNode):
'''The simulate node'''
bl_idname = 'SimulateNode'
bl_label = 'Simulate'
bl_icon = 'SOUND'

def init(self, context):
    self.inputs.new('CrowdSocketType', "Crowd")

def copy(self, node):
    print("Copying from node ", node)

def free(self):
    print("Removing node ", self, ", Goodbye!")

def draw_buttons(self, context, layout):
    if self.inputs['Crowd'].is_linked == False:
        layout.enabled = False
    layout.scale_y = 1.5
    layout.operator("scene.cm_run_simulation", icon_value=cicon('run_sim'))

def draw_buttons_ext(self, context, layout):
    layout.operator("scene.cm_run_simulation", icon_value=cicon('run_sim'))

def draw_label(self):
    return "Simulate"

I have an input node that supplies an integer:

class IntegerNode(Node, CrowdMasterTreeNode):
'''The integer node'''
bl_idname = 'IntegerNode'
bl_label = 'Integer'
bl_icon = 'SOUND'

Integer = bpy.props.IntProperty(default=3)

def init(self, context):
    self.outputs.new('NodeSocketInt', "Integer")

def copy(self, node):
    print("Copying from node ", node)

def free(self):
    print("Removing node ", self, ", Goodbye!")

def draw_buttons(self, context, layout):
    layout.prop(self, "Integer")

def draw_buttons_ext(self, context, layout):
    layout.prop(self, "Integer")

def draw_label(self):
    return "Integer"

integer input and crowd output nodes

How can I pass any data from any node connected to that output node to the operator?

John Roper
  • 695
  • 11
  • 22

0 Answers0