Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Feb 21, 2022
1 parent 9294a21 commit fe4a15d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 127 deletions.
6 changes: 2 additions & 4 deletions openpype/hosts/houdini/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
lsattrs,
read,

maintained_selection,
unique_name
maintained_selection
)


Expand All @@ -51,8 +50,7 @@
"lsattrs",
"read",

"maintained_selection",
"unique_name"
"maintained_selection"
]

# Backwards API compatibility
Expand Down
123 changes: 0 additions & 123 deletions openpype/hosts/houdini/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,65 +99,6 @@ def get_id_required_nodes():
return list(nodes)


def get_additional_data(container):
"""Not implemented yet!"""
return container


def set_parameter_callback(node, parameter, language, callback):
"""Link a callback to a parameter of a node
Args:
node(hou.Node): instance of the nodee
parameter(str): name of the parameter
language(str): name of the language, e.g.: python
callback(str): command which needs to be triggered
Returns:
None
"""

template_grp = node.parmTemplateGroup()
template = template_grp.find(parameter)
if not template:
return

script_language = (hou.scriptLanguage.Python if language == "python" else
hou.scriptLanguage.Hscript)

template.setScriptCallbackLanguage(script_language)
template.setScriptCallback(callback)

template.setTags({"script_callback": callback,
"script_callback_language": language.lower()})

# Replace the existing template with the adjusted one
template_grp.replace(parameter, template)

node.setParmTemplateGroup(template_grp)


def set_parameter_callbacks(node, parameter_callbacks):
"""Set callbacks for multiple parameters of a node
Args:
node(hou.Node): instance of a hou.Node
parameter_callbacks(dict): collection of parameter and callback data
example: {"active" :
{"language": "python",
"callback": "print('hello world)'"}
}
Returns:
None
"""
for parameter, data in parameter_callbacks.items():
language = data["language"]
callback = data["callback"]

set_parameter_callback(node, parameter, language, callback)


def get_output_parameter(node):
"""Return the render output parameter name of the given node
Expand Down Expand Up @@ -189,19 +130,6 @@ def get_output_parameter(node):
raise TypeError("Node type '%s' not supported" % node_type)


@contextmanager
def attribute_values(node, data):

previous_attrs = {key: node.parm(key).eval() for key in data.keys()}
try:
node.setParms(data)
yield
except Exception as exc:
pass
finally:
node.setParms(previous_attrs)


def set_scene_fps(fps):
hou.setFps(fps)

Expand Down Expand Up @@ -349,10 +277,6 @@ def render_rop(ropnode):
raise RuntimeError("Render failed: {0}".format(exc))


def children_as_string(node):
return [c.name() for c in node.children()]


def imprint(node, data):
"""Store attributes with value on a node
Expand Down Expand Up @@ -473,53 +397,6 @@ def read(node):
parameter in node.spareParms()}


def unique_name(name, format="%03d", namespace="", prefix="", suffix="",
separator="_"):
"""Return unique `name`
The function takes into consideration an optional `namespace`
and `suffix`. The suffix is included in evaluating whether a
name exists - such as `name` + "_GRP" - but isn't included
in the returned value.
If a namespace is provided, only names within that namespace
are considered when evaluating whether the name is unique.
Arguments:
format (str, optional): The `name` is given a number, this determines
how this number is formatted. Defaults to a padding of 2.
E.g. my_name01, my_name02.
namespace (str, optional): Only consider names within this namespace.
suffix (str, optional): Only consider names with this suffix.
Example:
>>> name = hou.node("/obj").createNode("geo", name="MyName")
>>> assert hou.node("/obj/MyName")
True
>>> unique = unique_name(name)
>>> assert hou.node("/obj/{}".format(unique))
False
"""

iteration = 1

parts = [prefix, name, format % iteration, suffix]
if namespace:
parts.insert(0, namespace)

unique = separator.join(parts)
children = children_as_string(hou.node("/obj"))
while unique in children:
iteration += 1
unique = separator.join(parts)

if suffix:
return unique[:-len(suffix)]

return unique


@contextmanager
def maintained_selection():
"""Maintain selection during context
Expand Down

0 comments on commit fe4a15d

Please sign in to comment.