Panda3D Studio!

Hi everyone,

After introducing Panda3D Studio (or p3ds if you prefer) and fixing some code issues after putting it up on GitHub, this is now the place to discuss it in more detail.

Currently it is a very early work in progress and you should expect some problems when running it… if you can run it at all - and on Linux that already seems to be a big problem, due to wxPython issues. For starters, you should have wxPython version 2.8.x installed, as some of the changes in version 3.x are messing up most of the customization I’ve done (panels don’t even show up, default text font seems to be smaller now, clicking a value inside an input field no longer seems to select it, and who knows what else).
But even with wxPython version 2.8.x there seems to be a wx.Sizer error when starting p3ds on Linux; I tried this on an Ubuntu Live USB (“try before install”) but I hardly know anything about Linux, so maybe I did something wrong when installing wxPython. If someone could verify this, that would be great.

EDIT:
The concerns regarding wxPython are no longer an issue, since the project now uses a pure-Panda GUI.

If the above does not affect you, I would like to know your first impressions of the program. Does it feel comfortable to navigate the scene? Do you find it acceptable that interacting with the program basically comes down to going into different modes (navigation, creation, selection, etc.)? What are your thoughts on the GUI?

If anyone wants to know more about how I handle certain things, like the history system, communication between Core and GUI components, managing object identities or whatever, just ask :slight_smile: .

1 Like

It looks very promising. There are a few quirks that take a bit of getting used to, but the overall impression is very good.

One big problem I have is the missing object properties panel (screen: s29.postimg.org/wg5zlwxhj/uv_panel.png ).

Export works fine, but Import is broken or not done yet (nothing happens when I try to import a .bam).

Creating, moving, scaling, rotating objects works flawlessly. Editing the UV also work (I can only move/rotate polygons one by one without the extra buttons). I also have no problems moving, rotating and zooming the camera, I don’t know why You choose space as the key to move the camera, but I have to say it’s better then the shift/alt/ctrl + all 3 mouse buttons as in some professional modelling software (especially if one uses a trackball with only 2 buttons like me).

The Deep Shelf is a bit awkward to use, when I hover over a item on the list it shows a sub list above, and when moving my pointer to one of the sub-items the whole menu rearranges itself to show the sub-items as main items (and a new set of sub-sub-items is show if they are available). When trying to customize the shelf I managed to delete all buttons and I didn’t know how to fix that (had to revert the files) :mrgreen:
I’d prefer a simple File, Edit, Select, Etc, old-school, drop-down, textual menu and a set of customizable, quick access, icon based toolbars. This is not something that would stop me from using the program, a minor thing.

The only obvious thing missing right now (apart from the extra modelling tools :wink: ) is the option to switch between orthographic and perspective view and buttons to set the camera to the front/side/back. Maya and then later Max had this ViewCube thing - it’s a very handy widget that you might want to replicate at some point:
knowledge.autodesk.com/support/ … e-htm.html

Glad you like it :slight_smile: .

Hmmm, what version of wxPython do you have installed? When I check the latest version mentioned in Panda3D-1.10.0\python\Lib\site-packages\wx-2.8-msw-unicode\docs\CHANGES.txt, I see that I have version 2.8.12.1 installed; yeah, a pretty old version :unamused: .

It used to work for .egg files (as long as they were exported with Panda3D Studio), but then I switched to .bam and I haven’t implemented the new import code yet, sorry.

Like you, I also dislike how this is usually handled and since navigating the scene is something that has to be done frequently, I just chose the biggest key available :smiley: .
By the way, you can press (while in navigation mode) to make the camera target the object the mouse is currently over, or the currently selected objects if the mouse isn’t over any object.

Okay, fair enough. The reason I made this was that I wanted a kind of “uber toolbar” that could house any number of tool buttons, placed in different groups/categories, while still being easy to navigate. What you see when you hover over a group button is a kind of “preview” of the items it contains, a bit like a popup really. And yes, when you move the mouse over this preview, you actually navigate to this contents. DeepShelf started life as a standalone application, a program launcher for Windows, and I found it to work quite well. But perhaps it’s not really suited for a program such as this one - or the world is simply not ready for this kind of innovation :mrgreen: .
I’ll think about replacing it with more familiar menu and toolbars.

Yup, I know of it and making something like this is on my todo list :slight_smile: .

I’ve got wxPython 3.0.2.0 (wxPython3.0-win64-3.0.2.0-py27), as far as I know that’s the latest version. I installed it myself, didn’t think panda ships with wx (does it?).

I can try to install some other version if you think that will help.

And that’s why the panels don’t show up.

Not to my knowledge, no.

Yes, it should help if you installed version 2.8.x of wxPython (2.8.12.1, if you can find it, should definitely make it work), as I mentioned before. In time, I hope to get rid of it entirely, but for now we’ll just need to continue to “relax with wxPython”… :frowning:

I gave it a try on Linux.

Firstly, apparently I had multiple versions of wxPython installed. I had to add this to the beginning of main.py to make it work:

import wxversion
wxversion.select('2.8.12')

Secondly, in class Panel, it seems that somehow __on_size was called before finalize. So, I had to hack around that to make it not rely on self._arrow_pos and self._bottom_rect being defined in __on_size.

Next, there were a series of crashes happening somewhere in deepshelf. I did some debugging to figure out where the crashes originated. It seems that on Linux, you cannot create a GraphicsContext in the constructor - you are only allowed to do so from the draw function, I reckon. You only use it to determine the text extents, from what I can gather; perhaps wxPython offers a different interface to do the same thing?
I commented out the calls to create the GraphicsContext (and set the text extents to some bogus value) in the constructors and it got past those crashes.

The final crash required me to remove this line in deepshelf/tool_btn_container.py:

Icons.add(wx.Bitmap(icon_path), icon_path)

These changes allowed me to run it. The GUI is a bit messed up (presumably due to the fact that I commented out lines haphazardly to work around the crash) and the viewport is blank. I’d be happy to continue to debug this when the aforementioned issues have been fixed.

I found wx 2.8.12.1 on Sourceforge and now I got the panels to show up.

Some minor problem in the uv editor:
-The ‘move’ part of the manipulation gizmo only has the lines and not the square active, to move something in the editor I have to click a 1 pixel line
-Vertex are 1 pixel or so - the clickable part is much smaller then the blue rectangle/dot displayed.

Thank you for that.

Fixed that by setting a flag “is_finalized” that is checked when __on_size is called.

For the most part, yes. There were a couple of instances where it’s also used to scale text but it’s not that important. I’ve tried using a ScreenDC instead, which should not cause a problem and also allows to get text extents. Yet, I’m still getting a segfault, even after removing Icons.add(…). So I had to comment out every reference to DeepShelf to fix all errors. Since I already planned to replace DeepShelf with a more traditional menu bar, it’s not such a big deal.

If you mean the black areas, then I don’t think those changes have got much to do with it. It rather looks like it’s caused by transparency issues; semi-transparent bitmaps should blend with the background, but instead it shows black where the background should show through.

Yeah, I have no idea why, but it seems the Panda window just isn’t visible. I commented out the part where it gets parented to the wx.Panel and then it shows up. When I tested a small code sample in which the Panda window is parented to a wx.Panel inside a larger wx.Frame, in exactly the same way I’m doing it in my project, it does work.

Thank you; feel free to do so after I replaced DeepShelf with a menu bar.
At the same time, I feel that continuing on this road is just going to be a huge waste of time for you, for me, and for anyone involved in this project. It’s not just the major problems discussed above, it’s also a number of minor things that annoy me, like the font being wider than on Windows so the panels become too wide (I could make the window stretch to compensate, but I dunno), tooltips that don’t disappear, the expanded panel scrollbar that doesn’t always collapse when it should, buttons staying highlighted after being pressed, text not being selected when clicked, etc.
It looks like it’s going to take a major rewrite to fix all these things (assuming they can be fixed), just to make it work on Linux. And on a Mac there might still be other problems.

Honestly, I think it would make more sense to rework the GUI using Panda itself. Instead of turning this thread into a wxPython discussion, we could then concentrate on any problems that actually have to do with Panda, don’t you agree?

For starters, I’d really appreciate it if you could test out the code in the first post. It turns out that on Linux, mouse movement and keyboard/mouse input are simply ignored when no rendering occurs and I just don’t understand that, seeing as it works without rendering on Windows, which is what I would expect. If this is another Linux quirk (or Windows quirk, depending on your point of view), then I’ll make the rendering dependent on platform. Apart from that (and the real title bar popping up when starting to drag the emulated one), everything should look and work the same on all platforms then.

For now, I do plan to add/change some more things for the current version with wxPython, but after that I would really like to leave it be and move on to a new version with a pure-Panda GUI.

The active parts of the square of the move gizmo are its outer lines, exactly like the move gizmo in the 3D viewport; this was modelled after the gizmo in 3dsmax, which works in the same way.
But the clickable part of lines and points should be around 10 pixels; perhaps your graphics card can’t handle the request of setting render mode thickness to 10 and falls back to 1, maybe?
With the UV editor open, you can select the corresponding geometry subobjects in the 3D viewport also (you might want to set the render mode to wireframe to better see what subobjects you’re mousing over). Does it work better when selecting vertex and edge subobjects there? For those, I set the render mode thickness to 5 (which seems to be sufficient there, presumably because it’s rendered by a perspective lens).
You can experiment with the render mode thickness of the UV subobjects in line 53 of this file:

src/core/uv_edit/cam.py

state_np.set_render_mode_thickness(10, 1)

It’s true though that transforming UV subobjects is not handled very well right now; I was already planning to change the transform system to be more like that used for the main 3D viewport (i.e. allowing the user to drag on the subobjects themselves to transform them).

As promised, I replaced DeepShelf with a menu bar and export to .obj is now possible (just choose the .obj file type in the export file dialog). Material export to .mtl is still somewhat basic (only diffuse color and transparency, as well as diffuse color map and alpha map). It doesn’t look like the .obj format supports multitexturing, though (multiple UV coordinates per vertex).

Currently, when you want to use exported models in your game, you will need to keep texture files together with the models that use them in the same directory; later on I will implement an export options dialog that allows you to set a path for the textures, relative to the model file directory.

A navigation gizmo has been added.

At first, you will hardly notice its presence in the topright corner, as it only occupies a small area of the viewport when it isn’t being used. As you hold the mouse over it, it will grow to a much bigger size.

The gizmo consists of a “Home” icon representing the default view, a cube representing 26 different views, and six arrows that each serve to select one of the main views when the corresponding cube side is not or hardly visible.
These red, green and blue arrows point in the direction of the positive X-, Y- and Z-axis, respectively. This makes it easy to figure out what view you will be switching to when clicking any of these arrows.

You can left-drag over the area of the gizmo to orbit the camera. While doing so, the arrows mentioned above will fade out as the corresponding cube sides come into view, so they will never get in your way when they aren’t needed.

Hope you like it :slight_smile: .

It is now possible to add string tags to any object. Simply right-click an object and a context menu will pop up, currently containing a single item: “Edit tags”. Selecting this item will show an “Edit object tags” dialog which will allow you to change and remove existing tags and add new tags.

These tags will also be exported along with the object (only applies to .bam format), and this already makes Panda3D Studio useful as a simple level editor. For example, you could use these tags to indicate what kind of collision shape your loaded nodes require and attach an appropriate collision solid to them in your game. Or you could set a tag labelled “light” on an object so your game code could replace it with a light source, and so on.

Cool would be if this would actually have some features that are not in Blender3D already and maybe need tighter engine integration to work. For example a tool kit for creating procedural character animations.

A really neat and relatively simple approach is explained in this video:
gdcvault.com/play/1020583/An … e-Approach

Given that Panda3D already has quite a few advanced animation blending features, something like this could be relatively easy to implement? Reinventing the wheel for a full-blown keyframe animation software would really not make much sense, but a small tight utility for tweaking procedural animations and maybe also physics objects (ragdolls, vehicle suspension etc.) would be really awesome to have.

I’ve been trying it on Linux again. It no longer crashes, though the Panda3D viewport is still grey, and so are some buttons. I get these errors:

Traceback (most recent call last):
  File "/home/rdb/lab/panda3dstudio/src/gui/button.py", line 269, in _draw
    dc.DrawBitmap(self._bitmaps["back"], 0, 0)
KeyError: 'back'
Traceback (most recent call last):
  File "/home/rdb/lab/panda3dstudio/src/gui/field.py", line 190, in _draw
    dc.DrawBitmap(self._back_bitmap, 0, 0)
AttributeError: 'InputField' object has no attribute '_back_bitmap'
Traceback (most recent call last):
  File "/home/rdb/lab/panda3dstudio/src/gui/button.py", line 269, in _draw
    dc.DrawBitmap(self._bitmaps["back"], 0, 0)
KeyError: 'back'

Any idea?

Well, it was a lot of work, but I managed to fix the most important problems!

The Panda window didn’t show up because of a stupid mistake I made: I created a panel for the border around the viewport and I parented it to the same wx.Window as the parent panel of the Panda window. So these two sibling panels overlapped and on Linux it’s the border panel that obscured Panda’s parent panel, while on Windows it was the other way around, which is why I never noticed.

The blank/black buttons and other interface elements however, were the result of a transparency bug related to GTK; see the last post in this thread. Thanks to Cody Precord’s workaround I was able to fix the problem but it was very laborious and some parts of the GUI still don’t look as they should, due to the way I had to apply the alpha components. But for the most part it’s OK I guess.

The text in the input fields has also been partly fixed, so it now shows up in the correct colour instead of grey, which was almost unreadable on the custom background colour.

There are still other issues that remain (e.g. the history window sometimes pops up at the normal size, but shrinks after moving it around, or just pops up at that small size to begin with).

All in all, the program should be quite usable now on Linux. Please try it out again and let me know how it works for you.

So yes, that means that if I did everything right, Linux users can now finally try out Panda3D Studio :slight_smile: .

One Panda-related issue under Linux that I noticed is the following: the picking camera seems to render GeomLines and GeomPoints only one pixel thick, making it very hard to select gizmo handles or model edges. Can you confirm this? If it works correctly for you, it might be that the graphics driver installed on my Ubuntu Live USB is outdated or something (the frame rate was also quite low).

@poVoq:
Although I do intend to support animation, I’m not sure how far I will get with that and it’s too early for me to really think about it, since I have a lot of other stuff to do first. When the time comes, maybe you would like to share some ideas or code? Things like ragdoll physics are a bit beyond me I’m afraid :stuck_out_tongue: .

Now we’re talking! It works, thanks so much! I’ll have to spend some time playing around with this.

Way out of my league as well, but managing physics objects should be relatively simple as Bullet is already integrated and I guess it works internally with Panda3D bones and primitives (as collision shapes) that you just need to display and let people play with the bullet settings. For example the maximum rotation of a joint or the mass of an object etc.

Procedural animations are of course a complicated topic, but I am guessing that most of the work is already done in the smartbody stuff that has been integrated with Panda3D, see:
smartbody.ict.usc.edu/

Maybe exposing a simplified version of that in your editor and allowing people to ‘bake’ those animations as keyframes so that you don’t have to run the full simulation in your game would be a good start?

Edit: Smartbody also recently added a automatic reshaping and rigging tool, which would be really awesome to have in an editor for humanoid characters. See: smartbody.ict.usc.edu/news/autor … l-released

Objects can now be linked (parented) to one another. This means you can now create hierarchies, which can also be exported. Note that if you select at least one object that belongs to a hierarchy, that entire hierarchy will be exported.

To link one object to another one, open the new Hierarchy panel and click the Link button to go into object linking mode. Simply drag the mouse from the first object over to the candidate parent object and release the mouse button. The mouse cursor will indicate whether or not you are currently over an object that the first one can be parented to. If a link was made, the parent object will flash a couple of times. No objects need to be selected to create a link.

To unlink objects, select them first and then click the Unlink button.

It was necessary to implement this before working on imports of .bam files, since these usually contain hierarchies.

Time for another update.

And that’s what this new update brings:

  • an orthographic camera has been added to render the six standard views (Left, Right, Front, Back, Top and Bottom) as well as a general-purpose orthographic view;

  • apart from the 8 default views, you can create any number of additional “User Views”, either by taking a snapshot of the current view (more info below), or by copying the current view using an orthographic or perspective camera;

  • you can switch between an orthographic and perspective camera at any time for any User View;

  • a view tile system has been implemented to quickly and easily check or select any view;
    in the upper left corner of the viewport you will find the View Tiles icon, through which you can access the view tiles in 2 ways:
    [list][*]left-click on it to show the tiles;
    the tiles will remain visible until you click the View Tiles icon a second time;
    this is the preferred method if you want to regularly check how objects look in different views: all you need to do is hover the mouse over a tile to temporarily make the associated view the current one; when you move the mouse away from the view tiles area, the selected view (its tile is highlighted) becomes current again;
    to select a view, simply left-click its tile;

  • left-drag on it until the tiles are shown and keep dragging the mouse all the way to the tile of your choice and release the mouse over it to select the associated view - the view tiles will be hidden again at the same time;
    this is the preferred method if you just want to quickly select a view and you don’t like the view tiles taking up valuable screen real estate;

[/:m]
[
] right-clicking a view tile pops up a context menu for that tile;

[/:m]
[
]views can be centered on objects (you can use the “C” hotkey for this, just like in Pview);
if the mouse is over a specific object, the view will be centered on that object exclusively, otherwise it will be centered on all selected objects or on all objects in the scene if nothing is selected;
some objects, like Dummy helpers, can have a constant screen size, making it impossible to fit them exactly inside the viewport, so the camera zoom will not be adjusted to accommodate for such objects;

[/:m]
[
]views can also be aligned to a specific object: not only is the view centered on that object, but the “view space” (as represented by the view cube gizmo in the upper right corner of the viewport) gets the same orientation of the object as well; that means that the “local” Front view - as seen on the view cube - is no longer necessarily the same as the standard Front view, but a custom one; the Home view is by default also set to this custom Front view, but you can change it as explained below; if you want to get the default Front and Home views back, you can click the new Reset icon on the View gizmo;

