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

Multiverse: Initial Support #2908

Merged
merged 64 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
b862015
create dummy creator plugin for multiverse usd
zhoub Mar 4, 2022
2cb1925
create first version of multiverse usd extractor
zhoub Mar 4, 2022
f6400ff
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 7, 2022
d155f60
fill attributes to creator CreateMultiverseUsd
zhoub Mar 8, 2022
1c58a3d
created load plugin to read USD file by multiverse
zhoub Mar 8, 2022
9f83eec
imroved data for creator of multiverse usd on animated parameters
zhoub Mar 9, 2022
2adbe78
implemented load method of multiverse usd loader
zhoub Mar 9, 2022
d6a0d2c
use time options for multiverse usd extractor
zhoub Mar 9, 2022
ee84d14
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 10, 2022
9418a49
improved multiverse usd loader
zhoub Mar 10, 2022
a2ee890
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 11, 2022
310c572
added creator for multiverse usd override
zhoub Mar 11, 2022
8ab9a14
Changed name, label family of multiverse usd override creator
zhoub Mar 11, 2022
ab4849a
Changed name and writeTimeRange of multiverse usd creator
zhoub Mar 11, 2022
3151784
Updated multiverse usd extracor for default option values
zhoub Mar 11, 2022
b36e312
add multiverse usd override extractor plugin
zhoub Mar 11, 2022
bf5f536
added new family usd_override
zhoub Mar 11, 2022
3f8103f
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 11, 2022
899958f
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 14, 2022
28f57a0
added new creator for multiverse usd composition
zhoub Mar 14, 2022
9f54fae
fixed label and family for multiverse usd composition creator
zhoub Mar 14, 2022
86d5127
declare more families for multiverse usd loader
zhoub Mar 14, 2022
82929bb
renamed family usd_override to usdOverride
zhoub Mar 14, 2022
99288ee
added multiverse usd composition extractor
zhoub Mar 17, 2022
f8c06e0
fix iteration for options among multiverse extractor
zhoub Mar 18, 2022
ca5017f
fix iteration loop
zhoub Mar 18, 2022
ae9e34b
use collected animation data at multiverse use creator
zhoub Mar 22, 2022
370416a
use openpye built-in variables for multiverse usd extractor
zhoub Mar 22, 2022
889851a
tidy variable of unused variable at multiverse usd creator
zhoub Mar 22, 2022
b553fe6
add method parse_overrides to multiverse usd extractor to update opti…
zhoub Mar 22, 2022
cc1d631
convert string to unicode at multiverse usd extractor
zhoub Mar 22, 2022
b5d7757
declare default string option as unicode
zhoub Mar 22, 2022
fba9399
use values from processed options from multiverse usd extractor
zhoub Mar 22, 2022
adde37f
removed root transform when load the usd file
zhoub Mar 22, 2022
e1bdbf3
updated update and remove method in usd loader
zhoub Mar 22, 2022
0bf37dd
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 23, 2022
0990163
fix removed module from multiverse usd extractor
zhoub Mar 23, 2022
7a96bfc
deal with handle start and end for multiverse usd extractor
zhoub Mar 24, 2022
006c43c
replace unicode with str and normalize unicode instance data value
zhoub Mar 24, 2022
de8eac5
improved multiverse usd composition creator
zhoub Mar 24, 2022
7320e57
fixed multiverse usd composition extractor
zhoub Mar 24, 2022
783c315
fixed creator of multiverse usd composition with more arguments
zhoub Mar 24, 2022
d69d7cd
fix multiverse composition extractor for arguments
zhoub Mar 24, 2022
3ab9c8c
fixed multiverse usd loader for new api
zhoub Mar 24, 2022
498c968
use py3 style to iterate option dict
zhoub Mar 24, 2022
0645dc8
use py3 style to iterate option dict from multiverse usd composition …
zhoub Mar 24, 2022
fe2a3e8
use usd as name and ext for representation from multiverse usd compos…
zhoub Mar 24, 2022
4d349a1
Merge branch 'develop' of https://github.com/pypeclub/OpenPype into f…
zhoub Mar 24, 2022
d41d114
updating create mv overwrite to correct data fields getting used.
dmo-j-cube Mar 24, 2022
20124bd
fix import - use direct api vs avalon
dmo-j-cube Mar 24, 2022
06dce74
use a set instead of a list
dmo-j-cube Mar 24, 2022
1cea33d
fixing the data getting used for the write options ; standardise on "…
dmo-j-cube Mar 24, 2022
9c9ea78
Merge branch 'feature/multiverse' of github.com:j-cube/OpenPype into …
zhoub Mar 24, 2022
73e691f
use cmds.listRelatives instead of mel at multiverse usd loader
zhoub Mar 24, 2022
7f18f94
removing unused variables.
dmo-j-cube Mar 24, 2022
ba57638
Merge remote-tracking branch 'origin/feature/multiverse' into feature…
dmo-j-cube Mar 24, 2022
e64797c
switch do more readable options.items()
dmo-j-cube Mar 24, 2022
600a072
removed extra space.
dmo-j-cube Mar 24, 2022
ef83218
use py3 style to iterate options dict
zhoub Mar 24, 2022
cedc936
Merge branch 'feature/multiverse' of github.com:j-cube/OpenPype into …
zhoub Mar 24, 2022
6ea0371
use set instead of list for discard option keys from multiverse compo…
zhoub Mar 24, 2022
bb8bd90
add the animation data first to maintain order.
dmo-j-cube Mar 25, 2022
5adf396
Adding "pointcache" & "animation" to the list of families, since it's…
dmo-j-cube Mar 25, 2022
deedc89
Lock the shape after creating to avoid deletion.
dmo-j-cube Mar 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions openpype/hosts/maya/plugins/create/create_multiverse_usd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from openpype.hosts.maya.api import plugin, lib


