Python hou.StringParmTemplate() Examples

The following are 6 code examples of hou.StringParmTemplate(). 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 hou , or try the search function .
Example #1
Source File: nmCreateFetch.py    From Nagamochi with GNU General Public License v3.0 6 votes vote down vote up
def createWedge(nName,nColor,sourcePath):
   

    outRop = hou.node('/out').createNode('wedge',nName) 
    tpl = hou.StringParmTemplate("source", "Source", 1, string_type=hou.stringParmType.NodeReference)
    outRop.addSpareParmTuple(tpl)
    outRop.setParms({
        "source"  : sourcePath,
        "prefix"  : "",
        "driver" : "`chs('source')`/To_Fetch",
        "wedgeparams" : 1,
        "random" : 0,
        })                  
    outRop.setParmExpressions({
        "range1y" : 'ch("steps1")-1',
        })
    outRop.setColor(nColor)
    return outRop 
Example #2
Source File: auxiliary.py    From anima with MIT License 6 votes vote down vote up
def create_spare_input(node, value=''):
    """creates spare inputs for the given node and sets the value

    :param hou.Node node: The node to insert the spare input to.
    :param str value: The value of the parameter
    """
    # Create space input0 for rs proxy output node
    parm_template_group = node.parmTemplateGroup()
    parm_template_group.append(
        hou.StringParmTemplate(
            'spare_input0', 'Spare Input 0', 1,
            string_type=hou.stringParmType.NodeReference
        )
    )
    node.setParmTemplateGroup(parm_template_group)
    node.parm('spare_input0').set(value) 
Example #3
Source File: nmCreateFetch.py    From Nagamochi with GNU General Public License v3.0 5 votes vote down vote up
def createAlembic(nName,nColor,sourcePath):
    outRop = hou.node('/out').createNode('alembic',nName)
    tpl = hou.StringParmTemplate("source", "Source", 1, string_type=hou.stringParmType.NodeReference)
    outRop.addSpareParmTuple(tpl)
    outRop.parm('f1').deleteAllKeyframes()
    outRop.parm('f2').deleteAllKeyframes()
    
    outRop.setParms({
        "use_sop_path" : 1,
        "source"  : sourcePath,
        "sop_path" : "`chs('source')`/TO_ROP",
            "filename" : "`chs(chsop('source')+'/filename')`",
        "path_attrib" : "_nmAbcPath",
        'full_bounds' : 1,
        'facesets' : 0,
        #"alfprogress" : 1,
        })
    outRop.setParmExpressions({
        "trange" : "ch(chs('source')+'/abc_type')",
        "f1" : "ch(chs('source')+'/f1')",
        "f2" : "ch(chs('source')+'/f2')",
        "f3" : "ch(chs('source')+'/f3')",
        "build_from_path" : "ch(chsop('source')+'/build_hier_from_path')",
        "facesets" :"ch(chsop('source')+'/facesets')",
        #"initsim" : "ch(chs('source')+'/initsim')",
        #"savebackground" : "ch(chs('source')+'/To_Fetch_savebackground')",
        })
    outRop.setColor(nColor)
    return outRop 
Example #4
Source File: lib.py    From core with MIT License 4 votes vote down vote up
def imprint(node, data):
    """Store attributes with value on a node

    Depending on the type of attribute it creates the correct parameter
    template. Houdini uses a template per type, see the docs for more
    information.

    http://www.sidefx.com/docs/houdini/hom/hou/ParmTemplate.html

    Args:
        node(hou.Node): node object from Houdini
        data(dict): collection of attributes and their value

    Returns:
        None

    """

    parm_group = node.parmTemplateGroup()

    parm_folder = hou.FolderParmTemplate("folder", "Extra")
    for key, value in data.items():
        if value is None:
            continue

        if isinstance(value, float):
            parm = hou.FloatParmTemplate(name=key,
                                         label=key,
                                         num_components=1,
                                         default_value=(value,))
        elif isinstance(value, bool):
            parm = hou.ToggleParmTemplate(name=key,
                                          label=key,
                                          default_value=value)
        elif isinstance(value, int):
            parm = hou.IntParmTemplate(name=key,
                                       label=key,
                                       num_components=1,
                                       default_value=(value,))
        elif isinstance(value, six.string_types):
            parm = hou.StringParmTemplate(name=key,
                                          label=key,
                                          num_components=1,
                                          default_value=(value,))
        else:
            raise TypeError("Unsupported type: %r" % type(value))

        parm_folder.addParmTemplate(parm)

    parm_group.append(parm_folder)
    node.setParmTemplateGroup(parm_group) 
