question

天睿 赵 avatar image
天睿 èµµ asked ·

MTOA API CExtensionAttrHelper ERROR ??

The user guides documentation use a CAttrData and ExtensionAttrHelper to add new attribute in a maya node . like this:

https://support.solidangle.com/display/A5AFMUG/Adding+specific+Arnold+attributes+to+a+node

So , I wrote a new node to do the test .

static void NodeInitialiser(CAbTranslator context)

{

CExtensionAttrHelper helper(context.maya,"procedural");

CAttrData data;

data.stringDefault = MString("");

data.name = "wahaha";

data.shortName = "wahaha";

helper.MakeInputEnum(data);

}

When I use this method, I encountered an error. :

API error detected in plugins\mtoa\attributes\AttrHelper.cpp at line 1301 : (kInvalidParameter): Object is incompatible with this method

Also, no attributes are added to the my node.

Please tell me why and how to fix it... thank you so much ~~

mtoaarnold5arnold object properties
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

天睿 赵 avatar image
天睿 èµµ answered ·

Hi , sorry for reply you so late. I'm using win10 , vs2010 . I found another way to fix this problem during this time . I created a similar class using MAYA API to fix it .

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Sebastien Blaineau-Ortega avatar image
Sebastien Blaineau-Ortega answered ·

Hi,

which Os, compiler, and version of the compiler are you using ?

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

天睿 赵 avatar image
天睿 èµµ answered ·

Thank you so much for your help ~~

But i still have problem when i do this :

void Wahaha_Translator::NodeInitialiser(CAbTranslator context)

{

CExtensionAttrHelper helper(context.maya,"procedural"); //CShapeTranslator::MakeCommonAttributes(helper); //CShapeTranslator::MakeMayaVisibilityFlags(helper);

CAttrData data;

MStringArray strArr;

strArr.append("Fixed");

strArr.append("Grid");

data.enums = strArr;

data.defaultValue.INT() = 0;

data.name = "aiTextureCoordinateMethod";

data.shortName = "ai_texture_coordinate_method";

helper.MakeInputEnum(data);

}

The same error message , no attributes are added to the my node again .

If i cancel the comment in the code ,

CShapeTranslator::MakeCommonAttributes(helper); or

CShapeTranslator::MakeMayaVisibilityFlags(helper);

Maya will crash ...

I am trying to write a maya shape node and translate it with mtoa .Working with MAYA2017-UPDATE3 and MTOA 2.0.2 and Arnold 5.0.1.2 .

https://support.solidangle.com/display/A5AFMUG/Adding+specific+Arnold+attributes+to+a+node

I have done the contents of the document once , but i can get the expected results . The "aiSpecularWeight" attribute dose not appear in the phong node .

Dose anyone know why ? Thank you so much ~~

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Sebastien Blaineau-Ortega avatar image
Sebastien Blaineau-Ortega answered ·

Hi,

here's an example of how enum attributes have to be created :

CAttrData data;

MStringArray strArr;

strArr.append("Fixed");

strArr.append("Grid");

data.enums = strArr;

data.defaultValue.INT() = 0;

data.name = "aiTextureCoordinateMethod";

data.shortName = "ai_texture_coordinate_method";

helper.MakeInputEnum(data);

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.