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

Commit

Permalink
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
Browse files Browse the repository at this point in the history
…cache-Animation-family
  • Loading branch information
Minkiu committed Dec 12, 2023
2 parents 0e905f3 + d66bac0 commit cd26a89
Show file tree
Hide file tree
Showing 302 changed files with 8,074 additions and 3,394 deletions.
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ body:
label: Version
description: What version are you running? Look to OpenPype Tray
options:
- 3.17.7-nightly.7
- 3.17.7-nightly.6
- 3.17.7-nightly.5
- 3.17.7-nightly.4
- 3.17.7-nightly.3
- 3.17.7-nightly.2
- 3.17.7-nightly.1
- 3.17.6
- 3.17.6-nightly.3
Expand Down Expand Up @@ -129,12 +135,6 @@ body:
- 3.15.3-nightly.3
- 3.15.3-nightly.2
- 3.15.3-nightly.1
- 3.15.2
- 3.15.2-nightly.6
- 3.15.2-nightly.5
- 3.15.2-nightly.4
- 3.15.2-nightly.3
- 3.15.2-nightly.2
validations:
required: true
- type: dropdown
Expand Down
7 changes: 5 additions & 2 deletions openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,15 @@ def run(script):
@click.option("--mongo_url",
help="MongoDB for testing.",
default=None)
@click.option("--dump_databases",
help="Dump all databases to data folder.",
default=None)
def runtests(folder, mark, pyargs, test_data_folder, persist, app_variant,
timeout, setup_only, mongo_url, app_group):
timeout, setup_only, mongo_url, app_group, dump_databases):
"""Run all automatic tests after proper initialization via start.py"""
PypeCommands().run_tests(folder, mark, pyargs, test_data_folder,
persist, app_variant, timeout, setup_only,
mongo_url, app_group)
mongo_url, app_group, dump_databases)


@main.command(help="DEPRECATED - run sync server")
Expand Down
4 changes: 4 additions & 0 deletions openpype/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
get_thumbnail_id_from_source,

get_workfile_info,

get_asset_name_identifier,
)

from .entity_links import (
Expand Down Expand Up @@ -108,4 +110,6 @@
"get_linked_representation_id",

"create_project",

"get_asset_name_identifier",
)
19 changes: 19 additions & 0 deletions openpype/client/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@
from .mongo.entities import *
else:
from .server.entities import *


def get_asset_name_identifier(asset_doc):
"""Get asset name identifier by asset document.
This function is added because of AYON implementation where name
identifier is not just a name but full path.
Asset document must have "name" key, and "data.parents" when in AYON mode.
Args:
asset_doc (dict[str, Any]): Asset document.
"""

if not AYON_SERVER_ENABLED:
return asset_doc["name"]
parents = list(asset_doc["data"]["parents"])
parents.append(asset_doc["name"])
return "/" + "/".join(parents)
2 changes: 1 addition & 1 deletion openpype/client/server/conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def convert_v4_version_to_v3(version):
output_data[dst_key] = version[src_key]

if "createdAt" in version:
created_at = arrow.get(version["createdAt"])
created_at = arrow.get(version["createdAt"]).to("local")
output_data["time"] = created_at.strftime("%Y%m%dT%H%M%SZ")

