MStatus liqCoordSysNode::initialize()
{
  MFnEnumAttribute      eAttr;
  MFnNumericAttribute   numAttr;
  MStatus               status;

  aCoordType = eAttr.create( "type", "t", 0, &status );
  eAttr.addField( "Card",           0 );
  eAttr.addField( "Sphere",         1 );
  eAttr.addField( "Cylinder",       2 );
  eAttr.addField( "Cube",           3 );
  eAttr.addField( "Deep Card",      4 );
  eAttr.addField( "Clipping Plane", 5 );
  MAKE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));
  CHECK_MSTATUS( addAttribute( aCoordType ) );

  aCoordColor = numAttr.createColor( "coordColor", "cc", &status );
  MAKE_INPUT(numAttr);
  CHECK_MSTATUS( numAttr.setMin( 0.0, 0.0, 0.0 ) );
  CHECK_MSTATUS( numAttr.setMax( 1.0, 1.0, 1.0 ) );
  CHECK_MSTATUS( numAttr.setDefault( 0.0, 0.0, 0.5) );
  CHECK_MSTATUS( addAttribute( aCoordColor ) );

  aCoordOpacity = numAttr.create( "coordOpacity", "co", MFnNumericData::kFloat, 0.0, &status );
  MAKE_INPUT(numAttr);
  CHECK_MSTATUS( numAttr.setMin( 0.0 ) );
  CHECK_MSTATUS( numAttr.setMax( 1.0 ) );
  CHECK_MSTATUS( addAttribute( aCoordOpacity ) );

  return MS::kSuccess;
}
Esempio n. 2
0
// DESCRIPTION:
//
MStatus PtexColorNode::initialize()
{
	MStatus status;

	MFnNumericAttribute numericAttribute;

	// Input attributes

	MFnTypedAttribute fileNameAttribute;
	aPtexFileName = fileNameAttribute.create( "ptexFileName", "f", MFnData::kString );
	MAKE_INPUT( fileNameAttribute );
	fileNameAttribute.setConnectable(false);

	MFnEnumAttribute enumAttribute;
	aPtexFilterType = enumAttribute.create( "ptexFilterType", "t", 0, &status );
	MCHECKERROR( status, "create filterType attribute" );
	enumAttribute.addField( "Point",      0 );
	enumAttribute.addField( "Bilinear",   1 );
	enumAttribute.addField( "Box",        2 );
	enumAttribute.addField( "Gaussian",   3 );
	enumAttribute.addField( "Bicubic",    4 );
	enumAttribute.addField( "BSpline",    5 );
	enumAttribute.addField( "CatmullRom", 6 );
	enumAttribute.addField( "Mitchell",   7 );
	enumAttribute.setHidden( false );
	MAKE_INPUT( enumAttribute );
	enumAttribute.setConnectable(false);
	MCHECKERROR( status, "Error adding shapeType attribute." );

	MFnNumericAttribute filterSizeAttribute;
	aPtexFilterSize = filterSizeAttribute.create( "ptexFilterSize", "s", MFnNumericData::kFloat, 1.0 );
	MAKE_INPUT( filterSizeAttribute );
	filterSizeAttribute.setConnectable(false);

	// Implicit shading network attributes

	MObject child1 = numericAttribute.create( "uCoord", "u", MFnNumericData::kFloat);
	MObject child2 = numericAttribute.create( "vCoord", "v", MFnNumericData::kFloat);
	aUVPos = numericAttribute.create( "uvCoord", "uv", child1, child2);
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	child1 = numericAttribute.create( "uvFilterSizeX", "fsx", MFnNumericData::kFloat);
	child2 = numericAttribute.create( "uvFilterSizeY", "fsy", MFnNumericData::kFloat);
	aUVSize = numericAttribute.create( "uvFilterSize", "fs", child1, child2 );
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	// Output attributes
	aOutColor = numericAttribute.createColor("outColor", "oc");
	MAKE_OUTPUT(numericAttribute);

	// Add attributes to the node database.
	CHECK_MSTATUS( addAttribute(aPtexFileName) );
	CHECK_MSTATUS( addAttribute(aPtexFilterType) );
	CHECK_MSTATUS( addAttribute(aPtexFilterSize) );
	CHECK_MSTATUS( addAttribute(aUVPos) );
	CHECK_MSTATUS( addAttribute(aUVSize) );

	CHECK_MSTATUS( addAttribute(aOutColor) );

	// All input affect the output color
	CHECK_MSTATUS( attributeAffects( aPtexFileName,   aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterSize, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterType, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVPos,          aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVSize,         aOutColor ) );

	return MS::kSuccess;
}
MStatus liqVolumeNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnNumericAttribute nAttr;
  MFnEnumAttribute    eAttr;
  MStatus status;

  // Create input attributes
  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderType = tAttr.create( MString("rmanShaderType"), MString("rst"), MFnData::kString, aRmanShaderType, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aRmanMethods = tAttr.create(  MString("rmanMethods"),  MString("rmt"), MFnData::kStringArray, aRmanMethods, &status );
  MAKE_INPUT(tAttr);

  aRmanIsOutput = tAttr.create(  MString("rmanIsOutput"),  MString("rio"), MFnData::kIntArray, aRmanIsOutput, &status );
  MAKE_INPUT(tAttr);
  
  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // Create output attributes
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);

  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderType));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));
  CHECK_MSTATUS(addAttribute(aRmanMethods));
  CHECK_MSTATUS(addAttribute(aRmanIsOutput));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));

  CHECK_MSTATUS(addAttribute(aOutColor));

  return MS::kSuccess;
}
Esempio n. 4
0
MStatus liqSurfaceNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnEnumAttribute    eAttr;
  MFnMessageAttribute mAttr;
  MFnLightDataAttribute lAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomLightRig = tAttr.create(  MString("previewCustomLights"),  MString("pcl"), MFnData::kString, aPreviewCustomLightRig, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewIntensity = nAttr.create("previewIntensity", "pi", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aGLPreviewTexture = nAttr.createColor("GLPreviewTexture", "gpt");
  nAttr.setDefault( -1.0, -1.0, -1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);



  aColor = nAttr.createColor("color", "cs");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);

  aOpacity = nAttr.createColor("opacity", "os");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
  MAKE_INPUT(nAttr);

  MObject defaultSpaceObj = tDefault.create( MString("shader"), &status);
  aDisplacementBoundSpace = tAttr.create( MString("displacementBoundSpace"), MString("dbs"), MFnData::kString, defaultSpaceObj, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // resolution attribute for maya's hardware renderer
  aResolution = nAttr.create("resolution", "res",  MFnNumericData::kInt, 8, &status);
  CHECK_MSTATUS(nAttr.setStorable( true ));
  CHECK_MSTATUS(nAttr.setReadable( true ));
  CHECK_MSTATUS(nAttr.setWritable( true ));
  CHECK_MSTATUS(nAttr.setHidden( true ));

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // dynamic shader attr
  aCi = nAttr.createColor("Ci", "ci");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);

  aOi = nAttr.createColor("Oi", "oi");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);


  // create attributes for maya renderer

  // lambertian control
  aMayaIgnoreLights = nAttr.create("mayaIgnoreLights", "mil",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_INPUT(nAttr);
  aMayaKa = nAttr.create("mayaKa", "mka", MFnNumericData::kFloat, 0.2, &status);
  MAKE_INPUT(nAttr);
  aMayaKd = nAttr.create("mayaKd", "mkd", MFnNumericData::kFloat, 0.8, &status);
  MAKE_INPUT(nAttr);

  // Camera Normals
  aNormalCameraX = nAttr.create( "normalCameraX", "nx", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCameraY = nAttr.create( "normalCameraY", "ny", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCameraZ = nAttr.create( "normalCameraZ", "nz", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCamera = nAttr.create( "normalCamera","n", aNormalCameraX, aNormalCameraY, aNormalCameraZ, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );

  // Light Direction
  aLightDirectionX = nAttr.create( "lightDirectionX", "ldx", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirectionY = nAttr.create( "lightDirectionY", "ldy", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirectionZ = nAttr.create( "lightDirectionZ", "ldz", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirection = nAttr.create( "lightDirection", "ld", aLightDirectionX, aLightDirectionY, aLightDirectionZ, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );

  // Light Intensity
  aLightIntensityR = nAttr.create( "lightIntensityR", "lir", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensityG = nAttr.create( "lightIntensityG", "lig", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensityB = nAttr.create( "lightIntensityB", "lib", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensity = nAttr.create( "lightIntensity", "li", aLightIntensityR, aLightIntensityG, aLightIntensityB, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );

  // Light
  aLightAmbient = nAttr.create( "lightAmbient", "la", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( true ) );
  aLightDiffuse = nAttr.create( "lightDiffuse", "ldf", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( true ) );
  aLightSpecular = nAttr.create( "lightSpecular", "ls", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( false ) );
  aLightShadowFraction = nAttr.create( "lightShadowFraction", "lsf", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setReadable( true ) );
  CHECK_MSTATUS( nAttr.setWritable( true ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aPreShadowIntensity = nAttr.create( "preShadowIntensity", "psi", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );

  #if MAYA_API_VERSION >= 800
  aLightBlindData = nAttr.createAddr( "lightBlindData", "lbld", 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( (void*) 0 ) );
  #else
  aLightBlindData = nAttr.create( "lightBlindData", "lbld", MFnNumericData::kLong, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 0 ) );
  #endif
  aLightData = lAttr.create( "lightDataArray", "ltd", aLightDirection,
                              aLightIntensity, aLightAmbient, aLightDiffuse, aLightSpecular,
                              aLightShadowFraction, aPreShadowIntensity, aLightBlindData,
                              &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( lAttr.setArray( true ) );
  CHECK_MSTATUS( lAttr.setStorable( false ) );
  CHECK_MSTATUS( lAttr.setHidden( true ) );
  CHECK_MSTATUS( lAttr.setDefault( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true, true, false, 1.0f, 1.0f, 0 ) );

  // Create output attributes
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);
  aOutTransparency = nAttr.createColor("outTransparency", "ot");
  MAKE_OUTPUT(nAttr);
  aAssignedObjects = mAttr.create("liqAssignedObjects", "ao");
  MAKE_OUTPUT(mAttr);


  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewCustomLightRig));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewPixelSamples));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewIntensity));
  CHECK_MSTATUS(addAttribute(aGLPreviewTexture));
  CHECK_MSTATUS(addAttribute(aCi));
  CHECK_MSTATUS(addAttribute(aOi));

  CHECK_MSTATUS(addAttribute(aColor));
  CHECK_MSTATUS(addAttribute(aOpacity));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aDisplacementBound));
  CHECK_MSTATUS(addAttribute(aDisplacementBoundSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aResolution));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));
  CHECK_MSTATUS(addAttribute(aMayaIgnoreLights));
  CHECK_MSTATUS(addAttribute(aMayaKa));
  CHECK_MSTATUS(addAttribute(aMayaKd));
  CHECK_MSTATUS(addAttribute(aNormalCamera));
  CHECK_MSTATUS(addAttribute(aLightData));
  CHECK_MSTATUS(addAttribute(aAssignedObjects));
  CHECK_MSTATUS(addAttribute(aOutColor));
  CHECK_MSTATUS(addAttribute(aOutTransparency));

  CHECK_MSTATUS(attributeAffects( aColor,               aOutColor ));
  CHECK_MSTATUS(attributeAffects( aOpacity,             aOutColor ));
  CHECK_MSTATUS(attributeAffects( aGLPreviewTexture,    aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaIgnoreLights,    aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaKa,              aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaKd,              aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityR,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityB,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityG,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensity,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraX,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraY,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraZ,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCamera,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionX,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionY,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionZ,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirection,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightAmbient,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightSpecular,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDiffuse,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightShadowFraction, aOutColor ));
  CHECK_MSTATUS(attributeAffects( aPreShadowIntensity,  aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightBlindData,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightData,           aOutColor ));

  return MS::kSuccess;
}
Esempio n. 5
0
MStatus VmIslandNode::initialize()
{
    fprintf( stderr, "VmIslandNode::initialize()...\n" );
    
    MStatus status;
    
    //Seed attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_seed = numericAttrFn.create( "seed", "sD", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 1000 );
        numericAttrFn.setDefault ( 0 );
        status = addAttribute( ia_seed );
        CHECK_MSTATUS( status );
    }
    
    //Roughness attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_roughness = numericAttrFn.create( "roughness", "rG", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 1 );
        numericAttrFn.setDefault ( 0.75 );
        status = addAttribute( ia_roughness );
        CHECK_MSTATUS( status );
    }
    
    //Plane Height attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_planeHeight = numericAttrFn.create( "planeHeight", "pH", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 2000 );
        numericAttrFn.setDefault ( 5 );
        status = addAttribute( ia_planeHeight );
        CHECK_MSTATUS( status );
    }

     //Plane smoothing attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_smooth = numericAttrFn.create( "smoothingStrength", "sS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 6 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_smooth );
        CHECK_MSTATUS( status );
    }
    
     //Plane resolution attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_resolution = numericAttrFn.create( "mayaResolution", "mR", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_resolution );
        CHECK_MSTATUS( status );
    }

    //Renderman resolution attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_rmanResolution = numericAttrFn.create( "rendermanResolution", "rR", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 6 );
        status = addAttribute( ia_rmanResolution );
        CHECK_MSTATUS( status );
    }

    //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_planeSize = numericAttrFn.create( "planeSizeScale", "pS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 200 );
        numericAttrFn.setDefault ( 20 );
        status = addAttribute( ia_planeSize );
        CHECK_MSTATUS( status );
    }


     //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_gridSize = numericAttrFn.create( "gridSize", "gS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_gridSize );
        CHECK_MSTATUS( status );
    }

     //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassMultiplier = numericAttrFn.create( "grassInstanceMultiplier", "gM", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 100 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_grassMultiplier );
        CHECK_MSTATUS( status );
    }


        //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_baseWidth = numericAttrFn.create( "grassBaseWidth", "bW", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.01f );
        numericAttrFn.setMax( 2.0f ); 
        numericAttrFn.setDefault ( 0.6f );
        status = addAttribute( ia_baseWidth );
        CHECK_MSTATUS( status );
    }



    //Grass segment length - Length of segment pieces
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassSegmentLength = numericAttrFn.create( "grassSegmentLength", "gSL", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.001f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 1.0f );
        status = addAttribute( ia_grassSegmentLength );
        CHECK_MSTATUS( status );
    }

     //Number of segments per piece of grass
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassNumSegments = numericAttrFn.create( "numberOfGrassSegments", "nGS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 3 );
        numericAttrFn.setMax( 20 );
        numericAttrFn.setDefault ( 5 );
        status = addAttribute( ia_grassNumSegments );
        CHECK_MSTATUS( status );
    }

    //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_windDirection = numericAttrFn.createPoint( "windDirection", "wDir");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(1.0f, 0.0f, 1.0f);
        status = addAttribute( ia_windDirection );
        CHECK_MSTATUS( status );
    }

    //Grass bend factor
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBendAmount = numericAttrFn.create( "grassBendFactor", "gBF", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.0f );
        numericAttrFn.setMax( 1.0f );
        numericAttrFn.setDefault ( 0.0f );
        status = addAttribute( ia_grassBendAmount );
        CHECK_MSTATUS( status );
    }

    //Wind strength
    {
        MFnNumericAttribute numericAttrFn;
        ia_windSpread = numericAttrFn.create( "windSpread", "wS", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.01f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 5.0f );
        status = addAttribute( ia_windSpread );
        CHECK_MSTATUS( status );
    }



        //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour1 = numericAttrFn.createColor( "grassBaseColour1", "bCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.0f,0.251f,0.167f);
        status = addAttribute( ia_grassBaseColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour1 = numericAttrFn.createColor( "grassTipColour1", "tCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.395f,0.551f,0.257f);
        status = addAttribute( ia_grassTipColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour2 = numericAttrFn.createColor( "grassBaseColour2", "bCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.275f,0.243f,0.043f);
        status = addAttribute( ia_grassBaseColour2 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour2 = numericAttrFn.createColor( "grassTipColour2", "tCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.611f,0.587f,0.257f);
        status = addAttribute( ia_grassTipColour2 );
        CHECK_MSTATUS( status );
    }





     //Clock attribute. Passes maya frame counter into node
    {
        MFnNumericAttribute numericAttrFn;
        ia_clock = numericAttrFn.create( "clock", "clk", MFnNumericData::kLong, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setDefault( 0 );
        status = addAttribute( ia_clock );
        CHECK_MSTATUS( status );
    }

    
    // "drawStyle"
    //
    // How we should draw in Maya.
    //
    // We will use this value in our Maya plug-in, but we
    // will NOT use it in Renderman. Note elsewhere that
    // this value will not be sent to Renderman, nor will
    // it have any effect on RIB generation.
    //
    // We think of this as an input attribute - hence the
    // prefix "ia_" for "input attribute". 
    {
        MFnEnumAttribute enumAttrFn;
        ia_drawStyle = enumAttrFn.create( "drawStyle", "ds", 1, & status );
        CHECK_MSTATUS( status );
        enumAttrFn.setReadable( true );
        enumAttrFn.setWritable( true );
        enumAttrFn.setStorable( true );
        enumAttrFn.setKeyable( true );
        enumAttrFn.setConnectable( true );
        enumAttrFn.setHidden( false );
        enumAttrFn.addField( "Bounds", 0 );
        enumAttrFn.addField( "Sub bounds", 1 );
        enumAttrFn.addField( "Geometry", 2 );
        enumAttrFn.addField( "Terrain slope normals", 3 );
        enumAttrFn.addField( "Point instances", 4 );
        enumAttrFn.addField( "Wind Velocity", 5 );
        enumAttrFn.addField( "All", 6 );
        enumAttrFn.setDefault(3);
        status = addAttribute( ia_drawStyle );
        CHECK_MSTATUS( status );
    }
    
    // "update"
    //
    // A 'dummy' attribute, and a powerful one. Although
    // the value of this attribute is actually meaningless,
    // when we ask for it we trigger an important computation
    // processs.
    //
    // We think of this as an input attribute - hence the
    // prefix "oa_" for "computation attribute". This signifies
    // that we don't really care about it's final value, but
    // that we know it's going to compute a lot of stuff. 
    {
        MFnNumericAttribute numericAttrFn;
        oa_update = numericAttrFn.create( "update", "upd", MFnNumericData::kBoolean, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( false );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( true );
        status = addAttribute( oa_update );
        CHECK_MSTATUS( status );
    }


   
    
    
    // "rib"
    //
    // A string which contains all the attributes, and that
    //  we need to have (and indeed will see again) on the 
    // Renderman side of things.
    //
    // We think of this as an output attribute - hence the
    // prefix "oa_" for "output attribute". The value
    // computed for this attribute (the string) is important,
    // an is used by whatever is asking for it.
    {
        MFnTypedAttribute typedAttrFn;
        oa_rib = typedAttrFn.create( "rib", "rb", MFnData::kString, MObject::kNullObj, & status );
        CHECK_MSTATUS( status );
        typedAttrFn.setReadable( true );
        typedAttrFn.setWritable( true );
        typedAttrFn.setStorable( false );
        typedAttrFn.setKeyable( false );
        typedAttrFn.setConnectable( true );
        typedAttrFn.setHidden( true );
        status = addAttribute( oa_rib );
        CHECK_MSTATUS( status );
    }


    
    // This section tells Maya what attribute effects
    // which attribute. When input attributes change, 
    // make the attributes they effect "dirty". That 
    // means that, when Maya asks for a dirty attribute, 
    // it will need to be computed and "cleaned".
    //
    // Changing an effecting "input" attribute does not
    // trigger a computation of it's effected "output"
    // attribute. It just tells Maya that - if the effected
    // attribute is ever asked for, it will have to call
    // the compute method to calculate it.
    //
    // For complex relationships between attributes,
    // an attributeEffects() call must exist for each
    // relationship. If A effects B, and B effects C,
    // then we will need to make two attributeEffects()
    // calls - one for A effecting B and one for B 
    // effecting C. Maya will not figure out that, if A
    // effects B, and B effets C, then A must effect C.
    //
    // Below we see that most "input" attributes effect
    // both our internal update and the rib generation
    // the same way in each case. But it's not always 
    // exactly the same like this.
    //
    // Notice also that ia_drawStyle does not effect
    // any of the attributes. It's something that's just
    // used in the draw method.
    
    attributeAffects( ia_seed, oa_update );
    attributeAffects( ia_seed, oa_rib );
    
    attributeAffects( ia_roughness, oa_update );
    attributeAffects( ia_roughness, oa_rib );

    attributeAffects( ia_smooth, oa_update );
    attributeAffects( ia_smooth, oa_rib );

    attributeAffects( ia_planeHeight, oa_update );
    attributeAffects( ia_planeHeight, oa_rib );

    attributeAffects( ia_resolution, oa_update );
    attributeAffects( ia_rmanResolution, oa_rib );
    
    attributeAffects( ia_planeSize, oa_update );
    attributeAffects( ia_planeSize, oa_rib );

    attributeAffects( ia_gridSize, oa_update );
    attributeAffects( ia_gridSize, oa_rib );

    attributeAffects( ia_grassMultiplier, oa_update );
    attributeAffects( ia_grassMultiplier, oa_rib );

    attributeAffects( ia_baseWidth, oa_update );
    attributeAffects( ia_baseWidth, oa_rib );

    attributeAffects( ia_grassSegmentLength, oa_update );
    attributeAffects( ia_grassSegmentLength, oa_rib );

    attributeAffects( ia_grassNumSegments, oa_update );
    attributeAffects( ia_grassNumSegments, oa_rib );

    attributeAffects( ia_grassBendAmount, oa_update );
    attributeAffects( ia_grassBendAmount, oa_rib );

    attributeAffects( ia_windDirection, oa_update );
    attributeAffects( ia_windDirection, oa_rib );

    attributeAffects( ia_windSpread, oa_update );
    attributeAffects( ia_windSpread, oa_rib );

    attributeAffects( ia_clock, oa_update );
    attributeAffects( ia_clock, oa_rib );

    attributeAffects( ia_grassBaseColour1, oa_update);
    attributeAffects( ia_grassBaseColour1, oa_rib);

    attributeAffects( ia_grassTipColour1, oa_update);
    attributeAffects( ia_grassTipColour1, oa_rib);

    attributeAffects( ia_grassBaseColour2, oa_update);
    attributeAffects( ia_grassBaseColour2, oa_rib);

    attributeAffects( ia_grassTipColour2, oa_update);
    attributeAffects( ia_grassTipColour2, oa_rib);


    
    
    fprintf( stderr, "VmIslandNode::initialize() done\n" );

    return MStatus::kSuccess;
}
MStatus liqDisplacementNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnMessageAttribute mAttr;
  MFnEnumAttribute    eAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));


  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
  MAKE_INPUT(nAttr);

  MObject defaultSpaceObj = tDefault.create( MString("shader"), &status);
  aDisplacementBoundSpace = tAttr.create( MString("displacementBoundSpace"), MString("dbs"), MFnData::kString, defaultSpaceObj, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // Create output attributes
  aDisplacement = nAttr.create("displacement", "d", MFnNumericData::kFloat, 0.0, &status);
  MAKE_OUTPUT(nAttr);
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);
  aAssignedObjects = mAttr.create("liqAssignedObjects", "ao");
  MAKE_OUTPUT(mAttr);

  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewPixelSamples));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aDisplacementBound));
  CHECK_MSTATUS(addAttribute(aDisplacementBoundSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));

  CHECK_MSTATUS(addAttribute(aAssignedObjects));
  CHECK_MSTATUS(addAttribute(aDisplacement));
  CHECK_MSTATUS(addAttribute(aOutColor));

  CHECK_MSTATUS(attributeAffects(aRmanShaderLong, aDisplacement));
  CHECK_MSTATUS(attributeAffects(aRmanShaderLif, aDisplacement));

  return MS::kSuccess;
}