A gallery entry is an entity containing data about an operator node setup. It has information about the node’s parameter values, any additional spare parameters, channels, and for subnet nodes the information about the children, etc. Thus, a gallery entry is like a node template or a parameter preset. Such templates can be created from and applied to existing nodes.
A gallery entry is identified by a unique, and has a non-unique label, and is usually associated with a specific hou.NodeType (or several node types) of the nodes to which it applies. In addition to the node information, gallery entries can have own categories that organize them into manageable sets and also can have keywords that identify their purpose. For more information about gallery entries, please see a gallery entry editor.
In order for your gallery entries to appear in the Material Palette pane, they must satisfy two conditions. First, the node category must be set to indicate the gallery entry creates a SHOP node. Use code like:
hou.galleries.galleryEntries("entry_name")[0].setNodeTypeCategory(hou.shopNodeTypeCategory())
The second condition is that the entry must contain one or more keywords that indicate what renderer the SHOP works with. This affects whether the gallery entry appears when a specific renderer is chosen in the Material Palette renderer menu. Even if "All" is chosen in that menu, the gallery entry must contain a keyword that matches one of the renderers that appears in that menu. To associate a gallery entry with the Mantra renderer, do the following:
hou.galleries.galleryEntries("entry_name")[0].setKeywords(('Mantra',))
In HOM the gallery entries can be managed using hou.Gallery.
Methods
allowIconRegeneration()
→ bool
Return True
if this gallery entry wants to let Houdini regenerate the
icon for it automatically using an appropriate renderer. Only applies to
material gallery entries.
applyToNode(node)
Apply the gallery entry to a given node. This method sets the node’s parameter values to match the ones stored by the entry. It may also add spare parameters and channels to the node and for the subnets, it may create new child nodes.
node
A node to which to apply the gallery entry.
bestNodeType()
→ NodeType or None
Return a best node type which this gallery entry is associated with and whose nodes it can be applied to.
canApplyToNode(node)
→ bool
Return True
if this gallery entry can be safely applied to the given node.
See hou.GalleryEntry.applyToNode() for more info.
node
A node to test whether the gallery entry can be applied to.
canCreateChildNode(parent)
→ bool
Return True
if hou.GalleryEntry.createChildNode() can succeed.
categories()
→ tuple of strings
Return the categories this gallery entry subscribes to.
createChildNode(parent)
→ Node
Create a new node in the parent network and then apply this gallery entry to that newly created node.
parent
A subnetwork within which the new node should be created. If None
,
an implicit natural parent is chosen using a node type this
gallery entry is associated with.
description()
→ string
Return a description of the gallery entry. A description is a short string that states the gallery entry purpose. It is used for tool-tip pop-ups.
helpURL()
→ string
Return the URL of the help document for this gallery entry.
icon()
→ string
Return the icon name or a icon file path that should be used for this gallery entry.
keywords()
→ tuple of strings
Return the keywords that describe this gallery entry.
label()
→ str
Return the gallery entry label.
name()
→ string
Return the gallery entry name.
nodeTypeCategory()
→ NodeTypeCategory
Return the category of the node types this gallery entry is associated with.
nodeTypeNames()
→ tuple of strings
Return the names of the node type this gallery is associated with. The gallery can be safely applied to the nodes of these types.
requiredHDAFile()
→ string
Return a file path to an HDA library that should be loaded before trying to apply this gallery entry. It is often used for gallery entries associated with a non-native operator type.
script()
→ string
Return a script that modifies the node parameters to match the information stored in the gallery entry.
setAllowIconRegeneration(allow)
Sets the allow icon regneration flag on this gallery entry.
setCategories(categories)
Set the categories this gallery entry subscribes to.
categories
A string with comma separated categories to set the gallery entry to.
setContentsFromNode(node)
Save the information about the node contents (i.e., child nodes). When applying the node entry later on, these nodes will be reconstructed in a new parent to match the contents of the current parent.
node
The parent of the nodes whose data should be saved.
setDescription(description)
Set the description of the gallery entry.
description
The text briefly describing the gallery entry purpose.
setEqual(entry)
Set this gallery entry to be exactly the same as the given entry, except for the name, which is left unchanged.
entry
The gallery entry to copy the information from.
setHelpURL(helpurl)
Set the URL of the help document for this gallery entry.
setIcon(icon)
Set the icon name or an icon file path that should be used for this gallery entry.
setKeywords(keywords)
Set the keywords that describe this gallery entry.
keywords
A string containing a white-space separated list of keywords.
setLabel(label)
Set the gallery entry label.
label
The label string.
setName(name)
Set the gallery entry name.
name
The name string.
setNodeTypeCategory(category)
Set the category of the node types this gallery entry should be associated with.
category
A hou.NodeTypeCategory to associate this gallery entry with.
setNodeTypeNames(nodetypes)
Set the names of the node types this gallery should be associated with.
nodetypes
A string containing white-space separated list of node type names.
setRequiredHDAFile(hda_file)
Set a file path to an HDA library on which this gallery entry depends.
hda_file
A path of the HDA library file (OTL).
setScript(script)
Set a script that modifies the parameters when the gallery entry is applied to a node.
script
A string that contains the commands setting the node’s parameters.
setScriptFromNode(node)
Set a script that modifies node parameters. Later on, when applying this gallery entry to a node, the script will reconstruct that node’s parameters to match exactly the parameters of a node passed to this method.
node
A node object from which to build the script.