Compz - GUI System

Hello everyone!

I started to re-make my old GUI system into a new and improved system. I used some code from Moguri’s BGUI and from the old versions.
The system features styling with textures (only), parenting and fonts.

Everything is on GitHub: https://github.com/DCubix/Compz, just clone or click Clone or Download -> Download ZIP.
There’s a test blend and the entire source code along with images.

I will be writing tutorials and docs soon, but until then I will keep adding more features.

Screenshots:

http://image.prntscr.com/image/ca236224f52a420c906dd2787d402ec3.png

Here’s the module in action:
http://i.imgur.com/PLfxWeN.gif

Stay tuned for updates, I hope you like it! :slight_smile:

There is so much I love about this. The layout-oriented panels, easy position/resize, small constructors, buttons activating on release, custom icon, image-based styling…

In all honesty I’m not concerned about the lack of aspect-ratio stuff that bgui had. Was kinda complicated and only really useful when making borders or dividing the screen. It’s easy enough to do panel.width = bge.render.getWindowWidth()

Now if the engine had a callback for window resize we’d be in business, although I suppose a user could do the same by comparing width/height each frame.

@pqftgs
Thank you very much! :smiley:

Update: Introducing Grid Layout. You can’t change the divider positions (I don’t know how to implement that), but this should be fine for now :slight_smile:
http://image.prntscr.com/image/2c41e21df00743d78d36c3eaf2afdbf2.png

Update: Column span and Slider! :smiley:
http://image.prntscr.com/image/1e67fcdacb8943e5a0009f02dd5901b8.png
And it’s very easy:


    spannedButton = gridPanel.addComp(compz.Button("Span", btnStyle))
    spannedButton.row = 2
    spannedButton.column = 0
    spannedButton.columnSpan = 2
    spannedButton.margin = [2, 6]
    
    lbl = gridPanel.addComp(compz.Label("Slider"))
    lbl.row = 3
    lbl.column = 0
    lbl.textAlignment = compz.TEXT_ALIGN_RIGHT
    
    sld = gridPanel.addComp(compz.Slider(style=sliderStyle))
    sld.row = 3
    sld.column = 1

Update: Image view and Row span :slight_smile:
The GUI system can be called almost complete. I only need Radio Buttons and Check Boxes

Cool and themes. :slight_smile:

Update: Color Picker and CheckBox
http://i.imgur.com/ga0FwfA.gif

Update: Radio Button and Radio Groups
Finally the last important feature was added to the module. It’s very easy to use:


    def radioGroupSelected(sender):
        print("Selected option " + str(sender.selectedIndex))
    
    radioGroup1 = pan.addComp(compz.RadioGroup(radioStyle))
    radioGroup1.addOption("Option 1")
    radioGroup1.addOption("Option 2")
    radioGroup1.addOption("Option 3")
    radioGroup1.addOption("Option 4")
    radioGroup1.events.set(compz.EV_OPTION_SELECTED, radioGroupSelected) 
    


Very good job!

Wow, this is exactly what I need right now. Do you mind if I use it for a game that will later be donated to the community ?

Oh yeah, what’s the license?
Seriously though I love this. Easy to use and doesn’t seem quirky. Coming from a QT background it feels very nice.

@henrymop
Thank you!

@Josip Kladaric
No I don’t mind, as long as you credit me hehe. But keep in mind tht the only documentation I have is the test blend. I will start to write docs asap!

@pqftgs
There’s o license yet, but I might use MIT.

Thank you everyone! :smiley:

EDIT: I made a simple API doc page for the module: https://pixd.paperplane.io/compzdoc.html

This might be a dumb question, is there a way to change text size?

Just

component.style.font.size

:slight_smile:
The size is in points.

Just curious, could this gui system also be used in Blender itself? Or is it a BGE thing only?

It’s BGE-only :slight_smile:

Too bad. Thanks :slight_smile:

This is very, very, very cool!!! :slight_smile:

@adriansnetlis
Thanks!

@Tiles
Well Blender already has a great GUI system, so no need to reinvent the wheel :stuck_out_tongue:

Is this system gone have cool window dragging where you don’t get the lag of the window elements? I hope so;)