Skip to main content
Inspiring
September 24, 2021
Answered

Understanding PF_ADD_POINT related macros e.g. INT2FIX

  • September 24, 2021
  • 1 reply
  • 501 views

I have no issues settings values when I declare a param in ParamSetup(). The problem is that I get odd behaviour when I try to set the point value in UserChangedParam().

I wish to use x and y in the same manner as the default params to PF_ADD_POINT () (i.e. a percentage of the comp). I do not wish to use the new x,y params to pass absolute x,y co-ordinates.

 

 

params[aeid]->u.td.x_value = (x << 16);

  - same as x, INT2FIX

 

params[aeid]->u.td.x_value = FIX2INT(x);

  Always 0

params[aeid]->u.td.x_value = (PF_Fixed)(x);

 Always 0

params[aeid]->u.td.x_value = asdkP->params[aeid]->u.td.y_value;

 - This works, so clearly I am setting the right flags.

asdkP->params[aeid]->u.td.y_value = INT2FIX (y);

 - Here y transforms to absolute y value.

 

Also, when I print

u.td.x_value

 that Adobe uses, it is nothing like the value passed in. For, reference the PF_ADD_POINT does this - 

def.u.td.x_value = def.u.td.x_dephault = (X_DFLT << 16);

 

This topic has been closed for replies.
Correct answer James Whiffin

I might be wrong but I think the only time you can set % values on the point param is in ParamsSetup. If you change it in UserChangedParam, you'll have to set the coordinates. You could then find the comp dims inside UserChangedParam and then set the coords so they match the % you're after. 

1 reply

James Whiffin
James WhiffinCorrect answer
Brainiac
September 27, 2021

I might be wrong but I think the only time you can set % values on the point param is in ParamsSetup. If you change it in UserChangedParam, you'll have to set the coordinates. You could then find the comp dims inside UserChangedParam and then set the coords so they match the % you're after. 

AnmolMAuthor
Inspiring
November 5, 2021

Can we set fixed point co ordinates during setup? So, if I want 3,3 during setup and these are absolute co ordinates.

James Whiffin
Brainiac
November 6, 2021

Yes using the method Shachar said in the other thread. Have a "sentinel" param that is set to 0, and a condition that if it's value is 0 in UpdateParamUI, make a change to the fixed point. Also update the sentinel value to 1 so that the process only happens once. I use this method in one of my plugins to change point values on first application of the effect.