Example #5
Source File: nmCreateFetch.py    From Nagamochi with GNU General Public License v3.0 4 votes vote down vote up
def createGeometry(nName,nColor,sourcePath):
    outRop = hou.node('/out').createNode('geometry',nName)
    tpl = hou.StringParmTemplate("source", "Source", 1, string_type=hou.stringParmType.NodeReference)
    outRop.addSpareParmTuple(tpl)
    outRop.parm('f1').deleteAllKeyframes()
    outRop.parm('f2').deleteAllKeyframes()
    
    outRop.setColor(nColor)

    outRop.setParms({
        #"use_sop_path" : 1,
        "source"  : sourcePath ,
        "soppath" : "`chs('source')`/TO_ROP",
        "alfprogress" : 1,
        })
    outRop.setParmExpressions({
        "trange" : "ch(chs('source')+'/trange')",
        "f1" : "ch(chs('source')+'/f1')",
        "f2" : "ch(chs('source')+'/f2')",
        "f3" : "ch(chs('source')+'/f3')",
        "sopoutput" : "chs(chsop('source')+'/To_Fetch/sopoutput')",
        #"build_from_path" : "ch(chsop('source')+'/build_hier_from_path')"
        "initsim" : "ch(chs('source')+'/initsim')",
        "savebackground" : "ch(chs('source')+'/savebackground')",
        })
    if nName.startswith("Cache"):
        outRop.setParms({
            "prerender": "hou.node(hou.node('.').parm('source').eval()).hdaModule().pre_render( hou.node(hou.node('.').parm('source').eval()).path() )",
            "lprerender":"python",
            "postrender":"hou.node(hou.node('.').parm('source').eval()).hdaModule().post_render( hou.node(hou.node('.').parm('source').eval()).path() )",
            "lpostrender":"python",
            })
        outRop.setParmExpressions({
            "tpreframe": "ch(chs('source')+'/tpreframe')",
            "preframe": "chs(chs('source')+'/preframe')",
            "lpreframe": "ch(chs('source')+'/lpreframe')",
            "tpostframe": "ch(chs('source')+'/tpostframe')",
            "postframe": "chs(chs('source')+'/postframe')",
            "lpostframe": "ch(chs('source')+'/lpostframe')",
            "tpostwrite": "ch(chs('source')+'/tpostwrite')",
            "postwrite": "chs(chs('source')+'/postwrite')",
            "lpostwrite": "ch(chs('source')+'/lpostwrite')",
            })
    return outRop 
Example #6
Source File: validate_houdini_parameters.py    From pyblish-bumpybox with GNU Lesser General Public License v3.0 4 votes vote down vote up
def process(self, context, plugin):
        import hou

        # Get the errored instances
        failed = []
        for result in context.data["results"]:
            if (result["error"] is not None and
               result["instance"] is not None and
               result["instance"] not in failed):
                failed.append(result["instance"])

        # Apply pyblish.logic to get the instances for the plug-in.
        instances = api.instances_by_plugin(failed, plugin)

        plugin = plugin()
        for instance in instances:

            node = instance[0]
            templates = []

            templates.append(hou.IntParmTemplate(
                "deadlineChunkSize", "Chunk Size", 1, default_value=(1,)
            ))
            templates.append(hou.IntParmTemplate(
                "deadlinePriority", "Priority", 1, default_value=(50,)
            ))
            templates.append(hou.StringParmTemplate(
                "deadlinePool", "Pool", 1, default_value=("",)
            ))
            templates.append(hou.IntParmTemplate(
                "deadlineConcurrentTasks",
                "Concurrent Tasks",
                1,
                default_value=(1,)
            ))

            parm_group = node.parmTemplateGroup()
            parm_folder = hou.FolderParmTemplate("folder", "Deadline")

            for template in templates:
                try:
                    parm_folder.addParmTemplate(template)
                except:
                    self.log.debug("Could not add \"{0}\"".format(template))

            parm_group.append(parm_folder)
            node.setParmTemplateGroup(parm_group)