WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-09-2014, 08:30 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Changes in vizdlg or vizact in Vizard 5?

Hello,

I have a problem running most of my files in Vizard 5:

To display text, images, ... I build my own vizdlg.Dialog class to create a panel which I can use to display and hide messages very easily (I used a small tutorial that is somewhere in the Vizard documentation).

Since I upgrade to Vizard 5, the background of the panel won't hide anymore. To show you guys what I mean, I created a small example (with a simplified version of my vizdlg.Dialog class).

The code pasted below works fine with Vizard 4: the text 'Bla' is displayed for 2 seconds, then the screen goes black
However, in Vizard 5, the text will also go away after 2 seconds, but the grey background will stay without any error message.

Have there been any changes to the built-in librarys that could cause such a problem?

Cheers,
Johannes


EDIT: I fixed it by changing line 68 'self.panel.addAction(vizact.fadeTo(0,time=fade))' to 'self.panel.background.addAction(vizact.fadeTo(0,t ime=fade))'


Code:
import os
import sys

import viz
import vizdlg
import vizact
import viztask


# text panel class

class displayInfo(vizdlg.Dialog):

	def __init__(self,mode = 'fit',fontSize = 50,textAlignment = viz.ALIGN_CENTER,border = True,background = True, padding = 5,**kw):
		
		vizdlg.Dialog.__init__(self,**kw)
		
		self.fontSize = fontSize
		self.textAlignment = textAlignment
		self.textColor = (1,1,1)
		self.borderDesired = border
		self.bgDesired = background
		self._padding = padding
		
		# define own color theme
		blackTheme = viz.getTheme()
		blackTheme.backColor = (0.4,0.4,0.4,1)
		blackTheme.lightBackColor = (0.6,0.6,0.6,1)
		blackTheme.darkBackColor = (0.2,0.2,0.2,1)
		blackTheme.highBackColor = (0.2,0.2,0.2,1)
		blackTheme.textColor = (self.textColor)
		
		if mode == 'fullscreen':
			self.panel = vizdlg.Panel(theme = blackTheme,align = vizdlg.ALIGN_CENTER,border = False, background = self.bgDesired) # add panel without border
			self.panel.background.setScale(5000,5000,1) # if fullscreen is passed, scale the background so it covers fullscreen
		elif mode == 'fit':
			self.panel = vizdlg.Panel(theme = blackTheme,align = vizdlg.ALIGN_CENTER, border = self.borderDesired, background = self.bgDesired, padding = self._padding) # add panel

		self.panel.background.alpha(1) 			# set background alpha
		viz.link(viz.CenterCenter,self.panel)	# link the panel to center of screen
	
		# switch variables to determine state of message panel
		self.textDisplayed = False
	
	# display message
	def message(self,text,fade = 0):
		
		# init text
		self.text = self.panel.addItem(viz.addText(text))	# if message should be displayed, add text item
		
		# set attributes
		self.text.fontSize(self.fontSize)
		self.text.alignment(self.textAlignment)
		self.text.color(self.textColor)
		
		# let the panel fade in
		self.panel.addAction(vizact.fadeTo(1,time=fade))
		
		# fade in of the text (if desired)
		self.text.addAction(vizact.fadeTo(1,time=fade))
	
	# hide text and panel
	def hide(self, fade = 0):
		
		for item in self.panel.getItems():
			self.panel.removeItem(item)
		
		self.panel.addAction(vizact.fadeTo(0,time=fade))
	


# small example

textPanel = displayInfo(mode = 'fullscreen',fontSize = 30, textAlignment = viz.ALIGN_LEFT_CENTER)	# fullscreen text for introduction text

def main():
	
	textPanel.message('Bla')
	
	yield viztask.waitTime(2)
	
	textPanel.hide()
	
viztask.schedule(main())

viz.go()

Last edited by mape2k; 12-09-2014 at 08:38 AM.
Reply With Quote
  #2  
Old 12-09-2014, 09:24 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Thanks for reporting the issue and providing a sample. This is a regression and will be fixed in the next update.
Reply With Quote
  #3  
Old 12-10-2014, 05:58 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thank you for the quick reply!

While debugging, I also noticed that the background can be faded in and out (e.g. textPanel.message('Bla', fade = 2)), but for text items in a panel the 'addAction(vizact.fadeTo(x))' command does not seem to work. Is that as intended? I would really like the text to fade in and out as well as the background.

Cheers,
Johannes
Reply With Quote
Reply

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 10:58 AM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Fall 2007 release of Vizard R3 3 D Announcements 0 10-15-2007 04:50 PM


All times are GMT -7. The time now is 01:28 PM.


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