Op::build_handles() is used for this.
You would append the matrix to the ViewerContext modelmatrix and then call 
Knob::build_handle() on the XY knobs.  The convenience function 
Op::build_knob_handles() normally does this but I think you'll need to call 
build_handle() in the correct order.

The key is appending the matrix before the Knob::build_handle() calls are done 
because each knob pushes themselves onto the draw list and the current matrix 
is stored at that point which needs to be the parent matrix state the knob 
needs to be drawn in.

I can't remember what Axis_Knob does exactly, I think it applies it's own 
matrix during draw_handles(), so you may need to manually call 
Knob::build_handle() in the correct order, something like:

MyOp::build_handles() {
   Axis_Knob::build_handle()
   save ctx->modelmatrix
   append matrix to ctx->modelmatrix
   Call all XY_Knob::build_handle()s
   restore ctx->modelmatrix
}

You normally also have to test the Viewer transform mode and whether the node's 
panel is open, and whether the node is disabled in order to do the right thing 
for each state in build_handles().

Good luck,

-jonathan


On Feb 13, 2013, at 7:48 AM, kulitorum wrote:

> I'm working on a plugin that has a lot of control points in the image.
> 
> I want to be able to link all the control points to a tracker, so they follow 
> the image around, so I added a Matrix4 in the GUI.
> 
> How do I get my points (XY_knobs) to move around with the matrix?
> 
> I hacked something together to update the transformation matrix inside 
> draw_handle, but there's gotter be a better, more streamlined way of doing 
> this? - Also because I have to invert the matrix to let the use move the 
> point around in my handle function.
> 
> What is the prober way to do this?
> 
> Michael
> _______________________________________________
> Nuke-dev mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to