profile
viewpoint
Autodesk Autodesk San Francisco, CA https://www.autodesk.com/ Open-source projects by Autodesk

Autodesk/coroutineworker 259

Kotlin Coroutine-based workers for native

Autodesk/animx 156

A project to make it easier for people to use Maya animation in their tools and pipelines.

Autodesk/hig 132

Autodesk's unified design design system

Autodesk/continuous-threat-modeling 122

A Continuous Threat Modeling methodology

Autodesk/arnold-usd 108

Arnold components for USD

Autodesk/civilconnection 41

CivilConnection enables the exchange of information between Civil 3D, Dynamo and Revit.

Autodesk/aomi 33

Provide secrets to build and release pipelines in a self service way using Hashicorp Vault.

Autodesk/enterprise-config-for-git 32

A painless Git setup with an easy way to share Git configs and scripts within a company using GitHub Enterprise.

Autodesk/3DViewerComponent 31

A ThreeJS 3D Viewer Web Component composed with (Google's) Polymer

pull request commentAutodesk/maya-usd

remove dependencies on old Hydra texture system from hdMaya for USD releases after 20.11

@pmolodo: Could I bug you to have a look at this one when you get a chance? Just want to make sure we haven't missed anything here, since we don't make heavy use of mtoh ourselves.

Thanks!

mattyjams

comment created time in 27 minutes

PR opened Autodesk/maya-usd

remove dependencies on old Hydra texture system from hdMaya for USD releases after 20.11 mtoh

Our Hydra team is working on removing parts of the old Hydra texture system for the next core USD release.

With Luma's recent work, it looks like all of the necessary support for the newer material network-based system is already in place, so the changes here mostly just pre-process the old code away for USD releases after 20.11.

+110 -78

0 comment

7 changed files

pr created time in 28 minutes

create barnchAutodesk/maya-usd

branch : tremblp/MAYA-106088/fix_parent_test

created branch time in an hour

pull request commentAutodesk/maya-usd

Reuse shader effect for duplicate material networks.

@kxl-adsk Please merge.

HdC-adsk

comment created time in 3 hours

PullRequestReviewEvent

PR opened Autodesk/hig

Contrib/avatar improvements
+325 -74

0 comment

10 changed files

pr created time in 5 hours

pull request commentAutodesk/hig

Feat/add stylesheet prop radio button 2201

@wmui51 I adjusted otherprops and squashed the commits

varoper

comment created time in 5 hours

PullRequestReviewEvent

delete branch Autodesk/maya-usd

delete branch : sabrih/fix_undo_redo_transformation

delete time in 6 hours

push eventAutodesk/maya-usd

Hamed Sabri

commit sha 3f99a2a65a6307304a31df6e59ff919ffe57a5ce

- Adjust UndoBlock to capture the opFunc functor that sets/adds to the transform op order. - Clean up old logics around recreateOp, _prevOpValue, _attrName.

view details

ppt-adsk

commit sha 4e8282c291a767e60ea8fa1c1e2b832dd1cd0265

Merge pull request #959 from Autodesk/sabrih/fix_undo_redo_transformation More code clean up in UsdTransform3dMayaXformStack

view details

push time in 6 hours

PR merged Autodesk/maya-usd

More code clean up in UsdTransform3dMayaXformStack
  • Adjust UndoBlock to capture the opFunc functor that sets/adds to the transform op order.
  • Clean up old logics around recreateOp, _prevOpValue, _attrName.
+3 -26

0 comment

1 changed file

HamedSabri-adsk

pr closed time in 6 hours

PullRequestReviewEvent

push eventAutodesk/maya-usd

Huidong Chen

commit sha 820c2cc59c93973ca9762ea551b43897e1dc1d78

Fix strange clang_format_linter failure.

view details

push time in 6 hours

PR opened Autodesk/maya-usd

Reviewers
More code clean up in UsdTransform3dMayaXformStack
  • Adjust UndoBlock to capture the opFunc functor that sets/adds to the transform op order.
  • Clean up old logics around recreateOp, _prevOpValue, _attrName.
+3 -26

0 comment

1 changed file

pr created time in 6 hours

create barnchAutodesk/maya-usd

branch : sabrih/fix_undo_redo_transformation

created branch time in 6 hours

pull request commentAutodesk/maya-usd

Reuse shader effect for duplicate material networks.

I have to rebase the branch so that it can compiled with latest UFE code. Aside from that, the new commit 59ac9e6 is to address the change proposed by @JGamache-autodesk .

HdC-adsk

comment created time in 7 hours

push eventAutodesk/maya-usd

Hamed Sabri

commit sha 5ef6b45b03c03b821bcdc228647796de7a37e438

MAYA-106089: Undo/Redo support for USD data model.

view details

Hamed Sabri

commit sha cf0d16712ca0968f140546e8128ffc5ff005eba0

Apply restriction rules for reorder command.

view details

Hamed Sabri

commit sha 2750774a882e61bfa3f829678e132e746bb17f50

Fix Linux/MacOS compiler errors.

view details

Hamed Sabri

commit sha 98360899ab96ce4bf396784e32bd85c8bdcf78e0

Address feedback: Use TF_CODING_ERROR instead of throwing an exception.

view details

Hamed Sabri

commit sha 4143fbfb41c9ff2033e504b8dd1503851df57099

Fix TestAdditionalTranslators by implementing _OnSetFieldDictValueByKey() method. AL's testTranslators.py has a call to SetVariantSelection() that triggers the _OnSetFieldDictValueByKey.

view details

Hamed Sabri

commit sha 59ba968ee75b3ef937c9b09909ac37ef73a49073

Fix testMayaUsdProxyAccessor by implementing the _OnSetTimeSample since these test cases work with time sample.

view details

Hamed Sabri

commit sha 3f9d348934715bdd73f509d29e4527f8665f39b8

Make GCC happy on Linux.

view details

krickw

commit sha c364d149cbf89649fc09e6919cebd73e2cc921cf

Fix variable names that got changed in UFE but not in MayaUSD.

view details

Hamed Sabri

commit sha 8f97278b275d179ef3fd8321ed3430270610c430

Fix python binding: TypeError: unbound method Boost.Python.function object must be called with UsdUndoManager instance as first argument.

view details

Krystian Ligenza

commit sha 300862603ae93b41cbaf79d1e0e5a3def7e0a0dd

Merge pull request #943 from Autodesk/krickw/MAYA-108155/fix_variable_names Fix variable names that got changed in UFE but not in MayaUSD.

view details

Hamed Sabri

commit sha 93e995d22fdd1a625217a86543977c8abde52db4

Address feedback: - Fix typo in readme - Add anonymous namespace - Remove unused include

view details

Hamed Sabri

commit sha 026a964e06a51e4a5d8d386e9a7cc50eb4e98355

Clean up header inclusions.

view details

Hamed Sabri

commit sha c51974c2ad2d08584837f439f99474d210b67d29

Address feedback: "insdide" -->"inside"

view details

Hamed Sabri

commit sha c0096229bd703dec037df6981a7235026ddd7aba

Fix crash when running AL's stageLoadAndChangeFilePath test. In this test, MayaUsdProxyStageSetNotice will be send out with a NULL stage object. See line 367 in test_ProxyShapeImport.cpp Added a check to make sure the stage object received from MayaUsdProxyStageSetNotice is always valid.

view details

Sean Donnelly

commit sha 8211e8499e2b7561d9d6539df2f2e25bd2d045cd

MAYA-107386 As a user, on the stage AE template I'd like to connect to time MAYA-107350 As a user, on the stage AE template I'd like to see what my default prim is MAYA-107338 As a user, on the stage AE template I'd like to see what my Root Layer is MAYA-107273 As a user, on the stage AE template I'd like to toggle Purpose=Default * Create new AETemplatesHelpers.py file which is used by the MEL templates to query USD (thru python API). * Organized proxy shape template in sections: "Stage", "Stage Source" and "Stage Display". * Suppressed 'Stage Cache ID' and 'Out Stage Cache ID'. * Added new non-editable text fields (for display purposes only) for "Root Layer" and "Default Prim". * Added tooltips to some controls.

view details

Hamed Sabri

commit sha 667a8c99593435abcd1f6523985d62520ec646e1

Added guard around some of the reorder logics to support PR 120. I will clean up this if guard once PR121 is out.

view details

Krystian Ligenza

commit sha 2ce2ed9cfd9999827f489089094be5d892a6285a

Some files got in without clang-format applied

view details

Hamed Sabri

commit sha a9f8fe7f22510138b8f4b7248e2629142568c468

Add temporary guards to protect against PR120.

view details

Krystian Ligenza

commit sha e3438c247d6a9b630445c6743f5af19149cc1e70

Merge pull request #946 from Autodesk/kxl-adsk/some_files_got_in_without_formatting Some files got in without clang-format applied

view details

Sean Donnelly

commit sha 604fe2788df8338fdb8477729aaaf94f9a5726b4

MAYA-107386 As a user, on the stage AE template I'd like to connect to time MAYA-107350 As a user, on the stage AE template I'd like to see what my default prim is MAYA-107338 As a user, on the stage AE template I'd like to see what my Root Layer is MAYA-107273 As a user, on the stage AE template I'd like to toggle Purpose=Default * Code review comment - cleanup usage of "|world"

view details

push time in 7 hours

pull request commentAutodesk/maya-usd

Add support for UV transform value exports

Credit goes to @smithw-adsk

dgovil

comment created time in 7 hours

Pull request review commentAutodesk/maya-usd

Fix broken test when run from parent-project.

 def testCreateStageFromFile(self):         # we can call what it does once the file is choose.         # Note: on ballFilePath we replace \ with / to stop the \ as         #       being interpreted.-        ballFilePath = os.path.normpath(self.getTestScene('ballset', 'StandaloneScene', 'top_layer.usda')).replace('\\', '/')+        ballFilePath = os.path.normpath(mayaUtils.getTestScene('ballset', 'StandaloneScene', 'top_layer.usda')).replace('\\', '/')

Okay I understand now. I agree with moving those lines to a new testUtils.py and then using that here instead of mayaUtils.

marsupial

comment created time in 7 hours

PullRequestReviewEvent

pull request commentAutodesk/maya-usd

Add support for UV transform value exports

Ah makes sense. Thanks for looking into it too!

dgovil

comment created time in 7 hours

pull request commentAutodesk/maya-usd

Add support for UV transform value exports

@dgovil There was an incident with GitHub yesterday - could be related - https://www.githubstatus.com/incidents/sxthxvdlljk4

New PF passed.

dgovil

comment created time in 7 hours

Pull request review commentAutodesk/maya-usd

Added Blendshape export functionality

 #include <string> #include <vector> +MObject mayaFindUpstreamOrigMesh(const MObject& mesh)+{+    MStatus stat;++    // NOTE: (yliangsiew) If there's a skinCluster, find that first since that+    // will be the intermediate to the blendShape node. If not, just search for any+    // blendshape deformers upstream of the mesh.+    MObject searchObject;+    MObject skinCluster;+    stat = mayaGetSkinClusterConnectedToMesh(mesh, skinCluster);+    if (stat) {+        searchObject = MObject(skinCluster);+    } else {+        searchObject = MObject(mesh);+    }++    // TODO: (yliangsiew) Problem: if there are _intermediate deformers between blendshapes,+    // then what do we do? Like blendshape1 -> wrap -> blendshape2. This won't find+    // that correctly...

You are correct the code you have can't return the input of the wrong blend shape. I misunderstood the power of MFnGeometryFilter::inputShapeAtIndex().

The problem with this function is if there are more deformers upstream of the blend shape's input geometry then inputShapeAtIndex skips over them and goes directly to a shape. There could be other deformers between the discovered mesh and the input to the blend shape node. For example those tweak nodes do not have to be empty, or there could be other animated deformers present. In that case the original mesh data you read won't match the mesh data Maya has at the input of the blend shape, and the deformation exported to USD won't match Maya.

In addition to that the discovered mesh node doesn't have to be static. The mesh can have an input mesh connection that can be animated with deformation as well.

The problem is Maya can support any combination of these nodes together. The code here must do more pattern matching to ensure that the deformation described by the DG is Maya matches a case that the exporter understands.

My suggestion to you would be to be extremely specific about the configuration of supported nodes to limit what is allowed to be exported and what is not. Trying to handle exporting arbitrary graphs of deformers is a huge task that I don't want this change to get bogged down in. Focus this change on doing a really good job exporting all the features of a blend shape node (which you already have) but in a simple graph context. The only thing missing is verifying that the graph of deformer nodes matches something the exporter can handle.

ysiewappl

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentAutodesk/maya-usd

Added Blendshape export functionality

+//+// Copyright 2020 Apple+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+//     http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.+//++#include "jointWriter.h"+#include "meshWriter.h"++#include <mayaUsd/fileio/primWriter.h>+#include <mayaUsd/fileio/translators/translatorUtil.h>+#include <mayaUsd/fileio/utils/meshWriteUtils.h>+#include <mayaUsd/fileio/utils/writeUtil.h>++#include <pxr/base/tf/diagnostic.h>+#include <pxr/base/tf/stringUtils.h>+#include <pxr/base/vt/types.h>+#include <pxr/usd/sdf/path.h>+#include <pxr/usd/usdGeom/pointBased.h>+#include <pxr/usd/usdSkel/bindingAPI.h>+#include <pxr/usd/usdSkel/blendShape.h>++#include <maya/MApiNamespace.h>+#include <maya/MFloatArray.h>+#include <maya/MFloatPointArray.h>+#include <maya/MFnAttribute.h>+#include <maya/MFnBlendShapeDeformer.h>+#include <maya/MFnComponentListData.h>+#include <maya/MFnGeometryFilter.h>+#include <maya/MFnPointArrayData.h>+#include <maya/MFnSingleIndexedComponent.h>+#include <maya/MGlobal.h>+#include <maya/MItDependencyGraph.h>+#include <maya/MObject.h>+#include <maya/MPointArray.h>+#include <maya/MStatus.h>++#include <algorithm>+#include <complex>+#include <string>+#include <unordered_map>+#include <vector>++#define MAYA_BLENDSHAPE_EVAL_HOTFIX 1++#define MAYA_ATTR_NAME_WEIGHT "weight"++struct MayaBlendShapeWeightDatum+{+    MObjectArray targetMeshes; // The target shape(s) to hit. (i.e. multiple shapes would be using+                               // Maya's "in-betweens" feature.)+    MIntArray+              inputTargetGroupIndices; // The input group indices at which each target is connected under.+    MIntArray inputTargetIndices; // The input indices at which each target is connected under.+    MIntArray targetItemIndices;  // The Maya blendshape weight indices for the resulting deformed+                                  // mesh shape.+    unsigned int weightIndex; // The logical index of the weight attribute on the blendshape node.+};++struct MayaBlendShapeDatum+{+    MObject deformedMesh;       // The resulting deformed mesh shape (i.e. deformation + weight ++                                // envelope) Maya calls this a base object.+    MObject baseMesh;           // The original base mesh shape (i.e. no deformation)+    MObject blendShapeDeformer; // The blendshape deformer node itself.+    std::vector<MayaBlendShapeWeightDatum> weightDatas;+    unsigned int                           numWeights;+    unsigned int outputGeomIndex; // The logical index at which the deformed mesh is ultimately+                                  // connected downstream from the blendshape deformer.+};++float mayaGetBlendShapeTargetWeightFromIndex(const unsigned int index)+{+    float targetWeight = (static_cast<float>(index) - 5000.0f) * 0.001f;+    return targetWeight;+}++/**+ * Gets information about available blend shapes for a given deformed mesh (i.e. final result)+ *+ * @param mesh        The deformed mesh to find the blendshape info(s) for.+ * @param outInfos    Storage for the result.+ *+ * @return            A status code.+ */+MStatus mayaGetBlendShapeInfosForMesh(+    const MObject&                    deformedMesh,+    std::vector<MayaBlendShapeDatum>& outInfos)+{+    // TODO: (yliangsiew) Eh, find a way to avoid incremental allocations like these and just+    // allocate upfront. But hard to do with the iterative search functions of the DG...+    MStatus stat;++    // NOTE: (yliangsiew) If there's a skinCluster, find that first since that+    // will be the intermediate to the blendShape node. If not, just search for any+    // blendshape deformers upstream of the mesh.+    MObject      searchObject;+    MObjectArray skinClusters;+    stat = mayaGetSkinClustersUpstreamOfMesh(deformedMesh, skinClusters);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    unsigned int numSkinClusters = skinClusters.length();+    switch (numSkinClusters) {+    case 0: searchObject = MObject(deformedMesh); break;+    case 1: searchObject = MObject(skinClusters[0]); break;+    default:+        MGlobal::displayWarning("More than one skinCluster was found; only the first one will be "+                                "considered during the search!");+        searchObject = MObject(skinClusters[0]);+        break;+    }++    // TODO: (yliangsiew) Problem: if there are _intermediate deformers between blendshapes,+    // then oh-no: what do we do? Like blendshape1 -> wrap -> blendshape2. We can't possibliy+    // export that into current USD file format and expect predictable behaviour.+    // Houston, we have a problem...+    MFnGeometryFilter     fnGeoFilter;+    MFnBlendShapeDeformer fnBlendShape;+    MItDependencyGraph    itDg(+        searchObject,+        MFn::kBlendShape,+        MItDependencyGraph::kUpstream,+        MItDependencyGraph::kDepthFirst,+        MItDependencyGraph::kPlugLevel,+        &stat);+    MFnDependencyNode fnNode;+    for (; !itDg.isDone(); itDg.next()) {+        MObject curBlendShape = itDg.currentItem();+        assert(curBlendShape.hasFn(MFn::kBlendShape));++        MPlug outputGeomPlug = itDg.thisPlug();+        assert(outputGeomPlug.isElement() == true);+        unsigned int outputGeomPlugIdx = outputGeomPlug.logicalIndex();++        // NOTE: (yliangsiew) Because we can have multiple output+        // deformed meshes from a single blendshape deformer, we have+        // to walk back up the graph using the connected index to find+        // out what the _actual_ base mesh was.+        MayaBlendShapeDatum info = {};+        info.blendShapeDeformer = curBlendShape;+        info.outputGeomIndex = outputGeomPlugIdx;+        fnGeoFilter.setObject(curBlendShape);+        MObject inputGeo = fnGeoFilter.inputShapeAtIndex(outputGeomPlugIdx, &stat);+        CHECK_MSTATUS_AND_RETURN_IT(stat);+        info.baseMesh = inputGeo;+        info.deformedMesh = deformedMesh;++        fnBlendShape.setObject(curBlendShape);+        info.numWeights = fnBlendShape.numWeights();+        MIntArray weightIndices;+        stat = fnBlendShape.weightIndexList(weightIndices);+        CHECK_MSTATUS_AND_RETURN_IT(stat);++        for (unsigned int i = 0; i < weightIndices.length(); ++i) {+            MayaBlendShapeWeightDatum weightInfo = {};+            weightInfo.weightIndex = weightIndices[i];+            stat = fnBlendShape.getTargets(+                deformedMesh, weightInfo.weightIndex, weightInfo.targetMeshes);+            CHECK_MSTATUS_AND_RETURN_IT(stat);++            for (unsigned int j = 0; j < weightInfo.targetMeshes.length(); ++j) {+                MObject targetMesh = weightInfo.targetMeshes[j];+                stat = fnNode.setObject(targetMesh);+                CHECK_MSTATUS_AND_RETURN_IT(stat);+                MPlug plgWorldMeshes = fnNode.findPlug("worldMesh", false, &stat);+                CHECK_MSTATUS_AND_RETURN_IT(stat);+                unsigned int numWorldMeshesConnected = plgWorldMeshes.numElements();+                if (numWorldMeshesConnected != 1) {+                    return MStatus::kFailure;+                }+                MPlug plgWorldMesh = plgWorldMeshes.elementByPhysicalIndex(0, &stat);+                CHECK_MSTATUS_AND_RETURN_IT(stat);++                if (!plgWorldMesh.isSource()) {+                    return MStatus::kFailure;+                }+                MPlugArray destPlugs;+                plgWorldMesh.destinations(destPlugs);+                for (unsigned int k = 0; k < destPlugs.length(); ++k) {+                    MPlug   destPlug = destPlugs[k];+                    MObject blendShape = destPlug.node();+                    MPlug   inputTargetGroupPlug;+                    MPlug   inputTargetPlug;+                    if (blendShape == curBlendShape) {+                        MPlug inputTargetItemPlug = destPlug.parent();+                        MPlug inputTargetItemsPlug = inputTargetItemPlug.array();+                        inputTargetGroupPlug = inputTargetItemsPlug.parent();+                        weightInfo.inputTargetGroupIndices.append(+                            inputTargetGroupPlug.logicalIndex());++                        MPlug inputTargetGroupsPlug = inputTargetGroupPlug.array();+                        inputTargetPlug = inputTargetGroupsPlug.parent();+                        weightInfo.inputTargetIndices.append(inputTargetPlug.logicalIndex());+                    }+                }+            }++            // NOTE: (yliangsiew) If the target mesh has "in-between" weights, in+            // Maya they are stored as an array of sparse ints, where the formula is:+            // index = fullWeight * 1000 + 5000.+            // Thus fullWeight values of 0.5, 1.0 and 2.0, they will be connected to+            // inputTargetItem array indices 5500, 6000 and 7000, respectively.+            // Refer to the docs for MFnBlendShape::targetItemIndexList for more info.+            stat = fnBlendShape.targetItemIndexList(+                weightInfo.weightIndex, deformedMesh, weightInfo.targetItemIndices);+            CHECK_MSTATUS_AND_RETURN_IT(stat);++            info.weightDatas.push_back(weightInfo);+        }+        outInfos.push_back(info);+    }+    return stat;+}++PXR_NAMESPACE_OPEN_SCOPE++VtIntArray getUnionOfVtIntArrays(const VtIntArray* const arrays, const size_t count)+{+    std::unordered_map<int, int> visitedMap = {};+    for (size_t i = 0; i < count; ++i) {+        const VtIntArray array = arrays[i];+        for (size_t j = 0; j < array.size(); ++j) {+            ++(visitedMap[array[j]]);+        }+    }++    VtIntArray result;+    for (auto it = visitedMap.begin(); it != visitedMap.end(); ++it) {+        if (it->second != 0) {+            result.push_back(it->first);+        }+    }++    return result;+}++MStatus findNormalOffsetsBetweenMeshes(+    const MObject&   target,+    const MObject&   base,+    const MIntArray& indices,+    VtVec3fArray&    offsets)+{+    assert(target.hasFn(MFn::kMesh));+    assert(base.hasFn(MFn::kMesh));++    MStatus stat;+    MFnMesh fnMesh(target, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    unsigned int numNormalsTarget = fnMesh.numNormals(&stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    const float* targetNormals = fnMesh.getRawNormals(&stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    const GfVec3f* pVtTargetNormals = reinterpret_cast<const GfVec3f*>(targetNormals);+    VtVec3fArray   vtTargetNormals(pVtTargetNormals, pVtTargetNormals + numNormalsTarget);++    fnMesh.setObject(base);+    unsigned int numNormalsBase = fnMesh.numNormals(&stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    if (numNormalsTarget != numNormalsBase) {+        return MStatus::kFailure;+    }++    const float* baseNormals = fnMesh.getRawNormals(&stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    const GfVec3f* pVtBaseNormals = reinterpret_cast<const GfVec3f*>(baseNormals);+    VtVec3fArray   vtBaseNormals(pVtBaseNormals, pVtBaseNormals + numNormalsBase);++    unsigned int numIndices = indices.length();+    offsets.resize(numIndices);+    for (unsigned int i = 0; i < numIndices; ++i) {+        int componentIdx = indices[i];+        offsets[i] = vtTargetNormals[componentIdx] - vtBaseNormals[componentIdx];+    }++    return stat;+}++/**+ * Reads data for a target from a blendshape node.+ *+ * @param blendShapeNode        The blendshape deformer.+ * @param inputTargetIndex      The input target sparse index.+ * @param targetGroupIndex      The input target group sparse index.+ * @param targetWeightIndex     The input target item sparse index that also acts as the "weight" of+ * the target.+ * @param outputGeomIndex       The output geometry sparse index.+ * @param targetOffsetIndices   Storage for the indices of the components being affected.+ * @param targetOffsets         Storage for the vertex offsets of the components being affected.+ * @param targetNormalOffsets   Storage for the normal offsets of the components being affected.+ *+ * @return                      A status code.+ */+MStatus readBlendShapeTargetData(+    const MObject& blendShapeNode,+    const int      inputTargetIndex,+    const int      targetGroupIndex,+    const int      targetWeightIndex,+    const int      outputGeomIndex,+    VtIntArray&    targetOffsetIndices,+    VtVec3fArray&  targetOffsets,+    VtVec3fArray&  targetNormalOffsets)+{+    MStatus stat;+    assert(blendShapeNode.hasFn(MFn::kBlendShape));+    MFnDependencyNode fnNode(blendShapeNode, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MPlug plgInputTargets = fnNode.findPlug("inputTarget", false, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    assert(plgInputTargets.isArray());+    MPlug plgInputTarget = plgInputTargets.elementByPhysicalIndex(inputTargetIndex, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MPlug plgInputTargetGrps = mayaFindChildPlugWithName(plgInputTarget, "inputTargetGroup");+    assert(!plgInputTargetGrps.isNull());+    assert(plgInputTargetGrps.isArray());++    unsigned int numInputTargetGrps = plgInputTargetGrps.numElements();+    assert(static_cast<int>(numInputTargetGrps) > targetGroupIndex);+    MPlug plgInputTargetGrp = plgInputTargetGrps.elementByPhysicalIndex(targetGroupIndex, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MPlug plgInputTargetItems = mayaFindChildPlugWithName(plgInputTargetGrp, "inputTargetItem");+    assert(!plgInputTargetItems.isNull());+    assert(plgInputTargetItems.isArray());++#if _DEBUG // TODO: (yliangsiew) Need to find a good macro that I can rely on for this.+    MIntArray plgInputTargetItemLogicalIndices;+    plgInputTargetItems.getExistingArrayAttributeIndices(plgInputTargetItemLogicalIndices, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    assert(mayaSearchMIntArray(weightIndex, plgInputTargetItemLogicalIndices) == true);+#endif++    MPlug plgInputTargetItem = plgInputTargetItems.elementByLogicalIndex(targetWeightIndex, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MPlug plgInputComponentsTarget+        = mayaFindChildPlugWithName(plgInputTargetItem, "inputComponentsTarget");+    assert(!plgInputComponentsTarget.isNull());++    // NOTE: (yliangsiew) Problem: looks like there's a maya bug where you have to twiddle the+    // blendshape weight directly before these kComponentListData-type plugs get evaluated.+#if MAYA_BLENDSHAPE_EVAL_HOTFIX+    MPlug plgBlendShapeWeights = fnNode.findPlug("weight", false, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    assert(plgBlendShapeWeights.isArray());++    MFnBlendShapeDeformer fnBS(blendShapeNode, &stat);+    MFloatArray           origWeightVals; // Storage for the original weight values.+    MIntArray             indicesChanged;+    MIntArray             targetItemIndexList;+    MIntArray             bsWeightIndices;+    stat = fnBS.weightIndexList(bsWeightIndices);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    // NOTE: (yliangsiew) Need to force the other kComponentListData plugs to+    // be dirtied and recalculated.+    MObjectArray baseObjs;+    stat = fnBS.getBaseObjects(baseObjs);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    for (unsigned int i = 0; i < bsWeightIndices.length(); ++i) {+        int weightIndex = bsWeightIndices[i];+        for (unsigned int j = 0; j < baseObjs.length(); ++j) {+            MObject baseObj = baseObjs[j];+            targetItemIndexList.clear();+            stat = fnBS.targetItemIndexList(weightIndex, baseObj, targetItemIndexList);+            CHECK_MSTATUS_AND_RETURN_IT(stat);++            for (unsigned int k = 0; k < targetItemIndexList.length(); ++k) {+                float curWeight = fnBS.weight(weightIndex, &stat);+                CHECK_MSTATUS_AND_RETURN_IT(stat);+                origWeightVals.append(curWeight);+                // NOTE: (yliangsiew) For in-between shapes, need to trigger at _all_+                // full weight values of each target so as to populate the components+                // list for each of the targets. Yea, this is dumb.+                float targetWeight = mayaGetBlendShapeTargetWeightFromIndex(targetItemIndexList[k]);+                fnBS.setWeight(i, targetWeight);+                indicesChanged.append(i);++                // NOTE: (yliangsiew) We also just force an evaluation+                // of the mesh at each time we set the blendshape+                // weight value in the scene to force the components+                // list to update.+                MFnMesh fnMesh;+                for (unsigned int i = 0; i < baseObjs.length(); ++i) {+                    stat = fnMesh.setObject(baseObjs[i]);+                    CHECK_MSTATUS_AND_RETURN_IT(stat);+                    const float* meshPts = fnMesh.getRawPoints(&stat);+                    CHECK_MSTATUS_AND_RETURN_IT(stat);+                    (void)meshPts;+                }+            }+        }+    }++    // NOTE: (yliangsiew) Restore the weight changes that we were doing above.+    for (unsigned int i = 0; i < indicesChanged.length(); ++i) {+        stat = fnBS.setWeight(indicesChanged[i], origWeightVals[i]);+        CHECK_MSTATUS_AND_RETURN_IT(stat);+    }+#endif++    MDataHandle dhInputComponentsTarget = plgInputComponentsTarget.asMDataHandle(&stat);++    CHECK_MSTATUS_AND_RETURN_IT(stat);+    MObject inputComponentsTargetIndices = dhInputComponentsTarget.data();+    if (inputComponentsTargetIndices.isNull()+        || !inputComponentsTargetIndices.hasFn(MFn::kComponentListData)) {+        return MStatus::kFailure;+    }+    MFnComponentListData fnComponentListData(inputComponentsTargetIndices, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);+    unsigned int numIndices = fnComponentListData.length();+    if (numIndices == 0) {+        return MStatus::kFailure;+    }++    targetOffsetIndices.clear();+    MIntArray indices;+    for (unsigned int i = 0; i < numIndices; ++i) {+        MObject                   curComponent = fnComponentListData[i];+        MFnSingleIndexedComponent fnSingleIndexedComponent(curComponent, &stat);+        CHECK_MSTATUS_AND_RETURN_IT(stat);+        stat = fnSingleIndexedComponent.getElements(indices);+        CHECK_MSTATUS_AND_RETURN_IT(stat);+        for (unsigned int j = 0; j < indices.length(); ++j) {+            targetOffsetIndices.push_back(indices[j]);+        }+    }++    MPlug plgInputPointsTarget = mayaFindChildPlugWithName(plgInputTargetItem, "inputPointsTarget");+    MDataHandle dhInputPointsTarget = plgInputPointsTarget.asMDataHandle(&stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MObject inputPointsTarget = dhInputPointsTarget.data();+    assert(inputPointsTarget.hasFn(MFn::kPointArrayData));++    MFnPointArrayData fnPtArrayData(inputPointsTarget, &stat);+    CHECK_MSTATUS_AND_RETURN_IT(stat);++    MPointArray  mptTargetOffsets = fnPtArrayData.array();+    unsigned int numOffsets = mptTargetOffsets.length();+    if (numOffsets == 0) { // NOTE: (yliangsiew) There cannot possibly be _no_ offsets in the+                           // blendshape, since we have indices for the offsets.+        return MStatus::kFailure;+    }+    targetOffsets.resize(numOffsets);+    for (unsigned int i = 0; i < numOffsets; ++i) {+        MPoint curPt = mptTargetOffsets[i];+        targetOffsets[i] = GfVec3f(curPt.x, curPt.y, curPt.z);+    }++    MPlug plgTargetGeom = mayaFindChildPlugWithName(plgInputTargetItem, "inputGeomTarget");+    if (plgTargetGeom.isNull()) {+        return MStatus::kFailure;+    }+    MObject targetGeom = plgTargetGeom.asMObject();

Yes an additional flag on the export command.

ysiewappl

comment created time in 9 hours

PullRequestReviewEvent

issue commentAutodesk/maya-usd

Incorrect viewport selection for "bounds" drawMode

Thanks @santosg87 to confirm. May I ask if there is any plan how to fix it? Should I expect to see a fix in maya-usd ?

csyshing

comment created time in 10 hours

pull request commentAutodesk/maya-usd

Add support for UV transform value exports

That’s new. I will start it again.

dgovil

comment created time in 13 hours

push eventAutodesk/arnold-usd

Sebastien Blaineau-Ortega

commit sha dc3a99a72e2e0ea5b8e6e2323aba218032e4ed99

Support polymeshes with empty nsides array (#610) Fixes #596

view details

push time in 13 hours

more