mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
added context function for attributes
This commit is contained in:
parent
4653cabb8a
commit
03c111f58d
1 changed files with 23 additions and 3 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import uuid
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
import hou
|
||||
|
||||
from avalon import io
|
||||
from avalon import api, io
|
||||
from avalon.houdini import lib
|
||||
|
||||
|
||||
|
|
@ -81,7 +83,7 @@ def generate_ids(nodes, asset_id=None):
|
|||
|
||||
def get_id_required_nodes():
|
||||
|
||||
valid_types = ["geometry"]
|
||||
valid_types = ["geometry", "geometry"]
|
||||
nodes = {n for n in hou.node("/out").children() if
|
||||
n.type().name() in valid_types}
|
||||
|
||||
|
|
@ -90,4 +92,22 @@ def get_id_required_nodes():
|
|||
|
||||
def get_additional_data(container):
|
||||
"""Not implemented yet!"""
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
@contextmanager
|
||||
def attribute_values(node, data):
|
||||
|
||||
previous_attrs = {key: node.parm(key).eval() for key in data.keys()}
|
||||
print("before", previous_attrs)
|
||||
try:
|
||||
node.setParms(data)
|
||||
during_attrs = {key: node.parm(key).eval() for key in data.keys()}
|
||||
print("during", during_attrs)
|
||||
yield
|
||||
except Exception as exc:
|
||||
print(exc)
|
||||
pass
|
||||
finally:
|
||||
print("reset")
|
||||
node.setParms(previous_attrs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue