Mouse-interface

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
porkie
Posts: 0
Joined: Tue Aug 30, 2005 5:46 pm

Mouse-interface

Post by porkie » Tue Sep 20, 2005 5:37 pm

I am part of a team planning to develope an interface enabling use of a system called "Flock of birds" with blender, and we need to be able to move blenders 3d-pointer, where should we start looking in the code?
Last edited by porkie on Tue Sep 27, 2005 8:47 pm, edited 1 time in total.

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Wed Sep 21, 2005 12:38 am

Could you restate the question?

Do you want to control the mouse pointer? Get the mouse coordinates? Or something else?

LetterRip

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Wed Sep 21, 2005 5:18 am

I understand the 3d-pointer to be the cursor here. Perhaps the mousing of it is what intrr's grab cursor used to do?

/Nathan

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri » Wed Sep 21, 2005 9:47 am

Unless you want to add objects in 3d space, there is not much more use to the 3d cursor in blender. Unless you want to perhaps snap objects to the (3d) cursor? I think you might be better of adding emptys and put those in 3d space. They are easy to access via python, and can act the same as the 3d cursor and you can have more then one.

porkie
Posts: 0
Joined: Tue Aug 30, 2005 5:46 pm

Clarification

Post by porkie » Wed Sep 21, 2005 12:53 pm

Yes, i want to use the 3d-cursor to interact with objects in blender. Flock of birds is a VR-system that gets the position and orientation of a sensor ,currently attached to a glove. We want to wear the glove and be able to do (basic) modelling in blender with it.

What i want to know is how do i contrtol the 3d-cursor?

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Thu Sep 22, 2005 8:28 am

do you want python access or c access?

If python see this script for an example of setting the cursor position

http://jmsoler.free.fr/didacticiel/blen ... jsplusckey

So look in the documentation under the Window section for more info

If you want to use C you could go to the python api directory and look at Window.c then look at the functions called from above.

LetterRip

suntzu
Posts: 0
Joined: Wed Feb 18, 2004 6:20 pm
Location: Berlin
Contact:

Post by suntzu » Thu Sep 22, 2005 9:35 am

hallo,
perhaps this may help you:

Code: Select all

# SPACEHANDLER.VIEW3D.EVENT

#----------------------------------------------
# for demonstration
# you can change the 
# position of the 3DCURSOR
# with these keys:
#  X-direction : 'w' 'y'    
#  Y-direction : 'a' 's'
#  Z-direction : 'e' 'x'
#-----------------------------------------------
import Blender
from Blender import Draw, Window
evt = Blender.event

def set3dcursor(x,y,z):
	global c3x, c3y, c3z
	
	c3x = c3x + x
	c3y = c3y + y
	c3z = c3z + z
	Blender.event = None
	Window.SetCursorPos(c3x,c3y,c3z)
	Draw.Redraw(1)

c3x,c3y,c3z=Window.GetCursorPos()

if   evt == Draw.AKEY: set3dcursor(-1, 0, 0)
elif evt == Draw.SKEY: set3dcursor( 1, 0, 0)
elif evt == Draw.WKEY: set3dcursor( 0, 1, 0)
elif evt == Draw.YKEY: set3dcursor( 0,-1, 0)
elif evt == Draw.EKEY: set3dcursor( 0, 0, 1)
elif evt == Draw.XKEY: set3dcursor( 0, 0,-1)
suntzu

!THINK!

porkie
Posts: 0
Joined: Tue Aug 30, 2005 5:46 pm

thanks

Post by porkie » Tue Sep 27, 2005 8:53 pm

thanks guys! sorry about writing "mouse", i meant "move" only noticed it just now :)

joeri: what are empties? I agree with you, my idea to use the 3d-cursor is useless for what i want to do :) Can you move empties in 3d, and at the same time use one as a cursor, more specifically use it for selecting and moving vertices/edges/objects/etc?

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri » Tue Sep 27, 2005 11:38 pm

An empty is an object in 3d space without any content.

I thought you wanted to get 3d coordinates from your device ( I understand you have only 1 position in space, not a suit full of flock of birds on back, head, elbows , knees, foots and hands ) and do motion capture. But I now start to think you want to use the glove as a modification tool; ie. grab objects with it and move them around.
For this you might want to model a 3d "hand" and put it's position on the 3d location your fob is giving you. The example here shows you how to move an object with python: http://www.blender.org/documentation/23 ... odule.html
(the example moves a camera, but you can select any object...)
Looking forward to see you model with this glove!

porkie
Posts: 0
Joined: Tue Aug 30, 2005 5:46 pm

great!

Post by porkie » Wed Sep 28, 2005 10:53 am

thanks, ill try that - sorry about the confusion with "flock of birds" thats actually just the name of the sensory device, and has nothing to do with neither flocks nor birds :)

As you have correctly understood, what i want to do, is use the gloves to move a "cursor" in 3d-space and be able to use it like the regular cursor for selection, moving, rotating etc.

Ill take a look at the script u linked, but what i could really use is a way to select items using the "hand" (or whatever i choose to model).
Thanks a lot for your help guys, and i cant wait to see me modelling with the gloves either :)

When (if) we finish this, ill try to post a movie of me using it :)

Post Reply