Example #1
0
def run(kwargs):
    # Get Selected Node
    selNodes = hou.selectedNodes()

    # Create NULL
    kwargs['bbox'] = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5)
    mrg = objecttoolutils.genericTool(kwargs, 'null')

    curNode = kwargs["pane"].currentNode()

    # Make InputField
    name = hou.ui.readInput("Call me Names", title="Name")[1]

    # Remove Special Chars and replace them with "_"
    for k in name.split("\n"):
        name = re.sub(r"[^a-zA-Z0-9]+", ' ', k)
    name = name.upper()
    name = name.replace(" ", "_")

    # Connect Node to Predecessor
    if not kwargs['shiftclick']:
        for x, node in enumerate(selNodes):
            mrg.setNextInput(node)

    # SetInterface
    curNode.setName(name, True)
    curNode.setColor(hou.Color((0, 1, 0)))

    curNode.setDisplayFlag(True)
    curNode.setRenderFlag(True)
Example #2
0
import objecttoolutils

crate_type = 'crate'
sticky_type = 'sticky_input'

if hou.selectedNodes():
    project_node = hou.selectedNodes()[0]
    parent_node = project_node.parent()

    objecttoolutils.genericTool(kwargs, 'null')

    curNode = parent_node.currentNode()

    curNode.setInput(1, project_node)

    curNode.setName("test")
    curNode.setColor(hou.Color((0.6, 0.4, 1.0)))
    curNode.setDisplayFlag(True)
    curNode.setRenderFlag(True)

kwargs['bbox'] = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5)
objecttoolutils.genericTool(kwargs, 'null')

curNode = kwargs['pane'].currentNode()

name = hou.ui.readInput("Give out name", title="Out null")[1]
name = name.upper()
name = name.replace(" ", "_")

curNode.setName(name)
curNode.setColor(hou.Color((0.6, 0.4, 1.0)))
# ----------------------------------------------------------

"""
Custom shelf tool for use to generate a Render Geo node with
user-defined naming. Naming convention coordinated with
Redshift ROP object list of render-ready geo.
"""

import objecttoolutils
from common_py_lib import utils

# -----------------------------------------------------------
# OBJECT NODE ))))))))))))))))))))))))))))))))))))))))) START
# -----------------------------------------------------------
# Generates node
objecttoolutils.genericTool(kwargs, 'geo')

# Return the currently selected node
render = kwargs['pane'].currentNode()

# Ask user for name for the RNDR node's suffix
# Since name is a tuple, we need the 2nd value, hence the [1]
name = hou.ui.readInput("Type node name", title="Render Geo Node Name")[1]
name = "RNDR_" + name.upper()

# Replaces blank spaces in the input name with an underscore
# Without this, the null node fails
name = name.replace(" ", "_")

# Assign name variable to the node
render.setName(name)