Skip to content

Bones with modifiers are not exported #45

Description

@charlesfleche

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions