Jordan,
I think I see what might be the problem here. You define ch_'pw' like this Channel ch_pw = pw[z]; And then use it like this: const float* pw_ptr = in[ch_pw] + x; Here's the secret: You have absolutely no guarantee what 'channels' contains. 'channels' are the channels *being requested of you by the downstream node*. If you hook a shuffle up to your node (Op), and shuffle Depth.Z into R, then 'Depth.Z' is going to be placed into the 'channels' ChannelSet passed to your _engine call. If, then, your 'point world' ChannelSet isn't requested, or isn't fully requested, then pw[z] is going to eventually return NULL. That makes 'ch_pw' NULL, and when you do the 'in[ch_pw]', *that* is going to be null, which makes pw_ptr NULL, which kind of makes: float a = *pw_ptr++; somewhat (well... more like 'really') invalid. What you always need to do is make sure the channel you're processing is actually being asked for... that your channel references are non-null so: Channel ch_pw = pw[z]; If (ch_pw) { ... code that uses 'ch_pw' } So, the inner code is only used if 'ch_pw' is not null. Hope that helps Steve -----Original Message----- From: nuke-dev-boun...@support.thefoundry.co.uk [mailto:nuke-dev-boun...@support.thefoundry.co.uk] On Behalf Of Jordan Olson Sent: Tuesday, May 15, 2012 5:56 PM To: Nuke plug-in development discussion Subject: [Nuke-dev] Inexperienced NDK simple question on pixelIop channels hey fellow Nuke developers! I'm writing a pixelIop node at the moment, and having difficulty figuring out some code. I have an extra knob for "Point World" channelset, and to test it, I'm trying to copy the pixel values from this set into the standard channels specified by the user. (default RGBA). However it's crashing, and I think I need to implement something like the following example taken from the IDistort Iop code: // missing channels will crash, use black instead: Channel uu = uv[0]; Channel vv = uv[1]; if (!intersect(tile.channels(), uu)) uu = Chan_Black; if (!intersect(tile.channels(), vv)) vv = Chan_Black; However this ^ is from an Iop node, and I'm having a crash on a PixelIop. Is there a similar function I could implement on my pixel operator? Here is my code below, slightly simplified for readability. ............ void PointSample::_validate(bool for_real){ copy_info(); set_out_channels(Mask_All); } void PointSample::in_channels(int input, ChannelSet& mask) const { mask += (pw[0]); mask += (pw[1]); mask += (pw[2]); } void PointSample::pixel_engine(const Row& in, int y, int x, int r, ChannelMask channels, Row& out) { foreach (z, channels) { const float* inptr = in[z]+x; const float* END = inptr+(r-x); Channel ch_pw = pw[z]; // This doesn't compile because the Pixel Iop has no tile functionality /* if (!intersect(tile.channels(), ch_pw)) ch_pw = Chan_Black; */ const float* pw_ptr = in[ch_pw] + x; float* outptr = out.writable(z)+x; while (pw_ptr < END) { float a = *pw_ptr++; *outptr++ = a; } } } ............ cheers if you could point out why this is crashing! Jordan _______________________________________________ Nuke-dev mailing list Nuke-dev@support.thefoundry.co.uk<mailto:Nuke-dev@support.thefoundry.co.uk>, 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 Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev