Pre-and-post-processor for blend2bam, a tool to convert Blender blend files to Panda3D BAM files
Project description
boterham
boterham
is a custom pre-and-post processor for blend2bam
, which is a CLI tool to convert Blender blend files to Panda3D BAM files.
Since a lot of my projects often end up with some bam parser I decided to make a more definitive one. Pre-processing revolves around automatically setting up custom properties to nodes in blend files based on certain characteristics applying destructive modifiers. Post-processing will then read all the custom properties as tags in panda3d and alter the nodes. Property names could mirror function names. I might add a generic pre-loader for setting up things on game load that can not be saved as a BAM file.
This place could also serve as a testbed for new blend2bam features.
This project started by ripping everything out of blend2bam. For this reason it should carry blend2bam's license for ever and ever. Any level of professionality in this project is thanks to Moguri.
Don't use this yet.
But if you do, it works just like blend2bam. After installing do boterham myblendfile.blend newbamfile.bam
Currently implemented:
Calling functions and replace PandaNodes with Custom Properties
Adding a custom property in blender whose name starts with the symbol $
will run it as a function on the NodePath. For example adding $reparent_to
or $flatten_strong
. You can pass arguments to this function using a dict as property value as followed: "extra_args":[some_value]
. This is evaluated as JSON.
A property starting with $node().
will run the function on the first attached PandaNode. For example on a DirectionalLight one could do $node().set_color
with value "extra_args":[(1,0,0,1)]
to make it shine red.
This is especially useful in combination with node replacement, by starting a property name with the symbol +
. For example on an empty, one could add the property +SequenceNode
to turn it into a sequence node. Add another property $node().loop
to make it start playing in an endless loop.
An argument that starts with the symbol @
will be replaced with the first nodepath found through render.find().
For example property $reparent_to
with value "extra_args":[@**/Camera]
will reparent the nodepath to whatever node in the scene is called Camera.
Automatic LODNodes using the Decimation modifier
Add a Decimate modifier an name it LOD_N
, where N is the number of LOD levels you want.
Set the modifiers ratio to be the furthest LOD.
Note: at the moment subdivision surface modifiers are applied AFTER LOD processing, so apply them manually for now.
Decending CollisionPolygons.
Adding the property geom_to_collision_polygon
will recursively copy all children's GeomNodes as CollisionPolygons. Tip: Use $flatten_strong
to combine shapes.
Dream features:
- displacement modifiers as ShaderTerrainMesh (partially implemented)
- better handle linked instances (for Actors)
- bake procedural textures as pbr material
- handle modifiers with regards to shapekeys
- convert object animation to armature animation
- mesh to waypoint
- edges as drawn with LineSegs
- who knows what else!
Note
Some assumptions are being made and not all blend2bam functionality work. It supports version >2.8 of blender only using pbr materials.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for panda3d_boterham-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503bcc0e510940cf7f3adadffe56a2483052e9fa118705d265536093bc1b961e |
|
MD5 | 2a7dd2649295ffdd1b40cd45989f1c49 |
|
BLAKE2b-256 | 3ef67efb4da6ce2cf2f1efe17ba5cc1bc345902554651d1f71c411b24744d192 |