Jump to content

simulate timeline of keyline system


photo

Recommended Posts

How to simulate the WidgetHSlider of keyline system by using a special output device like an uart slider? Which means when I change the uart slider's position, timeline slider's position is changing with it at the same time without dragging mouse. How to achieve it? Do I need more information about how widget's callback events are defined with binary version sdk? Thanks!

Link to comment

As far as I understand you would like to use some kind of hardware input device for timeline control, right ? If so, the following general steps would maybe do the trick:

 

  1. write a c++ plugin for hardware setup/shutdown in Plugin.init()/Plugin.shutdown() and slider value polling in Plugin.update()
  2. expose c++ value query function to UNIGINE script e.g. <pluginname>.getSliderValue()
  3. query current hardware value via <pluginname>.getSliderValue() from within world script update() function each frame
  4. update timeline position based on current hardware slider position via KeyLine::KeyLineManager::setPos() function each frame

 

There is a useful plugin sample in source\samples\Api\Plugin demonstrating c++ part and UNIGINE script access

Link to comment

How to simulate the WidgetHSlider of keyline system by using a special output device like an uart slider? Which means when I change the uart slider's position, timeline slider's position is changing with it at the same time without dragging mouse. How to achieve it? Do I need more information about how widget's callback events are defined with binary version sdk? Thanks!

 

Depending on how complex your set up is going to end up I would at least concider using MIDI,OSC or DMX as an intermediatory. The advantages being that your design will work with quite a lot of off the shelf hardware and you can use existing libraries to do most of the work.

Link to comment

As far as I understand you would like to use some kind of hardware input device for timeline control, right ? If so, the following general steps would maybe do the trick:

 

  1. write a c++ plugin for hardware setup/shutdown in Plugin.init()/Plugin.shutdown() and slider value polling in Plugin.update()
  2. expose c++ value query function to UNIGINE script e.g. <pluginname>.getSliderValue()
  3. query current hardware value via <pluginname>.getSliderValue() from within world script update() function each frame
  4. update timeline position based on current hardware slider position via KeyLine::KeyLineManager::setPos() function each frame

 

There is a useful plugin sample in source\samples\Api\Plugin demonstrating c++ part and UNIGINE script access

 

 

Yes,you are quite right. I've done all the steps you have mentioned except for the last one, I've updated timeline position via KeyLine::KeyLineManager::getPos() function each frame. Data from input device is now delivered to keyline system, but got some weird "0" result. My question is how does Gui callback events defined(like Gui::GUI_CHANGED)? As the simulation is when data received from input device just like draggine mouse to change position of timeline slider, i need to know more about define mechanism of Gui callback events(some xml codes: <callback type="changed">KeylineWindow::slider_pos_changed</callback>). Actually I have got some "right" results by commenting "slider.setCallbackEnabled(GUI_CHANGED,1)" in update_slider_pos() function of keyline_window.h file.

Link to comment

Yes,you are quite right. I've done all the steps you have mentioned except for the last one, I've updated timeline position via KeyLine::KeyLineManager::getPos() function each frame. Data from input device is now delivered to keyline system, but got some weird "0" result. My question is how does Gui callback events defined(like Gui::GUI_CHANGED)? As the simulation is when data received from input device just like draggine mouse to change position of timeline slider, i need to know more about define mechanism of Gui callback events(some xml codes: <callback type="changed">KeylineWindow::slider_pos_changed</callback>). Actually I have got some "right" results by commenting "slider.setCallbackEnabled(GUI_CHANGED,1)" in update_slider_pos() function of keyline_window.h file.

 

I don't understand why you want to use some additional GUI callbacks for timeline control when this should be done via external hardware device and direct calls to KeyLine::KeyLineManager::setPos().

Link to comment
  • 2 weeks later...

I don't understand why you want to use some additional GUI callbacks for timeline control when this should be done via external hardware device and direct calls to KeyLine::KeyLineManager::setPos().

 

The reason why I want to use GUI callbacks is that it seems keyline system use GUI callbacks to trigger the position changing of slider when mouse clicked.

 

void update_slider_pos() {

......

slider.setCallbackEnabled(GUI_CHANGED,0);

slider.setValue(int(keyline_manager.getPos()));

slider.setCallbackEnabled(GUI_CHANGED,1);

update_keyline_ui();

}

And I think I may need some kind of mechanism like when data received differs that slider of timeline changes.

Link to comment
  • 2 weeks later...
×
×
  • Create New...