Autodesk / Autodesk/3dsmax-usd

Bones with modifiers are not exported

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
94
Forks
6
Avg merge
6d 20h
Merged PRs (30d)
1

Description

**Describe the bug**

When exporting a Skeleton to USD, if a bone has a modifier, it is not exported properly and its bind and rest transforms are lost.

The following scene has two skeletons:

- `Skel_OK`: `A/B/C`
- `Skel_ERROR`: `D/E_with_noop_deformer/F`

Image

The `E` bone has this noop deformer applied:

```
plugin modifier NoOpModifier
name:"No-Op Modifier"
classID:#(0x6184a291, 0x3d7b42c8)
extends:EmptyModifier
replaceUI:true
version:1
(
parameters main rollout:params
(
)

rollout params "No-Op Modifier"
(
label lbl_info "This modifier performs no operation."
)
)
```

When exported to USD using this script:

```python
import tempfile

from pymxs import runtime as rt

export_options = rt.USDExporter.createOptions()

export_options.RootPrimPath = "/"

export_options.Meshes = True
export_options.Shapes = False
export_options.Lights = False
export_options.Cameras = False
export_options.Skin = True
export_options.Morpher = True
export_options.Materials = True
export_options.ShadingMode = rt.name("useRegistry") # none, useRegistry
export_options.AllMaterialTargets = rt.name("UsdPreviewSurface")

export_options.UsdStagesAsReferences = False
export_options.HiddenObjects = True
export_options.UseUSDVisibility = False
export_options.AllowNestedGprims = False

export_options.FileFormat = rt.name("ascii") # ascii, binary
export_options.Normals = rt.name("asAttribute") # none, asAttribute, asPrimvar
export_options.MeshFormat = rt.name("polyMesh") # fromScene, polyMesh, triMesh
export_options.TimeMode = rt.name("current")

export_options.SetChannelPrimvarMapping(-2, "displayOpacity") # Vertex Alpha
export_options.SetChannelPrimvarMapping(-1, "LayerWeights") # Vertex Illum
export_options.SetChannelPrimvarMapping(0, "displayColor") # Vertex Color

export_options.StartFrame = float(rt.animationRange.start)
export_options.EndFrame = float(rt.animationRange.end)
export_options.SamplesPerFrame = 1.0

export_options.UpAxis = rt.name("z") # y, z
export_options.BakeObjectOffsetTransform = True
export_options.PreserveEdgeOrientation = True

export_options.BonesPrimName = "MyDefaultBonesPrimName"
export_options.AnimationsPrimName = "MyDefaultBonesPrimName"

export_options.IncludeAllBones = True
export_options.PreserveBoneMeshes = False
export_options.SimplifyBonePaths = True

export_options.UseWorldspaceRoot = False

export_options.UseProgressBar = True

export_options.LogLevel = rt.name("info") # off, info, warn, error

export_options.OpenInUsdview = False

export_options.ChaserNames = rt.Array()
export_options.AllChaserArgs = rt.Dictionary()

with tempfile.NamedTemporaryFile(prefix="maxusd-", suffix=".usda", delete=False) as fp:
path = fp.name

print(path)

rt.USDExporter.ExportFile(
path,
exportOptions=export_options,
contentSource=rt.name("all"), # all, selected, nodeList,
)
```

- `Skel_OK` is exported as expected, with three bones and sets of 3 transforms
- `Skel_ERROR` has only two bones and only 2 sets of transforms

Image

**Steps to reproduce**
Steps to reproduce the behavior:
1. Create a bone hierarchy
2. Run `noop-modifier.ms` script to register a noop modifier
3. Apply it to one of the bone
4. Export to USD
5. The exported USD Skeleton misses the bone that has a modifier

**Expected behavior**

Bones should be exported regardless of their applied modifiers.

**Specs (if applicable):**
- OS & version: Windows 11
- 3ds Max version: 2027.2 / 29.2.0.20588
- 3ds USD version: 0.16.2.31

**Additional context**

I've attached this noop modifier as to have a minimal example, but in our pipeline with have other modifiers and they trigger the same bug.

[debug-bone-with-modifier.zip](https://github.com/user-attachments/files/30357459/debug-bone-with-modifier.zip)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the export with the attached scene and noop-modifier.ms, using the USDExporter.ExportFile entry point and the options shown. Compare the exported skeletons for Skel_OK and Skel_ERROR, focusing on the bone with the modifier and its bind and rest transforms. Done means bones with modifiers are included with their complete transform sets.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.