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

Maya: Add Xgen family support #1947

Merged
merged 10 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions openpype/hosts/maya/plugins/create/create_xgen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from openpype.hosts.maya.api import plugin


class CreateXgen(plugin.Creator):
"""Xgen interactive export"""

name = "xgen"
label = "Xgen Interactive"
family = "xgen"
icon = "pagelines"
defaults = ['Main']
3 changes: 2 additions & 1 deletion openpype/hosts/maya/plugins/load/load_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ReferenceLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
"layout",
"camera",
"rig",
"camerarig"]
"camerarig",
"xgen"]
representations = ["ma", "abc", "fbx", "mb"]

label = "Reference"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class ExtractMayaSceneRaw(openpype.api.Extractor):
families = ["mayaAscii",
"setdress",
"layout",
"camerarig"]
"camerarig",
"xgen"]
scene_type = "ma"

def process(self, instance):
Expand Down
61 changes: 61 additions & 0 deletions openpype/hosts/maya/plugins/publish/extract_xgen_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import os

from maya import cmds

import avalon.maya
import openpype.api


class ExtractXgenCache(openpype.api.Extractor):
"""Produce an alembic of just xgen interactive groom

"""

label = "Extract Xgen ABC Cache"
hosts = ["maya"]
families = ["xgen"]
optional = True

def process(self, instance):

# Collect the out set nodes
out_descriptions = [node for node in instance
if cmds.nodeType(node) == "xgmSplineDescription"]

start = 1
end = 1

self.log.info("Extracting Xgen Cache..")
dirname = self.staging_dir(instance)

parent_dir = self.staging_dir(instance)
filename = "{name}.abc".format(**instance.data)
path = os.path.join(parent_dir, filename)

with avalon.maya.suspended_refresh():
with avalon.maya.maintained_selection():
command = (
'-file '
+ path
+ ' -df "ogawa" -fr '
+ str(start)
+ ' '
+ str(end)
+ ' -step 1 -mxf -wfw'
)
for desc in out_descriptions:
command += (" -obj " + desc)
cmds.xgmSplineCache(export=True, j=command)

if "representations" not in instance.data:
instance.data["representations"] = []

representation = {
'name': 'abc',
'ext': 'abc',
'files': filename,
"stagingDir": dirname,
}
instance.data["representations"].append(representation)

self.log.info("Extracted {} to {}".format(instance, dirname))
3 changes: 2 additions & 1 deletion openpype/plugins/publish/integrate_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
"background",
"camerarig",
"redshiftproxy",
"effect"
"effect",
"xgen"
]
exclude_families = ["clip"]
db_representation_context_keys = [
Expand Down
26 changes: 26 additions & 0 deletions website/docs/artist_hosts_maya.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,32 @@ under `input_SET`). This mechanism uses *cbId* attribute on those shapes.
If match is found shapes are connected using their `outMesh` and `outMesh`. Thus you can easily connect existing animation to loaded rig.
:::

## Working with Xgen in OpenPype

OpenPype support publishing and loading of Xgen interactive grooms. You can publish
them as mayaAscii files with scalps that can be loaded into another maya scene, or as
alembic caches.

### Publishing Xgen Grooms

To prepare xgen for publishing just select all the descriptions that should be published together and the create Xgen Subset in the scene using - **OpenPype menu** → **Create**... and select **Xgen Interactive**. Leave Use selection checked.

For actual publishing of your groom to go **OpenPype → Publish** and then press ▶ to publish. This will export `.ma` file containing your grooms with any geometries they are attached to and also a baked cache in `.abc` format


:::tip adding more descriptions
You can add multiple xgen desctiption into the subset you are about to publish, simply by
adding them to the maya set that was created for you. Please make sure that only xgen description nodes are present inside of the set and not the scalp geometry.
:::

### Loading Xgen

You can use published xgens by loading them using OpenPype Publisher. You can choose to reference or import xgen. We don't have any automatic mesh linking at the moment and it is expected, that groom is published with a scalp, that can then be manually attached to your animated mesh for example.

The alembic representation can be loaded too and it contains the groom converted to curves. Keep in mind that the density of the alembic directly depends on your viewport xgen density at the point of export.



## Using Redshift Proxies

OpenPype supports working with Redshift Proxy files. You can create Redshift Proxy from almost
Expand Down