MStatus SwirlDeformer::initialize()
{
MFnMatrixAttribute mAttr;
deformSpace = mAttr.create( "deformSpace", "dSp" );
mAttr.setStorable( false );

MFnUnitAttribute unitFn;    
startDist = unitFn.create( "startDist", "sd", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );

endDist = unitFn.create( "endDist", "ed", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 3.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );

addAttribute( deformSpace );
addAttribute( startDist );
addAttribute( endDist );

attributeAffects( deformSpace, outputGeom );
attributeAffects( startDist, outputGeom );
attributeAffects( endDist, outputGeom );

return MS::kSuccess;
}
Ejemplo n.º 2
0
MStatus ArrayAngleConstructorNode::initialize()
{
    MStatus status;

    MFnNumericAttribute N;
    MFnTypedAttribute T;
    MFnUnitAttribute U;

    aSize = N.create("size", "size", MFnNumericData::kInt, 8.0, &status);
    N.setKeyable(true);
    N.setStorable(true);
    N.setWritable(true);
    N.setDefault(8);

    aInput = U.create("input", "i", MFnUnitAttribute::kAngle, 0.0, &status);
    U.setKeyable(false);
    U.setStorable(true);
    U.setWritable(true);
    U.setArray(true);

    aOutput = T.create("output", "o", MFnData::kDoubleArray, &status);
    T.setKeyable(false);
    T.setChannelBox(false);
    T.setWritable(false);
    T.setStorable(false);

    addAttribute(aSize);
    addAttribute(aInput);
    addAttribute(aOutput);

    attributeAffects(aSize, aOutput);
    attributeAffects(aInput, aOutput);

    return MS::kSuccess;
}
Ejemplo n.º 3
0
/*!
 * Initialize attributes in Maya.
 */
