Ejemplo n.º 1
0
    def create_category_parms(self, node):
        """
        Create the category parms needed for light linking
        with Houdini categories.
        """

        #parm_group
        parm_group = node.parmTemplateGroup()

        #fldr
        fldr = parm_group.containingFolder('categories')
         
        #lightcategories
        hou_parm_template = hou.StringParmTemplate("lightcategories", "Light Selection", 1, default_value='*')
        hou_parm_template.setHelp("A space-separated list of categories. Lights in these categories will illuminate this object.")
        #append
        parm_group.appendToFolder(fldr, hou_parm_template)
        #set in node
        node.setParmTemplateGroup(parm_group)

        #log
        parm = node.parm("lightcategories")
        parm_name = parm.name()
        parm_value = parm.eval()
        print('Added parm. {0} - {1}'.format(parm_name, parm_value))

        #fldr
        fldr = parm_group.containingFolder('categories')

        #reflectcategories
        hou_parm_template = hou.StringParmTemplate("reflectcategories", "Reflection Selection", 1, default_value='*')
        hou_parm_template.setHelp("A space-separated list of categories. Objects in these categories will reflect in this object.")
        #append
        parm_group.appendToFolder(fldr, hou_parm_template)
        #set in node
        node.setParmTemplateGroup(parm_group)

        #log
        parm = node.parm("reflectcategories")
        parm_name = parm.name()
        parm_value = parm.eval()
        print('Added parm. {0} - {1}'.format(parm_name, parm_value))

        #fldr
        fldr = parm_group.containingFolder('categories')

        #refractcategories
        hou_parm_template = hou.StringParmTemplate("refractcategories", "Refraction Selection", 1, default_value='*')
        hou_parm_template.setHelp("A space-separated list of categories. Objects in these categories will be visible in refraction rays.")
        #append
        parm_group.appendToFolder(fldr, hou_parm_template)
        #set in node
        node.setParmTemplateGroup(parm_group)

        #log
        parm = node.parm("refractcategories")
        parm_name = parm.name()
        parm_value = parm.eval()
        print('Added parm. {0} - {1}'.format(parm_name, parm_value))
Ejemplo n.º 2
0
    def save_tabs_to_hip(self):
        # collect data
        tabs = []
        for i in range(self.count()):
            c = self.widget(i)
            if c.is_backup:
                continue
            text = c.edit.text()
            if c.parm:
                type = 'parm'
                path = c.parm.path()
            elif c.file:
                type = 'file'
                path = c.file
            elif c.section:
                type = 'section'
                path = '/'.join([
                    c.section.definition().nodeType().name(),
                    c.section.name()
                ])
            else:
                type = 'empty'
                path = ''
            tabs.append(dict(text=text, type=type, path=path))
        if not tabs:
            return

        # create node
        self.clear_tabs_node()
        node = hou.node('/obj').createNode('vopnet')
        node.setName(tabsNodeName)

        # create template
        grp = node.parmTemplateGroup()

        for i, tab in enumerate(tabs):
            tp = hou.StringParmTemplate('type%s' % i, 'type%s' % i, 1,
                                        (tab['type'], ))
            path = hou.StringParmTemplate('path%s' % i, 'path%s' % i, 1,
                                          (tab['path'], ))
            text = hou.StringParmTemplate('text%s' % i, 'text%s' % i, 1,
                                          (tab['text'], ))
            text.setTags({"editor": "1"})
            name = os.path.basename(tab['path'])
            if not name:
                name = 'VEX Code%s' % i
            f = hou.FolderParmTemplate(name,
                                       name.replace('.', '_').lower(),
                                       (tp, path, text))
            grp.addParmTemplate(f)

        ind = hou.IntParmTemplate('tabs_active_index', 'tabs_active_index', 1,
                                  (self.currentIndex(), ))
        grp.addParmTemplate(ind)

        node.setParmTemplateGroup(grp)
        node.hide(True)
Ejemplo n.º 3
0
def parm_create(node, type, name, label):

    if type == "integer":
        new_template = hou.IntParmTemplate(name, name, 1)

    if type == "toggle":
        new_template = hou.ToggleParmTemplate(name, name)

    if type == "float":
        new_template = hou.FloatParmTemplate(name, name, 1)

    if type == "vector":
        new_template = hou.FloatParmTemplate(name, name, 3)
        new_template.setLook(hou.parmLook.Regular)

    if type == "color":
        new_template = hou.FloatParmTemplate(name, name, 3)
        new_template.setNamingScheme(hou.parmNamingScheme.RGBA)
        new_template.setLook(hou.parmLook.ColorSquare)

    if type == "string":
        new_template = hou.StringParmTemplate(name, label, 1)
        new_template.setStringType(hou.stringParmType.Regular)

    if type == "file":
        new_template = hou.StringParmTemplate(name, name, 1)
        new_template.setStringType(hou.stringParmType.FileReference)

    if type == "node":
        new_template = hou.StringParmTemplate(name, name, 1)
        new_template.setStringType(hou.stringParmType.NodeReference)

    if type == "separator":
        new_template = hou.SeparatorParmTemplate(name)

    if type == "label":
        new_template = hou.LabelParmTemplate(name, label, [label], False, True)

    if type == "rampfloat":
        new_template = hou.RampParmTemplate(name, name, hou.rampParmType.Float)
        new_template.setShowsControls(False)

    if type == "rampcolor":
        new_template = hou.RampParmTemplate(name, name, hou.rampParmType.Color)
        new_template.setShowsControls(False)

    try:
        ptg = node.parmTemplateGroup()
        ptg.addParmTemplate(new_template)
        node.setParmTemplateGroup(ptg)
        existed = 0

    except:
        existed = 1
Ejemplo n.º 4
0
    def _create_sgtk_parms(self, node):
        """
        Create the parameters that are going to live within the sgtk folder.

        :param node: A :class:`hou.Node` instance.

        :rtype: list(:class:`hou.ParmTemplate`)
        """
        templates = super(ExportNodeHandler, self)._create_sgtk_parms(node)
        sgtk_element = hou.StringParmTemplate(
            self.SGTK_ELEMENT,
            "Element",
            1,
            script_callback=self.generate_callback_script_str(
                "validate_parm_and_refresh_path"
            ),
            script_callback_language=hou.scriptLanguage.Python,
        )
        sgtk_element.setConditional(hou.parmCondType.DisableWhen, "{ use_sgtk != 1 }")
        sgtk_element.setJoinWithNext(True)
        templates.append(sgtk_element)

        sgtk_location = hou.StringParmTemplate(
            self.SGTK_LOCATION,
            "Location",
            1,
            script_callback=self.generate_callback_script_str(
                "validate_parm_and_refresh_path"
            ),
            script_callback_language=hou.scriptLanguage.Python,
        )
        sgtk_location.setConditional(
            hou.parmCondType.DisableWhen, '{ use_sgtk != 1 } { sgtk_element == "" }'
        )
        templates.append(sgtk_location)

        sgtk_variation = hou.StringParmTemplate(
            self.SGTK_VARIATION,
            "Variation",
            1,
            script_callback=self.generate_callback_script_str(
                "validate_parm_and_refresh_path"
            ),
            script_callback_language=hou.scriptLanguage.Python,
        )
        sgtk_variation.setConditional(
            hou.parmCondType.DisableWhen, '{ use_sgtk != 1 } { sgtk_element == "" }'
        )
        templates.append(sgtk_variation)

        return templates
Ejemplo n.º 5
0
def abcCamTrack():
    '''
    abc摄影机跟踪,可以使用object merge把相机内的点提取,选择transform参数
    '''

    node = hou.node(
        hou.ui.selectNode(node_type_filter=hou.nodeTypeFilter.ObjCamera))

    try:
        for node in node.allNodes():
            if node.type().name() != "cam":
                continue
            else:
                cam = node
    except AttributeError:
        return

    # look for /obj and create null node
    while not node.type().isManager():
        if node.type().name() == "alembicarchive":  #abcNode
            abcNode = node
        node = node.parent()

    null = node.createNode("null", cam.name() + "_track")
    str_template1 = hou.StringParmTemplate("cam_path", "cam_path", 1)
    str_template2 = hou.StringParmTemplate("abc_path", "abc_path", 1)
    null.addSpareParmTuple(str_template1)
    null.addSpareParmTuple(str_template2)
    null.parm("cam_path").set(cam.path())
    null.parm("abc_path").set(abcNode.path())

    for i in range(2):
        if i == 0:
            mode = "t"
        if i == 1:
            mode = "r"
        for j in range(3):
            expr = ""
            expr += "import _alembic_hom_extensions as abc\n"
            expr += "abcPath = hou.node(hou.pwd().parm(\"abc_path\").eval()).parm(\"fileName\").eval()\n"
            expr += "objPath = hou.node(hou.pwd().parm(\"cam_path\").eval()).parent().parm(\"objectPath\").eval()\n"
            expr += "trans_tuple = abc.getWorldXform(abcPath, objPath, hou.time())[0]\n"
            expr += "cam_trans = hou.Matrix4()\n"
            expr += "cam_trans.setTo(trans_tuple)\n"
            if mode == "t":
                expr += "return cam_trans.extractTranslates()[%d]" % j
            if mode == "r":
                expr += "return cam_trans.extractRotates()[%d]" % j
            null.parmTuple(mode)[j].setExpression(expr,
                                                  hou.exprLanguage.Python)
