Quick fix for YABEE Exports (Blender to Egg)

Hello Everyone,

I recently discovered that maxwells yabee exporter and its ancestors were failing due to a None reference. You can fix this pretty simple with the following code in egg_writer.py.

 for node in bpy.data.materials[0].node_tree.nodes: # HERE IS THE ISSUE.
                        if node.name == "Principled BSDF":
                            principled_bsdf = node
                            basecol = list(principled_bsdf.inputs["Base Color"].default_value)
                            metallic = principled_bsdf.inputs["Metallic"].default_value
                            roughness = principled_bsdf.inputs["Roughness"].default_value

To:

 for node in nodeTree.nodes: # HERE IS THE CHANGE, simply use the nodeTree from the correct index above in scope. 
                        if node.name == "Principled BSDF":
                            principled_bsdf = node
                            basecol = list(principled_bsdf.inputs["Base Color"].default_value)
                            metallic = principled_bsdf.inputs["Metallic"].default_value
                            roughness = principled_bsdf.inputs["Roughness"].default_value

The line number is different for each project:

GitHub - Maxwell175/YABEE: Export models from the Blender to Panda3D game engine - line 1236
GitHub - BlenderCN-Org/YABEE-1: YABEE -- Renewed Egg exporter for the Blender 2.8 - line 1186

This correctly exported Principled BSDF materials for me.

Remember, you can make this change in the addon itself. On linux this is in ~/.config/blender/<blender_version>/scripts/addons/<name_of_addon>

Ill submit PRs to the projects themselves soon.

2 Likes

Another note, It was not at all obvious to me how to originally evaluate a stack trace from blender. The message in the UI simply said “see console for back trace”. The problem with that ui design is that there is indeed a console for logs in blender in the scripting tab. This was not giving extra detail. If you want the raw output of blender in STDOUT, open in on the terminal and not through the desktop icon! This will get you more info. Cheers.

1 Like

Thanks for the help. I’ll add this change to my repo in a few days. Can you let me know what blender version you are using it with?

2 Likes

Thanks for the exporter! Im on 3.6

That’s great news! I’ll get it updated this week. Gotta just make sure things still work on older versions too.

3 Likes

Im happy to help in any way I can. Ill study thebcode more later, so i can learn more about the formats etc.

Keep in mind, i didnt test much beyond static objects and simple materials, that was my use case at the time. So with your insight, maybe test other things!

Yes, for sure. By the way, did you find the additional object properties window helpful?

This might also come in handy: https://github.com/panda3d/panda3d/blob/master/panda/src/doc/eggSyntax.txt

1 Like

If you are asking about applying tags via the object properties windows, yeah, thats very useful. My thought was you could use it to specify different meta data that then could be acted on in code. Since i plan to allow my users to make plugins, thats a great way to have custom data injected for custom game modes.

While i have you here, the old yabee exporter for 2.7 used the blender game objects properties for specifying the collision egg syntax info (from what i read in fireclaws book). They removed the blender game engine code to my knowledge. (You may want to fix that piece in your readme)
Can that be done with the object properties windows the same way as tags?

The blend2bam exporter does it with an invisible collisions collection naming schema.

Im trying to collect the knowledge of peoples workflows and 3d format tricks so i can add it to the docs, if the team agrees and allows me to.

This is what im refering to " * and collision options export through Blender’s “Game logic” → “properties”"

I dont think thats available anymore. At the very least, I cant find it ha.

That used to be a feature but I think I should be able to bring it back using Custom Properties — Blender Manual

This is the relevant code: https://github.com/Maxwell175/YABEE/blob/master/yabee_libs/egg_writer.py#L178

As far as collisions go all of the necessary egg properties are already exposed as text boxes in that Object Properties window.

1 Like

Are we talking about the same thing? I was indeed talking about the custom properties section you linked. I though these attributes just ended up as tag sections in the egg files. Is there another window for properties specific to panda nodes? Sorry for being confusing.

Ill check out the code when im not on my phone.

There is. I added a panda specific section that should be showing up in the object properties section.

If it doesn’t show up, that could be due to blender 3 changes of some sort.

I dont think i saw that. Walking to my computer.

Where should it be showing up? Im not sure im looking in the right place.

These are the sections of the object properties that I am seeing on a cube.

image

Yeah looks like new blender changed something there that is preventing it from adding it.

No, im an idiot, I had it disabled and was looking at the other yabee exporter. Its there

1 Like

So this is pretty neat, i can simply use this to add data to the egg sections, great!

1 Like

So one last question. Does it deal with rigidbodies for bullet nodes?