View Single Post
  #3  
Old 05-27-2014, 04:55 PM
masaki masaki is offline
Member
 
Join Date: Jan 2008
Posts: 63
R3 required the animpath.dlm plugin to run exported animations. In R4 you need to use the undocumented plugin scenegraphtools.dle.
The following code determines what version (R3 or R4) of Vizard you're running, and loads either the animpath module (for R3) or a wrapper class I've written that runs the scenegraphtools.dle (for R4). With the wrapper class you won't need to change any of your existing code that controls the animation. If you upgrade to R5, animation control is now part of the viz.VizNode object, so you'll have to change your code.

Best,
Masaki

Code:
# CHG: animation control depends on R3 or R4!!
currentVizardVersion = viz.version()
releaseVersion = int(currentVizardVersion.split('.')[0])
if releaseVersion == 4:
	viz.logNotice( 'Running Vizard R4' )
elif releaseVersion == 3:
	viz.logNotice( 'Running Vizard R3' )
else:
	viz.logError( 'Unknown Vizard Release!' )


if releaseVersion == 3:	
	import animpath
elif releaseVersion == 4:
	osg = viz.addExtension( 'scenegraphtools.dle' )
	
	class AnimationPathWrapper(osg.AnimationPath ):
		"""
		This class will allow the new animation path code for R4 to still work for
		the old R3 method.
		"""
		
		def __init__(self):
			pass

		def Path(self,node):
			osg.AnimationPath.__init__(self,node)
			return self
			
	animpath = AnimationPathWrapper()
Reply With Quote