output["data"] = output_data
Expand Down
82 changes: 57 additions & 25 deletions openpype/client/server/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def _get_subsets(

for subset in con.get_products(
project_name,
subset_ids,
subset_names,
product_ids=subset_ids,
product_names=subset_names,
folder_ids=folder_ids,
names_by_folder_ids=names_by_folder_ids,
active=active,
Expand Down Expand Up @@ -113,23 +113,23 @@ def _get_versions(

queried_versions = con.get_versions(
project_name,
version_ids,
subset_ids,
versions,
hero,
standard,
latest,
version_ids=version_ids,
product_ids=subset_ids,
versions=versions,
hero=hero,
standard=standard,
latest=latest,
active=active,
fields=fields
)

versions = []
version_entities = []
hero_versions = []
for version in queried_versions:
if version["version"] < 0:
hero_versions.append(version)
else:
versions.append(convert_v4_version_to_v3(version))
version_entities.append(convert_v4_version_to_v3(version))

if hero_versions:
subset_ids = set()
Expand Down Expand Up @@ -159,9 +159,9 @@ def _get_versions(
break
conv_hero = convert_v4_version_to_v3(hero_version)
conv_hero["version_id"] = version_id
versions.append(conv_hero)
version_entities.append(conv_hero)

return versions
return version_entities


def get_asset_by_id(project_name, asset_id, fields=None):
Expand All @@ -182,6 +182,19 @@ def get_asset_by_name(project_name, asset_name, fields=None):
return None


def _folders_query(project_name, con, fields, **kwargs):
if fields is None or "tasks" in fields:
folders = get_folders_with_tasks(
con, project_name, fields=fields, **kwargs
)

else:
folders = con.get_folders(project_name, fields=fields, **kwargs)

for folder in folders:
yield folder


def get_assets(
project_name,
asset_ids=None,
Expand All @@ -201,20 +214,39 @@ def get_assets(
fields = folder_fields_v3_to_v4(fields, con)
kwargs = dict(
folder_ids=asset_ids,
folder_names=asset_names,
parent_ids=parent_ids,
active=active,
fields=fields
)
if not asset_names:
for folder in _folders_query(project_name, con, fields, **kwargs):
yield convert_v4_folder_to_v3(folder, project_name)
return

if fields is None or "tasks" in fields:
folders = get_folders_with_tasks(con, project_name, **kwargs)
new_asset_names = set()
folder_paths = set()
for name in asset_names:
if "/" in name:
folder_paths.add(name)
else:
new_asset_names.add(name)

else:
folders = con.get_folders(project_name, **kwargs)
yielded_ids = set()
if folder_paths:
for folder in _folders_query(
project_name, con, fields, folder_paths=folder_paths, **kwargs
):
yielded_ids.add(folder["id"])
yield convert_v4_folder_to_v3(folder, project_name)

for folder in folders:
yield convert_v4_folder_to_v3(folder, project_name)
if not new_asset_names:
return

for folder in _folders_query(
project_name, con, fields, folder_names=new_asset_names, **kwargs
):
if folder["id"] not in yielded_ids:
yielded_ids.add(folder["id"])
yield convert_v4_folder_to_v3(folder, project_name)


def get_archived_assets(
Expand Down Expand Up @@ -507,11 +539,11 @@ def get_representations(

representations = con.get_representations(
project_name,
representation_ids,
representation_names,
version_ids,
names_by_version_ids,
active,
representation_ids=representation_ids,
representation_names=representation_names,
version_ids=version_ids,
names_by_version_ids=names_by_version_ids,
active=active,
fields=fields
)
for representation in representations:
Expand Down
1 change: 1 addition & 0 deletions openpype/hooks/pre_add_last_workfile_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
"tvpaint",
"substancepainter",
"aftereffects",
"wrap"
}
launch_types = {LaunchTypes.local}

Expand Down
3 changes: 2 additions & 1 deletion openpype/hooks/pre_copy_template_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CopyTemplateWorkfile(PreLaunchHook):

# Before `AddLastWorkfileToLaunchArgs`
order = 0
app_groups = {"blender", "photoshop", "tvpaint", "aftereffects"}
app_groups = {"blender", "photoshop", "tvpaint", "aftereffects",
"wrap"}
launch_types = {LaunchTypes.local}

def execute(self):
Expand Down
2 changes: 1 addition & 1 deletion openpype/host/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def get_context_title(self):
if project_name:
items.append(project_name)
if asset_name:
items.append(asset_name)
items.append(asset_name.lstrip("/"))
if task_name:
items.append(task_name)
if items:
Expand Down
23 changes: 13 additions & 10 deletions openpype/hosts/aftereffects/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ def create(self, subset_name_from_ui, data, pre_create_data):
use_composition_name = (pre_create_data.get("use_composition_name") or
len(comps) > 1)
for comp in comps:
composition_name = re.sub(
"[^{}]+".format(SUBSET_NAME_ALLOWED_SYMBOLS),
"",
comp.name
)
if use_composition_name:
if "{composition}" not in subset_name_from_ui.lower():
subset_name_from_ui += "{Composition}"

composition_name = re.sub(
"[^{}]+".format(SUBSET_NAME_ALLOWED_SYMBOLS),
"",
comp.name
)

dynamic_fill = prepare_template_data({"composition":
composition_name})
subset_name = subset_name_from_ui.format(**dynamic_fill)
Expand All @@ -81,14 +80,16 @@ def create(self, subset_name_from_ui, data, pre_create_data):
inst.subset_name))

data["members"] = [comp.id]
data["orig_comp_name"] = composition_name

new_instance = CreatedInstance(self.family, subset_name, data,
self)
if "farm" in pre_create_data:
use_farm = pre_create_data["farm"]
new_instance.creator_attributes["farm"] = use_farm

review = pre_create_data["mark_for_review"]
new_instance.creator_attributes["mark_for_review"] = review
new_instance. creator_attributes["mark_for_review"] = review

api.get_stub().imprint(new_instance.id,
new_instance.data_to_store())
Expand Down Expand Up @@ -150,16 +151,18 @@ def update_instances(self, update_list):
subset_change.new_value)

def remove_instances(self, instances):
"""Removes metadata and renames to original comp name if available."""
for instance in instances:
self._remove_instance_from_context(instance)
self.host.remove_instance(instance)

subset = instance.data["subset"]
comp_id = instance.data["members"][0]
comp = api.get_stub().get_item(comp_id)
orig_comp_name = instance.data.get("orig_comp_name")
if comp:
new_comp_name = comp.name.replace(subset, '')
if not new_comp_name:
if orig_comp_name:
new_comp_name = orig_comp_name
else:
new_comp_name = "dummyCompName"
api.get_stub().rename_item(comp_id,
new_comp_name)
Expand Down
22 changes: 19 additions & 3 deletions openpype/hosts/aftereffects/plugins/create/workfile_creator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from openpype import AYON_SERVER_ENABLED
import openpype.hosts.aftereffects.api as api
from openpype.client import get_asset_by_name
from openpype.pipeline import (
Expand Down Expand Up @@ -43,17 +44,28 @@ def create(self, options=None):
task_name = context.get_current_task_name()
host_name = context.host_name

existing_asset_name = None
if existing_instance is not None:
if AYON_SERVER_ENABLED:
existing_asset_name = existing_instance.get("folderPath")

if existing_asset_name is None:
existing_asset_name = existing_instance["asset"]

if existing_instance is None:
asset_doc = get_asset_by_name(project_name, asset_name)
subset_name = self.get_subset_name(
self.default_variant, task_name, asset_doc,
project_name, host_name
)
data = {
"asset": asset_name,
"task": task_name,
"variant": self.default_variant
}
if AYON_SERVER_ENABLED:
data["folderPath"] = asset_name
else:
data["asset"] = asset_name
data.update(self.get_dynamic_data(
self.default_variant, task_name, asset_doc,
project_name, host_name, None
Expand All @@ -68,14 +80,18 @@ def create(self, options=None):
new_instance.data_to_store())

elif (
existing_instance["asset"] != asset_name
existing_asset_name != asset_name
or existing_instance["task"] != task_name
):
asset_doc = get_asset_by_name(project_name, asset_name)
subset_name = self.get_subset_name(
self.default_variant, task_name, asset_doc,
project_name, host_name
)
existing_instance["asset"] = asset_name
if AYON_SERVER_ENABLED:
existing_instance["folderPath"] = asset_name
else:
existing_instance["asset"] = asset_name

existing_instance["task"] = task_name
existing_instance["subset"] = subset_name
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os

import pyblish.api

from openpype.client import get_asset_name_identifier
from openpype.pipeline.create import get_subset_name


Expand Down Expand Up @@ -48,9 +50,11 @@ def _get_new_instance(self, context, scene_file):
asset_entity = context.data["assetEntity"]
project_entity = context.data["projectEntity"]

asset_name = get_asset_name_identifier(asset_entity)

instance_data = {
"active": True,
"asset": asset_entity["name"],
"asset": asset_name,
"task": task,
"frameStart": context.data['frameStart'],
"frameEnd": context.data['frameEnd'],
Expand Down
Loading

0 comments on commit cd26a89

Please sign in to comment.