mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
update test_create() function
This commit is contained in:
parent
e3d2935d46
commit
838fa0cdab
2 changed files with 15 additions and 3 deletions
|
|
@ -6,6 +6,8 @@ import pyblish.api
|
|||
import ayon_api
|
||||
from ayon_core.pipeline import (
|
||||
get_current_project_name,
|
||||
get_current_folder_path,
|
||||
get_current_task_name,
|
||||
Anatomy,
|
||||
get_current_context,
|
||||
get_current_host_name,
|
||||
|
|
@ -71,6 +73,16 @@ def recursive_validate(valid_action_names):
|
|||
"""
|
||||
context = pyblish.api.Context()
|
||||
context.data["create_context"] = CreateContext(registered_host())
|
||||
project_name = get_current_project_name()
|
||||
folder_path = get_current_folder_path()
|
||||
folder_entity = ayon_api.get_folder_by_path(
|
||||
project_name, folder_path)
|
||||
context.data["folderEntity"] = folder_entity
|
||||
if folder_entity:
|
||||
task_name = get_current_task_name
|
||||
context.data["taskEntity"] = ayon_api.get_task_by_name(
|
||||
project_name, folder_entity["id"], task_name
|
||||
)
|
||||
context = pyblish.util.collect(context)
|
||||
pyblish.util.validate(context)
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ def test_create():
|
|||
hierarchy = {}
|
||||
if "instance_node" in instance.data:
|
||||
members = cmds.sets(instance.data["instance_node"], query=True)
|
||||
print(members)
|
||||
hierarchy[instance.data["instance_node"]] = cmds.ls(
|
||||
members, type="dagNode"
|
||||
)
|
||||
|
|
@ -88,14 +89,13 @@ def test_create():
|
|||
"creator_attributes": creator_attributes
|
||||
}
|
||||
)
|
||||
|
||||
instances_to_remove.append(instance)
|
||||
|
||||
context.remove_instances(instances_to_remove)
|
||||
|
||||
for data in create_data:
|
||||
created_instance = context.create(
|
||||
creator_identifier=creator_identifier,
|
||||
creator_identifier=data["creator_identifier"],
|
||||
variant="Main",
|
||||
pre_create_data={"use_selection": True}
|
||||
)
|
||||
|
|
@ -105,7 +105,7 @@ def test_create():
|
|||
|
||||
cmds.sets(nodes, forceElement=set)
|
||||
if created_instance:
|
||||
for key, value in data.creator_attributes:
|
||||
for key, value in data["creator_attributes"].items():
|
||||
created_instance.creator_attributes[key] = value
|
||||
|
||||
context.save_changes()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue