PDA

View Full Version : robthebloke.org source code


daniel_arz
03-11-2005, 11:56 PM
Hello, I downloaded the Graph Attribute from http://www.robthebloke.org/mayaapi.html (http://www.robthebloke.org/mayaapi.html).
I added some error checking to make sure the attributes where being created successfully. The node compiles fine but I get these error messages after creating the node:

// m_aTime successfully added attribute...

// addChild succeeded to add oPosition...

// addChild succeeded to add oFloatinfo...

// addChild succeeded to add oEnumValue...

// addAttribute successfully added m_aGraph...

$node = `createNode "simpleNode"`;

// Result: simpleNode1 //

// Error: Could not find attribute named simpleNode1.graph[-1].graph_FloatValue //

// Error: Could not find attribute named simpleNode1.graph[-1].graph_Position //

// Error: No object matches name: simpleNode1.graph[-1].graph_Interp //




I'm guessing the problem lies in the AETemplate Mel proc supplied with the source code:




/// \brief This file defines the attribute editor for our simpleNode.

/// \param $nodeName - the name of the node instance to display.

///

global proc AEsimpleNodeTemplate( string $nodeName )

{

// the following controls will be in a scrollable layout

editorTemplate -beginScrollLayout;

// add a bunch of common properties

editorTemplate -beginLayout "Simple Node Attributes" -collapse 0;

// add ramp control for our compound attribute

AEaddRampControl "graph" ;



editorTemplate -endLayout;

// include/call base class/node attributes

AEdependNodeTemplate $nodeName;

// add any extra attributes that have been added

editorTemplate -addExtraControls;

editorTemplate -endScrollLayout;

}


I really want/need this attribute in my node :bounce: . Would anyone like to compile and give the node a try? You can downloade from the link (TOP) towards the bottom of the page.


Daniel

Robert Bateman
03-13-2005, 08:51 PM
yup, it does actually work - it's just that the initial values are not set. Basically to get round the problem you'll have to add two initial entries into the attribute for the start and end of the graph within the nodes post constructor. even though it generates errors, the attribute editor should still display the graph, and you should be able to edit it.....

I assume that Alias assumed there would always be a couple of entries in the attribute hence it looking for index -1....

daniel_arz
03-14-2005, 05:28 PM
Thank you for your response.

"Basically to get round the problem you'll have to add two initial entries into the attribute for the start and end of the graph within the nodes post constructor."

Can you specify what you mean by "initial entries"?

Daniel

Robert Bateman
03-15-2005, 07:37 AM
normally when you create a node with some form of ramp attribute, the attribute is initialised to have two elements in the array. (each array position just holds info about each curve point : ie, the value, position and tangent type). Normally these attributes are created with a simple curve in place, that is when you enter the attribute editor the graph displays 0 to 1. For it to display a default curve for the parameter, there must be a start point and end point of the curve. ie, you need to add two elements into the ramp attribute in the post constructor so that the curve has a start and end point. hope that helps.... ;)

daniel_arz
03-20-2005, 08:47 PM
Thank you Robert.

Daniel

CGTalk Moderation
03-20-2005, 08:47 PM
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.