WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 07-02-2007, 05:05 AM
FalconNL FalconNL is offline
Join Date: Jul 2007
Posts: 1
Picking in multiple windows

Hello everyone,

I'm currently in the process of comparing Vizard and the TrueVision3D engine. Therefor I'm writing a simple test program in both environments. There are a few things that I haven't been able to accomplish in Vizard yet.

The program has two viewports, one top-down and one 3D viewport. The scene consists of a floor and a cube, both of which can be dragged. I've managed to add two windows and got the dragging working (via viz.pick), but it only works in the main viewport. it completely ignores the two windows. I found that window objects have a pick method as well, so I could use that.

My question is then how to determine which viewport to use for picking. In C# I set the active viewport on the mouse move event, but window objects don't seem to have the callback function. What is the correct way of doing this?

Thanks in advance.
Reply With Quote
Old 07-02-2007, 09:45 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

There is currently no built-in feature that returns the selected window, but you can compute it manually. Here is sample script that creates a couple windows and will determine which one is selected when the left mouse button is pressed:
import viz

#Create some windows
window1 = viz.addWindow()

window2 = viz.addWindow(pos=(0,1))

#Create list of windows to select
windowSelection = [window1,window2,viz.MainWindow]

def SelectWindow():
	"""Returns the window that is underneath the mouse"""
	for w in windowSelection:
		c = w.displayToWindow(viz.mousepos())
		if 0.0 <= c[0] <= 1.0 and 0.0 <= c[1] <= 1.0:
			return w
	return None

#Perform picking on selected window when left mouse button pressed
def PickWindow():
	window = SelectWindow()
	if window:
		print 'Window',,'selected'
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 10:54 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC