New Mouse Gestures Script

EDIT. AN IMPROVED VERSION BY CAMBO IS AVAILABLE DOWN THE PAGE. VISUAL CLUES, BETTER GESTURE DETECTION AND MORE!

Blender Mouse Gesture system has been around for years I think, but its funcionality is very limited. I manage to create new gestures in Python that override the blender original ones. I did this as an experiment and it amazed me that worked, specially since I´m a terrible coder :wink:

http://img288.imageshack.us/img288/3094/newgesturestypes9yq.jpg

If you like gestures or you like to use your mouse, give it a try. Testing is also needed by I managed to do a full session modeling without troubles. It´s kinda a strange hack using new features of bphyton so no guarantees.

It´s very usefull if you model extruding a lot… you know… extrude, scale, grab extrude rotate extrude and so on :wink:

Get the file here http://www.webfilehost.com/index.php?mode=viewupload&id=1416

[b]To use: Open the script in a text window, or just copy and paste into blender. Then activate it in the View -> Space Handlers Scripts menu in the 3D View.

http://img288.imageshack.us/img288/7571/newgestureshowto8is.jpg

Hope you like this. Feedback Welcome. Mirror the file if you want (I have no hosting right now)


# SPACEHANDLER.VIEW3D.EVENT

import Blender
from Blender import Window, Draw, sys

# New Mouse Gestures v0.1 for Blender
# by Mariano Hidalgo a.k.a uselessdreamer
#
# Feel free to improve, modify or just ignore this awfull code. I SUCK at math :D
#
# To use load the script in a Text Window and then activate it
# in the View -> Space Handlers Scripts menu in the 3D View.
# For simple customization you just search for EKEY, RKEY, SKEY or whatever key
# you want to change and replace for the new one (change only mode specific keys if
# you dont know python enough, ie: do not change scale(S) for separate(P) since it
# won´t work in object mode). Also don´t delete the fist line, it will not work without it.
#
# Note if you want to customize that some keys will not work (SPACEBAR, I, TAB and some others)
#
#
# Drag Up = Extrude (E) or Move To Layer (M)
# Drag Down = Rotate (R)
# Drag Left = Scale (S)
# Drag Right = Grab (G)
# Drag Up Left = Undo (U) or (CTRL Z)
# Drag Up Right = Redo (U) or (CTRL Y)
# Drag Down Left = Select All (A)
# Drag Down Right = Delete (X)
#
#

evt = Blender.event
if evt == Draw.LEFTMOUSE:

	# Gather info about which 3D Window is generating the event
	# Grab it´s size and location on the screen
	winId = Window.GetAreaID()
	winSize = Window.GetAreaSize()
	winData = Window.GetScreenInfo()
	width = winSize[0]
	height = winSize[1]
	for win in winData:
		if win["id"] == winId:
			xmin = win["vertices"][0]
			ymin = win["vertices"][1]
			xmax = win["vertices"][2]
			ymax = win["vertices"][3]
	
	# Grab old and new Mouse Position
	# Not sure about this sys.sleep trick...
	# There should be a better way of doing this :/
	clickX =  Window.GetMouseCoords()[0]
	clickY =  Window.GetMouseCoords()[1]
	sys.sleep(200) # Tweak this for debbuging funcionality if you want
	clickNewX = Window.GetMouseCoords()[0]
	clickNewY = Window.GetMouseCoords()[1]

		
	#  Put here what you want to do in case of Straight Drag Up
	if (clickNewY - clickY) > 30 and (clickNewX - clickX) < 30 and (clickNewX - clickX) > -30:
		if Window.EditMode():		
			Window.QAdd(winId,Draw.EKEY,1) # Change KeyPress Here for EditMode
			Window.QHandle(winId)
			Blender.event = None
		else:
			Window.QAdd(winId,Draw.MKEY,1) # Change KeyPress Here for ObjectMode
			Window.QHandle(winId)
			Blender.event = None
	#  Put here what you want to do in case of Straight Drag Down
	if (clickNewY - clickY) < -30 and (clickNewX - clickX) < 30 and (clickNewX - clickX) > -30:
		Window.QAdd(winId,Draw.RKEY,1) # Change KeyPress Here
		Window.QHandle(winId)
		Blender.event = None			
	
	#  Put here what you want to do in case of Straight Drag Left
	if (clickNewX - clickX) < -30 and (clickNewY - clickY) < 30 and (clickNewY - clickY) > -30:
		Window.QAdd(winId,Draw.SKEY,1) # Change KeyPress Here
		Window.QHandle(winId)
		Blender.event = None
			
	#  Put here what you want to do in case of Straight Drag Right
	if (clickNewX - clickX) > 30 and (clickNewY - clickY) < 30 and (clickNewY - clickY) > -30:
		Window.QAdd(winId,Draw.GKEY,1) # Change KeyPress Here
		Window.QHandle(winId)
		Blender.event = None
						
	#  Put here what you want to do in case of Straight Drag Up Left
	if (clickNewY - clickY) > 30 and (clickNewX - clickX) < -60 and (clickNewX - clickX) < 30:
		if Window.EditMode():
			Window.QAdd(winId,Draw.UKEY,1) # Change KeyPress Here for EditMode
			Window.QHandle(winId)
			Blender.event = None
		else:
			Window.SetKeyQualifiers(48) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
			Window.QAdd(winId,Draw.ZKEY,1) # Change KeyPress Here for ObjectMode
			Window.QHandle(winId)
			Blender.event = None
			Window.SetKeyQualifiers(0) # Release the modifier keys!!!	

	#  Put here what you want to do in case of Straight Drag Up Right
	if (clickNewY - clickY) > 30 and (clickNewX - clickX) > 30 and (clickNewX - clickX) > -60:
		if Window.EditMode():
			Window.SetKeyQualifiers(3) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
			Window.QAdd(winId,Draw.UKEY,1) # Change KeyPress Here for EditMode
			Window.QHandle(winId)
			Blender.event = None
			Window.SetKeyQualifiers(0) # Release the modifier keys!!!
		else:
			Window.SetKeyQualifiers(48) # This is to use CTRL modifier (3=SHIFT | 48=CTRL | 12=ALT)
			Window.SetKeyQualifiers(3) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
			Window.QAdd(winId,Draw.ZKEY,1) # Change KeyPress Here for ObjectMode
			Window.QHandle(winId)
			Blender.event = None
			Window.SetKeyQualifiers(0) # Release the modifier keys!!!	
	#  Put here what you want to do in case of Straight Drag Down Right
	if (clickNewY - clickY) < -30 and (clickNewX - clickX) > 30 and (clickNewX - clickX) > -60:
			Window.QAdd(winId,Draw.XKEY,1) # Change KeyPress Here
			Window.QHandle(winId)
			Blender.event = None

	#  Put here what you want to do in case of Straight Drag Down Left
	if (clickNewY - clickY) < -30 and (clickNewX - clickX) < -60 and (clickNewX - clickX) < 30:
			Window.QAdd(winId,Draw.AKEY,1) # Change KeyPress Here
			Window.QHandle(winId)
			Blender.event = None			
			Draw.Redraw()		


Nothing happens when I open it in a text window and hit alt-p. No errors, nothing. And there’s nothing in the View menu.

Its weird… I haven´t tested it with older blender versions… what version are you using?..

Don´t need to hit alt p btw… just by loading it in a text window it should appear in the menu thats in the picture…

WORKS

Im in a public computer right now browsing elysiun… Went to Blender3D.org , downloaded 2.37a, installed…

Copied and pasted the script from the page and pasted in text window: WORKING

Downloaded the zipfile and open in blender: WORKING

I must only work with 2.37a maybe… sorry for not stated in the post :slight_smile:

