summaryrefslogtreecommitdiffstats
path: root/tools/globalcode/utility/nodehelper.h
blob: ef0842aa0466f3b70887c9f7103ec7204e25fecf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef NODE_HELPERS

#include "precompiled/PCH.h"

namespace NodeHelper
{

inline int OverrideNodeColour( MObject& node, int defaultColour )
{
    int colour = defaultColour;

    MStatus status;
    MFnDagNode fnDag( node );
    MPlug overColour = fnDag.findPlug( MString( "overrideColor" ), &status );
    if ( status )
    {
        overColour.getValue( colour );
        if ( colour != 0 ) //The override is Active...
        {
            colour--;
            if ( colour < 0 )
            {
                colour = 0;
            }
        }
        else
        {
            colour = defaultColour;
        }
    }

    return colour;
}

};

#endif