MStatus ffdPlanar::initialize()
{
    // Local attributes.
    MFnNumericAttribute nAttr;
    
    latticeRow1 = nAttr.create( "row1", "r1", MFnNumericData::k3Double );
    nAttr.setDefault( 0.0, 0.0, 0.0 );
    nAttr.setMin( -100.0, -100.0, -100.0 );
    nAttr.setMax( 100.0, 100.0, 100.0 );
    nAttr.setKeyable( true );
    addAttribute( latticeRow1 );
    
    latticeRow2 = nAttr.create( "row2", "r2", MFnNumericData::k3Double );
    nAttr.setDefault( 0.0, 0.0, 0.0 );
    nAttr.setMin( -100.0, -100.0, -100.0 );
    nAttr.setMax( 100.0, 100.0, 100.0 );
    nAttr.setKeyable( true );
    addAttribute( latticeRow2 );
    
    latticeRow3 = nAttr.create( "row3", "r3", MFnNumericData::k3Double );
    nAttr.setDefault( 0.0, 0.0, 0.0 );
    nAttr.setMin( -100.0, -100.0, -100.0 );
    nAttr.setMax( 100.0, 100.0, 100.0 );
    nAttr.setKeyable( true );
    addAttribute( latticeRow3 );
    
    // Attributes affect geometry.
    attributeAffects( ffdPlanar::latticeRow1, ffdPlanar::outputGeom );
    attributeAffects( ffdPlanar::latticeRow2, ffdPlanar::outputGeom );
    attributeAffects( ffdPlanar::latticeRow3, ffdPlanar::outputGeom );

    return MS::kSuccess;
}
MStatus PhysicalsunNode::initialize_shader_parameters()
{
    //CM_TRACE_FUNC("PhysicalsunNode::initialize_shader_parameters()");
    MFnTypedAttribute   tAttr;
    MFnStringData       tDefault;
    MFnNumericAttribute nAttr;
    MFnEnumAttribute    eAttr;
    MFnLightDataAttribute lAttr;
    MFnStringData stringData;
    MStatus status, sstat;

    CREATE_FLOAT(nAttr, ai_multiplier,		"multiplier",		"mul", 1.0);
    CREATE_COLOR(nAttr, ai_rgb_unit_conversion, "rgb_unit_conversion", "uc", 0.0, 0.0, 0.0);
    CREATE_FLOAT(nAttr, ai_haze,			"haze",			"haz", 0.0);
    CREATE_FLOAT(nAttr, ai_redblueshift,	"redblueshift",	"rbs", 0.0);
    CREATE_FLOAT(nAttr, ai_saturation,		"saturation",		"sat", 0.7);
    CREATE_FLOAT(nAttr, ai_horizon_height,	"horizon_height", "hoh", 0.0);
    CREATE_FLOAT(nAttr, ai_shadow_softness, "shadow_softness","ssf", 0.0);
    CREATE_STRING(tAttr,ai_shadowmap,		"shadowmap",		"sm",  "raytrace");
    CREATE_INT(nAttr,	ai_shadow_samples,	"shadow_samples",	"ssp", 3);
    CREATE_BOOL(nAttr,  ai_y_is_up,			"y_is_up",		"yup", false );

    IfMErrorWarn( attributeAffects( ai_multiplier,			aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_rgb_unit_conversion,	aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_haze,				aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_redblueshift,		aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_saturation,			aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_horizon_height,		aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_shadow_softness,		aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_shadowmap,			aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_shadow_samples,		aOutColor ) );
    IfMErrorWarn( attributeAffects( ai_y_is_up,				aOutColor ) );

    return MS::kSuccess;
}
Ejemplo n.º 5
0
MStatus VolumePushCollider::initialize()
{
    MFnNumericAttribute nAttr;
    MFnMatrixAttribute mAttr;

    // inCollider
    aInCollider = mAttr.create("inCollider", "col");
    mAttr.setArray(true);
    CHECK_MSTATUS(addAttribute(aInCollider));

    // inVolume
    aInVolume = mAttr.create("inVolume", "vol");
    mAttr.setArray(true);
    CHECK_MSTATUS(addAttribute(aInVolume));

    // output
    aOutput = nAttr.create("output", "out", MFnNumericData::kDouble, 0.0);
    nAttr.setArray(true);
    nAttr.setReadable(true);
    nAttr.setWritable(true);
    nAttr.setHidden(true);
    CHECK_MSTATUS(addAttribute(aOutput));

    attributeAffects(aInCollider, aOutput);
    attributeAffects(aInVolume, aOutput);

    return MS::kSuccess;
}
MStatus OccLightNode::initialize_shader_parameters()
{
	//CM_TRACE_FUNC("OccLightNode::initialize_shader_parameters()");
	MFnTypedAttribute   tAttr;
	MFnStringData       tDefault;
	MFnNumericAttribute nAttr;
	MFnEnumAttribute    eAttr;
	MFnLightDataAttribute lAttr;
	MFnStringData stringData;
	MStatus status, sstat;

	CREATE_FLOAT(nAttr, akocc,			"Kocc",			"k",	1.0);
	CREATE_INT(nAttr,	asamples,		"samples",		"sam",	64);
	CREATE_FLOAT(nAttr,	amaxdist,		"maxdist",		"max",	1e36);
	CREATE_STRING(tAttr,adistribution,	"distribution",	"dis",	"cosine");
	CREATE_BOOL(nAttr,	a__nonspecular,	"__nonspecular","nsp",	1);

	IfMErrorWarn( attributeAffects( akocc,			aOutColor ) );
	IfMErrorWarn( attributeAffects( asamples,		aOutColor ) );
	IfMErrorWarn( attributeAffects( amaxdist,		aOutColor ) );
	IfMErrorWarn( attributeAffects( adistribution,	aOutColor ) );
	IfMErrorWarn( attributeAffects( a__nonspecular,	aOutColor ) );

	return MS::kSuccess;
}
Ejemplo n.º 7
0
MStatus sgLockAngleMatrix::initialize()	
{
	MStatus status;

	MFnMatrixAttribute mAttr;
	MFnNumericAttribute nAttr;
	MFnEnumAttribute   eAttr;

	aBaseMatrix = mAttr.create( "baseMatrix", "baseMatrix" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBaseMatrix ) );

	aInputMatrix = mAttr.create( "inputMatrix", "inputMatrix" );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMatrix ) );

	aAngleAxis = eAttr.create( "angleAxis", "angleAxis" );
	eAttr.addField( " X", 0 );eAttr.addField( " Y", 1 );eAttr.addField( " Z", 2 );
	eAttr.addField( "-X", 3 );eAttr.addField( "-Y", 4 );eAttr.addField( "-Z", 5 );
	eAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aAngleAxis ) );

	aInputAngle = nAttr.create( "inputAngle", "inputAngle", MFnNumericData::kDouble, 45 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputAngle ) );

	aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" );
	mAttr.setStorable( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBaseMatrix, aOutputMatrix ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMatrix, aOutputMatrix ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aAngleAxis, aOutputMatrix ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputAngle, aOutputMatrix ) );

	return MS::kSuccess;
}
Ejemplo n.º 8
0
MStatus sgBulgeDeformer::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnMatrixAttribute mAttr;
	MFnCompoundAttribute cAttr;

	aBulgeWeight = nAttr.create(nameBulgeWeight, nameBulgeWeight, MFnNumericData::kFloat, 1.0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeWeight);

	aBulgeRadius = nAttr.create(nameBulgeRadius, nameBulgeRadius, MFnNumericData::kDouble, 0);
	nAttr.setMin(0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeRadius);

	aBulgeInputs = cAttr.create(nameBulgeInputs, nameBulgeInputs);
	aMatrix = mAttr.create(nameMatrix, nameMatrix);
	aMesh = tAttr.create(nameMesh, nameMesh, MFnData::kMesh );
	cAttr.addChild(aMatrix);
	cAttr.addChild(aMesh);
	cAttr.setArray(true);
	addAttribute(aBulgeInputs);

	attributeAffects(aBulgeWeight, outputGeom);
	attributeAffects(aBulgeRadius, outputGeom);
	attributeAffects(aBulgeInputs, outputGeom);

	return status;
}
Ejemplo n.º 9
0
MStatus PushDeformer::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	//add bulge attribute which affects the output geom
	aAmount = nAttr.create("amount", "amt", MFnNumericData::kDouble, 0.0);
	nAttr.setKeyable(true);
	addAttribute(aAmount);

	aStressMap = tAttr.create("aStressMap", "stMap", MFnData::kDoubleArray);
	tAttr.setKeyable(true);
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	addAttribute(aStressMap);

	aUseStress = nAttr.create("useStress", "useStress", MFnNumericData::kBoolean, 0);
	nAttr.setKeyable(true);
	nAttr.setStorable(true);
	addAttribute(aUseStress);

	aMultiThreadingType = nAttr.create("multiThreadingType", "multiThreadingType", MFnNumericData::kInt, 0);
	nAttr.setKeyable(true);
	addAttribute(aMultiThreadingType);

	attributeAffects(aAmount, outputGeom);
	attributeAffects(aStressMap, outputGeom);
	attributeAffects(aUseStress, outputGeom);
  attributeAffects(aMultiThreadingType, outputGeom);
	// make paintable deformer
	MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer pushDeformer weights");

	return MS::kSuccess;
}
Ejemplo n.º 10
0
MStatus simpleEvaluationNode::initialize()
{
	MFnNumericAttribute nAttr;
	MFnUnitAttribute    uAttr;
	MStatus				status;

	input = nAttr.create( "input", "in", MFnNumericData::kFloat, 2.0 );
 	nAttr.setStorable(true);

	aTimeInput = uAttr.create( "inputTime", "itm", MFnUnitAttribute::kTime, 0.0 );
	uAttr.setWritable(true);
	uAttr.setStorable(true);
    uAttr.setReadable(true);
    uAttr.setKeyable(true);

	output = nAttr.create( "output", "out", MFnNumericData::kFloat, 0.0 );
	nAttr.setWritable(false);
	nAttr.setStorable(false);

	status = addAttribute( input );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( aTimeInput );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( output );
		if (!status) { status.perror("addAttribute"); return status;}

	status = attributeAffects( input, output );
		if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( aTimeInput, output );
		if (!status) { status.perror("attributeAffects"); return status;}

	return MS::kSuccess;
}
Ejemplo n.º 11
0
//
// DESCRIPTION:
///////////////////////////////////////////////////////
MStatus Gamma::initialize()
{
    MFnNumericAttribute		nAttr;

    // Input attributes

    aColor = nAttr.createColor( "color", "c" );
    MAKE_INPUT(nAttr);

	aGamma = nAttr.createPoint( "gamma", "g" );
    MAKE_INPUT(nAttr);
	CHECK_MSTATUS ( nAttr.setDefault(1.f, 1.f, 1.f) );

	// Output attributes

    aOutColor= nAttr.createColor( "outColor", "oc" );
    MAKE_OUTPUT(nAttr);

	//  Add attributes to the node database.
    CHECK_MSTATUS ( addAttribute(aColor) );
    CHECK_MSTATUS ( addAttribute(aGamma) );
    CHECK_MSTATUS ( addAttribute(aOutColor) );

    // All input affect the output color
    CHECK_MSTATUS ( attributeAffects( aColor, aOutColor ));
    CHECK_MSTATUS ( attributeAffects( aGamma, aOutColor ));

    return MS::kSuccess;
}
Ejemplo n.º 12
0
//
// DESCRIPTION:
MStatus OSLNode::initialize()
{
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnGenericAttribute gAttr;
	MFnEnumAttribute eAttr;
	MFnMessageAttribute mAttr;

	MStatus status;

	color = nAttr.createColor("color", "color");
	MAKE_INPUT(nAttr);
	CHECK_MSTATUS(addAttribute( color ));

	script = tAttr.create("script", "script", MFnNumericData::kString);
	MAKE_INPUT(tAttr);
	CHECK_MSTATUS(addAttribute( script ));

	outColor = nAttr.createColor("outColor", "outColor");
	MAKE_OUTPUT(nAttr);
	CHECK_MSTATUS(addAttribute( outColor ));

//---------------------------- automatically created attributes start ------------------------------------
//---------------------------- automatically created attributes end ------------------------------------

	attributeAffects(color, outColor);
	attributeAffects(script, outColor);

    return MS::kSuccess;
}
Ejemplo n.º 13
0
MStatus testNpassiveNode::initialize()
{
    MStatus stat;
    MFnTypedAttribute tAttr;
    inputGeom = tAttr.create("inputGeom", "ing", MFnData::kMesh, MObject::kNullObj, &stat );
    //statCheck(stat, "failed to create inputGeom");
    tAttr.setWritable(true);
    tAttr.setStorable(true);
    tAttr.setHidden(true);
    currentState = tAttr.create("currentState", "cus", MFnData::kNObject, MObject::kNullObj, &stat );
   // statCheck(stat, "failed to create currentState");
    tAttr.setWritable(true);
    tAttr.setStorable(false);
    tAttr.setHidden(true);
    startState = tAttr.create( "startState", "sts", MFnData::kNObject, MObject::kNullObj, &stat );
    //statCheck(stat, "failed to create startState");
    tAttr.setWritable(true);
    tAttr.setStorable(false);
    tAttr.setHidden(true);
    MFnUnitAttribute uniAttr;
    currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime,  0.0, &stat  );    
    addAttribute(inputGeom);
    addAttribute(currentTime);
    addAttribute(startState);
    addAttribute(currentState);
    
    attributeAffects(inputGeom, startState);
    attributeAffects(inputGeom, currentState);
    attributeAffects(currentTime, currentState);    
    attributeAffects(currentTime, startState);    
    return MStatus::kSuccess;
}
Ejemplo n.º 14
0
MStatus BCIViz::initialize()
{ 
	MFnNumericAttribute numFn;
	MFnMatrixAttribute matAttr;
	MStatus			 stat;
	
	ainput = matAttr.create( "input", "in", MFnMatrixAttribute::kDouble );
	matAttr.setStorable(false);
	matAttr.setWritable(true);
	matAttr.setConnectable(true);
	addAttribute(ainput);
	
	atargets = matAttr.create( "target", "tgt", MFnMatrixAttribute::kDouble );
	matAttr.setStorable(false);
	matAttr.setWritable(true);
	matAttr.setArray(true);
	matAttr.setConnectable(true);
	addAttribute(atargets);
	
	outValue = numFn.create( "outValue", "ov", MFnNumericData::kDouble );
	numFn.setStorable(false);
	numFn.setWritable(false);
	numFn.setReadable(true);
	numFn.setArray(true);
	numFn.setUsesArrayDataBuilder( true );
	addAttribute(outValue);
	
	attributeAffects(ainput, outValue);
	attributeAffects(atargets, outValue);
	return MS::kSuccess;
}
Ejemplo n.º 15
0
MStatus  sgBLocator_fromGeo::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute   tAttr;

	aOutputValue    = nAttr.create( "outputValue", "outputValue", MFnNumericData::kInt, 1.0 );
	nAttr.setStorable( false );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputValue ) );
	CHECK_MSTATUS_AND_RETURN_IT( status );


	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputCurve ) );


	aLineWidth = nAttr.create( "lineWidth", "lineWidth", MFnNumericData::kInt, 1 );
	nAttr.setMin( 1 );
	nAttr.setKeyable( true );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aLineWidth ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputCurve, aOutputValue ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aLineWidth,  aOutputValue ) );


	return MS::kSuccess;
}
Ejemplo n.º 16
0
MStatus mapBlendShape::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;

	aBlendMesh = tAttr.create("blendMesh", "blendMesh", MFnData::kMesh);
	addAttribute(aBlendMesh);
	
	aBlendMap = nAttr.createColor("blendMap", "blendMap");
	addAttribute(aBlendMap);

	aUseBlendMap = nAttr.create("useBlendMap", "useBlendMap", MFnNumericData::kBoolean);
	nAttr.setDefault(true);
	addAttribute(aUseBlendMap);

	aBlendMapMultiplier = nAttr.create("blendMapMultiplier", "blendMapMultiplier", MFnNumericData::kFloat);
	nAttr.setDefault(1.0);
	nAttr.setMin(0.0);
	addAttribute(aBlendMapMultiplier);
	
	attributeAffects(aBlendMesh, outputGeom);
	attributeAffects(aBlendMap, outputGeom);
	attributeAffects(aUseBlendMap, outputGeom);
	attributeAffects(aBlendMapMultiplier, outputGeom);

	MGlobal::executeCommand( "makePaintable -attrType multiFloat -sm deformer blendNode weights;" );

	return MS::kSuccess;
}
Ejemplo n.º 17
0
MStatus AlembicCurvesDeformNode::initialize()
{
  MStatus status;

  MFnUnitAttribute uAttr;
  MFnTypedAttribute tAttr;
  MFnNumericAttribute nAttr;
  MFnGenericAttribute gAttr;
  MFnStringData emptyStringData;
  MObject emptyStringObject = emptyStringData.create("");

  // input time
  mTimeAttr = uAttr.create("inTime", "tm", MFnUnitAttribute::kTime, 0.0);
  status = uAttr.setStorable(true);
  status = uAttr.setKeyable(true);
  status = addAttribute(mTimeAttr);

  // input file name
  mFileNameAttr =
      tAttr.create("fileName", "fn", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setUsedAsFilename(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mFileNameAttr);

  // input identifier
  mIdentifierAttr =
      tAttr.create("identifier", "if", MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = addAttribute(mIdentifierAttr);

  // output for list of ArbGeomParams
  mGeomParamsList = tAttr.create("ExocortexAlembic_GeomParams", "exo_gp",
      MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = tAttr.setHidden(false);
  status = tAttr.setInternal(true);
  status = addAttribute(mGeomParamsList);

  // output for list of UserAttributes
  mUserAttrsList = tAttr.create("ExocortexAlembic_UserAttributes", "exo_ua",
      MFnData::kString, emptyStringObject);
  status = tAttr.setStorable(true);
  status = tAttr.setKeyable(false);
  status = tAttr.setHidden(false);
  status = tAttr.setInternal(true);
  status = addAttribute(mUserAttrsList);

  // create a mapping
  status = attributeAffects(mTimeAttr, outputGeom);
  status = attributeAffects(mFileNameAttr, outputGeom);
  status = attributeAffects(mIdentifierAttr, outputGeom);

  return status;
}
Ejemplo n.º 18
0
MStatus sgIkSmoothStretch::initialize()
{
	MStatus stat;

	MFnNumericAttribute nAttr;

	aInputDistance = nAttr.create( "inputDistance", "in", MFnNumericData::kDouble, 0.0 );
	nAttr.setArray( true );
	nAttr.setUsesArrayDataBuilder( true );
	nAttr.setStorable( true );
	
	aInPositionX = nAttr.create( "inPositionX", "ipx", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );
	aInPositionY = nAttr.create( "inPositionY", "ipy", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );
	aInPositionZ = nAttr.create( "inPositionZ", "ipz", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );
	aInPosition = nAttr.create( "inPosition", "ip", aInPositionX, aInPositionY, aInPositionZ );
	
	aOutputDistance = nAttr.create( "outputDistance", "out", MFnNumericData::kDouble, 0,0 );
	nAttr.setArray( true );
	nAttr.setUsesArrayDataBuilder( true );
	nAttr.setStorable( false );
	nAttr.setWritable( false );

	aSmoothArea = nAttr.create( "smoothArea", "smoothArea", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );

	aStretchAble = nAttr.create( "stretchAble", "sa", MFnNumericData::kFloat, 1.0 );
	nAttr.setStorable( true );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1 );

	stat = addAttribute( aInputDistance );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( aInPosition );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( aOutputDistance );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( aStretchAble );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( aSmoothArea );
		if (!stat) { stat.perror("addAttribute"); return stat;}

	stat = attributeAffects( aInputDistance, aOutputDistance );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aInPosition, aOutputDistance );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aStretchAble, aOutputDistance );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aSmoothArea, aOutputDistance );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	
	return MS::kSuccess;
}
Ejemplo n.º 19
0
// INIT =========================================
MStatus gear_uToPercentage::initialize()
{
	MFnTypedAttribute tAttr;
	MFnNumericAttribute nAttr;
	MStatus stat;
	
    // Curve
    curve = tAttr.create("curve", "crv", MFnData::kNurbsCurve);
    stat = addAttribute( curve );
		if (!stat) {stat.perror("addAttribute"); return stat;}

		
   // Sliders
    normalizedU = nAttr.create("normalizedU", "n", MFnNumericData::kBoolean, false);
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
    stat = addAttribute( normalizedU );
		if (!stat) {stat.perror("addAttribute"); return stat;}

    u = nAttr.create("u", "u", MFnNumericData::kFloat, .5, 0);
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
    stat = addAttribute( u );
		if (!stat) {stat.perror("addAttribute"); return stat;}

    steps = nAttr.create("steps", "s", MFnNumericData::kShort, 40);
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
    stat = addAttribute( steps );
		if (!stat) {stat.perror("addAttribute"); return stat;}

    // Outputs
	percentage = nAttr.create( "percentage", "p", MFnNumericData::kFloat, 0 );
    nAttr.setWritable(false);
    nAttr.setStorable(false);
    nAttr.setReadable(true);
    nAttr.setKeyable(false);
    stat = addAttribute( percentage );
		if (!stat) {stat.perror("addAttribute"); return stat;}
		
    // Connections 
    stat = attributeAffects ( curve, percentage );
		if (!stat) {stat.perror("attributeAffects"); return stat;}
    stat = attributeAffects ( steps, percentage );
		if (!stat) {stat.perror("attributeAffects"); return stat;}
    stat = attributeAffects ( u, percentage );
		if (!stat) {stat.perror("attributeAffects"); return stat;}
    stat = attributeAffects ( normalizedU, percentage );
		if (!stat) {stat.perror("attributeAffects"); return stat;}

   

   return MS::kSuccess;
}
Ejemplo n.º 20
0
MStatus LSystemNode::initialize()
{
        MFnUnitAttribute unitAttr;
        MFnTypedAttribute typedAttr;
		MFnNumericAttribute numericAttr;

        MStatus returnStatus;
		//(i)angle
		LSystemNode::angle = numericAttr.create("angle","ag",MFnNumericData::kDouble,90.0,&returnStatus);
		McheckErr(returnStatus, "ERROR creating LSystemNode angle attribute\n");
		//(ii)size
		step = numericAttr.create("step","st",MFnNumericData::kDouble,1.0, &returnStatus);
		McheckErr(returnStatus, "ERROR creating LSystemNode step attribute\n");//(iv)time
        //(iii)grammar
		LSystemNode::grammar = typedAttr.create( "grammar", "grm", MFnData::kString, &returnStatus );
		McheckErr(returnStatus, "ERROR creating LSystemNode grammar attribute\n");
		//(iv)time
		LSystemNode::time = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 0.0, &returnStatus );
        McheckErr(returnStatus, "ERROR creating LSystemNode time attribute\n");
		//(v)output
        LSystemNode::outputMesh = typedAttr.create( "outputMesh", "out", MFnData::kMesh, &returnStatus ); 
        McheckErr(returnStatus, "ERROR creating LSystemNode output attribute\n");
        typedAttr.setStorable(false);


		//(i)angle
		returnStatus = addAttribute(LSystemNode::angle);
		McheckErr(returnStatus, "ERROR adding angle attribute\n");
		//(ii)step
		returnStatus = addAttribute(LSystemNode::step);
		McheckErr(returnStatus, "ERROR adding step attribute\n");
		//(iii)grammar
		returnStatus = addAttribute(LSystemNode::grammar);
		McheckErr(returnStatus, "ERROR adding grammar attribute\n");
		//(iv)time
        returnStatus = addAttribute(LSystemNode::time);
        McheckErr(returnStatus, "ERROR adding time attribute\n");
		//(v)output
        returnStatus = addAttribute(LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

		returnStatus = attributeAffects(LSystemNode::angle,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
		returnStatus = attributeAffects(LSystemNode::step,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
		returnStatus = attributeAffects(LSystemNode::grammar,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");
        returnStatus = attributeAffects(LSystemNode::time,LSystemNode::outputMesh);
        McheckErr(returnStatus, "ERROR in attributeAffects\n");

        return MS::kSuccess;
}
Ejemplo n.º 21
0
MStatus DynamicEnum::initialize()
{
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnStringData sData;
	MStatus status; // Status will be used to hold the MStatus value

	// returned by each api function call. It is important
	// to check the status returned by a call to aid in
	// debugging. Failed API calls can result in subtle
	// errors that can be difficult to track down, you may
	// wish to use the CHECK_MSTATUS macro for any API
	// call where you do not need to provide your own
	// error handling.
	//

	// Attribute Initialization:
	aFilePath = tAttr.create( "filepath", "file", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aGridName = tAttr.create( "grid", "grd", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aOutColor = nAttr.createColor( "outColor", "oc", &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( nAttr.setHidden( false ) );
	CHECK_MSTATUS( nAttr.setReadable( true ) );
	CHECK_MSTATUS( nAttr.setWritable( false ) );

	// Next we will add the attributes we have defined to the node
	//
	CHECK_MSTATUS( addAttribute( aFilePath ) );
	CHECK_MSTATUS( addAttribute( aGridName ) );
	CHECK_MSTATUS( addAttribute( aOutColor ) );

	// The attributeAffects() method is used to indicate when the input
	// attribute affects the output attribute. This knowledge allows Maya
	// to optimize dependencies in the graph in more complex nodes where
	// there may be several inputs and outputs, but not all the inputs
	// affect all the outputs.
	//
	CHECK_MSTATUS( attributeAffects( aFilePath, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aGridName, aOutColor ) );

	return( MS::kSuccess );
}
Ejemplo n.º 22
0
MStatus multiCurve::initialize()
{
	MStatus				stat;
	MFnNumericAttribute	nAttr;
	MFnTypedAttribute	typedAttr;
	
	numCurves = nAttr.create ("numCurves", "nc",
							  MFnNumericData::kLong, 5, &stat);
	PERRORfail(stat, "initialize create numCurves attribute");
	CHECK_MSTATUS ( nAttr.setKeyable( true ) );
	stat = addAttribute( numCurves );
	PERRORfail(stat, "addAttribute(numCurves)");
	
	curveOffset = nAttr.create ("curveOffset", "co",
							  MFnNumericData::kDouble, 1.0, &stat);
	PERRORfail(stat, "initialize create curveOffset attribute");
	CHECK_MSTATUS ( nAttr.setKeyable( true ) );
	stat = addAttribute( curveOffset );
	PERRORfail(stat, "addAttribute(curveOffset)");

	inputCurve = typedAttr.create( "inputCurve", "ic",
								   MFnNurbsCurveData::kNurbsCurve, &stat );
	PERRORfail(stat, "initialize create inputCurve attribute");
	CHECK_MSTATUS ( typedAttr.setReadable( false ) );
	CHECK_MSTATUS ( typedAttr.setWritable( true ) );
	stat = addAttribute( inputCurve );
	PERRORfail(stat, "addAttribute(inputCurve)");
	
	outputCurves = typedAttr.create( "outputCurves", "oc",
									 MFnNurbsCurveData::kNurbsCurve, &stat );
	PERRORfail(stat, "initialize create outputCurves attribute");
	CHECK_MSTATUS ( typedAttr.setArray( true ) );
	CHECK_MSTATUS ( typedAttr.setReadable( true ) );
	CHECK_MSTATUS ( typedAttr.setWritable( false ) );
	CHECK_MSTATUS ( typedAttr.setUsesArrayDataBuilder( true ) );
	stat = addAttribute( outputCurves );
	PERRORfail(stat, "addAttribute(outputCurves)");

	stat = attributeAffects( numCurves, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	stat = attributeAffects( curveOffset, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	stat = attributeAffects( inputCurve, outputCurves );
	PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");

	return stat;
}
Ejemplo n.º 23
0
//
// DESCRIPTION:
///////////////////////////////////////////////////////
MStatus DispNode::initialize()
{
	MFnNumericAttribute nAttr; 

	// Inputs
	aColor = nAttr.createColor( "color", "c" );
	CHECK_MSTATUS(nAttr.setKeyable(true));
	CHECK_MSTATUS(nAttr.setStorable(true));
	CHECK_MSTATUS(nAttr.setDefault(1.0f, 1.0f, 1.0f));

	aInputValue = nAttr.create( "factor", "f", MFnNumericData::kFloat);
	CHECK_MSTATUS(nAttr.setKeyable(true));
	CHECK_MSTATUS(nAttr.setStorable(true));
    CHECK_MSTATUS(nAttr.setDefault(1.0f));

	// Outputs

    aOutColor  = nAttr.createColor( "outColor", "oc" );
    CHECK_MSTATUS(nAttr.setStorable(false));
    CHECK_MSTATUS(nAttr.setHidden(false));
    CHECK_MSTATUS(nAttr.setReadable(true));
    CHECK_MSTATUS(nAttr.setWritable(false));

    aOutTransparency  = nAttr.createColor( "outTransparency", "ot" );
    CHECK_MSTATUS(nAttr.setStorable(false));
    CHECK_MSTATUS(nAttr.setHidden(false));
    CHECK_MSTATUS(nAttr.setReadable(true));
    CHECK_MSTATUS(nAttr.setWritable(false));

    aOutDisplacement = nAttr.create( "displacement", "od", 
									 MFnNumericData::kFloat);
    CHECK_MSTATUS(nAttr.setStorable(false));
    CHECK_MSTATUS(nAttr.setHidden(false));
    CHECK_MSTATUS(nAttr.setReadable(true));
    CHECK_MSTATUS(nAttr.setWritable(false));


    CHECK_MSTATUS(addAttribute(aColor));
    CHECK_MSTATUS(addAttribute(aInputValue));
    CHECK_MSTATUS(addAttribute(aOutColor));
    CHECK_MSTATUS(addAttribute(aOutTransparency));
    CHECK_MSTATUS(addAttribute(aOutDisplacement));

    CHECK_MSTATUS(attributeAffects (aColor, aOutColor));
    CHECK_MSTATUS(attributeAffects (aColor, aOutDisplacement));

    return MS::kSuccess;
}
Ejemplo n.º 24
0
//
// DESCRIPTION:
///////////////////////////////////////////////////////
MStatus depthShader::initialize()
{
    MFnNumericAttribute nAttr;

    // Create input attributes

	aColorNear = nAttr.createColor("color", "c");
	MAKE_INPUT(nAttr);
    CHECK_MSTATUS(nAttr.setDefault(0., 1., 0.));			// Green

	aColorFar = nAttr.createColor("colorFar", "cf");
	MAKE_INPUT(nAttr);
    CHECK_MSTATUS(nAttr.setDefault(0., 0., 1.));			// Blue

    aNear = nAttr.create("near", "n", MFnNumericData::kFloat);
	MAKE_INPUT(nAttr);
    CHECK_MSTATUS(nAttr.setMin(0.0f));
	CHECK_MSTATUS(nAttr.setSoftMax(1000.0f));

    aFar = nAttr.create("far", "f", MFnNumericData::kFloat);
	MAKE_INPUT(nAttr);
    CHECK_MSTATUS(nAttr.setMin(0.0f));
	CHECK_MSTATUS(nAttr.setSoftMax(1000.0f));
    CHECK_MSTATUS(nAttr.setDefault(2.0f));

    aPointCamera = nAttr.createPoint("pointCamera", "p");
	MAKE_INPUT(nAttr);
	CHECK_MSTATUS(nAttr.setHidden(true));

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

    CHECK_MSTATUS(addAttribute(aColorNear));
    CHECK_MSTATUS(addAttribute(aColorFar));
    CHECK_MSTATUS(addAttribute(aNear) );
    CHECK_MSTATUS(addAttribute(aFar));
    CHECK_MSTATUS(addAttribute(aPointCamera));
    CHECK_MSTATUS(addAttribute(aOutColor));

    CHECK_MSTATUS(attributeAffects(aColorNear, aOutColor));
    CHECK_MSTATUS(attributeAffects(aColorFar, aOutColor));
    CHECK_MSTATUS(attributeAffects(aNear, aOutColor));
    CHECK_MSTATUS(attributeAffects(aFar, aOutColor));
    CHECK_MSTATUS(attributeAffects(aPointCamera, aOutColor));

    return MS::kSuccess;
}
Ejemplo n.º 25
0
MStatus nailConstraintNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;

    ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status);
    MCHECKSTATUS(status, "creating inRigidBody attribute")
    status = addAttribute(ia_rigidBody);
    MCHECKSTATUS(status, "adding inRigidBody attribute")

    ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating damping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_damping);
    MCHECKSTATUS(status, "adding damping attribute")

    ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraint attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraint);
    MCHECKSTATUS(status, "adding ca_constraint attribute")

    ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraintParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraintParam);
    MCHECKSTATUS(status, "adding ca_constraintParam attribute")


    status = attributeAffects(ia_rigidBody, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)")

    status = attributeAffects(ia_rigidBody, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)")

    status = attributeAffects(ia_damping, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")

    return MS::kSuccess;
}
Ejemplo n.º 26
0
MStatus fullLoft::initialize()
{
	MStatus stat;
	MFnTypedAttribute typedAttr;
	
	inputCurve=typedAttr.create( "inputCurve", "in",
										 MFnNurbsCurveData::kNurbsCurve,
										 &stat );
	PERRORfail("initialize create input attribute");
	stat = typedAttr.setArray( true );
	PERRORfail("initialize set input attribute array");
	
	outputSurface=typedAttr.create( "outputSurface", "out",
											MFnNurbsSurfaceData::kNurbsSurface,
											&stat );
	PERRORfail("initialize create output attribute");
	stat = typedAttr.setStorable( false );
	PERRORfail("initialize set output attribute storable");

	stat = addAttribute( inputCurve );
	PERRORfail("addAttribute(inputCurve)");

	stat = addAttribute( outputSurface );
	PERRORfail("addAttribute(outputSurface)");

	stat = attributeAffects( inputCurve, outputSurface );
	PERRORfail("attributeAffects(inputCurve, outputSurface)");

	return MS::kSuccess;
}
Ejemplo n.º 27
0
MStatus animCube::initialize()
{
	MFnUnitAttribute unitAttr;
	MFnTypedAttribute typedAttr;

	MStatus returnStatus;

	animCube::time = unitAttr.create( "time", "tm",
										  MFnUnitAttribute::kTime,
										  0.0, &returnStatus );
	McheckErr(returnStatus, "ERROR creating animCube time attribute\n");


	animCube::outputMesh = typedAttr.create( "outputMesh", "out",
												 MFnData::kMesh,
												 &returnStatus ); 
	McheckErr(returnStatus, "ERROR creating animCube output attribute\n");
	typedAttr.setStorable(false);

	returnStatus = addAttribute(animCube::time);
	McheckErr(returnStatus, "ERROR adding time attribute\n");

	returnStatus = addAttribute(animCube::outputMesh);
	McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

	returnStatus = attributeAffects(animCube::time,
								    animCube::outputMesh);
	McheckErr(returnStatus, "ERROR in attributeAffects\n");

	return MS::kSuccess;
}
Ejemplo n.º 28
0
MStatus connectingNode::initialize()
{
	MFnTypedAttribute tAttr;
	MFnNumericAttribute nAttr;
	
	MStatus returnStatus;

	connectingNode::state=0;

	connectingNode::tmp=nAttr.create("tmp","t",MFnNumericData::kInt,0,&returnStatus);
	connectingNode::tmp1=nAttr.create("tmp1","t1",MFnNumericData::kInt,0,&returnStatus);
	connectingNode::index1=nAttr.create("index1","in1",MFnNumericData::kInt,-1,&returnStatus);
	connectingNode::index2=nAttr.create("index2","in2",MFnNumericData::kInt,-1,&returnStatus);
	connectingNode::trigger=nAttr.create("trigger","tri",MFnNumericData::kBoolean,true,&returnStatus);
	connectingNode::rootNumber=nAttr.create("rootNum","rN",MFnNumericData::kInt,0,&returnStatus);

	addAttribute(tmp);
	addAttribute(tmp1);
	addAttribute(index1);
	addAttribute(index2);
	addAttribute(trigger);
	addAttribute(rootNumber);

	attributeAffects(tmp1,tmp);

	return MS::kSuccess;
}
Ejemplo n.º 29
0
MStatus MocapMesh::initialize()
{
	MStatus stat;

	MFnTypedAttribute tAttr;
	MFnNumericAttribute nAttr;

	in_inMesh  = tAttr.create("inMesh", "im",MFnData::kMesh);
	tAttr.setKeyable(true);
	tAttr.setStorable(true);
	tAttr.setReadable(true);
	tAttr.setWritable(true);
	stat = addAttribute(in_inMesh);
	if(!stat) { stat.perror("adding inMesh"); return stat; }

	out_message  = nAttr.create("test", "test", MFnNumericData::kDouble, 0.0);
	nAttr.setKeyable(false);
	nAttr.setStorable(false);
	nAttr.setWritable(false);
	nAttr.setReadable(true);
	stat = addAttribute(out_message);
	if(!stat) { stat.perror("adding test"); return stat; }

	stat = attributeAffects(in_inMesh,out_message);
	if(!stat) { stat.perror("attributeAffects"); return stat; }
	return MS::kSuccess;
}
Ejemplo n.º 30
0
MStatus blindDataMesh::initialize()
{
	MFnTypedAttribute typedAttr;
	MStatus returnStatus;

	blindDataMesh::outputMesh = typedAttr.create( "outputMesh", "out",
		MFnData::kMesh, &returnStatus ); 
	McheckErr(returnStatus, "ERROR creating blindDataMesh output attribute\n");
	typedAttr.setStorable(false);

	returnStatus = addAttribute(blindDataMesh::outputMesh);
	McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");

	MFnNumericAttribute numAttr;
	blindDataMesh::seed = numAttr.create( "randomSeed", "seed",
		MFnNumericData::kLong, 0, &returnStatus );
	McheckErr(returnStatus, "ERROR creating blindDataMesh input attribute\n");

	returnStatus = addAttribute(blindDataMesh::seed);
	McheckErr(returnStatus, "ERROR adding input attribute\n");

	returnStatus = attributeAffects(blindDataMesh::seed,
								    blindDataMesh::outputMesh);
	McheckErr(returnStatus, "ERROR in attributeAffects\n");

	return MS::kSuccess;
}