class CreateMultiverseUsd(plugin.Creator):
"""Multiverse USD data"""

name = "usdMain"
label = "Multiverse USD"
family = "usd"
icon = "cubes"

def __init__(self, *args, **kwargs):
super(CreateMultiverseUsd, self).__init__(*args, **kwargs)

# Add animation data first, since it maintains order.
self.data.update(lib.collect_animation_data(True))

self.data["stripNamespaces"] = False
self.data["mergeTransformAndShape"] = False
self.data["writeAncestors"] = True
self.data["flattenParentXforms"] = False
self.data["writeSparseOverrides"] = False
self.data["useMetaPrimPath"] = False
self.data["customRootPath"] = ''
self.data["customAttributes"] = ''
self.data["nodeTypesToIgnore"] = ''
self.data["writeMeshes"] = True
self.data["writeCurves"] = True
self.data["writeParticles"] = True
self.data["writeCameras"] = False
self.data["writeLights"] = False
self.data["writeJoints"] = False
self.data["writeCollections"] = False
self.data["writePositions"] = True
self.data["writeNormals"] = True
self.data["writeUVs"] = True
self.data["writeColorSets"] = False
self.data["writeTangents"] = False
self.data["writeRefPositions"] = False
self.data["writeBlendShapes"] = False
self.data["writeDisplayColor"] = False
self.data["writeSkinWeights"] = False
self.data["writeMaterialAssignment"] = False
self.data["writeHardwareShader"] = False
self.data["writeShadingNetworks"] = False
self.data["writeTransformMatrix"] = True
self.data["writeUsdAttributes"] = False
self.data["timeVaryingTopology"] = False
self.data["customMaterialNamespace"] = ''
self.data["numTimeSamples"] = 1
self.data["timeSamplesSpan"] = 0.0
23 changes: 23 additions & 0 deletions openpype/hosts/maya/plugins/create/create_multiverse_usd_comp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from openpype.hosts.maya.api import plugin, lib


class CreateMultiverseUsdComp(plugin.Creator):
"""Create Multiverse USD Composition"""

name = "usdCompositionMain"
label = "Multiverse USD Composition"
family = "usdComposition"
icon = "cubes"

def __init__(self, *args, **kwargs):
super(CreateMultiverseUsdComp, self).__init__(*args, **kwargs)

# Add animation data first, since it maintains order.
self.data.update(lib.collect_animation_data(True))

