Python bpy.types.Node() Examples

The following are 15 code examples of bpy.types.Node(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bpy.types , or try the search function .
Example #1
Source File: custom_nodes.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def poll(cls, ntree):
        return ntree.bl_idname == 'CustomTreeType'


# Derived from the Node base type. 
Example #2
Source File: custom_nodes.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def draw_buttons(self, context, layout):
        layout.label("Node settings")
        layout.prop(self, "myFloatProperty")

    # Detail buttons in the sidebar.
    # If this function is not defined, the draw_buttons function is used instead 
Example #3
Source File: custom_nodes.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def draw_label(self):
        return "I am a custom node"


### Node Categories ###
# Node categories are a python system for automatically
# extending the Add menu, toolbar panels and search operator.
# For more examples see release/scripts/startup/nodeitems_builtins.py 
Example #4
Source File: custom_nodes.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def poll(cls, ntree):
        return ntree.bl_idname == 'CustomTreeType'


# Derived from the Node base type. 
Example #5
Source File: custom_nodes.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def draw_buttons(self, context, layout):
        layout.label("Node settings")
        layout.prop(self, "myFloatProperty")

    # Detail buttons in the sidebar.
    # If this function is not defined, the draw_buttons function is used instead 
Example #6
Source File: __init__.py    From kaleidoscope with GNU General Public License v3.0 5 votes vote down vote up
def poll(cls, ntree):
        b = False
        if ntree.bl_idname == 'ShaderNodeTree':
            b = True
        return b

# Derived from the Node base type 
Example #7
Source File: __init__.py    From kaleidoscope with GNU General Public License v3.0 5 votes vote down vote up
def draw_buttons(self, context, layout):
        col = layout.column(align=True)
        col.label()
        col.label(text="Kaleidoscope Hybrid is just a")
        col.label(text="quick node to choose the nodes")
        col.label(text="that come with Kaleidoscope.")
        col.label()
        col.label(text="Select any one of the option to")
        col.label(text="to use the node that comes with")
        col.label(text="Kaleidoscope")
        col.label()
        row = col.row(align=True)
        row.prop(self, 'node_type', expand = True)

    #Node Label 
Example #8
Source File: spectrum.py    From kaleidoscope with GNU General Public License v3.0 5 votes vote down vote up
def draw_buttons(self, context, layout):
        SpectrumPaletteUI(self, context, layout)

    #Node Label 
Example #9
Source File: intensity.py    From kaleidoscope with GNU General Public License v3.0 5 votes vote down vote up
def poll(cls, ntree):
        b = False
        if ntree.bl_idname == 'ShaderNodeTree':
            b = True
        return b

# Derived from the Node base type. 
Example #10
Source File: action_set_material_rgb_param.py    From armory with zlib License 5 votes vote down vote up
def init(self, context):
        self.inputs.new('ArmNodeSocketAction', 'In')
        self.inputs.new('NodeSocketShader', 'Material')
        self.inputs.new('NodeSocketString', 'Node')
        self.inputs.new('NodeSocketColor', 'Color')
        self.outputs.new('ArmNodeSocketAction', 'Out') 
Example #11
Source File: action_set_material_value_param.py    From armory with zlib License 5 votes vote down vote up
def init(self, context):
        self.inputs.new('ArmNodeSocketAction', 'In')
        self.inputs.new('NodeSocketShader', 'Material')
        self.inputs.new('NodeSocketString', 'Node')
        self.inputs.new('NodeSocketFloat', 'Value')
        self.outputs.new('ArmNodeSocketAction', 'Out') 
Example #12
Source File: action_set_material_image_param.py    From armory with zlib License 5 votes vote down vote up
def init(self, context):
        self.inputs.new('ArmNodeSocketAction', 'In')
        self.inputs.new('NodeSocketShader', 'Material')
        self.inputs.new('NodeSocketString', 'Node')
        self.inputs.new('NodeSocketString', 'Image')
        self.outputs.new('ArmNodeSocketAction', 'Out') 
Example #13
Source File: CGTNodes.py    From caffe-gui-tool with The Unlicense 5 votes vote down vote up
def draw_label(self):
        return "Data Node" 
Example #14
Source File: ScSendToSverchok.py    From Sorcar with GNU General Public License v3.0 5 votes vote down vote up
def draw_buttons(self, context, layout):
        super().draw_buttons(context, layout)
        layout.prop(self, "prop_tree")
        if (not self.prop_tree == None):
            layout.prop_search(self, "prop_node", self.prop_tree, "nodes", text="Node") 
Example #15
Source File: spectrum.py    From kaleidoscope with GNU General Public License v3.0 4 votes vote down vote up
def set_color_ramp(self):
    """Set the Colors from the Palette to a ColorRamp node"""
    kaleidoscope_spectrum_props=bpy.context.scene.kaleidoscope_spectrum_props
    ramp = None
    ramp_world = None
    if kaleidoscope_spectrum_props.assign_colorramp_world == True:
        try:
            try:
                ramp_world = bpy.context.scene.world.node_tree.nodes[kaleidoscope_spectrum_props.colorramp_world_name].color_ramp
            except:
                if kaleidoscope_spectrum_props.assign_colorramp_world == True:
                    try:
                        self.report({'WARNING'}, "There is Not a Valid ColorRamp Node in the World Material")
                    except AttributeError:
                        pass
            if kaleidoscope_spectrum_props.colorramp_world_name != "" and kaleidoscope_spectrum_props.assign_colorramp_world == True:
                try:
                    for i in range(0, len(ramp_world.elements)):
                            if kaleidoscope_spectrum_props.assign_colorramp_world == True:
                                exec("ramp_world.elements["+str(i)+"].color[0] = kaleidoscope_spectrum_props.color"+str(i+1)+"[0]")
                                exec("ramp_world.elements["+str(i)+"].color[1] = kaleidoscope_spectrum_props.color"+str(i+1)+"[1]")
                                exec("ramp_world.elements["+str(i)+"].color[2] = kaleidoscope_spectrum_props.color"+str(i+1)+"[2]")
                                ramp_world.elements[0].color[3] = 1.0
                except:
                    pass
        except:
            pass

    for mat in bpy.data.materials:
        spectrum_active = mat.kaleidoscope_spectrum_props
        if spectrum_active.assign_colorramp == True and spectrum_active.colorramp_name != "":
            try:
                if spectrum_active is not None:
                    ramp = mat.node_tree.nodes[spectrum_active.colorramp_name].color_ramp
            except:
                if spectrum_active.assign_colorramp == True:
                    try:
                        self.report({'WARNING'}, "There is Not a Valid ColorRamp Node in '"+mat.name+"'")
                    except AttributeError:
                        pass
            if spectrum_active.colorramp_name != "" and spectrum_active.assign_colorramp == True:
                try:
                    for i in range(0, len(ramp.elements)):
                            if spectrum_active.assign_colorramp == True:
                                exec("ramp.elements["+str(i)+"].color[0] = kaleidoscope_spectrum_props.color"+str(i+1)+"[0]")
                                exec("ramp.elements["+str(i)+"].color[1] = kaleidoscope_spectrum_props.color"+str(i+1)+"[1]")
                                exec("ramp.elements["+str(i)+"].color[2] = kaleidoscope_spectrum_props.color"+str(i+1)+"[2]")
                                ramp.elements[0].color[3] = 1.0
                except:
                    pass