May 06

MG_FollowNode v1.00

Hi everyone this is the last node I made for maya .
What the node does is making a connection that lets me control the object and best think is I can give a weight of the connection and avoiding any pop when the value change so it s fully controllable .

This was just the core of the node in version 2 I want to have multiple inputs and switching between inputs influence without having the object popping around the scene how it usually happen with constraints

here is a quick demo :

and here the download +source link :

http://www.giordanoanimator.com/download.html

if you wanna help me compiling it for other platform or maya versions just mail me or comment here

Share and Enjoy

Apr 20

MAYA API TIP: Adding an array compound attribute

Hi today the tip&trick will be about how to add a compound array attribute to our node.

THe basic idea is tho create an array attribute and then feed a compound attribute with it  using the addChild() method

 

         ////////////////////////////////////////////////////////////////////////////////////////
//INPUT  ATTRIBUTE
///////////////////////////////////////////////////////////////////////////////////////

//Compounds's input  float
MFnNumericAttribute  numFn;
input =numFn.create("inputA","ia",MFnNumericData::kFloat);
numFn.setArray(TRUE);
addAttribute(input);

//input  Compoud

inputA= compA.create("inputs","i" );
compA.addChild(input);
compA.setArray(TRUE);
addAttribute(inputA);

 

Just rember to declare all the  needed MObject :

MObject input;
MObject inputA;

and to include all the needed headers.

Enjoy.
For more tips&tricks check my website :
http://www.giordanoanimator.com/tips.php?prog=1

Share and Enjoy

Apr 18

MAYA API TIP: Creating string attribute

Hi everyone in this tip I’m gonna show you how create an attribute ables to recive string data

First of all we need to include a header in our node

#include MFnStringData.h>

for example in my save node I added an author attribute and set default value to a given string:

//Creating author attribute

MFnStringData stringFn;
MFnTypedAttribute authorA;
MOBject authorS stringFn.create("Type here the autor");
author = authorA.create("author","aut",MFnData::kString,authorS);
authorA.setStorable(true);
addAttribute(author);

Here we go :)

Share and Enjoy

Apr 07

MAYA PLUGIN: MG_dotProduct v2

Hi everyone ,

i wanna share with you my new plugin .

It s about vector dot product .

It was a great learning experience in both math and programming.

I had to build an external header in order to handle the numerous vector operation like dot product sum length and so on.

Here is a little demo.

Plugin features :
Dot product
max dot product
normalize dot and max dot product
Projection of vector to the other
Angle in-between
Angle in-between projected on world and custom planes

In the V2 I have implemented the projection on user custom axis so you can project on transformed system.

As default it s set at same maya world .

The plugin is free download with the source code included.

I hope you guys enjoy

C&C appreciated

download :

http://www.giordanoanimator.com/download.html

Share and Enjoy

Mar 29

MAYA API TIP: how to create a checkBox/boolean attribute

Creating a boolean attribute or just an attribute that looks like a checkBox you just need those couple of lines :

MFnNumericAttribute normAttr;
normalize=normAttr.create("normalize","n",MFnNumericData::kBoolean );
addAttribute(normalize);
normAttr.setStorable(TRUE);

The only difference between a float attribute is the type of data that the attributes accepts

float attribute uses :


MFnNumericData::kFloat

enjoy .
For more tips and tricks visit :

http://www.giordanoanimator.com/tips.php

Share and Enjoy

Mar 29

MAYA API TIP: Creating compound VS point attribute

When creating your node, you might need to add an attribute holding multiple fields like can be a position attribute or a vector attribute .

There are two main way in order to accomplish that (as far as i know ).

1) Compound attribute

2) Point attribute

The compound attribute let you creates many attributes and then group them together like in the example  1:

example 1 ) I created an output attribute for holding vector data


//Output vector attribute
//Creating 3 single attributes  vectorX,Y,Z
MFnNumericAttribute oVecXAttr;
oVecX= oVecXAttr.create("vectorX","vx",MFnNumericData::kFloat);
addAttribute(oVecX);

MFnNumericAttribute oVecYAttr;
oVecY= oVecYAttr.create("vectorY","vy",MFnNumericData::kFloat);
addAttribute(oVecY);

MFnNumericAttribute oVecZAttr;
oVecZ= oVecZAttr.create("vectorZ","vZ",MFnNumericData::kFloat);
addAttribute(oVecZ);

//Output vector compound attribute
//Group them togheter with a compound attribute
MFnCompoundAttribute FoVec;
oVec= FoVec.create("outputVector","ov");

//use addChild method to add our attributes to the compound attribute
FoVec.addChild(oVecX);
FoVec.addChild(oVecY);
FoVec.addChild(oVecZ);
addAttribute(oVec);

The point attribute make everything faster , you can achieve same result with way fewer lines of codes check example 2:

example 2)


//Create a numeric attribute function set

MFnNumericAttribute originFn;

 

// instead using create() we will use createPoint()
origin=originFn.createPoint("origin","o");
addAttribute(origin);

The main difference here is that using createPoint() method will automatically create  originX originY and originZ so if that s the goal you want to achieve I highly suggest using createPoint() method if you want to have attributes that are not X,Y,Z or have different names or are more than 3 use the compound attribute function set .

enjoy .
For more tips and tricks visit :
http://www.giordanoanimator.com/tips.php

Share and Enjoy

Older posts «