self.data["stripNamespaces"] = False
self.data["mergeTransformAndShape"] = False
self.data["flattenContent"] = False
self.data["writePendingOverrides"] = False
self.data["numTimeSamples"] = 1
self.data["timeSamplesSpan"] = 0.0
28 changes: 28 additions & 0 deletions openpype/hosts/maya/plugins/create/create_multiverse_usd_over.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from openpype.hosts.maya.api import plugin, lib


class CreateMultiverseUsdOver(plugin.Creator):
"""Multiverse USD data"""

name = "usdOverrideMain"
label = "Multiverse USD Override"
family = "usdOverride"
icon = "cubes"

def __init__(self, *args, **kwargs):
super(CreateMultiverseUsdOver, self).__init__(*args, **kwargs)

# Add animation data first, since it maintains order.
self.data.update(lib.collect_animation_data(True))

self.data["writeAll"] = False
self.data["writeTransforms"] = True
self.data["writeVisibility"] = True
self.data["writeAttributes"] = True
self.data["writeMaterials"] = True
self.data["writeVariants"] = True
self.data["writeVariantsDefinition"] = True
self.data["writeActiveState"] = True
self.data["writeNamespaces"] = False
self.data["numTimeSamples"] = 1
self.data["timeSamplesSpan"] = 0.0
102 changes: 102 additions & 0 deletions openpype/hosts/maya/plugins/load/load_multiverse_usd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# -*- coding: utf-8 -*-
import maya.cmds as cmds

from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.lib import (
maintained_selection,
namespaced,
unique_namespace
)
from openpype.hosts.maya.api.pipeline import containerise


class MultiverseUsdLoader(load.LoaderPlugin):
"""Load the USD by Multiverse"""

families = ["model", "usd", "usdComposition", "usdOverride",
"pointcache", "animation"]
representations = ["usd", "usda", "usdc", "usdz", "abc"]

label = "Read USD by Multiverse"
order = -10
icon = "code-fork"
color = "orange"

def load(self, context, name=None, namespace=None, options=None):

asset = context['asset']['name']
namespace = namespace or unique_namespace(
asset + "_",
prefix="_" if asset[0].isdigit() else "",
suffix="_",
)

# Create the shape
cmds.loadPlugin("MultiverseForMaya", quiet=True)

shape = None
transform = None
with maintained_selection():
cmds.namespace(addNamespace=namespace)
with namespaced(namespace, new=False):
import multiverse
shape = multiverse.CreateUsdCompound(self.fname)
transform = cmds.listRelatives(
shape, parent=True, fullPath=True)[0]

BigRoy marked this conversation as resolved.
Show resolved Hide resolved
# Lock the shape node so the user cannot delete it.
cmds.lockNode(shape, lock=True)

nodes = [transform, shape]
self[:] = nodes

return containerise(
name=name,
namespace=namespace,
nodes=nodes,
context=context,
loader=self.__class__.__name__)

def update(self, container, representation):
# type: (dict, dict) -> None
"""Update container with specified representation."""
node = container['objectName']
assert cmds.objExists(node), "Missing container"

members = cmds.sets(node, query=True) or []
shapes = cmds.ls(members, type="mvUsdCompoundShape")
assert shapes, "Cannot find mvUsdCompoundShape in container"

path = get_representation_path(representation)

import multiverse
for shape in shapes:
multiverse.SetUsdCompoundAssetPaths(shape, [path])

cmds.setAttr("{}.representation".format(node),
str(representation["_id"]),
type="string")

def switch(self, container, representation):
self.update(container, representation)

def remove(self, container):
# type: (dict) -> None
"""Remove loaded container."""
# Delete container and its contents
if cmds.objExists(container['objectName']):
members = cmds.sets(container['objectName'], query=True) or []
cmds.delete([container['objectName']] + members)

# Remove the namespace, if empty
namespace = container['namespace']
if cmds.namespace(exists=namespace):
members = cmds.namespaceInfo(namespace, listNamespace=True)
if not members:
cmds.namespace(removeNamespace=namespace)
else:
self.log.warning("Namespace not deleted because it "
"still has members: %s", namespace)
Loading