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 release/3.15.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	openpype/hosts/aftereffects/api/pipeline.py
#	openpype/hosts/photoshop/api/pipeline.py
#	openpype/hosts/photoshop/plugins/create/create_legacy_image.py
#	openpype/modules/deadline/plugins/publish/submit_publish_job.py
  • Loading branch information
iLLiCiTiT committed Dec 16, 2022
2 parents 0d1f7a1 + 0af6df0 commit d3753fe
Show file tree
Hide file tree
Showing 178 changed files with 1,711 additions and 680 deletions.
8 changes: 7 additions & 1 deletion openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ def main(ctx):
It wraps different commands together.
"""

if ctx.invoked_subcommand is None:
ctx.invoke(tray)
# Print help if headless mode is used
if os.environ.get("OPENPYPE_HEADLESS_MODE") == "1":
print(ctx.get_help())
sys.exit(0)
else:
ctx.invoke(tray)


@main.command()
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/aftereffects/api/launch_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
WebSocketAsync
)

from Qt import QtCore
from qtpy import QtCore

from openpype.lib import Logger
from openpype.pipeline import legacy_io
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/aftereffects/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
from functools import partial

from Qt import QtWidgets
from qtpy import QtWidgets

from openpype.pipeline import install_host
from openpype.modules import ModulesManager
Expand Down
3 changes: 2 additions & 1 deletion openpype/hosts/aftereffects/api/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from Qt import QtWidgets

from qtpy import QtWidgets

import pyblish.api

Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/blender/api/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from types import ModuleType
from typing import Dict, List, Optional, Union

from Qt import QtWidgets, QtCore
from qtpy import QtWidgets, QtCore

import bpy
import bpy.utils.previews
Expand Down
10 changes: 5 additions & 5 deletions openpype/hosts/blender/plugins/create/create_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ def _process(self):
subset = self.data["subset"]
name = plugin.asset_name(asset, subset)

camera = bpy.data.cameras.new(subset)
camera_obj = bpy.data.objects.new(subset, camera)

instances.objects.link(camera_obj)

asset_group = bpy.data.objects.new(name=name, object_data=None)
asset_group.empty_display_type = 'SINGLE_ARROW'
instances.objects.link(asset_group)
Expand All @@ -53,6 +48,11 @@ def _process(self):
bpy.ops.object.parent_set(keep_transform=True)
else:
plugin.deselect_all()
camera = bpy.data.cameras.new(subset)
camera_obj = bpy.data.objects.new(subset, camera)

instances.objects.link(camera_obj)

camera_obj.select_set(True)
asset_group.select_set(True)
bpy.context.view_layer.objects.active = asset_group
Expand Down
83 changes: 63 additions & 20 deletions openpype/hosts/blender/plugins/load/load_layout_blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ def _remove(self, asset_group):
bpy.data.objects.remove(obj)

def _remove_asset_and_library(self, asset_group):
if not asset_group.get(AVALON_PROPERTY):
return

libpath = asset_group.get(AVALON_PROPERTY).get('libpath')

if not libpath:
return

# Check how many assets use the same library
count = 0
for obj in bpy.data.collections.get(AVALON_CONTAINERS).all_objects:
Expand All @@ -63,10 +69,12 @@ def _remove_asset_and_library(self, asset_group):
# If it is the last object to use that library, remove it
if count == 1:
library = bpy.data.libraries.get(bpy.path.basename(libpath))
bpy.data.libraries.remove(library)
if library:
bpy.data.libraries.remove(library)

def _process(
self, libpath, asset_group, group_name, asset, representation, actions
self, libpath, asset_group, group_name, asset, representation,
actions, anim_instances
):
with bpy.data.libraries.load(
libpath, link=True, relative=False
Expand Down Expand Up @@ -140,12 +148,12 @@ def _process(
elif local_obj.type == 'ARMATURE':
plugin.prepare_data(local_obj.data)

if action is not None:
if action:
if local_obj.animation_data is None:
local_obj.animation_data_create()
local_obj.animation_data.action = action
elif (local_obj.animation_data and
local_obj.animation_data.action is not None):
local_obj.animation_data.action):
plugin.prepare_data(
local_obj.animation_data.action)

Expand All @@ -157,19 +165,26 @@ def _process(
t.id = local_obj

elif local_obj.type == 'EMPTY':
creator_plugin = get_legacy_creator_by_name("CreateAnimation")
if not creator_plugin:
raise ValueError("Creator plugin \"CreateAnimation\" was "
"not found.")

legacy_create(
creator_plugin,
name=local_obj.name.split(':')[-1] + "_animation",
asset=asset,
options={"useSelection": False,
"asset_group": local_obj},
data={"dependencies": representation}
)
if (not anim_instances or
(anim_instances and
local_obj.name not in anim_instances.keys())):
avalon = local_obj.get(AVALON_PROPERTY)
if avalon and avalon.get('family') == 'rig':
creator_plugin = get_legacy_creator_by_name(
"CreateAnimation")
if not creator_plugin:
raise ValueError(
"Creator plugin \"CreateAnimation\" was "
"not found.")

legacy_create(
creator_plugin,
name=local_obj.name.split(':')[-1] + "_animation",
asset=asset,
options={"useSelection": False,
"asset_group": local_obj},
data={"dependencies": representation}
)

if not local_obj.get(AVALON_PROPERTY):
local_obj[AVALON_PROPERTY] = dict()
Expand Down Expand Up @@ -272,7 +287,8 @@ def process_asset(
avalon_container.objects.link(asset_group)

objects = self._process(
libpath, asset_group, group_name, asset, representation, None)
libpath, asset_group, group_name, asset, representation,
None, None)

for child in asset_group.children:
if child.get(AVALON_PROPERTY):
Expand Down Expand Up @@ -352,10 +368,20 @@ def update(self, container: Dict, representation: Dict):
return

actions = {}
anim_instances = {}

for obj in asset_group.children:
obj_meta = obj.get(AVALON_PROPERTY)
if obj_meta.get('family') == 'rig':
# Get animation instance
collections = list(obj.users_collection)
for c in collections:
avalon = c.get(AVALON_PROPERTY)
if avalon and avalon.get('family') == 'animation':
anim_instances[obj.name] = c.name
break

# Get armature's action
rig = None
for child in obj.children:
if child.type == 'ARMATURE':
Expand Down Expand Up @@ -384,9 +410,26 @@ def update(self, container: Dict, representation: Dict):
# If it is the last object to use that library, remove it
if count == 1:
library = bpy.data.libraries.get(bpy.path.basename(group_libpath))
bpy.data.libraries.remove(library)
if library:
bpy.data.libraries.remove(library)

asset = container.get("asset_name").split("_")[0]

self._process(
str(libpath), asset_group, object_name, asset,
str(representation.get("_id")), actions, anim_instances
)

self._process(str(libpath), asset_group, object_name, actions)
# Link the new objects to the animation collection
for inst in anim_instances.keys():
try:
obj = bpy.data.objects[inst]
bpy.data.collections[anim_instances[inst]].objects.link(obj)
except KeyError:
self.log.info(f"Object {inst} does not exist anymore.")
coll = bpy.data.collections.get(anim_instances[inst])
if (coll):
bpy.data.collections.remove(coll)

avalon_container = bpy.data.collections.get(AVALON_CONTAINERS)
for child in asset_group.children:
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/api/menu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from Qt import QtWidgets, QtCore, QtGui
from qtpy import QtWidgets, QtCore, QtGui

from openpype.tools.utils import host_tools
from openpype.style import load_stylesheet
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging

import pyblish.api
from Qt import QtCore
from qtpy import QtCore

from openpype.lib import (
Logger,
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/api/pulse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sys

from Qt import QtCore
from qtpy import QtCore


class PulseThread(QtCore.QThread):
Expand Down
8 changes: 4 additions & 4 deletions openpype/hosts/fusion/deploy/MenuScripts/install_pyside2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


try:
from Qt import QtWidgets # noqa: F401
from Qt import __binding__
print(f"Qt binding: {__binding__}")
mod = importlib.import_module(__binding__)
from qtpy import API_NAME

print(f"Qt binding: {API_NAME}")
mod = importlib.import_module(API_NAME)
print(f"Qt path: {mod.__file__}")
print("Qt library found, nothing to do..")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import glob
import logging

from Qt import QtWidgets, QtCore
from qtpy import QtWidgets, QtCore

import qtawesome as qta

Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/plugins/inventory/set_tool_color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Qt import QtGui, QtWidgets
from qtpy import QtGui, QtWidgets

from openpype.pipeline import InventoryAction
from openpype import style
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/scripts/set_rendermode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Qt import QtWidgets
from qtpy import QtWidgets
import qtawesome
from openpype.hosts.fusion.api import get_current_comp

Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/harmony/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import signal
import time
from uuid import uuid4
from Qt import QtWidgets, QtCore, QtGui
from qtpy import QtWidgets, QtCore, QtGui
import collections

from .server import Server
Expand Down
4 changes: 2 additions & 2 deletions openpype/hosts/houdini/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import hou # noqa

from openpype.host import HostBase, IWorkfileHost, ILoadHost, INewPublisher
from openpype.host import HostBase, IWorkfileHost, ILoadHost, IPublishHost

import pyblish.api

Expand Down Expand Up @@ -40,7 +40,7 @@
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")


class HoudiniHost(HostBase, IWorkfileHost, ILoadHost, INewPublisher):
class HoudiniHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
name = "houdini"

def __init__(self):
Expand Down
88 changes: 88 additions & 0 deletions openpype/hosts/maya/api/gltf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
"""Tools to work with GLTF."""
import logging

from maya import cmds, mel # noqa

log = logging.getLogger(__name__)

_gltf_options = {
"of": str, # outputFolder
"cpr": str, # copyright
"sno": bool, # selectedNodeOnly
"sn": str, # sceneName
"glb": bool, # binary
"nbu": bool, # niceBufferURIs
"hbu": bool, # hashBufferURI
"ext": bool, # externalTextures
"ivt": int, # initialValuesTime
"acn": str, # animationClipName
"ast": int, # animationClipStartTime
"aet": int, # animationClipEndTime
"afr": float, # animationClipFrameRate
"dsa": int, # detectStepAnimations
"mpa": str, # meshPrimitiveAttributes
"bpa": str, # blendPrimitiveAttributes
"i32": bool, # force32bitIndices
"ssm": bool, # skipStandardMaterials
"eut": bool, # excludeUnusedTexcoord
"dm": bool, # defaultMaterial
"cm": bool, # colorizeMaterials
"dmy": str, # dumpMaya
"dgl": str, # dumpGLTF
"imd": str, # ignoreMeshDeformers
"ssc": bool, # skipSkinClusters
"sbs": bool, # skipBlendShapes
"rvp": bool, # redrawViewport
"vno": bool # visibleNodesOnly
}


def extract_gltf(parent_dir,
filename,
**kwargs):

"""Sets GLTF export options from data in the instance.
"""

cmds.loadPlugin('maya2glTF', quiet=True)
# load the UI to run mel command
mel.eval("maya2glTF_UI()")

parent_dir = parent_dir.replace('\\', '/')
options = {
"dsa": 1,
"glb": True
}
options.update(kwargs)

for key, value in options.copy().items():
if key not in _gltf_options:
log.warning("extract_gltf() does not support option '%s'. "
"Flag will be ignored..", key)
options.pop(key)
options.pop(value)
continue

job_args = list()
default_opt = "maya2glTF -of \"{0}\" -sn \"{1}\"".format(parent_dir, filename) # noqa
job_args.append(default_opt)

for key, value in options.items():
if isinstance(value, str):
job_args.append("-{0} \"{1}\"".format(key, value))
elif isinstance(value, bool):
if value:
job_args.append("-{0}".format(key))
else:
job_args.append("-{0} {1}".format(key, value))

job_str = " ".join(job_args)
log.info("{}".format(job_str))
mel.eval(job_str)

# close the gltf export after finish the export
gltf_UI = "maya2glTF_exporter_window"
if cmds.window(gltf_UI, q=True, exists=True):
cmds.deleteUI(gltf_UI)
Loading

0 comments on commit d3753fe

Please sign in to comment.