So, Jonathan, what you're saying is you basically take the union of what you 
want to output and what is requested, and provide that?

Steve


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jonathan Egstad
Sent: Monday, October 31, 2011 4:22 PM
To: Nuke plug-in development discussion
Subject: Re: [Nuke-dev] Weird 3D Axis in a Iop node

This is some build_handles code used in a DD::Image::RenderScene subclassed Iop 
- not sure if it will work for your particular situation.

Iop::build_handles() loops through each input calling build_handles(), then it 
does the same on all local Knobs.  If the Knob is a 2D knob then it doesn't 
draw when transform_mode is 3D.

   /*! Sets viewer to 3D mode. */
   /*virtual*/
   void build_handles(ViewerContext* ctx) {
      Matrix4 saved_matrix = ctx->modelmatrix;
      int saved_mode = ctx->transform_mode();
      if (saved_mode == VIEWER_2D) {
         // If modelmatrix has had a projection applied to it,
         // skip drawing this renderer's 3D scene:
         if (ctx->modelmatrix.a32 != 0.0f) return;

         // Get matrices up to date and switch to 3D mode:
         validate(false);
         ctx->modelmatrix *= get_format_matrix(0, 0);
         ctx->modelmatrix *= projection_matrix(0);
         ctx->modelmatrix *= camera_matrix(0);
         ctx->transform_mode(VIEWER_PERSP);
      }
      Iop::build_handles(ctx);
      // Restore ctx state:
      ctx->modelmatrix = saved_matrix;
      ctx->transform_mode(saved_mode);
   }


Good luck,

-jonathan


On Oct 31, 2011, at 1:30 AM, Chishing Yip wrote:

> Hi Johnathan,
> 
> I tried set transform_mode() & ViewerContext::model_matrix ( also tried 
> proj_matrix ) but still got the weird axis, is there any pseudo code please?
> 
> Thanks a lot,
> Shing
> 
> On Sat, Oct 29, 2011 at 12:12 AM, Chishing Yip <[email protected]> wrote:
> Will have a try later, thanks again!
> 
> 
> On Sat, Oct 29, 2011 at 12:05 AM, Jonathan Egstad <[email protected]> 
> wrote:
> Yes, plus setting the ViewContext's transform_mode() for each input/knob.
> 
> 
> On Oct 28, 2011, at 8:30 AM, Chishing Yip wrote:
> 
>> Hi Jonathan,
>> 
>> Thanks a lot for you reply.
>> For the camera transform, do you mean the ViewerContext ( OpenGL ) 
>> model/projection matrix?
>> 
>> Shing
>> 
>> On Fri, Oct 28, 2011 at 10:47 PM, Jonathan Egstad <[email protected]> 
>> wrote:
>> For mixed transform Ops you must implement your own build_handles() to set 
>> the viewer mode correctly for each input or knob.  Basically the camera 
>> transform isn't correct for the 3d knob since knobs on Iops are assumed to 
>> be 2d.
>> 
>> 
>> 
>> 
>> 
>> On Oct 28, 2011, at 3:10 AM, Chishing Yip <[email protected]> wrote:
>> 
>>> Hi guys,
>>> 
>>> If I add a Axis_knob(....) in my DD::Image::Iop node and then connect this 
>>> Iop to a GeoOp, the axis in the 3D viewer is very weird.
>>> Has anyone seem this before?
>>> And is there any trick to make the shape correct?
>>> 
>>> I could attach a snapshot, if anyone asks.
>>> 
>>> Best,
>>> Shing
>>> --
>>> Zhicheng YE - Shing
>>> the /*jupiter jazz*/ group - visual research mercenaries of jupiter 
>>> jazz limited - hong kong www.jupiter-jazz.com 
>>> _______________________________________________
>>> 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
>> 
>> 
>> 
>> _______________________________________________
>> 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
> 
> 
> 
> 
> --
> Zhicheng YE - Shing
> the /*jupiter jazz*/ group - visual research mercenaries of jupiter 
> jazz limited - hong kong www.jupiter-jazz.com
> 
> 
> 
> --
> Zhicheng YE - Shing
> the /*jupiter jazz*/ group - visual research mercenaries of jupiter 
> jazz limited - hong kong www.jupiter-jazz.com 
> _______________________________________________
> 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
(CONFIDENTIALITY NOTICE: The information contained in this email may be 
confidential and/or privileged. This email is intended to be reviewed by only 
the individual or organization named above. If you are not the intended 
recipient, or an authorized representative of the intended recipient, you are 
hereby notified that any review, dissemination or copying of this email, or the 
information contained herein is strictly prohibited. If you have received this 
communication in error, please notify the sender by return email and delete 
this email from your system. Thank You.)

_______________________________________________
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