Ejemplo n.º 6
0
def add_TMP(attr_name, tmp_type, current_tmpparm, language_dict=None):
    attr_label = attr_name
    if language_dict:
        attr_label = language_dict.get(attr_name, attr_name)
    if tmp_type == "FloatParmTemplate":
        current_tmpparm.append(hou.FloatParmTemplate(attr_name, attr_label, 1))
    elif tmp_type == "RampParmTemplate":
        current_tmpparm.append(
            hou.RampParmTemplate(attr_name,
                                 attr_label,
                                 hou.rampParmType.Float,
                                 default_value=2,
                                 default_basis=None,
                                 color_type=None))
    elif tmp_type == "IntParmTemplate":
        current_tmpparm.append(hou.IntParmTemplate(attr_name, attr_label, 1))
    elif tmp_type == "StringParmTemplate":
        current_tmpparm.append(hou.StringParmTemplate(attr_name, attr_label,
                                                      1))
    elif tmp_type == "ToggleParmTemplate":
        current_tmpparm.append(hou.ToggleParmTemplate(attr_name, attr_label,
                                                      0))
    elif tmp_type == "SeparatorParmTemplate":
        current_tmpparm.append(
            hou.SeparatorParmTemplate(attr_name, attr_label, 1))
    return current_tmpparm
Ejemplo n.º 7
0
    def _create_sgtk_parms(self, node):
        """
        Create the parameters that are going to live within the sgtk folder.

        :param node: A :class:`hou.Node` instance.

        :rtype: list(:class:`hou.ParmTemplate`)
        """
        templates = super(BaseRenderNodeHandler, self)._create_sgtk_parms(node)

        templates[-1].setJoinWithNext(True)

        sgtk_pass_name = hou.StringParmTemplate(
            self.SGTK_PASS_NAME,
            "Render Pass",
            1,
            default_value=("beauty", ),
            script_callback=self.generate_callback_script_str(
                "validate_parm_and_refresh_path"),
            script_callback_language=hou.scriptLanguage.Python,
        )
        sgtk_pass_name.setConditional(hou.parmCondType.DisableWhen,
                                      "{ use_sgtk != 1 }")
        templates.append(sgtk_pass_name)

        return templates
Ejemplo n.º 8
0
def loadCurve(*args, **kwargs):
    node = hou.pwd()
    node_path = node.type().definition().libraryFilePath()
    node_name = node.type().name()
    data_folder = os.path.dirname(node_path) + "/%s_data" % node_name
    if not os.path.exists(data_folder):
        return
    # delete all child node
    for c_node in node.children():
        c_node.destroy()

    # read data
    for curve_data in os.listdir(data_folder):
        full_data_path = os.path.join(data_folder, curve_data)
        curve_name = os.path.splitext(curve_data)[0]

        # create curve node
        target_node = node.createNode("curve", curve_name)

        parm_dic = {}
        with open(full_data_path, "r") as outfile:
            all_info = outfile.read()
            parm_dic = json.loads(all_info)

        # add width parm to interface
        current_tmpparm = target_node.parmTemplateGroup()
        current_tmpparm.append(hou.StringParmTemplate("Style", "Style", 1))
        current_tmpparm.append(hou.FloatParmTemplate("width", "Width", 1))
        target_node.setParmTemplateGroup(current_tmpparm)
        target_node.setParms({"Style": "HRS_Default"})
        target_node.setParms(parm_dic)
    hou.ui.displayMessage("Loaded!")
