The VG Resource
Another UMC side-thread - Printable Version

+- The VG Resource (https://www.vg-resource.com)
+-- Forum: Creativity (https://www.vg-resource.com/forum-126.html)
+--- Forum: Other Creativity (https://www.vg-resource.com/forum-130.html)
+--- Thread: Another UMC side-thread (/thread-26342.html)

Pages: 1 2 3


Another UMC side-thread - Tcll - 12-13-2014

Short Description:
Universal Model Converter (UMC) is a simple tool for allowing noobs and hackers alike to write SMALL scripts for importing and exporting 3D model formats.
It's designed to help port models between programs while being much easier to write scripts for. Smile

more info here
^the OP is oudated

3.0a is the current version I'm working on which has been deemed as scrap.
(this version supports models, images, and compression)
^animation is not entirely possible in this build, though the interface-format CAN roughly support it.

3.0 is the future intended version which claims it's scripts are so easy to build, you need at least 73% less code than a Blender26 script.

anyways, not trying to advertize or anything, this is just a side development thread for anyone here who's interested in my project.
(no hastle or stress from having to post over at SB or my forum) Wink


the documentation for building scripts for UMC can be found here: (it's still very much unfinished and only lists the functions supplied by the interface)
http://tcll5850.proboards.com/thread/182/layout
make sure JS is enabled, everything visual is done via forum-plugins

regarding trackers and blocked web content, all I have is harmless tracking and advertising done by google and PB (my forum's host)
(I'm not one to do malicious acts or provide malicious content)


what can UMC do currently?

here's a few images showing off a few things for the next update to 3.0a Smile

my favorite star from Kirby Air-Ride:
[Image: Screenshot%2520from%25202014-11-06%25202...253A54.png]
my favorite fighter from SSBM:
[Image: Screenshot%2520from%25202014-11-23%25201...253A52.png]
^ignore the lines, those will be removed on the release
here's a better image: (older)
[Image: Screenshot%2520from%25202014-11-03%25201...253A55.png]
^not sure what's causing the texture problem, though it will be found Wink

SSBM Bump maps: (WIP)
[Image: Screenshot%2520from%25202014-11-07%25201...253A19.png]
^NOTE: SSBB does not have this

I've described the HAL-DAT format pretty well here:
http://wiki.tockdom.com/wiki/HAL_DAT_(File_Format)

my best fighter from Brawl:
[Image: Screenshot%2520from%25202014-11-23%25201...253A18.png]
^again, ignore the lines Tongue

PNG images: (and ~50 other formats)
[Image: Screenshot%2520from%25202014-11-13%25201...253A40.png]


the displayed import buttons and scrollbars currently do nothing.
(the GUI is a piece of trash in this build, partly because of SDL)
the top panel is the only thing with working widgets.

Ctrl+I to import and Ctrl+E to export

I'm sorry this update doesn't do more.
the viewer can't be easily made to support animation w/o a major update to the internal format. (I was a noob when I wrote it)
3.0 aims to fix alot of the stuff that plain can't be done w/o alot of hastle in 3.0a

but 3.0 won't be out for quite a while as I'm learning new tricks every day.
so 3.0a is just to give everyone a solid interface to work with until 3.0's release Smile


I hope UMC will really make a place here as it's designed for both noobs and pros for 3D hacking/programming.


RE: Another UMC side-thread - Tcll - 12-13-2014

just wanted to note, if you have any questions, feel free to ask Smile
and also keep in mind, your ideas matter and will always have an effect towards UMC's development Wink

if you have any feedback what so ever, even if you think it sounds dumb, feel free to post Smile

this is a side development thread, so anything goes here. Wink

EDIT:
also wanted to note I have a skype group discussion, if you'd like to join in for anything on:
- helping out with UMC (any aspect of it, not just scripting)
- learning a good portion of how to program in python, and roughly OpenGL (my knowledge here is very choppy and based on old interfaces)
- any other discussions (such as advanced technology) that randomly go on in the chat (it's not a boring limited chat)

all you have to do to join is add me to your skype contacts, and notify me that:
- you're not a bot
- you'd like to join the UMC Group Discussion

my skype is rather obvious Tongue
Tcll5850 (DarkPikachu)

again though, let me know you're not a bot or you may get spammed to the point of crashing your skype client... heh Wink
(I've had at least 8 bots try to contact me)


RE: Another UMC side-thread - Struggleton! - 12-13-2014

This is coming along quite nicely. Very good Big Grin


RE: Another UMC side-thread - Tcll - 12-14-2014

thanks Smile

also wanted to note, when I said to "ignore the lines", here's why Wink
[Image: Screenshot%2520-%252012142014%2520-%2520...2520AM.png]
^it displays the bone parent/child  relations in negative color (I figured out how to do it easily) Cute

code from the bone display-list function:
Code:
                   
                   __GL.glEnable(__GL.GL_LINE_STIPPLE)
                   __GL.glLineStipple(1, 0xF0F0) # [1]
                   __GL.glLineWidth(1.5)
                   
                   #invert color here:
                   __GL.glEnable(__GL.GL_COLOR_LOGIC_OP)
                   __GL.glLogicOp(__GL.GL_INVERT)

                   __GL.glBegin(__GL.GL_LINES)
                   __GL.glVertex3f(CBL[0]*CBS[0],CBL[1]*CBS[1],CBL[2]*CBS[2])
                   __GL.glVertex3f(PBL[0]*PBS[0],PBL[1]*PBS[1],PBL[2]*PBS[2])
                   __GL.glEnd()
                   
                   __GL.glDisable(GL_LINE_STIPPLE)
                   __GL.glDisable(__GL.GL_COLOR_LOGIC_OP)


those lines were the bone-tails, which were meant to display bone rotation and scale.

while 3.0a now currently has bone head/tail settings, displaying that data is still not well known.
(3.0a's interface is scrap for just that reason, the data handled must be in world relation for everything)


RE: Another UMC side-thread - Tcll - 12-15-2014

hey nub, I'm redesigning UMC's module interface to support the new header functions.

I need a Tkinter popup dialog with selection buttons for shared filetypes, kinda like something I had before:
[Image: CMBW.jpg]

think you could do better than me and actually make something that works?? Tongue
(have the buttons return a feedback and close the dialog)

I can't do crap with Tkinter... heh

EDIT:
in the mean-time I'll just do a console selection... heh


EDIT2:
hey nub, forget my request!
I'mma reverse-engineer askopenfilename and asksaveasfilename and make my own classes by revising the current src

askopenfilename will be changed to Open() and will return the filter name along with the file(s)

EDIT3:
so much for that... T3T

command = "tk_getOpenFile"
s = w.tk.call(self.command, *w._options(self.options))

tracing that back, 'tk' is part of a root module _Tkinter, which is imported in Tkinter.py >3<
meaning what I need access to is compiled into the interpreter's backend >3<

so I can't make Tkinter's file dialog return the filter... ugh
I'll see if I can find an alternate tomorrow...
(something small that can do what askopenfilename can do AND return the filter)

this sucks and blows >3<

EDIT4:
for anyone who's interested, I've posted my revers-engineered code here:
https://www.daniweb.com/software-development/python/threads/489079/prompt-for-file-with-filter-return

it should work just a tad better than the original functions as you're not forwarding through 3rd-party interfaces, and have a little more control. Wink

EDIT5:
you know what... WTF am I doing...
I've been wanting to make UMC's import button work for so long now,
and having to redo the way scripts are handled give me the perfect opportunity to do so.

so UMC's UI will handle opening and saving files. Smile


RE: Another UMC side-thread - Tcll - 12-17-2014

fixed up a little issue with the GUI:
[Image: Screenshot%2520-%252012172014%2520-%2520...2520PM.png]
nothing looks different right?
think again...

earlier with UMC's Layering update to the GUI, I'd previousely ran into an issue with the font:
[Image: Screenshot%25202014-02-26%252013.24.40.jpg]
(textured quads as display lists seems to be a standard for OpenGL font display)

this issue was previousely fixed by using a quad on the active stack-layer as the BG for that font:
[Image: Screenshot%25202014-02-26%252018.41.55.jpg]
but that in itself was the problem I've fixed now, so I don't need that extra quad
the issue was the priority, or the stack-overlay-layer the font was drawn on,
which should've been the base priority and instead was the widget priority,
which Z-clipped the panel quad causing a transparent-BG appearence of the text.

EDIT:
though I must mention, this fix is almost irrelevent as I'm redoing the GUI so I can have a little more ease towards building it...
right now, every small little action the GUI does has to be manually scripted as the interface is controlled with functions.
what I'm doing to update the GUI is turning the widgets into classes and automating things a bit better, which should also cut down on the amount of scripting needed for GUI.py Smile

EDIT2: this issue is not related to this forum



RE: Another UMC side-thread - puggsoy - 12-17-2014

Post that forum error in the Errors thread, along with your OS and browser.


RE: Another UMC side-thread - Struggleton! - 12-17-2014

(12-15-2014, 09:56 PM)Tcll Wrote: hey nub, I'm redesigning UMC's module interface to support the new header functions.

I need a Tkinter popup dialog with selection buttons for shared filetypes, kinda like something I had before:
[Image: CMBW.jpg]

think you could do better than me and actually make something that works?? Tongue
(have the buttons return a feedback and close the dialog)

I can't do crap with Tkinter... heh

EDIT:
in the mean-time I'll just do a console selection... heh


EDIT2:
hey nub, forget my request!
I'mma reverse-engineer askopenfilename and asksaveasfilename and make my own classes by revising the current src

askopenfilename will be changed to Open() and will return the filter name along with the file(s)

EDIT3:
so much for that... T3T

command = "tk_getOpenFile"
s = w.tk.call(self.command, *w._options(self.options))

tracing that back, 'tk' is part of a root module _Tkinter, which is imported in Tkinter.py >3<
meaning what I need access to is compiled into the interpreter's backend >3<

so I can't make Tkinter's file dialog return the filter... ugh
I'll see if I can find an alternate tomorrow...
(something small that can do what askopenfilename can do AND return the filter)

this sucks and blows >3<

EDIT4:
for anyone who's interested, I've posted my revers-engineered code here:
https://www.daniweb.com/software-development/python/threads/489079/prompt-for-file-with-filter-return

it should work just a tad better than the original functions as you're not forwarding through 3rd-party interfaces, and have a little more control. Wink

EDIT5:
you know what... WTF am I doing...
I've been wanting to make UMC's import button work for so long now,
and having to redo the way scripts are handled give me the perfect opportunity to do so.

so UMC's UI will handle opening and saving files. Smile

I can surely try to create something. Do you want me to do it in PyQt? or Tkinter? Big Grin
btw he refers to me as BrawlNub on the chat

edit: saw edit5


RE: Another UMC side-thread - Tcll - 12-17-2014

thanks, and while I could kinda get a PyQt gui going, I asked for Tk Tongue
but even still, screw that ;P
I'm going full-out with OpenGL, I just need a little help porting the widgets to classes so I'll have less work to do. Cute
(all I need to know is the hierarchy for building a proper GUI and I'll be set) Smile

but as for right now, here's the code for my simplest widget: (the Toggle-Button)
Code:
def __RemoveTButton(Na,priority=0):
    global Widgets,layer
    try:
        Widgets[Na].hitdef.enabled=False #disable the hitdef (save the state)
        tbna='TButton%sQuad'%Na
        tbfna='TButton%sText'%Na
        tbfbgna='TButton%sText'%Na
        p2 = priority+2
        if layer[0].stack[p2].HasPrimitive(tbna):
            layer[0].stack[p2].RemovePrimitive(tbna)
            layer[0].stack[p2].RemoveString(tbfna)
            layer[0].stack[p2].RemovePrimitive(tbfbgna)
    except: pass

def __TButton(X,Y,Na,St=False,Text='',fontcolor=(0,0,0,220),priority=0):
    global Widgets,layer, AllowHitUpdates

    #minor pre-calculations
    X2,Y2=X+20.,Y+20.
    fx,fy=X+25.,Y+2.
    
    #verify the widget exists
    try: W=Widgets[Na]
    except KeyError:
        Widgets[Na]=__Widget()
        W=Widgets[Na]

        W.info=St #toggle state
        W.hitdef.x=X; W.hitdef.y=Y; W.hitdef.X=X2; W.hitdef.Y=Y2
        
    #update the HitDef if changed by an outside function
    if AllowHitUpdates!=W.hitdef.enabled: W.hitdef.enabled=AllowHitUpdates
    
    #drawing data:
    tbna='TButton%sQuad'%Na
    tbfna='TButton%sText'%Na
    #tbfbgna='TButton%sText'%Na
    p2 = priority+2
    if not layer[0].stack[p2].HasPrimitive(tbna): #don't draw if we already have
        layer[0].stack[p2].AddQuad(tbna,[X,Y],[X2,Y],[X2,Y2],[X,Y2],(95,95,95,180))
        layer[0].stack[priority].AddString(tbfna,Text,0.667,fx,fy,None,None,fontcolor)
        fxtbfw = fx+layer[0].stack[priority].strings[tbfna].w
        fytbfh = fy+layer[0].stack[priority].strings[tbfna].h
        #layer[0].stack[p2].AddQuad(tbfbgna,[fx,fy],[fxtbfw,fy],[fxtbfw,fytbfh],[fx,fytbfh],(127,127,127,200))
    
    TB = layer[0].stack[p2].primitives[tbna]
    TBF = layer[0].stack[priority].strings[tbfna]
    #TBFBG = layer[0].stack[p2].primitives[tbfbgna]

    #Positioning Verification
    if TB.Position([X,Y],[X2,Y],[X2,Y2],[X,Y2]):
        TBF.Position(fx,fy,None,None)
        fxtbfw,fytbfh = fx+TBF.w,fy+TBF.h
        #TBFBG.Position([fx,fy],[fxtbfw,fy],[fxtbfw,fytbfh],[fx,fytbfh])

    #HitDef
    if W.hitdef.x!=X: W.hitdef.x=X; W.hitdef.X=X2
    if W.hitdef.y!=Y: W.hitdef.y=Y; W.hitdef.Y=Y2

    #Widget logic
    if W.info:
        if W.event.hasFocus: #change the color if the mouse is over the selection box
            if W.event.clickL or W.event.holdL: #change the color if the selection box is clicked or held
                TB.Color(79,79,79,180)
            else: TB.Color(95,95,95,180)
        else: TB.Color(79,79,79,180)
    else:  
        if W.event.hasFocus:
            if W.event.clickL or W.event.holdL:
                TB.Color(79,79,79,180)
            else: TB.Color(111,111,111,180)
        else: TB.Color(95,95,95,180)

    if W.event.releaseL: W.info=(False if W.info else True)

    return W.info

yea, everything's just functions, except for the main layer and widget classes.
the original design of the GUI (as those 2 classes are modifications) consisted of nothing but functions as I didn't know how to work classes, or even decorators back then.

decorators are easy Smile
they're just special wrapper functions:

def wrapper(f,v): f(*v) # I think this is right?? >.>
@wrapper
def func(v): pass

func(1)

is the same thing as:

def wrapper(f,*v): f(*v) # I think this is right?? >.>
def func(v): pass

wrapper(func,1)

EDIT:
also, some useful info for functions Cute

>>> def f(a,b,c): print a,b,c

>>> d={'a':0,'c':1,'b':2}
>>> d
{'a': 0, 'c': 1, 'b': 2}
>>> f(**d)
0 2 1
>>>


I don't always syntax highlight, but I often try to. Wink

that syntax style can be found in IDLE, Python's native IDE


RE: Another UMC side-thread - Tcll - 12-18-2014

good news, my awesome brain came up with something Genki ^_^
Code:
class _SelectBox(_Widget):
    def __init__(this, X,Y,W,Na,Items,Def=0,Text='',priority=0):
        _Widget.__init__()
        this.widgets[Na] = this

        # names
        this.sbna='SelectBox%sQuad'%Na
        this.sbfna='SelectBox%sText'%Na
        this.sbbna='SelectBox%sButtonQuad'%Na
        this.sbbdna='SelectBox%sButtonDecal'%Na

        # priorities
        this.p2 = priority+2
        this.p3 = priority+3
        
        # minor pre-calculations
        this.X,this.Y,this.X2,this.Y2 = X,Y,X+W,Y+20.
        this.sy = this.Y2-this.Y
        this.hsy=this.sy*.5
        this.hsx2 = ((this.X2+15.)-this.X2)*.5
        
        this.info=[Def,Items[Def],False] # [selectionID, selectionItem, isOpen]
        this.hitdef.x=this.X; this.hitdef.y=this.Y
        this.hitdef.X=this.X2+15.; this.hitdef.Y=this.Y2

        this.add()
    
    def add(this):
        this.layer[0].stack[this.p2].AddQuad(this.sbna,[this.X,this.Y],[this.X2,this.Y],[this.X2,this.Y2],[this.X,this.Y2],(175,175,175,180))
        this.layer[0].stack[this.p2].AddString(this.sbfna,this.info[1],0.667,this.X+5.,this.Y+2.,None,None,(0,0,0,220))
        this.layer[0].stack[this.p2].AddQuad(this.sbbna,[this.X2,this.Y],[this.X2+15.,this.Y],[this.X2+15.,this.Y2],[this.X2,this.Y2],(95,95,95,180))
        this.layer[0].stack[this.p3].AddTri(this.sbbdna,[this.X2+5.,(this.Y+this.hsy)-2.],[(this.X2+15.)-5.,(this.Y+this.hsy)-2.],[this.X2+this.hsx2,(this.Y+this.hsy)+2.], (63,63,63,180))
        
    def update(this):
        if not this.layer[0].stack[this.p2].HasPrimitive(this.sbna): this.add() #TODO: get rid of this
            
        SB = this.layer[0].stack[this.p2].primitives[this.sbna]
        SBF = this.layer[0].stack[this.p2].strings[this.sbfna]
        SBB = this.layer[0].stack[this.p2].primitives[this.sbbna]
        SBBD = this.layer[0].stack[this.p3].primitives[this.sbbdna]
        
        #Positioning Verification
        if SB.Position([this.X,this.Y],[this.X2,this.Y],[this.X2,this.Y2],[this.X,this.Y2]):
            SBF.Position(this.X+5.,this.Y+2.,None,None)
            SBB.Position([this.X2,this.Y],[this.X2+15.,this.Y],[this.X2+15.,this.Y2],[this.X2,this.Y2])
            SBBD.Position([this.X2+5.,(this.Y+this.hsy)-2.],[(this.X2+15.)-5.,(this.Y+this.hsy)-2.],[this.X2+this.hsx2,(this.Y+this.hsy)+2.])
        
        #HitDef
        if this.hitdef.x!=this.X: this.hitdef.x=this.X; this.hitdef.X=this.X2+15.
        if this.hitdef.y!=this.Y: this.hitdef.y=this.Y; this.hitdef.Y=this.Y2
        
    def remove(this):
        this.hitdef.enabled=False
        this.layer[0].stack[this.p2].RemovePrimitive(this.sbna)
        this.layer[0].stack[this.p2].RemoveString(this.sbfna)
        this.layer[0].stack[this.p2].RemovePrimitive(this.sbbna)
        this.layer[0].stack[this.p3].RemovePrimitive(this.sbbdna)

    #TODO: event functions

it's far from finished, but should work better than before Smile

I'mma see if I can cut down on the CPU usage a bit more Wink
the draw-code is gonna be the hardest part here.
you see the parts with this.layer[0].stack[this.p2]
take a guess at what parses that.

the reason that's gonna be hard is because I'm already removing what's not drawn...
so the best I could possibly do is optimize.

one big area that needs alot of work is the update code, as that's about half the current CPU usage... heh

why CPU and not GPU if GPU is so much faster?
because I was a noob when I built the interface and followed tuts on GLUT and SDL...
so the interface currently CAN'T run on the GPU any more than it already is...

wait for 3.0 where I'll have shaders to hopefully pass the whole draw-code to the GPU Smile


btw, SDL sucks.
it clears the GL context on a video resize event, forcing you to have to rebuild it.
it also gimps your mouse usage, but luckily I've worked around that. Smile

what's better?
take a look into GLFW Wink
it's SDL+freeglut (no limitations)

I can't promise I'll have GLFW support on the next release of 3.0a, but I'll try for it. Wink


EDIT: btw, if anyone wants to watch me code the new GUI, it's actively sync'd from my compy here:
https://copy.com/vBWPp0VGzmk6dWuK
^ every Ctrl+S I make goes there, so you get the src fresh from my compy Smile

for the old GUI (which still works), you can find that here:
https://copy.com/p6N0xfn6oA3plh3O
good luck trying to understand it though Tongue

NOTE:
in UMC3.0 this will be a plugin, meaning it can be removed, and UMC will still run w/o it. Wink
WIDGETS.py won't work w/o GUI.py though which provides the widgets for UMC-scripts.
basically, that's what the CMD var in the import/export functions will be used for Smile


RE: Another UMC side-thread - Tcll - 12-27-2014

first test of the GUI remake:
(I ported it so that now it uses classes instead of in-line functions)
^ makes event handling a crap-load easier and takes quite a load off the CPU Smile

[Image: new_GUI.png]

yea... there's alot to be fixed...
first thing you'll notice is that hit-defs don't resize properly...
next you'll notice the buttons have no BGs

something you won't notice by image is the gainFocus() event (hover your cursor over a widget) breaks the UI

this is all being worked on and will be fixed (and then some) by the release Wink

EDIT:
update:
[Image: new_GUI_update.png]
everything works so far except fonts.

what you're seeing in yellow is an active hitdef

EDIT2:
update:
finally got the fonts working Genki ^_^
[Image: new_GUI_font.png]

I'm a freakin retard... heh
SDL sucks because it clears the GL context on video resize, which was causing each font character to have a list ID of 0L.

what was I doing?
I had the font creation code in the GUI-init code which was being deleted by the initial window creation.
so I moved the code to the GUI-resize code.

if SDL worked properly, I could keep the font creation in the GUI-init code
this is why GLFW is better (for being as limitless as SDL in not hijacking your run-loop)


RE: Another UMC side-thread - Struggleton! - 12-29-2014

As of now, we're working on a way to allow users to get updates in a nice way Smile


RE: Another UMC side-thread - Tcll - 12-29-2014

no this isn't the updates system you're seeing in my screenshot... that's a different interface for UMC-scripts and such Smile

what we're talking about is just the UMC run-time interface and data/ modules...

I don't think it's possible to make this update to version 3.0 though, but beyond that we'll be as free as needed Smile

EDIT:
just posting some GUI progress before I call it a night Tongue
[Image: new_GUI_progress1.png]

everything works properly so far except:
- bottom and top panels don't yet resize when side panels are closed
- panels are not yet hidden when options/updates are open

oh and an old issue that's been for quite a while... heh
- VIEWER controls are active while options/updates are open

but a video resize event resizes the panels properly Smile


RE: Another UMC side-thread - Tcll - 01-01-2015

finally working on the import dialog I'd planned since dev4 Tongue

[Image: import_dialog.png]
though I won't say the layout will be the same as planned...

tbh, I never really had a solid plan for the layout, so for now I'm just gonna do something very basic and keep it quite similar to Tkinter.

though the scrolled dialog for selecting your files will just be made of buttons.

it's kinda sad to realize just how pointless this update is though when everything will be ported to shaders in 3.0
(that should say something about just how simple my GUI really is) Tongue

would be nice if display lists weren't deprecated already... Tongue
but using them very inefficient on your MBd as is... heh


EDIT:
lol every time I break this thing, I keep making it better XD

my code for my UI class is getting to be a bit bulky and hard to edit, so I've decided to split up the panels...
in doing so, I broke the very framework that handles the GUI-layering...

the problem was I had to define each layer and stack before I could use it, otherwize the interface would throw a KeyError exception.
so what I've done now was automated that part and removed the limitation of a fixed order.
meaning you can do this:

layer(1).stack(0).AddQuad( ... ) # this draws last
layer(1).stack(5).AddQuad( ... ) # this draws next
layer(0).overlay(2).AddQuad( ... ) # this draws first

normally this would throw a major key-error and cause the interface to cough, even when recompiling the UI display list.
but now everything is automated and you no longer need stacks 1 through 4 or overlays 0 and 1.
all the stack does is determine the position on the current layer and draws from top to bottom. (5 to 0)


RE: Another UMC side-thread - Tcll - 01-29-2015

this is starting to look more like a legit file dialog now Smile
[Image: UMC_FileDialog4.png]

and oops, I messed up with the text and used the widget names... lol
that's a simple fix Tongue

soon enough this thing will be functional, and I can start working on the rest of the UI Wink