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 bugfix/OP-6951_resolve_db_duration_calcul…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
jakubjezek001 authored Nov 28, 2023
2 parents 7c25e4a + 5068b65 commit 2511006
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 38 deletions.
14 changes: 9 additions & 5 deletions openpype/hosts/fusion/plugins/publish/extract_render_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,24 @@ def enabled_savers(comp, savers):
"""
passthrough_key = "TOOLB_PassThrough"
original_states = {}
enabled_save_names = {saver.Name for saver in savers}
enabled_saver_names = {saver.Name for saver in savers}

all_savers = comp.GetToolList(False, "Saver").values()
savers_by_name = {saver.Name: saver for saver in all_savers}

try:
all_savers = comp.GetToolList(False, "Saver").values()
for saver in all_savers:
original_state = saver.GetAttrs()[passthrough_key]
original_states[saver] = original_state
original_states[saver.Name] = original_state

# The passthrough state we want to set (passthrough != enabled)
state = saver.Name not in enabled_save_names
state = saver.Name not in enabled_saver_names
if state != original_state:
saver.SetAttrs({passthrough_key: state})
yield
finally:
for saver, original_state in original_states.items():
for saver_name, original_state in original_states.items():
saver = savers_by_name[saver_name]
saver.SetAttrs({"TOOLB_PassThrough": original_state})


Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/harmony/api/TB_sceneOpened.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var LD_OPENHARMONY_PATH = System.getenv('LIB_OPENHARMONY_PATH');
LD_OPENHARMONY_PATH = LD_OPENHARMONY_PATH + '/openHarmony.js';
LD_OPENHARMONY_PATH = LD_OPENHARMONY_PATH.replace(/\\/g, "/");
include(LD_OPENHARMONY_PATH);
this.__proto__['$'] = $;
//this.__proto__['$'] = $;

function Client() {
var self = this;
Expand Down
4 changes: 2 additions & 2 deletions openpype/hosts/harmony/plugins/publish/extract_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def process(self, instance):

args = [application_path, "-batch",
"-frames", str(frame_start), str(frame_end),
"-scene", scene_path]
self.log.info(f"running [ {application_path} {' '.join(args)}")
scene_path]
self.log.info(f"running: {' '.join(args)}")
proc = subprocess.Popen(
args,
stdout=subprocess.PIPE,
Expand Down
11 changes: 3 additions & 8 deletions openpype/hosts/maya/plugins/inventory/import_modelrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def is_compatible(container):
)

def process(self, containers):
from maya import cmds
from maya import cmds # noqa: F401

project_name = get_current_project_name()
for container in containers:
Expand Down Expand Up @@ -66,7 +66,7 @@ def assign_model_render_by_version(self, nodes, version_id):
None
"""

from maya import cmds
from maya import cmds # noqa: F401

project_name = get_current_project_name()
repre_docs = get_representations(
Expand All @@ -85,12 +85,7 @@ def assign_model_render_by_version(self, nodes, version_id):
if scene_type_regex.fullmatch(repre_name):
look_repres.append(repre_doc)

# QUESTION should we care if there is more then one look
# representation? (since it's based on regex match)
look_repre = None
if look_repres:
look_repre = look_repres[0]

look_repre = look_repres[0] if look_repres else None
# QUESTION shouldn't be json representation validated too?
if not look_repre:
print("No model render sets for this model version..")
Expand Down
1 change: 1 addition & 0 deletions openpype/hosts/maya/plugins/load/load_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def _lock_camera_transforms(self, nodes):
class MayaUSDReferenceLoader(ReferenceLoader):
"""Reference USD file to native Maya nodes using MayaUSDImport reference"""

label = "Reference Maya USD"
families = ["usd"]
representations = ["usd"]
extensions = {"usd", "usda", "usdc"}
Expand Down
58 changes: 36 additions & 22 deletions openpype/hosts/maya/plugins/publish/collect_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,23 @@ def get_pxr_multitexture_file_attrs(node):
"PxrTexture": "filename"
}

