View Single Post
  #4  
Old 11-19-2008, 11:04 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
is this what you mean. You can only click on the avatar when the dropdown is set to ON.

Code:
import viz

viz.go()

viz.add('court.ive')
avatar = viz.add('vcc_male.cfg', pos = [0,0,5], euler = [180,0,0])
avatar.state(1)


click_avatar = True

list = viz.addDropList()
list.addItems(['ON','OFF'])
list.translate(.85,.95)


def dropListChanged(e): 

	global click_avatar

	if e.newSel == 0:
		click_avatar = True
	else:
		click_avatar = False
	
	
vizact.onlist( list, dropListChanged )


def onMouseDown(button):
	
	#if you pass in a value 1 a VizIntersect object will be returned
	object = viz.pick(1)
	
	if object.valid and click_avatar == True:
	
		if object.name == 'casual32_m_highpoly.CMFX':
			print "you picked the avatar's head"
			avatar.state(2)
	
		elif object.name == 'casual32_m_highpoly01.CMFX':
			avatar.state(4)
			print "you picked the avatar's body"
		else:
			avatar.state(1)
			print "you picked " + object.name
	
		

viz.callback(viz.MOUSEDOWN_EVENT,onMouseDown)
Reply With Quote