OX Node Class
This page includes the class method documenatation for the OXNode class and ParmTemplate mix-in class.
- class ox.base_objects.ox_node.OXNode(node=None)
- apply_child_parms_dict(children_parms_dict)
Applies a dictionary of child nodes and their parameter values as returned from get_child_parms_dict method
- apply_parms_dict(parms_dict)
Applies the values from a parm dictionary returned by get_parms_as_dict
- child(child_name)
shorthand method for get_child_node_by_name
- connect_from(ox_node=None, input_index=0, out_index=0, input_label=None)
Connects to this node’s input from another ox node’s output. use input_label over input_index whenever possible.
- copy_node(new_name_postfix=None, destination_node: Optional[hou.Node] = None, delete_if_exists=False, keep_existing_parm_values=False, return_ox=True, keep_existing_children_parm_values=False)
Copies a node to a destination with optional behaviors
- create_node(node_type_name, node_name=None) hou.Node
Creates a child node. It’s better to create nodes using the ‘nodes’ package.
- create_node_if_not_exists(ox_node_class=None, ox_node_type=None, node_name=None) hou.Node
Creates a child node, but only if it does not already exist. need to pass in either ox_node_class or ox_node_type str
- create_ox_node_if_not_exists(ox_node_class, node_name=None)
shortcut method that will go ahead and create and return an ox node
- delete_all_child_nodes()
delete all child nodes. Keep in mind this might not delete everything within a node network. See “delete_all_items” method
- delete_all_items()
deletes all items within the node
- delete_child_node_by_name(child_name, expect_child_node=True)
Deletes a child node matching the child_name. will raise an exception if no child is found and excpect_child_node is True
- Parameters:
expect_child_node – this is another parm
- delete_node()
A simple method to delete the current node. Also see destroy_node method
- delete_parms_by_name(parm_name_list: List[str])
Deletes all parameters by list of parm names
- delete_preset(node_path, preset_name, preset_path=None)
Deletes a preset. uses default preset path when preset_path not specified
- destroy_node()
A simple method to delete the current node. Also see delete_node method
- get_child_by_node_type(node_type, substring=None, expect_match=False, only_one_match=True)
WARNING: TO BE DEPRICATED. this is redundant and poorly named. use get_child_node_by_type instead
- get_child_node_by_name(child_name) hou.Node
Returns a matching child node, if it exists, else None is returned
- get_child_node_by_partial_name(substring, exclude_substring=None, case_sensitive=True) hou.Node
Searches for a child node by substring. Returns the first match.
- get_child_node_by_type(node_type, substring=None, expect_match=False)
Returns the first matching child node of node_type parameter
- get_child_node_paths_by_partial_name(substring) List[str]
Returns child node paths based on child nodes matched to the substring
- get_child_nodes() List[hou.Node]
Returns all child nodes
- get_child_nodes_by_partial_name(substring, exclude_substring=None, case_sensitive=True) List[hou.Node]
Returns a list of child nodes matched by substring
- get_child_nodes_by_regex(regex_str)
Returns all nodes with names that match the regular expression
- get_child_nodes_by_type(node_type, substring=None, expect_match=False)
Returns all child nodes mathcing specified type.
- get_child_ox_node_by_name(child_name, node_class=None)
Returns a child ox node matching the child_hame parameter.
- get_child_ox_node_by_type(node_class, expect_match=False)
Returns the first matching child node as ox node of node_type parameter
- get_child_parms_dict(node_list: Optional[List[hou.Node]] = None, exclude_type_list: Optional[List[str]] = None)
exclude_type_list: a list of types (from node.type() values) to exclude from the parms dict handy method that gets all children nodes and parameters as a dict to reaply later or to another node.
- get_connected_input_node_by_index(index=0) hou.Node
Returns the node connected to the specified input index
- get_connected_output_node_by_index(index=0) hou.Node
Returns the node connected to the specified output index
- get_displayed_child_node() hou.Node
Returns displayed child node.
- get_folder_labels()
Returns top-level folder labels.
- get_input_connections_count()
returns number of connected input connections
- get_input_connections_node_name_list()
Returns a list of node names of the connected input nodes
- get_input_label_index(label)
Given an input label, returns the input index value
- get_input_labels()
Gets all input labels for the node
- get_parent_network_box()
Returns the parent Network box this node is contained in.
- get_parm_labels()
Returns all parm labels
- get_parm_names()
Returns all parm names
- get_parm_names_by_substring(substring)
Returns all parm names that match the substring
- get_parms() List[hou.Parm]
Gets all parms
- get_parms_as_dict(substring=None, as_raw_value=False)
returns all parameters as a dictionary with the parm name as key and parm value as the value. If a substring is specified, this will only match parameter names with that substring
- get_parms_by_name_substring(substring, ends_with=False, starts_with=False) List[hou.parm]
Returns all parms that match the specified substring
- get_parms_by_regex(regex_str)
Returns all parms that match the regular expression
- get_planes()
Returns planes. Heightfield Masks are held as planes. Not sure what else this is fore.
- get_prim_groups()
Returns the primative group names
- get_prim_int_values(prim_name)
Returns primative integer values by prim name
- get_prim_values_by_field(field, filter_out_blank_values=True)
Returns primative values by specified field
- has_child_with_name(child_name) bool
Checks for child match by exact name
- has_child_with_node_type(node_type, expect_match=False) bool
Checks for a child match by node type
- is_display_flag_set()
Checks to see if display flag is set
- layout_children()
Auto-layout children
- load_preset(preset_name=None)
Loads a preset. if no preset name specified, just use the node name. This is a good default for many use cases
- move_node_relative_to(ox_node, x=0, y=-1, unit_multiplier=1)
a handy method that will move this node relative to another node. The default moves the node below the relative node
- remove_parms_by_name_substring(substring, ends_with=False, starts_with=False)
Removes all parms by name that match a substring
- rename_node(new_name)
Alternative to ‘set_name’ with more debugging if needed.
- save_preset(preset_name, preset_path, node_path=None)
Saves a preset
- select_node(on=True)
” Set node as selected
- set_bypass_flag(on=True)
Sets the bypass flag
- set_color(color)
Can pass in a tuple for RGB values or a hou.Color object.
- set_display_and_render_flags(on=True)
Sets the display and render flags
- set_display_flag(on=True)
Sets the display flag
- set_name(new_name)
Sets the node name
- set_render_flag(on=True)
Sets the render flag
- unlock_node()
Allows editing of node contents.
Parm Template Class
- class ox.base_objects.parm_templates.ParmTemplate(node)
- add_folder(folder_label, folder_name, as_first=False)
Adds a folder to a node.
- add_parm_template(parm_template, folder_label=None, as_first=False, insert_after_parm=None, insert_before_parm=None, return_type=None, supress_logger=False) hou.Parm
Adds a parm template to a node. if folder_label is specified, as_first, insert_after_parm, and insert_before_parm are not relavant as those will dictate which folder a parm template is added to.
- Parameters:
folder_label – When specified, the parm_template will be added to the folder by label string.
as_first – Will insert this parameter as the first in the node.
insert_after_parm – This can be a parm object or the name of a parm after which you insert the new parm template
insert_before_parm – same as insert_after_parm but before.
return_type – Return types may vary depending on the type of parm template. Add logic as neccisary. Options: * ‘color’ # for color parm templates
supress_logger – For specific expected error logging that may intentionally be supressed
- add_parm_template_if_not_exist(parm_template, **kwargs)
Only adds the parm template if it does not already exist
- add_parm_template_to_sub_folder()
TODO: Need to implement this.
- add_parm_template_with_override(parm_template, folder_label=None, as_first=False, insert_after_parm=None, insert_before_parm=None, return_type=None, keep_original_value=True) hou.Parm
This method will delete the parm method if it already exists and can reapply the previous value to the newly created parm
- create_button_parm_template(name, label, join_with_next=False, script_callback=None, script_callback_language=hou.scriptLanguage.Python, **kwargs)
Creates a button parameter template
- create_color_tuple_parm_template(name, label=None, default_value=[1, 1, 1], is_label_hidden=False, join_with_next=False)
creates a color tuple parameter template
- create_float_parm_template(name, label=None, num_components=1, default_value=(), min=0.0, max=10.0, min_is_strict=False, max_is_strict=False, is_label_hidden=False, join_with_next=False, **kwargs)
Creates a float parameter template
- create_folder_parm_template(name, label=None) hou.FolderParmTemplate
Creates a folder parameter template
- create_int_parm_template(name, label=None, num_components=1, default_value=(), min=0, max=10, help=None, is_label_hidden=False, join_with_next=False, **kwargs)
Creates an integer parameter template
Creates a menu parameter template
- create_operator_parm_template(name, label=None, num_components=1, is_label_hidden=False, join_with_next=False, **kwargs)
Creates an operator parameter template
- create_ramp_parm_template(name, label, ramp_parm_type=hou.rampParmType.Float, **kwargs)
Creates a ramp parameter template
- create_separator_parm_template(name, **kwargs)
Creates a separator parameter template
- create_string_parm_template(name, label=None, num_components=1, multiline=False, join_with_next=False, script_callback=None, script_callback_language=hou.scriptLanguage.Python, tags=None, is_label_hidden=False, default_value=(), **kwargs)
Creates a string parameter template
- create_toggle_parm_template(name, label=None, default_value=False, is_label_hidden=False, join_with_next=False, **kwargs)
Creates a toggle parameter template
- create_vex_snippet_parm_template(name, label=None, **kwargs) hou.StringParmTemplate
This is pretty much just the attribute wrangle vex parameter .asCode() I have not been able to get this to work properly. TODO: figure out how to implement this correctly
- delete_folder(folder_label)
Deletes a top-level folder
- get_entry_labels()
Retruns a list of entry labels. TODO: explain what an entry is
- get_folder_name_by_label(label)
Returns the folder name by label. Note that folder names are auto-generated and may be unexpected values that don’t line up the way you think they would
- get_folder_parm_labels(folder_label)
Returns the parm labels of a folder
- get_folder_parm_templates_by_label(folder_label)
Returns the folder parm templates given the folder label string
- get_folder_parms_by_label(folder_label) List[hou.Parm]
Returns parms of a folder
- get_folder_template(folder_label)
Returns as folder’s template by folder label
- get_parm_template_by_label(label)
Returns a parm template by label
- get_parm_template_names_by_substring(substring)
Returns parm template names matched by specified substring
- get_parm_templates_by_type(template_type)
Returns list of parm templates by type. template types can be found in ox.constants.parm_template_types
- get_sub_folder_parm_value_dict_by_folder_labels(parent_folder_label, folder_label) dict
Returns a dictionary of parm names and values for the subfolder
- remove_folder_by_label(label)
Removes a folder given the label string
- remove_parm_template_by_name(parm_name, save_template_group=True)
removes a parm template by name
- Parameters:
save_template_group – This parameter lets you hold off on saving the template group, which may behave better when removing many parms
- remove_subfolder_by_labels(parent_folder_label, folder_label)
Removes a subfolder by parent and subfolder labels