BTW DONT HIT ALT P – ITS NOT NEEDED simply go to the menu in the picture and it will be there… its a new kind of script type

thanks for trying it… :slight_smile:

Still nothing. Pretty sure I’m on 2.37a, but might just be 2.37

Works nice here (Blender CVS) :smiley:
Huge speed in the workflow! :wink:

Thanks.

SUPER F’n SWEEEEEET!

as a hardcore firefox gesture extension user i can just say: AWESOME, thanks so much!!
for me it’s a huge workflow speedup! :smiley:

.andy

Ah there we go. Got it all working :smiley: Great fun to use, and nice and quick. Don’t know if I’ll use em much, too used to the keyboard :wink: Although there seems to be a major bug, when ever you use a gesture to do something, and then use undo via the keyboard it causes blender to crash.

Correction It crashes whenever you have ‘Hotspots’ enabled. So it’s not the gesture script, but the Hot Spots.

Thanks for testing it… Ill check what mr_bomb said about the crashing… perhapes the undo in object mode removes the scriptlink from the 3d view…

don´t know Ill have to check :slight_smile:

May be a bug of the undo system, because nobody used “space handler scripts” previously (at least I don’t remember).

Thanks a lot. I reckon this should be integrated into blender, such a great script it is. :smiley:

Try this, Tools can be added more easerly and have there own vector.

Draws a line on the screen with text as to the tool you want before you select that rotation.

Only executes on mouse up, minor change.

Unpack function calls.


# SPACEHANDLER.VIEW3D.EVENT



import Blender

from Blender import Window, Draw, sys, Text, Scene, Mathutils


# New Mouse Gestures v0.1 for Blender

# by Mariano Hidalgo a.k.a uselessdreamer

#

# Feel free to improve, modify or just ignore this awfull code. I SUCK at math :D

#

# To use load the script in a Text Window and then activate it

# in the View -> Space Handlers Scripts menu in the 3D View.

# For simple customization you just search for EKEY, RKEY, SKEY or whatever key

# you want to change and replace for the new one (change only mode specific keys if

# you dont know python enough, ie: do not change scale(S) for separate(P) since it

# won´t work in object mode). Also don´t delete the fist line, it will not work without it.

#

# Note if you want to customize that some keys will not work (SPACEBAR, I, TAB and some others)

#

#

# Drag Up = Extrude (E) or Move To Layer (M)

# Drag Down = Rotate (R)

# Drag Left = Scale (S)

# Drag Right = Grab (G)

# Drag Up Left = Undo (U) or (CTRL Z)

# Drag Up Right = Redo (U) or (CTRL Y)

# Drag Down Left = Select All (A)

# Drag Down Right = Delete (X)

#

#



from Blender.BGL import *
import math

RADIAL_LIMIT = 120
RADIAL_MIN_LIMIT = 60
DEG_TO_RAD = 3.1415926535897931 / 180.0 

# Here we define all tools, there functions and vectors on the circle.
def getTools(winId):
	is_editmode = Window.EditMode()
	# DEFINE ALL THE BUTTONS
	DIRECTION_PARMS = []
	

	# BOTTOM LEFT DIR ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc():
		Window.QAdd(winId,Draw.AKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
	
	CONTEXT_TOOL['text'] = '(De)Select' 
	CONTEXT_TOOL['func'] = tempFunc
	
	# TOP LEFT DIR ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	if is_editmode:
		def tempFunc():
			Window.QAdd(winId,Draw.UKEY,1) # Change KeyPress Here for EditMode
			Blender.StartClickXY = 0
			Window.QHandle(winId)
			Blender.event = None
	else:
		def tempFunc():
			Window.SetKeyQualifiers(48) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
			Window.QAdd(winId,Draw.ZKEY,1) # Change KeyPress Here for ObjectMode
			Blender.StartClickXY = 0
			Window.QHandle(winId)
			Blender.event = None
			Window.SetKeyQualifiers(0) # Release the modifier keys!!!   
	
	CONTEXT_TOOL['text'] = 'Undo' 
	CONTEXT_TOOL['func'] = tempFunc	
	
	
	# BOTTOM Right DIR ==================================================
	CONTEXT_TOOL = {} 
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc(): # Del
		Window.QAdd(winId,Draw.XKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
	
	CONTEXT_TOOL['text'] = 'Delete Selection' 
	CONTEXT_TOOL['func'] = tempFunc	

	
	
	# TOP Right DIR ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc(): # Redo
		if is_editmode:
			def tempFunc():
				Window.SetKeyQualifiers(3) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
				Window.QAdd(winId,Draw.UKEY,1) # Change KeyPress Here for EditMode
				Blender.StartClickXY = 0
				Window.QHandle(winId)
				Blender.event = None
				Window.SetKeyQualifiers(0) # Release the modifier keys!!!
		else:
			def tempFunc():
				Window.SetKeyQualifiers(48) # This is to use CTRL modifier (3=SHIFT | 48=CTRL | 12=ALT)
				Window.SetKeyQualifiers(3) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
				Window.QAdd(winId,Draw.ZKEY,1) # Change KeyPress Here for ObjectMode
				Blender.StartClickXY = 0
				Window.QHandle(winId)
				Blender.event = None
				Window.SetKeyQualifiers(0) # Release the modifier keys!!!   
	
	CONTEXT_TOOL['text'] = 'Redo' 
	CONTEXT_TOOL['func'] = tempFunc
	
	
	# LEFT DIR ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc():
		Window.QAdd(winId,Draw.SKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
	
	CONTEXT_TOOL['text'] = 'Scale'
	CONTEXT_TOOL['func'] = tempFunc
	
	
	# UP DIR ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)
	if is_editmode:		
		def tempFunc():
			Window.QAdd(winId,Draw.EKEY,1) # Change KeyPress Here for EditMode	
			Blender.StartClickXY = 0
			Window.QHandle(winId)
			Blender.event = None
		
		CONTEXT_TOOL['text'] = 'Extrude'
	
	else:
		def tempFunc():
			Window.QAdd(winId,Draw.MKEY,1) # Change KeyPress Here for ObjectMode
			Blender.StartClickXY = 0
			Window.QHandle(winId)
			Blender.event = None
		
		CONTEXT_TOOL['text'] = 'Move Layer'
	
	CONTEXT_TOOL['func'] = tempFunc
	
	
	# ROTATE ==================================================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc():
		Window.QAdd(winId,Draw.RKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
	
	CONTEXT_TOOL['text'] = 'Rotate'
	CONTEXT_TOOL['func'] = tempFunc
	
	
	# GRAB   =============================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc():
		Window.QAdd(winId,Draw.GKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
	
	CONTEXT_TOOL['text'] = 'Grab'
	CONTEXT_TOOL['func'] = tempFunc
	
	
	# SELECT GROUP =============================
	CONTEXT_TOOL = {}
	DIRECTION_PARMS.append(CONTEXT_TOOL)	
	def tempFunc():
		Window.SetKeyQualifiers(3) # This is to use SHIFT modifier (3=SHIFT | 48=CTRL | 12=ALT)
		Window.QAdd(winId,Draw.GKEY,1) # Change KeyPress Here for EditMode	
		Blender.StartClickXY = 0
		Window.QHandle(winId)
		Blender.event = None
		Window.SetKeyQualifiers(0) # Release the modifier keys!!!   
	CONTEXT_TOOL['text'] = 'Sel Group'
	CONTEXT_TOOL['func'] = tempFunc
	
	# Sort be name!
	DIRECTION_PARMS.sort(lambda a,b: cmp(a['text'], b['text']))
		
	
	
	# We can generate automatic Vectors to use here.
	# Comment it out if you want to assign manual vectors
	for i, CONTEXT_TOOL in enumerate(DIRECTION_PARMS):
		angle = 2*math.pi*i/len(DIRECTION_PARMS)
		CONTEXT_TOOL['vec'] = Mathutils.Vector(math.cos(angle), math.sin(angle))

	
	return DIRECTION_PARMS


def removeScriptLink(scn):
	if scn.getScriptLinks('Redraw'):
		scriptLinks = scn.getScriptLinks('Redraw')
		while scriptLinks != None  and 'new_gestures.py' in scriptLinks:
			scn.clearScriptLinks(['new_gestures.py'])	
			scriptLinks = scn.getScriptLinks('Redraw')



# This is what is run when the 3d window gets an event.
# It manages the logic behind setting the right tool and launching it.
def event_main():
	mod =[Window.Qual.CTRL,  Window.Qual.ALT, Window.Qual.SHIFT]
	qual = Window.GetKeyQualifiers()
	
	# Mouse button down with no modifiers.
	if Blender.event == Draw.LEFTMOUSE and not [True for m in mod if m & qual]:
		
		
		# Gather info about which 3D Window is generating the event
		# Grab it´s size and location on the screen
		winId = Window.GetAreaID()
		#width, height = Window.GetAreaSize()
		
		Blender.TOOLS_DICT = getTools(winId)
		bestToolSoFar = length = None	
		
		
		scn = Scene.GetCurrent()
		
		# Adds self as a scene scriptlink
		scn.clearScriptLinks(['new_gestures.py'])
		scn.addScriptLink('new_gestures.py', 'Redraw')	
		
		# Con only ever be 1 in this for loop
		xmin, ymin, xmax, ymax = Blender.offset = [ win['vertices'] for win in Window.GetScreenInfo() if win["id"] == winId ][0]
		
		# Grab old and new Mouse Position
		# Not sure about this sys.sleep trick...
		# There should be a better way of doing this :/
		Blender.StartClickXY = Window.GetMouseCoords()
		origClickVec = Mathutils.Vector(Blender.StartClickXY)
		
		testVec = Mathutils.Vector([-100,-100])
		while Window.GetMouseButtons() & Window.MButs['L']:
			new_mouse_coords = Window.GetMouseCoords()
			
			# We did move the mouse
			if new_mouse_coords != tuple(testVec):
				testVec.x, testVec.y = new_mouse_coords
				mouseRelDirVec = testVec - origClickVec
				
				# Only draw if the user has a direction offset from the original click point.
				if mouseRelDirVec.x != 0 and mouseRelDirVec.y != 0:
					
					if mouseRelDirVec.length > RADIAL_LIMIT or\
					mouseRelDirVec.length < RADIAL_MIN_LIMIT:
						Blender.AngleText = 'Do Nothing! Out of Range'
						bestToolSoFar = None
					else:
						bestDistSoFar = 1000
						bestToolSoFar = None
						
						# Select the best tool	
						mouseRelDirVec.normalize()
						
						for toolDict in Blender.TOOLS_DICT:
							
							length = Mathutils.AngleBetweenVecs(toolDict['vec'], mouseRelDirVec)
							
							if length != length:
								break
							if length < bestDistSoFar:
								
								bestDistSoFar = length
								bestToolSoFar = toolDict
						
						if length!= length:
							Blender.AngleText = ''
						else:
							Blender.AngleText = bestToolSoFar['text']
							
					Window.Redraw(Window.Types.VIEW3D)
			
			sys.sleep(10) # Tweak this for debbuging funcionality if you want
		
		# if length is NAN then this wont work
		if length == length and\
		bestToolSoFar and\
		testVec.x>xmin and testVec.x < xmax and testVec.y>ymin and testVec.y<ymax: # Best so far must not be none, None means the user clicked out of range.
			# Move mouse back
			Window.SetMouseCoords(tuple(origClickVec))
			
			# Done se execute the command
			removeScriptLink(scn)
			bestToolSoFar['func']()
			Blender.event = None
		else:
			# Move mouse back
			Window.SetMouseCoords(tuple(origClickVec))
			
		Draw.Redraw(Window.Types.VIEW3D)
		
		removeScriptLink(scn)
		
		
		
		# Clean up
		del Blender.StartClickXY
		del Blender.offset 
		del Blender.TOOLS_DICT


# This is what is run when the script is launched as a scene scriptlink.
# Hindles drawing only.
def scriptlink_main():
	# Use Registry for storing mouse location in 3d space
	if Window.GetMouseButtons() & Window.MButs['L'] and\
	'StartClickXY' in dir(Blender) and\
	Blender.StartClickXY:
		
		# SHOULD BE DECUMENTED!!!! ise the firsta value to scale glRasterPos2i by.
		viewMatrix = Buffer(GL_FLOAT, 16)
		glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix)
		
		newX, newY = Window.GetMouseCoords()
		xmin, ymin, xmax, ymax = Blender.offset 
		# Mouse in the screen?
		if newX>xmin and newX < xmax and newY>ymin and newY<ymax:
			
			# Scale the mouse vars.
			f = 1/viewMatrix[0] # Scene viewspace size factor.
			x1,y1,x2,y2 = int((newX-xmin)*f),int((newY-ymin)*f), int((Blender.StartClickXY[0]-xmin)*f), int((Blender.StartClickXY[1]-ymin)*f)
			
			
			# Draw a filled circly
			glColor4f(0.4, 0.5, 0.6, 0.8)
			
			
			glEnable( GL_LINE_SMOOTH )
			glEnable( GL_BLEND )
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
			
			glBegin(GL_POLYGON)
			circlePoints = 22
			for i in range(circlePoints):
				angle = 2*math.pi*i/circlePoints
				glVertex3f(x2+(math.cos(angle)*(RADIAL_LIMIT*f)), y2+(math.sin(angle)*(RADIAL_LIMIT*f)), 0)
			glEnd()
			
			'''
			glColor4f(0.4, 0.5, 0.6, 0.10)
			glBegin(GL_POLYGON)
			circlePoints = 22
			Circle_Size= 20
			for i in range(circlePoints):
				angle = 2*math.pi*i/circlePoints
				glVertex3f(x2+(math.cos(angle)*Circle_Size), y2+(math.sin(angle)*Circle_Size), 0)
			glEnd()
			'''
			
			
			praDictVec = Mathutils.Vector([x1,y1]) - Mathutils.Vector([x2,y2])
			praDictVec.normalize()
			praDictVec = praDictVec * RADIAL_LIMIT * f # Back intto mouse space.
			
			# Draw hint lines
			drawVec = Mathutils.Vector([0,0])
			for tool in Blender.TOOLS_DICT:
				glColor3f(0.2, 0.2, 0.2)
				
				drawVec.x, drawVec.y = tuple(tool['vec'])
				drawVec.normalize()
				drawVec = (drawVec * RADIAL_LIMIT * f * 0.8) 
				drawVec = drawVec + Mathutils.Vector([x2,y2])
				'''
				glBegin(GL_LINES)
				glVertex2i( int((x2+drawVec.x)/2), int((y2+drawVec.y)/2) )
				glVertex2i(int(drawVec.x), int(drawVec.y))
				glEnd()
				'''
				if Blender.AngleText == tool['text']:
					glColor3f(1.0, 1.0, 1.0)
					size = 'normal'
				else:
					glColor3f(0.7, 0.7, 0.7)
					size = 'small'
				w = Draw.GetStringWidth(tool['text'], size) * f
				
				'''
				# LHS Align to left
				# RHS Align to right.
				if drawVec.x > x2:
					glRasterPos2i(int(drawVec.x), int(drawVec.y))
				elif drawVec.x < x2:
					glRasterPos2i(int(drawVec.x-w), int(drawVec.y))
				else:
					glRasterPos2i(int(drawVec.x-(w/2)), int(drawVec.y))
				'''
				glRasterPos2i(int(drawVec.x-(w/2)), int(drawVec.y-4))
				
				Draw.Text(tool['text'], size)
				
			
			
			glColor3f(1, 1, 1)
			# Draw line to predict
			glBegin(GL_LINES)
			glVertex2i(x1, y1)
			glVertex2i(x2, y2)
			glEnd()
			
			# Draw a started square.
			#glColor3f(0.0, 0.0, 0.0)
			#glRecti(x2-4, y2-4, x2+4, y2+4)
			
			# Pradict square.
			glRecti(int(x2+praDictVec[0]-2), int(y2+praDictVec[1]-2), int(x2+praDictVec[0]+2), int(y2+praDictVec[1]+2))	
			
			# Outline text.	
			'''
			glColor3f(0.0, 0.0, 0.0)
			glRasterPos2i(x1+2, y1+2)
			w = int(Draw.GetStringWidth(Blender.AngleText, 'normal') * f)
			glColor4f(1, 1, 1, 0.8)
			glRecti(x1, y1, x1+w+2, y1+16)
			Draw.Text(Blender.AngleText, 'normal')
			'''
			
			glDisable( GL_LINE_SMOOTH )
			glDisable( GL_BLEND )


if Blender.link != 1:
	scriptlink_main()
else:
	event_main()


I updated my modification, should not interfraw when Crtl/Alt/Shift are clicked and also leaves things a bit cleaner.

Thanks Cambo… you are a true coder I can see… as I stated in the post I have very basic knowledge of coding… I do what I can and sometimes I can make things work :smiley:

I will study this too… to learn a bit more :wink:

Thank you

Thanks Cambo… you are a true coder I can see… as I stated in the post I have very basic knowledge of coding… I do what I can and sometimes I can make things work :smiley:

I will study this too… to learn a bit more :wink:

Thank you[/quote]

Glad you like the edits, if you want to keep developing your own- Which Id totaly understanmd, (nothing like working with concepts you fully understand, some stuff in my code might not make so much sence to you)

Dont do too many function calls-
x = GetLocation()[0]
y = GetLocation()[1]
is better done like this.
x,y = GetLocation()

Some advice, Make tools objects you can add and remove. Mine is almost like that.

I could probably clean my code a little. the gestures relying on adding and removing a scriptlink is a bit annoying, but for the moment Its necessary.

Mabe GL Calls fron an event handeler should act like scene scriptlinks.

  • Cam

Another big update, lots of speedups and new graphics :slight_smile: - Text for each vector.
Remember all this is dynamic, you can add new tools realy easerly and the vectors and names etc are drawn in the right place.

Mouse cursor is fake. :slight_smile:

http://members.iinet.net.au/~cpbarton/ideasman/gesture.png

Im thinking of each having each tool, a state for when ALT/CTRL/SHIFT are held.

So you could hit Ctrl and get a new lot of menu items. mabe the more obscure ones.

I might make the default non active text larger…

Cheers.

It´s getting better and better… I would like you to continue to develop this if you want… just credit me for first concept or something if you want…

I ´ve found that scriptlinks are broken it tuhoopu so it crash with it… ill post yours on top if you want along with mine for tuhoopu users (like me) till that get fixed.

IT WILL BE REALLY COOL IF ONE DIRECTION COULD BE USED TO SWITCH vertex/edge/face selection mode… without the need to go to the window header… but I coulndt make certain keys to work… have you tried?

Thank for the improvements mate… regards :slight_smile:

BTW… I´m started to work in the particle tweaking script i va mentioned in other thread and may be using some of this (need lots of gestures for it)

BTW… i noticed that mine´s react to shorted drags… can this be added to yours or it will mess the algo to detect the drags?

Hi, I have fixed the scriptlink problem and reacting incorrectly, Ill make it so a draw less then 10px dosent do anytrhing.

Im coding a better Fly mode as an example of a menu item :).

  • You you can navigate your scene like in quake.
  • Cam