Python hou.FolderParmTemplate() Examples

The following are 4 code examples of hou.FolderParmTemplate(). 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: tools.py    From hou_farm with GNU General Public License v3.0 6 votes vote down vote up
def make_top_level_folder(node, name, label):
    """
    Creates a top level folder on a node and places all existing parameters and folders underneath it.

    Args:
        node (hou.RopNode): The ROP to modify
        name (str): The parameter name of the folder
        label (str): The label of the folder

    Returns:
        None
    """
    parm_tg = node.parmTemplateGroup()
    top_folder = hou.FolderParmTemplate(name, label, parm_tg.entries())
    parm_tg.clear()
    parm_tg.addParmTemplate(top_folder)
    node.setParmTemplateGroup(parm_tg) 
Example #2
Source File: tools.py    From hou_farm with GNU General Public License v3.0 5 votes vote down vote up
def create_rop_parameters(script_args, farm_name, rop_node, error_list_obj=None):
    """
    Creates parameters on a specific ROP and farm

    Args:
        script_args (dict): The Houdini "kwargs" dictionary
        farm_name (str): Name of the farm integration. Lowercase. Must match the name of the farm module. E.g. "deadline"
        rop_node (hou.Node): A ROP node (in any context)
        error_list_obj (RopErrorList): An instance of RopErrorList class to store any errors or warnings

    Returns:
        Bool: True if successful, False if the parameter configuration can't be found
    """
    with ErrorList(error_list_obj) as error_list_obj:

        param_list = get_config_parameter_list(farm_name, rop_node)
        if param_list is None:
            err_msg = "Could not load '{0}' ROP {1} parameters from config".format(rop_node.type().name(), farm_name)
            error_list_obj.add(ErrorMessage(err_msg))
            return False

        parm_list = create_parameters_from_list(param_list, farm_name)
        farm_folder = hou.FolderParmTemplate("hf_{0}_folder".format(farm_name), farm_name.title(), parm_list)

        rop_parm_template_group = rop_node.parmTemplateGroup()
        rop_parm_template_group.append(farm_folder)
        rop_node.setParmTemplateGroup(rop_parm_template_group)

        return True 
Example #3
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 #4
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)