Ejemplo n.º 9
0
def create_shot_menu(hideWhen=None, callback_script=None):
    script = '''
from byuam.project import Project

project = Project()
directory_list = list()

shots = project.list_shots()

for shot in shots:
	directory_list.append(shot)
	directory_list.append(shot)

return directory_list
	'''
    project = Project()
    first_shot = (str(project.list_shots()[0]), )
    print first_shot
    shot = hou.StringParmTemplate(
        'shot',
        'Shot',
        1,
        item_generator_script=script,
        menu_type=hou.menuType.Normal,
        script_callback=callback_script,
        script_callback_language=hou.scriptLanguage.Python,
        default_value=first_shot)
    print shot.defaultValue()
    if hideWhen is not None:
        shot.setConditional(hou.parmCondType.HideWhen, '{ ' + hideWhen + ' }')
    return shot
Ejemplo n.º 10
0
def add_spare_input(node=None, index=0, value=""):

    parm_name = "spare_input{}".format(index)
    parm_label = "Spare Input {}".format(index)

    if node.parm(parm_name) is not None:
        return node.parm(parm_name)

    template_grp = node.parmTemplateGroup()

    tags = {"opfilter": "!!SOP!!", "oprelative": "."}
    help = ('Refer to this in expressions as -{0},'
            ' such as: npoint(-{0})'.format(index))

    spare_in = hou.StringParmTemplate(name=parm_name,
                                      label=parm_label,
                                      num_components=1,
                                      string_type=NodeReference,
                                      tags=tags,
                                      default_value=('', ),
                                      help=help)

    template_grp.addParmTemplate(spare_in)
    node.setParmTemplateGroup(template_grp)

    node.parm(parm_name).set(value.replace('"', ''))

    return node.parm(parm_name)
Ejemplo n.º 11
0
def createWedge(nName,nColor,sourcePath):
    #try:
    #    outRop = hou.node('/out').createNode('mzWedgeToH',nName)
    #    outRop.setParms({           
    #        "driver" : sourcePath,
    #        "per_task" : 0,
    #        })  

    #except:
    

    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
Ejemplo n.º 12
0
    def get_new_parameter(self, parm):
        # ch, chf - float
        # chv - vector
        # chp - point
        # chs - string
        # chi- int
        # chramp - ramp

        if parm['func'] == 'ch' or parm['func'] == 'chf':
            return hou.FloatParmTemplate(parm['name'], parm['name'].title(), 1)

        elif parm['func'] == 'chv':
            return hou.FloatParmTemplate(parm['name'], parm['name'].title(), 3)

        elif parm['func'] == 'chs':
            return hou.StringParmTemplate(parm['name'], parm['name'].title(), 1)

        elif parm['func'] == 'chi':
            return hou.IntParmTemplate(parm['name'], parm['name'].title(), 1)

        elif parm['func'] == 'chramp':
            if parm['type'] == 'vector':
                return hou.RampParmTemplate(parm['name'], parm['name'].title(), hou.rampParmType.Color )
            else:
                return hou.RampParmTemplate(parm['name'], parm['name'].title(), hou.rampParmType.Float )

        elif parm['func'] == 'chp':
            return hou.FloatParmTemplate(parm['name'], parm['name'].title(), 4)
Ejemplo n.º 13
0
def pywy():
    """
    create a node to test code with python
    """

    help(pywy)

    import hou
    nodeSelect = hou.selectedNodes()
    pink = hou.Color((0.98, 0.275, 0.275))

    for node in nodeSelect:
        #create node from selected node
        pyNull = node.createOutputNode("null", "pythonRunCode")
        pyNull.setColor(pink)
        #prepa param
        parm_group = pyNull.parmTemplateGroup()
        parm_folder = hou.FolderParmTemplate("folder", "pywy")
        #button run code
        button = hou.ButtonParmTemplate("runcode", "Run_Code")
        button.setTags({
            "script_callback_language":
            "python",
            "script_callback":
            "exec(kwargs['node'].parm('pythonCode').eval())"
        })
        parm_folder.addParmTemplate(button)
        #multistring
        multistring = hou.StringParmTemplate("pythonCode", "PythonCode", 1)
        multistring.setTags({"editor": "1", "editorlang": "python"})
        parm_folder.addParmTemplate(multistring)
        #append param
        parm_group.append(parm_folder)
        pyNull.setParmTemplateGroup(parm_group)
Ejemplo n.º 14
0
def hda_parameter_setup(hda, geo, project):
    parmGroup = hda.parmTemplateGroup()
    projectName = project.get_name().lower().replace(' ', '_')
    projectFolder = hou.FolderParmTemplate(projectName, project.get_name(), folder_type=hou.folderType.Tabs, default_value=0, ends_tab_group=False)

    source_menu = hou.MenuParmTemplate('source', 'Source', ('set', 'animated', 'object_space'), menu_labels=('Set', 'Animated', 'Object Space'), default_value=2)
    source_menu_index = hou.IntParmTemplate('source_index', 'Source Index', 1, is_hidden=True, default_expression=('ch("source")',))

    projectFolder.addParmTemplate(source_menu)
    projectFolder.addParmTemplate(source_menu_index)
    cook_script='hou.node("./' + geo.name() + '").parm("cook").pressButton()\nprint "Asset Refreshed"'
    projectFolder.addParmTemplate(create_shot_menu(hideWhen='source_index != 1', callback_script=cook_script))
    projectFolder.addParmTemplate(create_set_menu(hideWhen='source_index != 0', callback_script=cook_script))
    hide_toggle = hou.ToggleParmTemplate('hide', 'Hide')
    projectFolder.addParmTemplate(hide_toggle)
    recook = hou.ButtonParmTemplate('re_cook_hda', 'Reload', script_callback=cook_script, script_callback_language=hou.scriptLanguage.Python)
    projectFolder.addParmTemplate(recook)
    version = hou.IntParmTemplate('abcversion', 'Alembic Version', 1)
    projectFolder.addParmTemplate(version)
    lightlink = hou.StringParmTemplate("lightmask", "Light Mask", 1, default_value=(["*"]), string_type=hou.stringParmType.NodeReferenceList) #, menu_items=([]), menu_labels=([]), icon_names=([]))
    lightlink.setTags({"opfilter": "!!OBJ/LIGHT!!", "oprelative": "/"})
    projectFolder.addParmTemplate(lightlink)
    auto_archive = hou.properties.parmTemplate(get_latest_prman(),"ri_auto_archive")
    auto_archive.setDefaultValue(("exist",))
    projectFolder.addParmTemplate(auto_archive)
    parmGroup.addParmTemplate(projectFolder)
    hda.type().definition().setParmTemplateGroup(parmGroup)
    hda.parm("ri_auto_archive").set("force")

    return hda
Ejemplo n.º 15
0
def create_set_menu(hideWhen=None, callback_script=None, hidden=False, value=None):
    item_gen_script='''
from byuam.project import Project

project = Project()
set_list = list()

sets = project.list_sets()

for set in sets:
    set_list.append(set)
    set_list.append(set.replace('_', ' ').title())

return set_list
    '''
    project = Project()
    if(value == None):
        if len(project.list_sets()) < 1:
            message_gui.error('There are currently no sets in created in the film. Because of how this node works you are going to have to create at least one set before assembling anything.')
            raise('No sets in the project')
        default_set = (str(project.list_sets()[0]),)
    else:
        default_set = (value,)
    #print default_set
    set_menu = hou.StringParmTemplate('set', 'Set', 1, item_generator_script=item_gen_script, is_hidden=hidden, menu_type=hou.menuType.Normal, script_callback=callback_script, script_callback_language=hou.scriptLanguage.Python, default_value=default_set)
    #print set_menu.defaultValue()
    if hideWhen is not None:
        set_menu.setConditional( hou.parmCondType.HideWhen, '{ ' + hideWhen + ' }')
    return set_menu
def add_tags_parm(node):
    '''.'''
    #assert type(node) is hou.Node

    if not has_tags_parm(node):
        pass  # add tags parm

        #hou_parm_template_group = hou.ParmTemplateGroup()
        hou_parm_template_group = node.parmTemplateGroup()

        # Code for parameter template
        hou_parm_template = hou.StringParmTemplate(
            n_tags,
            l_tags,
            1,
            default_value=([""]),
            naming_scheme=hou.parmNamingScheme.Base1,
            string_type=hou.stringParmType.Regular,
            menu_items=([]),
            menu_labels=([]),
            icon_names=([]),
            item_generator_script="",
            item_generator_script_language=hou.scriptLanguage.Python,
            menu_type=hou.menuType.Normal)

        hou_parm_template_group.append(hou_parm_template)

        node.setParmTemplateGroup(hou_parm_template_group)
    else:
        dbg('%s already has tags parm' % node.path())

    return node.parm(n_tags)
