View Single Post
# 168 12-09-2006 , 08:24 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
Congratulation!!! :attn:

I was thinking about using custom nodes as material info holders
And some extra attributes in the polys to hold material name and the "Generate this" option user added image

Code:
string $indPolyObject[];
$indPolyObject = `ls -sl`;
$shaderName = "Diffuse";

$indShaderNode = ( $indPolyObject[0] + "ShaderName" );
$indGenNode = ( $indPolyObject[0] + "GenThis" );

$indSetShaderNode = ( $indPolyObject[0] + "." + $indShaderNode );
$indSetGenNode = ( $indPolyObject[0] + "." + $indGenNode );

   addAttr -ln "ShaderName" -sn $indShaderNode -dt "string";
   addAttr -ln "GenerateThis" -sn $indGenNode -at "bool";
   setAttr $indSetShaderNode -type "string" $shaderName;
   setAttr $indSetGenNode true;
This will create a Node containing the Diffuse Settings
Code:
		if( !`objExists "indigoDiffuseNode"` ) {
                                                createNode "transform" -n "indigoDiffuseNode";
$indObjectToAddTo = `ls -sl`;
			//---------------------------------------- Add Attributes

			// add a string attribute
			addAttr -ln "ShaderName" -sn "indDifName" -dt "string";

addAttr -ln indDiffuseColor -usedAsColor -at float3;
    addAttr -ln redCol -at "float" -sn "indDifRed" -parent indDiffuseColor;
    addAttr -ln greenCol -at "float" -sn "indDifGreen" -parent indDiffuseColor;
    addAttr -ln blueCol -at "float" -sn "indDifBlue" -parent indDiffuseColor;

$iotatRed = ( $indObjectToAddTo[0] + ".indDifRed" );
$iotatGreen = ( $indObjectToAddTo[0] + ".indDifGreen" );
$iotatBlue = ( $indObjectToAddTo[0] + ".indDifBlue" );
$iotatName = ( $indObjectToAddTo[0] + ".indDifName" );

			//---------------------------------------- Set Initial Values
			setAttr $iotatRed 0.5;
			setAttr $iotatGreen 0.5;
			setAttr $iotatBlue 0.5;
			setAttr $iotatName -type "string" "Wall";

		}
And to Change Attribute Settings
Code:
select -r indigoDiffuseNode; //name of material node to be selected
$indObjectToAddTo = `ls -sl`;

$iotatRed = ( $indObjectToAddTo[0] + ".indDifRed" );
$iotatGreen = ( $indObjectToAddTo[0] + ".indDifGreen" );
$iotatBlue = ( $indObjectToAddTo[0] + ".indDifBlue" );
$iotatName = ( $indObjectToAddTo[0] + ".indDifName" );

			//---------------------------------------- Set Initial Values
			setAttr $iotatRed 0.5;
			setAttr $iotatGreen 0.5;
			setAttr $iotatBlue 0.5;
			setAttr $iotatName -type "string" "Wall";
What do you think? Just connect this to the Mat Editor user added image

Anyway, Welcome back!!! user added image


Last edited by arneoog; 13-09-2006 at 10:13 AM.