Jump to content

[SOLVED] Update Tracker keys in Unigine 2.8


photo

Recommended Posts

Здравствуйте!

Есть один общий трэк, который содержит в себе несколько мелких. Пытаюсь программно поменять расположение запуска одного из трэков. Не очень понятно как это сделать.

Если правильно понимаю, то для этого нужно задать indicies_t и keys_t и сделать update_track_float.

Код примерно такой:

Unigine::Tracker::TrackerParameterTrack::Track t = track.parameter_tracks[num];
t.indices_t[0] = 7.0f;
t.indices_t[1] = 17.0f;
Unigine::Tracker::TrackerParameter tp = track.getParameter(num);
tp.update_track_float(t.keys_t, t.indices_t);

Объясните, пожалуйста, также, что такое indicies_t, и какое отношение этот массив имеет к keys_t?

Comp.track

Link to comment

Dear a.semenov,

I just spot my eyes on this thread because of the subject. I know Polish and Turkish beside four Indian Languages. Will love to learn Russian as working with three companies from Russia now.

After Google Translate, I understood that you need to start the track from specific position. Why don't you use setMinTime for that if the interpolation from that point is ok for you?

For example, If I have object whose 0th key for scaling are 1, 1, 1 and 1st key for scaling are 0.01, 0.01, 0.01.

Now if My min time = 0, max time = 1 and unit time = 1, then as expected scale of object will go from 1 to almost 0 for 1 second. If you need to change the starting time you can just do it with setMinTime. The only issue if min time is set to 0.250, the value of scale will be 0.250. If it is ok then you may use setMinTime.

But if you only need to reduce time then change the setUnitTime 0.75, to run the track as needed for 0.75 seconds..

I hope I understood your problem.

Rohit

  • Like 1
Link to comment

Rohit.gonsalves, thank you for your answer.

But I need something different: how can I change keys_t (or indicies_t, do not sure) parameters in class Unigine::Tracker::TrackerParameterTrack::Track? Methods setMinTime() and setMaxTime() contain in TrackerTrack class. But my Comp.track contains parameters with type="track" and I need to edit <keys_t> tags.

Link to comment

Dear a.semenov,

I am still confuse with your requirement.. But I did understand what you want to achieve. I did this similar for parameters with type="track" and changed the weight.

Check attached file I have written as wrapper for my calling from C++.

Check setIHOTrackParameterWeight method. I have changed the weights for the parameter type track. IHO is simply In-Hold-Out animations. 

image.thumb.png.90ecc8b6748179a2ce404f6404f29429.png

I hope the wrapper file will help you out. I change the weight of each parameter track when I want. So you may change keys_t.

tracker_wrapper.h

  • Like 1
Link to comment

День добрый, a.semenov!

Объясните, пожалуйста, также, что такое indicies_t, и какое отношение этот массив имеет к keys_t?
indices_t - это отсортированный массив ключей, где каждый элемент - это время. Обновляется функцией update_track_float(). Поэтому менять значения из этого массива не нужно. Используется, судя по всему, как кеш для быстрого доступа к значениям.
keys_t - это сами ключи. Без сортировки. Содержат время (time), значение (value), тип интерполяции (type) с соседними и их касательные (handles).
Так что попробуйте поменять именно их. Что-то в духе:

Unigine::Tracker::TrackerParameterTrack::Track t = track.parameter_tracks[num];
t.keys_t[0].time = 7.0f;
t.keys_t[1].time = 17.0f;
Unigine::Tracker::TrackerParameter tp = track.getParameter(num);
tp.update_track_float(t.keys_t, t.indices_t);

...А может достаточно поменять только indices_t. Но тогда точно не стоит вызывать update_track_float(...)

Please explain what is the indicies_t and keys_t?
indices_t is a sorted array of keys, where each element is a time value. update_track_float() function updates this array. So, don't change the values of this array by yourself. I think Tracker uses it as a cache for quick access during play.
keys_t are... the keys. Unsorted. They contain time, value, type of interpolation between neighbors and tangents (named as "handles").
Try to change them instead of indices_t.

...Or it may be enough to change indices_t. But in this way you definitely shouldn't call the update_track_float(...)

С уважением,
Александр

  • Like 2
Link to comment
  • silent changed the title to [SOLVED] Update Tracker keys in Unigine 2.8
×
×
  • Create New...