PDA

View Full Version : osg Sequence


TarkaDahl
08-11-2011, 01:16 AM
Hi,

Im loading an ive file with an osg sequence that i would like to control.

Whats the best way of doing this?

I would like to be able to stop, start and set the current time of the sequence.

Thanks

TarkaDahl

farshizzo
08-17-2011, 09:20 AM
There's currently no built-in support for this, but we will add it to a future release.

If you are familiar with C++ programming and OpenSceneGraph, you could write a Vizard extension that does this. Our SDK is freely available and contains an example for writing an extension that interacts with the underlying scene graph of a node.

TarkaDahl
08-31-2011, 06:42 AM
Hi

Im having a problem with this ive been looking at the example of creating an modifier using the sdk but how do a get from the osg::Node to the osg::sequence
ive looked at the documentation here.
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00654.html
and it explains functions that i need to call on the osg sequence but i cant find how to get to the osg::sequence

Sorry it that doesnt make sence. but ive not used c++ for a while and have only done the basics of OpenSceneGraph.

I will do more reading about it later but any help would be good.

Thanks

TarkaDahl

farshizzo
08-31-2011, 09:11 AM
Support for controlling osg::Sequence nodes is in the latest version of Vizard (4.02). Here is some sample code:

import viz
viz.go()

model = viz.add('sequence.ive',pos=(0,1.5,4))

osg = viz.add('SceneGraphTools.dle')
sequence = osg.Sequence(model)

import vizact
vizact.onkeydown(' ',sequence.setMode,vizact.choice([sequence.PAUSE,sequence.RESUME]))
vizact.onkeydown('r',sequence.setMode,sequence.STA RT)
vizact.onkeydown('1',sequence.setFrame,50)

And here is the help print out of the sequence control class:
class Sequence(object)
| Methods defined here:
|
| __init__(self, node, name='')
|
| getBegin(self)
| Get the begin frame
|
| getClearOnStop(self)
| Get whether to show no children after stopping
|
| getEnd(self)
| Get the end frame
|
| getFrame(self)
| Get the current frame
|
| getFrameCount(self)
| Get the number fo frames
|
| getFrameTime(self, frame)
| Get the time for the specified frame
|
| getLoopMode(self)
| Get the sequence loop mode
|
| getMode(self)
| Get the sequence mode
|
| getNumRepeats(self)
| Get the number of repeat times
|
| getSpeed(self)
| Get the sequence speed
|
| getSync(self)
| Get whether to sync frames with frame time
|
| iterFrameTimes(self)
| Returns iterator that yields frame time values
|
| setBegin(self, begin)
| Set the begin frame
|
| setClearOnStop(self, clearOnStop)
| Set whether to show no children after stopping
|
| setEnd(self, end)
| Set the end frame
|
| setFrame(self, frame)
| Set the current frame
|
| setLoopMode(self, mode)
| Set the sequence loop mode
|
| setMode(self, mode)
| Set the sequence mode
|
| setNumRepeats(self, repeats)
| Set the number of times to repeat
|
| setSpeed(self, speed)
| Set the sequence speed
|
| setSync(self, sync)
| Set whether to sync frames with frame time

TarkaDahl
09-01-2011, 01:45 AM
hi farshizzo,

Thanks for that it works like a dream.

Thanks