WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-25-2006, 01:41 AM
Joran Joran is offline
Member
 
Join Date: Jun 2006
Posts: 38
Send a message via Yahoo to Joran
How to show different objects on different windows from the same scene

Hello,

I have two windows. On on each window I want to show different objects on the viz.SCREEN, but the rest of the scene must be the same. What is the best way to do that?

Greetings, Joran.
Reply With Quote
  #2  
Old 08-25-2006, 09:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
There are two ways to go about this.

1) Each window has its own orthographic HUD. The window HUD is slightly different than the SCREEN because the coordinates are in actual pixel units, not normalized 0 to 1. Here is a sample script that adds a different text object to each windows HUD:
Code:
import viz
viz.go()

#Set main window size to half
viz.MainWindow.setSize(0.5,1)

#Add a new window to other half
window = viz.addWindow()
window.setPosition(0.5,1)
window.setSize(0.5,1)

#Add a model
viz.add('gallery.ive')

#Add text to the main windows orthographic HUD
text1 = viz.add(viz.TEXT3D,'Text 1',parent=viz.ORTHO,scene=viz.MainWindow)
text1.fontSize(36)

#Add text to the second windows orthographic HUD
text2 = viz.add(viz.TEXT3D,'Text 2',parent=viz.ORTHO,scene=window)
text2.fontSize(36)
2) Use 2 different scenes that share the same data. Example:
Code:
import viz
viz.go()

#Set main window size to half
viz.MainWindow.setSize(0.5,1)

#Add a new window to other half
window = viz.addWindow()
window.setPosition(0.5,1)
window.setSize(0.5,1)
view = viz.addView()
view.scene(2)
window.viewpoint(view)

#Add the root of your entire scene
root = viz.add(viz.GROUP)

#Duplicate this root onto scene 2
root.duplicate(scene=2)

#Add all subsequent world objects to this root
gallery = root.add('gallery.ive')

#Add text to scene 1 screen
text1 = viz.add(viz.TEXT3D,'Text 1',parent=viz.SCREEN,scene=1)

#Add text to scene 2 screen
text2 = viz.add(viz.TEXT3D,'Text 2',parent=viz.SCREEN,scene=2)
Reply With Quote
  #3  
Old 07-09-2014, 06:19 PM
deborah deborah is offline
Member
 
Join Date: Nov 2011
Posts: 3
Hi farshizzo,

I was able to copy your code to produce two different scenes that share the data, but cannot not use viz.add for anything other than text. For example, if I try:

#Add ball to scene 2 screen
ball = viz.add('white_ball.wrl',parent=viz.SCREEN,scene=2 )

the ball does not appear in the window. How can I add different types of nodes?
Reply With Quote
  #4  
Old 07-14-2014, 03:07 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Try scaling the ball by a large value such as 1000. You can also add it to the ortho layer:

Code:
ball = viz.add('white_ball.wrl',parent=viz.ORTHO, scene=2)
ball.setPosition([300,300,1])
ball.setScale([100]*3)
Reply With Quote
Reply


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 04:55 PM.


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