Serializing PandaNode, Shaders, CollisionTraverser, etc

I got the following error when yaml.load(yaml.dump(NodePath))

could not determine a constructor for the tag ‘tag:yaml.org,2002:python/object/apply:panda3d.core.py_decode_NodePath_from_bam_stream’

Is it possible to steam pandanodepath using yaml? or should I use another tool. Thanks!

The problem was solved with Pickle.
But there remains a warning:

:util(warning): Objects of type ShaderAttrib cannot be read; bam file is invalid.

At the moment, setShader/setShaderInput/setShaderAuto settings are not yet serialized, which is what the warning is telling you about. There is an open feature request about this here:

Thanks. I bypassed the problem by using a post-processing to update the shader attributes.
One thing I cannot bypass is the CollisionTraverser. I am dumping a self-defined class which has a NodePath member variable and a CollisionTraverser member variable. I have to suppress the CollisionTraverser before pickle.dump and reinitialize it again after pickle.load. Is it possible to make a serializable CollisionTraverser?

Yes, it is possible to add this feature, I think. Please file a feature request over on GitHub for this. Thanks!

1 Like