[/:m]
[
](the following may sound a bit complicated and confusing, but experimenting with the different possibilities should make it clearer - hopefully :stuck_out_tongue: )
not only the “local” Front view (see above) can be changed to a custom one, also the Home view can be customized: just navigate the view to how you like it and select “Set current as Home” in the View menu; from now on, this is the view you’ll return to when clicking the Home icon on the View gizmo;
note that you can set a custom Home view for the default Front view, as well as for a custom Front view;
to undo a custom Home view, you can Shift-click the View gizmo Reset icon, while Control-clicking the icon will reset the default (local) Front view (but not a custom Home view associated with that default Front view, so you can reset the Home views step-by-step);

[/:m]
[
]some things like render mode (shaded, wireframe, or shaded + wireframe) and grid plane (XY, YZ or XZ) are now set per view; when you click the View gizmo Reset icon without modifier key, these are also reset to their defaults;

[/:m]
[
]creating a User View as a snapshot from the current view copies the custom Front and Home views, render mode and grid plane and sets them as its defaults (meaning that resetting the view will never return you to the defaults of the copied view), as opposed to copying the current view using an orthographic or perspective camera, which also copies the defaults;

[/:m]
[
]the View gizmo can now be pinned.[/*:m][/list:u]

One thing that I am currently not considering to implement is a multi-view, e.g. the traditional quad view, since this would be quite difficult to implement (and probably bad for performance).
Hopefully you will find the view tiles to be a good alternative.

Enjoy the view(s) :slight_smile: !

After more than two years, I’m happy to tell you about the latest update for this project: a complete overhaul of the GUI!

At first glance it doesn’t look too different, but there are a lot of important changes, especially under the hood:
gone are the problems related to wxPython, because the latter is now completely out of the (Panda) window!
It has been replaced with a pure-Panda GUI, which has several benefits:
*) no dependency on third-party libraries;
*) more cross-platform (I tested it on Linux and it seemed to work well);
*) easily skinnable (there’s only the default skin at the moment, but adding more skins should be straightforward).

The new GUI system is also very flexible: thanks to my own implementation of sizers (similar to wx.Sizer), it is not only simple to retain the layout while resizing/maximizing the window, but things like dragging toolbars to different locations or relocating the control panels to the left side of the window are easily done as well.

Apart from being able to “dock” toolbars at any side of the screen, they can also be grouped into “bundles”. When you drag and release a toolbar over another one while holding down [Shift], they will form a bundle, with only the “top” toolbar visible. This can create some additional space for the viewport, as you are effectively hiding the other toolbars in the bundle. These are still easily accessible though: just like a regular spinner control, toolbar bundles have up/down buttons to the right that can be clicked or dragged to bring other toolbars to the top. Alternatively, any toolbar can be chosen directly by right-clicking the top toolbar and selecting its name from the popup menu.
The top toolbar can also be removed from the bundle by [Shift]-dragging it to another location.

The entire layout can be saved to file, loaded and reset to the default state using the “Options” menu.

Another new GUI-related feature is the auxiliary viewport that is used to open additional interfaces, like the UV editing interface, where it replaces the second window used by the old GUI system. That second window had its own toolbar and control panels, while the non-relevant toolbars and control panels in the main window were disabled. The former took up additional screen space while the latter felt forced and unintuitive. The new system makes the GUI more context-sensitive by only showing toolbars and control panels relevant to the current interface and hiding the others.
Some toolbars are shown in different interfaces, where they can be laid out differently.
The auxiliary viewport can be resized and swap its contents with that of the main viewport.
Currently, the auxiliary viewport is overlaid on top of the main viewport, but I will try to also make it possible to have both viewports side-by-side.

Since I am no longer using a third-party library, I also had to implement my own dialogs and menu system.
One thing you will notice when using these, is that they block access to the main application (think of “modal” dialogs); this was done to prevent annoying bugs that might otherwise occur.
The same actually goes for input fields; while this might not always be intuitive, I couldn’t find a good way to solve problems that might otherwise happen in certain cases.

One other thing I need to mention is that the performance of the file dialog isn’t that great; it is coded entirely in pure Python and uses up a lot of resources when opening large directories, so please don’t even try to access something like the Windows System32 directory.

As I said earlier, I already tested the new version on Linux, but I would still like to hear from other Linux users if there are any problems. Thanks in advance!

And last but not least, the application now has its own icon, whose image I created in… Panda3D Studio (yeah it’s supposed to be a Panda head made of gears :panda_face::gear:):

Enjoy :slight_smile: !

2 Likes

Wow, this looks absolutely amazing!