Panda3D Scene Editor

Hi everyone,

today I present to you my brand new Scene Editor for Panda3D.

The editor is in early development with most basic features working fine and more and more features being implemented over the next time.
But now it’s up to you to try it out and let me know which features you’d like to see in it. What would you expect from a Panda3D scene editor.

This editor is part of the modular editor FRAME

Features

  • Editing scene objects
  • Add various kinds of objects (models, lights, collision solids, etc)
  • Scene graph tree view
  • Blender style scene navigation
  • Loading/Saving and exporting scenes
  • Infinite undo/redo cycle
  • Pure python
  • Pure Panda3D

Dependencies

To make the Editor work wherever Panda3D will work, the dependencies are kept minimal with all GUI elements being written in DirectGUI with the addition of my DirectGUI extension library and direct folder browser

Download

Grab the latest version from github. There you’ll also find details of how to use it.

Screenshots

If you are interested in the SceneEditor, you may also like to take a look at my DirectGuiDesigner which completes the workflow with an editor for DirectGui UIs.

7 Likes

That is very cool! :slight_smile:

As to expected features, I’m not likely to be a user of this tool myself, so take the following with a grain of salt.

That said, I suppose that my first thought is this: How does one connect elements within an editor-scene to game-logic?

Connecting the scene to game logic is up to the user as this would require knowledge of how the user is setting up it’s logic which will probably differ for everyone.

The scene editor simply creates a scene as either json or python code which can both theoretically be used by the end user.
Recommended is the python way, if you exported a scene, just create your logic code in a separate class and use the nodepaths created in the python script to do whatever you want in your logic with them.

For example if you have a character which you have to place in your scene, simply place empty nodes in the scene and position the character on it in your logic like so:

myCharacter.set_pos(myScene.characterStartPosNodePath.get_pos())

The same can be done for anything else added to the scene like, handling collisions, changing light values, switching cameras etc.

I mean, it can indeed be done that way. But then why not just use Blender?

I suppose that, to my mind, the main advantage of a scene editor is to give developers a more-visual approach to building their game–beyond just building the physical structure of a level. A way to associate code with things seen in the game-world, and a convenient interface for altering properties.

I’m thinking, for example, of Unity. There objects within a scene can be directly linked to scripts, as I recall, and properties in code can appear within the editor’s UI for convenient entry and connection.

The difference to blender is that it directly shows how things will look in the engine. Currently there aren’t many specific things compared to exporting from blender but I do have plans to add things like applying shaders to nodes which are things that as to my knowledge wont be able to be exported from blender. Or display performance details like how much ram the scene requires and if it’s performing well at all.

Also in the longer run I am planning to integrate the scene editor in a larger “frame” application that will be able to create and connect application logic with the scene as well as include the GUI editor and so on.

Okay, fair enough on all points, then! Thank you for expanding on those matters so. :slight_smile:

you’re welcome. I also hope this will help especially those new to Panda3D to ease getting into developing with it. But also I like to see this helpful for long time users as well so I’m looking for how others work with the engine and where the tools may fit in or can be fitted to.

1 Like

For me, personally, I don’t think that it fits into my workflow. However, I can see others finding it to fit theirs, potentially!

It’s more of a graphical flow. So if your workflow is more developer centric then it probably won’t fit well but that’s fine. That’s the plus of Panda3D it doesn’t force a specific way of doing things and that way I also try to keep my editors. They add a graphical layer on top of the API but try to not force anyone to use a specific workflow, hence you can also use all the editors standalone and wherever they fit.

Hmm… It’s less that it’s a graphical flow–I recall using Unity and very much liking it, for example–than that, in my current Panda workflow, it sits somewhat awkwardly between two steps:

On the one hand, I’m going to be using Blender to create models, I daresay, and won’t be in a position to preview shaders etc. on them while doing so. On the other, I’m going to want to bring those models into my game at run-time.

I can thus place objects and suchlike in Blender, and do performance-testing, shader-viewing, etc. in my code. (And if I want to just preview a shader, I have a mini-tool for that.) I thus feel that, for me, there’s little real space in my workflow for this tool in its current form.

If anything, for it to work for me it would have to be more graphical–to incorporate game-logic as I mentioned previously, and things like shader-application as you described, and thus take over part of what I currently do just in code.

Ah I see, makes sense. Then it’s just in an too early state to be usable for you.

Regarding the logic, do you use a specific pattern to connect logic, scene setup and other parts of your games?

It’s strange because the fastest way to save as bam, but this is also an option.

In all fairness, I do think that it could prove very useful in its current state for developers who don’t do their own modelling. Those who make use of third-party assets, or teams in which there are distinct modellers and level-builders.

Hmm… For my current games, probably, but it’s not something that I’ve formally settled upon. Rather, it build my games as makes sense to me.

I suppose that my “beginner’s tutorial” perhaps shows a simple version of my approach. (Perhaps look to the reference code that accompanies it if you want to examine that approach.)

But I suppose in short, my basic pattern is to have “logical objects” that hold models and nodes. For example, a very simple “GameObject” class might look like this:

class GameObject():
    def __init__(self, modelFileName):
        self.manipulator = NodePath(PandaNode("an object"))

        self.modelFileName = modelFileName
        self.model = loader.loadModel(modelFileName)

        self.model.reparentTo(self.manipulator)

        self.velocity = Vec3(0, 0, 0)

    def update(self, dt):
        self.manipulator.setPos(self.manipulator.getPos() + self.velocity * dt)

That said, as I mentioned previously I have used Unity in the past–admittedly many years ago, now–and I did find that I liked their approach, too.

Exporting the Scene as a bam may also be an option worth looking into but as far as I know the bam format, it may be limiting the features that can be exported. Even though, probably not yet but in the future when the feature set grew, as bam is simply a binary representation of the scene graph.

I see. Thanks for the insight.

I have to say I never really used unity much, just looked at it few years back, same for most other game engine editors like godot or unreal and so on. So if anyone has insights to those or know about features they have which would really be worth to integrate in the Scene Editor, let me know.

1 Like

Sick! This’ll definitely come in handy with my project because since it’s a pain to manually place objects with code. I’ve come up with my own object loader which loads objects based on an objects.json file, it’d be quite nice if you could, in theory, add an “Export to JSON” feature.

The main project save file is already in json format. But it probably will differ with your format. I do have plans to provide a feature for custom format exports.

Mine is just this.

[
    {
        "name": "myobject",
        "model": "mymodel",
        "texture": "mytexture",
        "hpr": [0, 0, 0]
    }
]

I’ll probably modify your scene editor to work with my resource loader. But yeah, this is quite helpful.

That’s quite a simple format and should be very easy to implement. There currently isn’t a way to edit textures in the Editor yet, but you may be able to retrieve the data from the model node if it’s stored there somewhere.

My resource loader works on a name2path system so there’s a very low chance it’ll work out-of-the-box.