MHGUI: a Blender python quick GUI (UPDATE)

This is another version with a little difference:
the bezier is based on openGL evaluator, the code
of Eeshlo (thanks again!).

You can see a difference?
The speed is greater than the previous version (beta30)?
In your opinion, do you prefer this alghorithm or previous ?

http://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta031.zip

Cheers,

           Manuel

I don’t see any difference, looks or speed. But maybe it might be better (in case of OGL problems for some) to use the software version, although I don’t see why there really should be any problems.

Thx…

This is only a brief parenthesis, an experiment to
future implementation.

I promise that before the end of week I try
to make a stable no experimental version
of this MHGUI lib, but now I’m charmed by
this new test: a low resolution 3D object in a
GUI window.

This can be usefull in more applications:

-For a preview of the material before export it
(for all export script )

-For a low resolution preview before load
an object from a library (ie makehuman
target)

http://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta063.zip

Ok. I’ve a problem: The refresh of button.
Take a look to image…
And I’ve the impression the system memory
not correctly used…

http://www.kino3d.com/~Ken75/makehuman/screenshot_3d.jpg
In this sample you can move all window…

Ah…the message is wrong: you must use only left click and hold
to move…

Help…again!

This is the last update before the exit from beta status.
Now you can expand or collapse the item with right click
on it. Please test it

http://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta081.zip

http://www.kino3d.com/~Ken75/makehuman/screenshot_tree.jpg

I have tried the previous version, but I had no time anymore to react. Anyway your displaylist stuff for TridiWin.py is not quite right, I see that you changed it, but you might as well remove the GenList and NewList stuff. You also forgot to end the list with glEndList() in the last version.
In the version you had before, you create and draw the list at the same time, and immediately draw it again. You either initialize the list before the draw call (only using GL_COMPILE), and then draw by CallList, or you use GL_COMPILE_AND_EXECUTE without using CallList again.
Anyway, none of that will cure the button problem. The problem seems to be that using translate/rotate/scale will interfere with Blender button drawing for some reason, I thought this might be somehow corrected with Push- and Pop-Matrix at appropriate points but I had no luck sofar. Also, using Redraw(1) will redraw EVERYTHING continuously, not just that particular window.

Anyway, I did find a problem in this version too, clicking on a triangle with the left mouse button will cause a ‘unsubscriptable object’ error, the problem is that mouse.testAndMove returns None when clicking with the left mouse button, so it is just a case of testing the return value to correct this.

thx Eeshlo.
I’ve solved the my stupid error about unsuscriptable
object here:
http://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta081.zip

About tridiwin class, I will try to use your suggestion with
push and pop matrix…but I’m not openGL expert , and
I can only try, and try, and try again…
I’m very grateful if you can take a look
to this problem 8)

Ciao,

         Manuel

Ok.
This can be named MHGUI1.01, only,
before to change the name, you must help me
to test.

You can use it, because in the future I dont’ change
the sintax in the client code: I will only work on internal
class changement, adding a properties and method.
Don’t use Tridiwin class, because it’s very experimental.

In the sample attention to item image path and resolution.
I make the tga by Gimp. Don’t use compression to save it.
I hope this is useful. Thanks to all…

http://www.kino3d.com/~Ken75/makehuman/can_be_1_01.zip

http://www.kino3d.com/~Ken75/makehuman/betafinal.jpg

I’ve a notice about a very slow movement
under Suse. Can anyone test this? The problem
can be the grab test. I can try to re-use the
Blender-button to select a windows…

I’m still having the “really thin bezier curve” bug, so they are really hard to see, pale colors on blue background and all. Maybe using a more neutral background (like gray) would be a bit better.

Just a mere suggestion, it works great otherwise.

Martin

A user tell me that under Windows the SAMPLE_tree use
all computer resource. Can you try this?
If you want change the background, you must only change
a.setColorBG(…) value in the script (a is an istance of background class.)

Aheeee!
Now the Treevin seem Okhttp://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta087.zip
I’ve used the default MODELVIEW matrix, and I’ve
used push and popMatrix() for the PROJECTION matrix.
Now you can see the Blender Button and the 3D object.
The display list is created in the init

UPDATE 10/10/2002.

Sorry…after 45 min the Tridiwin has
used all memory of my machine…
I don’t understand where is the error.
Please take a look on code and help me…
:frowning:


import Blender
from Blender.BGL  import *
from Blender.Draw import Redraw
from BaseWindowClass import BaseWindowClass 

