Merge pull request #1947 from pypeclub/feature/xgen_basic_support

This commit is contained in:
Milan Kolar 2021-08-19 17:24:13 +02:00 committed by GitHub
commit 725c0265f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 104 additions and 3 deletions

View file

@ -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']

View file

@ -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"

View file

@ -19,7 +19,8 @@ class ExtractMayaSceneRaw(openpype.api.Extractor):
families = ["mayaAscii",
"setdress",
"layout",
"camerarig"]
"camerarig",
"xgen"]
scene_type = "ma"
def process(self, instance):

View file

@ -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))

View file

@ -97,7 +97,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
"background",
"camerarig",
"redshiftproxy",
"effect"
"effect",
"xgen"
]
exclude_families = ["clip"]
db_representation_context_keys = [

View file

@ -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