Ejemplo n.º 17
0
    def assign_preflight(self):
        print "assign preflight node", self.node.path(
        ), "on topnet", self.parent

        # get the template group for the parent top node.
        self.parm_group = self.parent.parmTemplateGroup()
        print "Create folder parm template"

        self.parm_folder = hou.FolderParmTemplate("folder", "Firehawk")
        self.parm_folder.addParmTemplate(
            hou.StringParmTemplate(
                "preflight_node",
                "Preflight Node",
                1, [""],
                string_type=hou.stringParmType.NodeReference))

        # Search for the template folder.  if it already exists it will be replaced in order to ensure parms are current.
        self.found_folder = self.parm_group.findFolder("Firehawk")

        print "self.found_folder", self.found_folder
        # If a folder already exists on the node, remove it and add it again.  This deals with any changes to the parm layout if they occur.
        if self.found_folder:
            self.parm_group.remove(self.found_folder)

        # re add the folder to the template group.
        self.parm_group.append(self.parm_folder)

        # update the parm template on the parent node.
        self.parent.setParmTemplateGroup(self.parm_group)

        # set values for path to preflight node.

        self.parent.parm("preflight_node").set(self.node.path())
Ejemplo n.º 18
0
def TextureParmTemplate(parmName, parmLabel, parmDesc):
    parmArgs = {}
    parmArgs["string_type"] = hou.stringParmType.NodeReference
    parmArgs["tags"] = {'spare_category': 'vray', 'opfilter': '!!VOP!!', 'oprelative': '.'}
    parmArgs["script_callback_language"] = hou.scriptLanguage.Python
    parmArgs['num_components'] = 1
    return hou.StringParmTemplate(parmName, parmLabel, **parmArgs)
Ejemplo n.º 19
0
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
Ejemplo n.º 20
0
def createTurbNoiseFolderParmTemplate(id):
    a_parm = hou.FloatParmTemplate('a' + id,
                                   'Amp' + id,
                                   1,
                                   default_value=(1, ))
    f_parm = hou.FloatParmTemplate('f' + id,
                                   'Freq' + id,
                                   1,
                                   default_value=(1, ))
    t_parm = hou.IntParmTemplate('t' + id, 'Turb' + id, 1, default_value=(5, ))
    r_parm = hou.FloatParmTemplate('r' + id,
                                   'Rough' + id,
                                   1,
                                   default_value=(0.5, ))
    at_parm = hou.FloatParmTemplate('at' + id,
                                    'Atten' + id,
                                    1,
                                    default_value=(1.0, ))

    type_parm = hou.StringParmTemplate('type'+id,'NoiseType'+id,1,default_value = ("a",),\
    menu_items =("p","o","s","a","x","c"),\
    menu_labels =("Perlin","OriginalPerlin","SparseConvultion","Alligator","Simplex","CorrectedPerlin"),\
    join_with_next=True)

    noise_folder = hou.FolderParmTemplate('noise'+id,'Noise'+id,\
    parm_templates = (a_parm,f_parm,t_parm,r_parm,at_parm,type_parm),\
    folder_type = hou.folderType.Simple)

    return noise_folder
Ejemplo n.º 21
0
def createCurlNoiseFolderParmTemplate(id):
	a_parm = hou.FloatParmTemplate('a'+id,'Amp'+id,1,default_value = (1,))
	f_parm = hou.FloatParmTemplate('f'+id,'Freq'+id,1,default_value = (1,))   
	t_parm = hou.IntParmTemplate('t'+id,'Turb'+id,1,default_value = (3,))   
	o_parm = hou.FloatParmTemplate('o'+id,'Offset'+id,1,default_value = (0,)) 
	r_parm = hou.FloatParmTemplate('r'+id,'Rough'+id,1,default_value = (0.5,))   
	at_parm = hou.FloatParmTemplate('at'+id,'Atten'+id,1,default_value = (0.5,))   
	ef_parm = hou.FloatParmTemplate('ef'+id,'Effect'+id,1,default_value = (1,))   
	type_parm = hou.StringParmTemplate('type'+id,'NoiseType'+id,1,default_value = ("p",),\
	menu_items =("p","o","s","a","x"),\
	menu_labels =("Perlin","OriginalPerlin","SparseConvultion","Alligator","Simplex"),\
	join_with_next=True)   
	sdf_parm = hou.StringParmTemplate('sdf'+id,'SDF'+id,1,default_value = ("",),\
	default_expression=("i2()",)) 

	noise_folder = hou.FolderParmTemplate('noise'+id,'Noise'+id,\
	parm_templates = (a_parm,f_parm,t_parm,o_parm,r_parm,at_parm,type_parm,sdf_parm,ef_parm),\
	folder_type = hou.folderType.Simple)

	return noise_folder	
Ejemplo n.º 22
0
    def set_parm(self):
        for node in self.node_sel:
          
            
            if node.parm('ver') not in node.parms():
                add_parm = hou.StringParmTemplate('ver', 'Version', 1, ('v001',))

                parm_group = node.parmTemplateGroup()
                parm_group.insertBefore('vm_picture', add_parm)
                node.setParmTemplateGroup(parm_group)
            change_file = node.setParms(
                    {"vm_picture": "$HIP/render" + '''/$OS/`chs("ver")`/$HIPNAME.$OS.$F4.exr'''})
Ejemplo n.º 23
0
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)
Ejemplo n.º 24
0
def c_light(n):
	group = n.parmTemplateGroup()
	folder = hou.FolderParmTemplate("folder", "Static Model Component")

	folder.addParmTemplate(hou.MenuParmTemplate("lighttype", "Light Type",("Directional","Spot","Point",),default_value=2))
	folder.addParmTemplate(hou.FloatParmTemplate("color", "Color",4,(1.0,1.0,1.0,1.0,)))
	folder.addParmTemplate(hou.FloatParmTemplate("specintensity", "Spec Intensity", 1, (1.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("brightmult", "Brightness Multiplier", 1, (1.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("range", "Range", 1, (10.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("spotfov", "Spot FOV", 1, (30.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("spotaspectratio", "Spot Aspect Ratio", 1, (1.0,) ) )
	folder.addParmTemplate(hou.StringParmTemplate("atttext", "Attenuation Texture", 1))
	folder.addParmTemplate(hou.StringParmTemplate("lightshapetext", "Light Shape Texture",1))
	folder.addParmTemplate(hou.ToggleParmTemplate("isoccludable", "Can Be Occluded", 1))
	folder.addParmTemplate(hou.ToggleParmTemplate("castshadows", "Cast Shadows", 0))
	folder.addParmTemplate(hou.ToggleParmTemplate("prevertex", "Per Vertex", 0))
	folder.addParmTemplate(hou.FloatParmTemplate("drawdistance", "Draw Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("fadedistance", "Fade Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("shadowdistance", "Shadow Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("shadowfadedistance", "Shadow Fade Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("shadowintensity", "Shadow Intensity", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("shadowresolution", "Shadow Resolution", 1 ) )
	folder.addParmTemplate(hou.ToggleParmTemplate("focustoscene", "Focus To Scene", 1))
	folder.addParmTemplate(hou.ToggleParmTemplate("nonuniformview", "Non Uniform View", 1))
	folder.addParmTemplate(hou.ToggleParmTemplate("autoreducesize", "Auto Reduce Size", 1))
	folder.addParmTemplate(hou.FloatParmTemplate("cmssplits", "CMS Splits",3,(1000.0,0.0,0.0,)))
	folder.addParmTemplate(hou.FloatParmTemplate("cmsfadestart", "CMS Fade Start", 1, (0,8,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("cmsbiasautoadjust", "CMS Bias Auto Adjust", 1, (1.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("viewsizequantize", "View Size Quantize", 1, (0.5,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("viewsizemin", "View Size Minimum", 1, (1.0,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("depthconstantbias", "Depth Constant Bias", 1, (0.0002,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("depthslopebias", "Depth Slope Bias", 1, (0.5,) ) )
	folder.addParmTemplate(hou.FloatParmTemplate("nearfarclip", "Near Far Clip Ratio", 1, (0.002,) ) )
	folder.addParmTemplate(hou.IntParmTemplate("viewmask", "View Mask",1,(-1,)))
	folder.addParmTemplate(hou.IntParmTemplate("lightmask", "Light Mask",1,(-1,)))

	group.append(folder)
	n.setParmTemplateGroup(group)
Ejemplo n.º 25
0
def c_staticmodel(n):
	group = n.parmTemplateGroup()
	folder = hou.FolderParmTemplate("folder", "Static Model Component")

	folder.addParmTemplate(hou.StringParmTemplate("model", "Model", 1))
	folder.addParmTemplate(hou.StringParmTemplate("material", "Material",1))

	folder.addParmTemplate(hou.ToggleParmTemplate("isoccluder", "Is Occluder", 0))
	folder.addParmTemplate(hou.ToggleParmTemplate("isoccludable", "Can Be Occluded", 1))
	folder.addParmTemplate(hou.ToggleParmTemplate("castshadows", "Cast Shadows", 0))
	folder.addParmTemplate(hou.FloatParmTemplate("drawdistance", "Draw Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("shadowdistance", "Shadow Distance", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("lodbias", "LOD Bias", 1 ,(1.0,)) )
	folder.addParmTemplate(hou.FloatParmTemplate("maxlights", "Max Lights", 1 ) )

	folder.addParmTemplate(hou.IntParmTemplate("viewmask", "View Mask",1,(-1,)))
	folder.addParmTemplate(hou.IntParmTemplate("lightmask", "Light Mask",1,(-1,)))
	folder.addParmTemplate(hou.IntParmTemplate("shadowmask", "Shadow Mask",1,(-1,)))
	folder.addParmTemplate(hou.IntParmTemplate("zonemask", "Zone Mask",1,(-1,)))
	folder.addParmTemplate(hou.IntParmTemplate("occlodlevel", "Occ LOD Level",1,(-1,)))
	
	group.append(folder)
	n.setParmTemplateGroup(group)
    def process(self, context, plugin):

        # 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 = pyblish.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)
Ejemplo n.º 27
0
def pathParm(p, parent=None):
    name = parmName(p.name, prefix=parent)
    label = parmLabel(p)
    default = ([p.defaultValue.value])
    parm = hou.StringParmTemplate(name,
                                  label,
                                  1,
                                  default_value=default,
                                  naming_scheme=hou.parmNamingScheme.Base1,
                                  string_type=hou.stringParmType.FileReference,
                                  help=p.description,
                                  **presetsMenuArgs(p))

    return {'name': name, 'tuple': parm, 'initialValue': [p.getTypedValue()]}
Ejemplo n.º 28
0
 def InitTask(self, taskPathName, projData):
     obj = hou.node("/obj")
     taskGrpName = btpVfxProject.TaskNodeNameByTaskPathName(taskPathName)
     taskNode = obj.createNode("geo", node_name=taskGrpName)
     fileObj = hou.node("/obj/%s/file1" % taskGrpName)
     fileObj.destroy()
     taskNode.addSpareParmTuple(
         hou.StringParmTemplate("taskPath", "taskPath", 1))
     taskNode.addSpareParmTuple(
         hou.StringParmTemplate("version", "version", 1))
     taskNode.addSpareParmTuple(
         hou.StringParmTemplate("projName", "projName", 1))
     taskNode.setParms({
         "taskPath": taskPathName,
         "projName": btpVfxProject.ProjName(),
         "version": "0"
     })
     projInfo = btpVfxProject.ProjInfo()
     hou.setFps({"film": 24, "ntsc": 30, "pal": 25}[projInfo["fps"]])
     taskCamNode = obj.createNode("cam", node_name="%s_Cam" % taskGrpName)
     taskCamNode.setParms({
         "resx": float(projInfo["resW"]),
         "resy": float(projInfo["resH"])
     })
Ejemplo n.º 29
0
def c_collisionshape(n):
	group = n.parmTemplateGroup()
	folder = hou.FolderParmTemplate("folder", "Collision Shape Component")
	
	folder.addParmTemplate(hou.MenuParmTemplate("shapetype", "Shape Type",("Box","Sphere","StaticPlane","Cylinder","Capsule","Cone","TriangleMesh","ConvexHull","Terrain",)))
	folder.addParmTemplate(hou.FloatParmTemplate("size", "Size",3,(1.0,1.0,1.0,)))
	folder.addParmTemplate(hou.FloatParmTemplate("offsetposition", "Offset Position",3))
	folder.addParmTemplate(hou.FloatParmTemplate("offsetrotation", "Offset Rotation",3))
	folder.addParmTemplate(hou.StringParmTemplate("model", "Model", 1))
	folder.addParmTemplate(hou.FloatParmTemplate("lodlevel", "LOD Level", 1 ) )
	folder.addParmTemplate(hou.FloatParmTemplate("collisionmargin", "Collision Margin", 1 ,(0.04,)) )
	folder.addParmTemplate(hou.FloatParmTemplate("customnodeid", "CustomGeometry NodeID", 1 ) )

	group.append(folder)
	n.setParmTemplateGroup(group)
Ejemplo n.º 30
0
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)