class Tridiwin(BaseWindowClass):

	def __init__(self, LocX, LocY, Width, Height, obj, Deco):

		BaseWindowClass.__init__(self,LocX,LocY,Width,Height)
		self.Frame   = 0
		self.ObjectToDraw=obj
		self.title = "3D object"
		self.decoration = Deco


		global displayList
		if len(self.ObjectToDraw)>0:
			
			displayList=glGenLists(1)	
			glNewList(displayList, GL_COMPILE)

			glColor3f(1.0, 0.0, 0.0)	
			for face in self.ObjectToDraw:
				glBegin(GL_LINE_LOOP)
				for v in face:
					glVertex3f(v[0], v[1], v[2])
				glEnd()
			glFlush()
			glEndList()

	def moveAndRotate(self):

		#glMatrixMode(GL_MODELVIEW)
		#glPushMatrix()
		#glLoadIdentity()
		glTranslatef(0.0, 0.0, -5.0)

		if (self.Frame>=720):
			glRotatef(self.Frame, 0.0, 1.0, 0.0)
		elif (self.Frame>=360): 
			glRotatef(self.Frame, 1.0, 0.0, 0.0)
		else:
			glRotatef(self.Frame, 0.0, 0.0, 1.0)

		self.Frame= self.Frame+10
		if (self.Frame>1080): self.Frame= 0

		glCallList(displayList)
		#glPopMatrix()

	def drawIt(self):
		
		WinSize = Buffer(GL_FLOAT,4);
		glGetFloatv(GL_SCISSOR_BOX,WinSize)
		if self.decoration == 0:
				self.drawBox()
		else:
				self.drawBoxS()
		self.drawTitle(self.title)
		# Cause this window to be continuously redisplayed
		Redraw(1) 
		
		glMatrixMode(GL_PROJECTION)
		glPushMatrix()
		glLoadIdentity()
		glOrtho(-5.0, 5.0, -5.0, 5.0, 0.1, 10.0)
		glViewport(self.LocX+WinSize[0], self.LocY+WinSize[1]-self.Height, self.Width, self.Height)
		self.moveAndRotate()
		glPopMatrix()

In the client code I use only the drawIt() function. The
list is generated only when a istance is create (one time) in the
client code, because I put it in the init of Tridiwin class

Your code looks ok (although glFlush() doesn’t seem really necessary), and on my computer there doesn’t seem to be an increase in memory use at all. So maybe it has something to do with your OpenGL driver.

Mhh…In another test I’ve used the Windows utility to
see the graph of processor work: it go to 100% after
1 sec :o

Can you test this on your machine?
Thanks,

          Manuel

This happens because the entire GUI is continuously redrawn.

Mhh…this can be a fundamental observation!!
Thanks!! I’m go to try a new experiments :slight_smile:

This is a optimized version. When you move
the win, the image is leaved and the connector
bezier is changed in simple lines. This is because
now the item have a item.detailVisibility. Now the client
code is more light, because I’ve added a
windows.isSelected and you don’t must use
another global variable…

In the old version, when the mouse is
pressed, the grab test is called continuously.
Now the selection method is little different:
click to select, release, move, then click
to deselect. The grabtest is called only when
you click

But the first improvement is the semplification
of Itemwin and Picture class. I’ve found and solved
a very ricorsive and stupid computation, and the speed
is increased…Now the picture is stored in a
DisplayList.

I’ve added the picture.zoom, and now you can
zoom the picture. Take a look to SAMPLE_image.
Press and release Z a few times…

http://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta115.zip

works great!

Martin

From a non-program-user viewpoint, I must say it functions well but I have no idea what to do with it…
Really looking forward to seeing it in action.
Keep up the great work

Thanks for the reply :smiley:
I’ve found a bug in the picture istance, and now
I’m working to fixed it. But a great notice is that
I’ve optimized the Draw() function, the real
cause to CPU work. In this version the Draw() function
is called when you move the mouse in the Y coord.
In the next version I will add a refresh time, and
the computation can be reduced like 1/10, because
the Draw() function is called only after 10 Y movement.
You will be able to set this value.
:smiley:

                    Manuel

Thisi is the first stable version.
http://www.kino3d.com/~Ken75/makehuman/MHGUI_1_0.zip
You can see a quick doc made by HappyDoc…

http://www.kino3d.com/~Ken75/makehuman/screenshot_butt.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_doc.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_file.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_time.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_tree.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_tridi.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_menu.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_message.jpg

http://www.kino3d.com/~Ken75/makehuman/screenshot_slid.jpg