RENDER_SET_TYPES = [
"VRayDisplacement",
"VRayLightMesh",
"VRayObjectProperties",
"RedshiftObjectId",
"RedshiftMeshParameters",
]

# Keep only node types that actually exist
all_node_types = set(cmds.allNodeTypes())
for node_type in list(FILE_NODES.keys()):
if node_type not in all_node_types:
FILE_NODES.pop(node_type)

for node_type in RENDER_SET_TYPES:
if node_type not in all_node_types:
RENDER_SET_TYPES.remove(node_type)
del all_node_types

# Cache pixar dependency node types so we can perform a type lookup against it
Expand All @@ -69,9 +81,7 @@ def get_attributes(dictionary, attr, node=None):
else:
val = dictionary.get(attr, [])

if not isinstance(val, list):
return [val]
return val
return val if isinstance(val, list) else [val]


def get_look_attrs(node):
Expand Down Expand Up @@ -106,14 +116,15 @@ def get_look_attrs(node):


def node_uses_image_sequence(node, node_path):
# type: (str) -> bool
# type: (str, str) -> bool
"""Return whether file node uses an image sequence or single image.
Determine if a node uses an image sequence or just a single image,
not always obvious from its file path alone.
Args:
node (str): Name of the Maya node
node_path (str): The file path of the node
Returns:
bool: True if node uses an image sequence
Expand Down Expand Up @@ -247,7 +258,7 @@ def get_file_node_files(node):

# For sequences get all files and filter to only existing files
result = []
for index, path in enumerate(paths):
for path in paths:
if node_uses_image_sequence(node, path):
glob_pattern = seq_to_glob(path)
result.extend(glob.glob(glob_pattern))
Expand Down Expand Up @@ -358,6 +369,7 @@ def collect(self, instance):
for attr in shader_attrs:
if cmds.attributeQuery(attr, node=look, exists=True):
existing_attrs.append("{}.{}".format(look, attr))

materials = cmds.listConnections(existing_attrs,
source=True,
destination=False) or []
Expand All @@ -367,30 +379,32 @@ def collect(self, instance):
self.log.debug("Found the following sets:\n{}".format(look_sets))
# Get the entire node chain of the look sets
# history = cmds.listHistory(look_sets, allConnections=True)
history = cmds.listHistory(materials, allConnections=True)
# if materials list is empty, listHistory() will crash with
# RuntimeError
history = set()
if materials:
history = set(
cmds.listHistory(materials, allConnections=True))

# Since we retrieved history only of the connected materials
# connected to the look sets above we now add direct history
# for some of the look sets directly
# handling render attribute sets
render_set_types = [
"VRayDisplacement",
"VRayLightMesh",
"VRayObjectProperties",
"RedshiftObjectId",
"RedshiftMeshParameters",
]
render_sets = cmds.ls(look_sets, type=render_set_types)
if render_sets:
history.extend(
cmds.listHistory(render_sets,
future=False,
pruneDagObjects=True)
or []
)

# Maya (at least 2024) crashes with Warning when render set type
# isn't available. cmds.ls() will return empty list
if RENDER_SET_TYPES:
render_sets = cmds.ls(look_sets, type=RENDER_SET_TYPES)
if render_sets:
history.update(
cmds.listHistory(render_sets,
future=False,
pruneDagObjects=True)
or []
)

# Ensure unique entries only
history = list(set(history))
history = list(history)

files = cmds.ls(history,
# It's important only node types are passed that
Expand Down
6 changes: 6 additions & 0 deletions openpype/pipeline/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
deregister_plugin_path
)

from .load.utils import get_representation_path_from_context


class LauncherAction(object):
"""A custom action available"""
Expand Down Expand Up @@ -100,6 +102,10 @@ def process(self, containers):
"""
return True

@classmethod
def filepath_from_context(cls, context):
return get_representation_path_from_context(context)


# Launcher action
def discover_launcher_actions():
Expand Down

0 comments on commit 2511006

Please sign in to comment.