New Gui Designer

This GUI designer uses meshes and text objects to generate python code for a ui.

This blend contains the files you need to generate a UI, no python experience needed to start with
http://members.optusnet.com.au/cjbarton/obui/ObUI.blend

Youll need blender 2.43 for the 3d ball button.

If there is interest I could make it use object properties to set Min/Max initial values. tooltips etc.

http://members.optusnet.com.au/cjbarton/obui/ObUI.png

hmmm… interesting! wonder what possiblyties this has… will check out.

this has lot’s of possibilities:yes:
might even get a script out of me with this sort of tool.:smiley:
sent a pm Cambo.

Looks really useful. I know that moving stuff around in the UI for the scripts I work on is always a pain in the a. Will your script import from a script you already have. I guess this would make it aqn “editor” rather than a “designer”.

1 Like

Cool idea. Maybe you could allow more extensive control strings though? For instance put control codes in curly brackets before/after the button text and have them of the form “key”:value? Then you would just need to chop out the bit from { to } and eval it as a dict

eval("options = " + input.strip())
self.color = options.color
self.fancything = option.fnacy
etc.

I’ve done things like this in the past, but I should have done some research before posting :rolleyes:
IIRC I figured out a way to check code before eval to prevent executing arbitrary code accidentally. I can’t remember where I put it though…
anyway something with keywork args would be cool!

kitsu, Iv thaught of ways to extend this…

Probably the best thing would be to use object properties.

  • You could have properties
    type, min, max, default, func

with function, you could reference a function to run. Id like to have a way you could use this script to add a UI to existing code.

hmmm can’t say I understand it yet…

Pretty cool :slight_smile:

Some suggestions :

A QUIT button would have been nice in your sample gui :smiley: (CTR-C in the console
not the mose elegant way of exiting).

  1. Add “import Blender” to the HEADER

  2. Add to the “input_event” function :

 
text.write('	if evt == Blender.Draw.ESCKEY:
')
text.write('		Blender.Draw.Exit()
')

(Or some equivalent … giving ESC the exit function as is usual for most scripts)

  1. Would be nice if the event variables were generated for the buttons with the button names as the value. e.g.
 EVENT_BUTTON1 = 1000
EVENT_QUIT   = 1001
EVENT_MYSLIDER = 1002

  1. Would be nice if the but_event, and input_event had “stubs” inserted for all the u.i. elements created:

e.g.

def but_event(evt):
   if evt == EVENT_QUIT:
       print 'EVENT_QUIT'
  elif  evt = EVENT_BUTTON:
      print 'EVENT_BUTTON'

…

I’m actually trying to add those things right now, but as a “greenhorn” Python programmer might take a while. :slight_smile:

Mike

Awesome, maybe one of us can make an option to spit out C code too :wink:

Mike_S, ctrl+q is quit, even generation is definetly possible.

broken my intention is to make it write C code also, though that would we a flat set of commands, not a working C file :wink:

not sure how much UI code will change for blender 2.5 tho?

Someone has done similar thing a while back
Blender-Python GUI Designer
May be you could get some idea from it - hope this help you guy :slight_smile:

1234567890

I wish Python scripts had an edit mode. Just hit tab and then objects could be dragged and resized - hit n-key and you get properties of the object like min and max values. I did an interface like this once in Flash. The trouble is how do you save the changes because you’d have to write to the script itself while it was running. But what I had thought of was how about using a separate interface file like the Mac uses with .nib XML files. It means you get reusable interfaces for one thing and you don’t have to clutter your source code with interface code.

Maybe a subset of XUL?