View Full Version : API issues - node attributes & accessing images

05 May 2003, 11:59 PM
I posted this on the maya-dev list, but haven't had a reply yet, so I thought I'd try it on here too....

I've only just started using the Maya API, and as my 'learning' project, I'm doing a few shader nodes - putting some simple compositing features into the hypershader....

The two nodes that I've done so far work fine, but I am trying to make them easier to control...

Is there a way of creating custom attribute controls? I've currently got 4 float sliders that act independently. The ideal control for this would be four markers on the same slider, and some constraint that stops them passing each other. (If you're interested, this is a Luma Key node and the four are the upper and lower threshold and tolerance values)

Another area that I'm not entirely sure about (I'm working my way through David Gould's book, and regularly refer to the Maya docs) is accessing parts of a texture outside of the current point... (in that the shader nodes mainly work on a single point, and just use one pixel value at a time - I'm creating a 'blur' node that needs to be able to access pixel values around the current one...) - I'm also hoping to be able to create a histogram to be shown in the luma key attributes, and, to do that, I'd need to access the rest of the image/texture too...

The third part that is giving me troubles is arrays of attributes... I've used nAttr.setArray(true), which, when I link an element to it in the hypershader, adds [0] to the attribute name, but I can't add more elements - I can only replace the one I've already placed. I've tried using a MArrayDataBuilder - setting the grow size. I've just had a thought on this one, though - do I have to have my own code to expand the array when I place a link - I had assumed that it would do this for me...

Anyway, any help would be hugely appreciated!

05 May 2003, 01:12 AM
This kinda reminds of that set attr problem. Look at the mel documentation at file://C:\Program%20Files\AliasWavefront\Maya4.5\docs\en_US\html\UserGuide\Mel\ScriptFAQ16.html :shrug: it might give you an idea.


05 May 2003, 01:24 AM
Umm - that's a MEL page...

I'm working in the API... (C++ plugin writing)

The code that I'm having problems with is this: (the arrays of attributes)

MFnNumericAttribute nAttr;
MFnDependencyNode fnDN;
MStatus stat;

input = nAttr.create("input", "is", MFnNumericData::kFloat);


Thanks anyway, though - my problem here is that there are so few people on here who actually use the API....

05 May 2003, 05:53 AM
deleted text because i can't delete the post

05 May 2003, 12:32 PM
I've sorted the Attribute Arrays issue - thanks to Taos on IRC....

What I discovered was that when you R-Drag from one Shader Node to another, the only ones that come up in the box are colours. And If you've got an array of colours then it works exactly like I was trying to get it to....

I think I'll be writing my own command to do this, then....

CGTalk Moderation
01 January 2006, 06:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.