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