Help with WYSIWYG suite

Having spent the last few months wrapping up some prototype work, I’ve to say I’m blown away by the ease of use as well as flexibility of Panda3D.

That being said, I currently consider rolling my own editor for it.

I’m only in the conceptual state but would like to know what some of the Panda3D 'pros" think of the following.

My concept is basically split into two possible ways to achieve what I want in an editor (i. e. a flexible all-in-one solution with shader viewer/editor, map editor, in-editor Python IDE and several templates/starter kits for the creation of different genres).

One would be to simply create the whole editor inside a Windows Form and have XNA/managed DirectX power all the visuals.

The other would include a Windows Form as well, but this time with Panda3D windows and OpenGL calls rather than XNA.

Output (i. e. the position of objects inside the scenegraph or shader definitions) would have to be written to .py* and the likes, in any case.

Aside of the fact that only the later will give me a true WYSIWYG feel, are there other benefits to any solution (speed, flexibility, etc)?

EDIT: The way I’m currently generating all my terrain is by importing the mesh of a procedural terrain I created inside another application (which uses marching cubes).

Ideally, I’d like to implement my own marching cube algorithm, save my terrain as a simple mesh in one tab and import it as a game asset. While I do realize this might be considered “lazy”, it probably would be the better solution, considering this makes it pretty much fill-rate dependent, rather than shader dependent (thus allowing the final game to be run on older GPUs as well).

*Not sure how other editors manage this. Do they do it exactly like that or use some sort of XML file?

So what is everyone using for GUIs?

Is there no easy way to call and control Panda3D from within a Windows Form?

Are DirectGUI, TreeGui, wxPython, PGUI and the likes the only reasonable options for such an endeavour?

I really love the way I can set up GUIs graphically within Visual Studio and wouldn’t want to waste time coding a similar system myself, just so I can use it on a single editor.

EDIT: Just had a look at wxDesigner.
Seems like just the kind of tool I’m looking for.

Sure, you can. Just pass the HWND of your window to windowProps.setParentWindow(x) when creating your window.

Other considerations might be pyGTK and pyQT. I’m using wxPython myself, but I haven’t tried out any others yet.

I’ve settled with wxPython and wxGlade for now.

Seems like a great combination. Not being able to freely place widgets is kind of a bummer, but it also allows for a much cleaner interface.

Ok.

I can’t, for the life of me, get this piece of generated code to work.

import wx 

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

# end of class MyFrame

I get no warnings whatsoever. It simply quits the program before ever opening the specified frame.

Any suggestions?

I also tried out wxFormBuilder, but the result is exactly the same ('cept wxFormBuilder generates valid Python code in the first place. With wxGlade, I always end up changing something myself).

Perhaps I’m missing something, but you don’t seem to be instantiating your class anywhere. As a result, the python code never actually does anything, and so exits immediately.

I imagine that the idea is that the code given would be imported into a larger project which would then instantiate the class as called for, thus producing frames. For testing purposes you could either create a small test script or simply put an instantiation at the end of that file (after “#end of class MyFrame”).

Lol.

Just took the time to actually read the generated code (I simply passed it as a given that the code should be functional) and immediately realized that as well.

When I regenerated the code, I ended up with a more complete code that doesn’t really work right either though.

All those wxwidget GUI builders seem to generate a lot of superfluos code that takes a whole lot longer to get to work than writing a GUI from scratch, to begin with.

Here’s the code I pieced together myself (reading a tutorial on wxpython).

import wx

class MainWindow(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(1024,768))
        
	# Setting up the menu.
        filemenu= wx.Menu()

        # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
        filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")

        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&About") # Adding the "filemenu" to the MenuBar
	self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
        self.Show(True)
app = wx.App(False)
frame = MainWindow(None, "Little Paw EDK (V.0.1.)")
app.MainLoop()

and here’s the code for a similar frame, generated by wxGlade

#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.5 (standalone edition) on Mon Jan 21 00:37:30 2013

import wx

# begin wxGlade: extracode
# end wxGlade


class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        # Menu Bar
        self.frame_1_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
        wxglade_tmp_menu = wx.Menu()
        self.frame_1_menubar.Append(wxglade_tmp_menu, "About")
        self.SetMenuBar(self.frame_1_menubar)
        # Menu Bar end

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("Little Paw EDK (0.1)")
        self.SetSize((1024, 768))
        self.SetFocus()
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer_1)
        self.Layout()
        # end wxGlade

# end of class MyFrame
if __name__ == "__main__":
    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    dialog_1 = (None, -1, "")
    app.SetTopWindow(dialog_1)
    dialog_1.Show()
    app.MainLoop()

EDIT: Weirdly enough, I just changed to another path (the Panda3D Python directory) and got wxGlade to generate proper code immediately.

It’s still far from the elegance of hand written code, of course.