Moguri / blend2bam

A CLI tool to convert Blender blend files to Panda3D BAM files
MIT License
68 stars 18 forks source link

Shape Keys don't get exported #72

Closed staylazy-studios closed 1 year ago

staylazy-studios commented 1 year ago

I've created a new model and exported one with gltf and one with blend2bam. the gltf version works but not the bam version.

the code:

from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from direct.interval.LerpInterval import LerpPosInterval

class ShapeKeys(ShowBase):
    def __init__(self):
        super().__init__()

        self.cube = Actor("box2.gltf") # this works
        #self.cube = Actor("box2.bam") # not this
        self.cube.reparentTo(self.render)
        print(self.cube.listJoints())

        self.joint = self.cube.controlJoint(None, "modelRoot", "Key 1")

        i = LerpPosInterval(
                self.joint,
                5,
                (1, 0, 0),
                blendType='noBlend',
                name="cube interval"
            )
        i.start()

ShapeKeys().run()

the blend file is a newly created version 3.3.1 model with Shape keys Basis and Key 1 box2.zip

image

Entikan on Discord pointed out that it could be because of blend2bam not supporting the new "Shape Keys" tick on gltf export image

Moguri commented 1 year ago

This option is checked by default, so I do not believe that is the issue. However, it seems that the Apply Modifiers option breaks shape keys. I have not had a chance to look at the file itself, but does the object in question have modifiers?

staylazy-studios commented 1 year ago

@Moguri No, it doesn't have any modifiers applied. It's just the default cube with the default shape key 'Basis' and 'Key 1' which looks like: image

Moguri commented 1 year ago

I did some digging, and it looks like some change in Blender 3.3 broke shape key export for blend2bam. I have some ideas for how to fix it. In the meantime, you can use an older version of Blender as a work-around.

staylazy-studios commented 1 year ago

Oh, okay. I tried it with 3.2.2 and it worked! Thanks for your help!

Moguri commented 1 year ago

I have pushed a potential fix to master if you'd like to give it a try in your workflow.

Moguri commented 1 year ago

Marking as resolved.