Ejemplo n.º 1
0
def _addVRayFolder(ptg):
    vrayFolder = hou.FolderParmTemplate("vray_folder", VRAY_FOLDER)

    vfh_attrs.insertInFolderAfterLastTab(ptg, ptg, vrayFolder)

    vrayFolder = ptg.findFolder(VRAY_FOLDER)
    vrayFolder.setName("vray_folder")
Ejemplo n.º 2
0
def add_physical_camera_attributes():
    physCamPlugID = 'CameraPhysical'
    CameraPhysicalDesc = vfh_json.getPluginDesc(physCamPlugID)

    if not CameraPhysicalDesc:
        sys.stderr.write("CameraPhysical plugin description is not found!\n")

    else:
        physCamTabName = "V-Ray Physical Camera"

        for node in hou.selectedNodes():
            if node.type().name() == "cam":
                sys.stdout.write(
                    "Adding \"Physical Camera\" attributes to \"%s\"...\n" %
                    node.name())

                ptg = node.parmTemplateGroup()

                if not ptg.findFolder(physCamTabName):
                    vfh_attrs.insertInFolderAfterLastTab(
                        ptg, ptg,
                        hou.FolderParmTemplate("vray.%s" % physCamPlugID,
                                               physCamTabName))

                vfh_attrs.addPluginParms(ptg,
                                         CameraPhysicalDesc,
                                         parmPrefix=physCamPlugID,
                                         parmFolder=physCamTabName)
                node.setParmTemplateGroup(ptg)

                # Set "Use" by default.
                node.parm("CameraPhysical_use").set(True)
Ejemplo n.º 3
0
def _addVRayDisplacementFolder(ptg):
    vrayFolder = ptg.findFolder(VRAY_FOLDER)
    assert vrayFolder

    dispFolder = hou.FolderParmTemplate("vray_displ_folder_main",
                                        "Displacement")
    dispFolder.setName("vray_displ_folder_main")

    vfh_attrs.insertInFolderAfterLastTab(ptg, vrayFolder, dispFolder)
Ejemplo n.º 4
0
def addVRayDisplamentParamTemplate(ptg):
    if not ptg.findFolder("V-Ray"):
        vfh_attrs.insertInFolderAfterLastTab(ptg, ptg, hou.FolderParmTemplate("vray", "V-Ray"))

    if not ptg.findFolder(("V-Ray", "Displacement")):
        vfh_attrs.insertInFolderAfterLastTab(ptg, ptg.findFolder('V-Ray'), hou.FolderParmTemplate("vray", "Displacement"))

    folder = ("V-Ray", "Displacement")
    # enable displacement
    if not ptg.find("vray_use_displ"):
        params = { }
        params["tags"] = {'spare_category': 'vray'}
        params["default_value"] = False
        params["script_callback_language"] = hou.scriptLanguage.Python
        ptg.appendToFolder(folder, hou.ToggleParmTemplate("vray_use_displ", "Use Displacement", **params))

    # displacement type
    if not ptg.find("vray_displ_type"):
        params = { }
        params["tags"] = {'spare_category': 'vray'}
        params["default_value"] = 0
        params["menu_items"]=(['0', '1', '2'])
        params["menu_labels"]=(['From Shop Net', 'Displaced', 'Smoothed'])
        params["conditionals"]={hou.parmCondType.DisableWhen: "{ vray_use_displ == 0 }"}
        params["script_callback_language"] = hou.scriptLanguage.Python
        ptg.appendToFolder(folder, hou.MenuParmTemplate("vray_displ_type", "Displacement Type", **params))

    # params for vray_displ_type = 'shopnet'
    if not ptg.findFolder("shopnet"):
        params = { }
        params["tags"] = {'spare_category': 'vray'}
        params["folder_type"] = hou.folderType.Simple
        params["conditionals"]={hou.parmCondType.HideWhen: "{ vray_displ_type != 0 }"}
        ptg.appendToFolder(folder, hou.FolderParmTemplate("vray", "shopnet",**params))

    shopnetFolder = ("V-Ray", "Displacement", "shopnet")
    if not ptg.find("vray_displshoppath"):
        params = { }
        params["string_type"] = hou.stringParmType.NodeReference
        params["tags"] = {'spare_category': 'vray', 'opfilter': '!!SHOP!!', 'oprelative': '.'}
        params["script_callback_language"] = hou.scriptLanguage.Python
        params["conditionals"]={hou.parmCondType.HideWhen: "{ vray_displ_type != 0 }", hou.parmCondType.DisableWhen: "{ vray_use_displ == 0 }"}
        ptg.appendToFolder(shopnetFolder, hou.StringParmTemplate("vray_displshoppath", "Shop path", 1, **params))

        # params for vray_displ_type = 'GeomDisplacedMesh'
    if not ptg.findFolder("gdm"):
        params = { }
        params["tags"] = {'spare_category': 'vray'}
        params["folder_type"] = hou.folderType.Simple
        params["conditionals"]={hou.parmCondType.HideWhen: "{ vray_displ_type != 1 }"}
        ptg.appendToFolder(folder, hou.FolderParmTemplate("vray", "gdm",**params))

    gdmFolder = ("V-Ray", "Displacement", "gdm")
    displDesc = vfh_json.getPluginDesc('GeomDisplacedMesh')
    paramDescList = filter(lambda parmDesc: parmDesc['attr'] != 'displacement_tex_float', displDesc['PluginParams'])
    for parmDesc in paramDescList:
        vfh_attrs.addPluginParm(ptg, parmDesc, parmPrefix = 'GeomDisplacedMesh', parmFolder = gdmFolder)

    # params for vray_displ_type = 'GeomStaticSmoothedMesh'
    if not ptg.findFolder("gssm"):
        params = { }
        params["tags"] = {'spare_category': 'vray'}
        params["folder_type"] = hou.folderType.Simple
        params["conditionals"]={hou.parmCondType.HideWhen: "{ vray_displ_type != 2}"}
        ptg.appendToFolder(folder, hou.FolderParmTemplate("vray", "gssm",**params))

    gssmFolder = ("V-Ray", "Displacement", "gssm")

    subdivDesc = vfh_json.getPluginDesc('GeomStaticSmoothedMesh')
    paramDescList = filter(lambda parmDesc: parmDesc['attr'] != 'displacement_tex_float', subdivDesc['PluginParams'])
    for parmDesc in paramDescList:
        vfh_attrs.addPluginParm(ptg, parmDesc, parmPrefix = 'GeomStaticSmoothedMesh', parmFolder = gssmFolder)