public override bool getInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { if (plug.equalEqual(aTransparency)) { dataHandle.set(fTransparency); return true; } return base.getInternalValueInContext(plug, dataHandle, ctx); }
public override bool setInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { if (plug.equalEqual(aTransparency)) { fTransparency = dataHandle.asDouble; setImageDirty(); return true; } return base.setInternalValueInContext(plug, dataHandle, ctx); }
public override void validateAndSetValue(MPlug plug, MDataHandle handle, MDGContext context) { // Make sure that there is something interesting to process. // if (plug.isNull) { throw new ArgumentNullException("plug"); } if (plug.equalEqual(aRockInX)) { MDataBlock block = _forceCache(context); MDataHandle blockHandle = block.outputValue(plug); // Update our new rock in x value double rockInX = handle.asDouble; blockHandle.set(rockInX); rockXValue = rockInX; // Update the custom transformation matrix to the // right rock value. rockingTransformCheckMatrix ltm = getRockingTransformMatrix(); if (ltm != null) { ltm.setRockInX(rockXValue); } else { MGlobal.displayError("Failed to get rock transform matrix"); } blockHandle.setClean(); // Mark the matrix as dirty so that DG information // will update. dirtyMatrix(); return; } base.validateAndSetValue(plug, handle, context); }
public override void validateAndSetValue(MPlug plug, MDataHandle handle, MDGContext context) { // Make sure that there is something interesting to process. // if (plug.isNull) throw new ArgumentNullException("plug"); if (plug.equalEqual(aRockInX)) { MDataBlock block = _forceCache(context); MDataHandle blockHandle = block.outputValue(plug); // Update our new rock in x value double rockInX = handle.asDouble; blockHandle.set(rockInX); rockXValue = rockInX; // Update the custom transformation matrix to the // right rock value. rockingTransformCheckMatrix ltm = getRockingTransformMatrix(); if (ltm != null) { ltm.setRockInX(rockXValue); } else { MGlobal.displayError("Failed to get rock transform matrix"); } blockHandle.setClean(); // Mark the matrix as dirty so that DG information // will update. dirtyMatrix(); return; } base.validateAndSetValue(plug, handle, context); }
public override bool getInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { if (plug.equalEqual(aTransparency)) { dataHandle.set(fTransparency); return(true); } return(base.getInternalValueInContext(plug, dataHandle, ctx)); }
public override bool setInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { if (plug.equalEqual(aTransparency)) { fTransparency = dataHandle.asDouble; setImageDirty(); return(true); } return(base.setInternalValueInContext(plug, dataHandle, ctx)); }
// // Calls applyRotationLocks && applyRotationLimits // This method verifies that the passed value can be set on the // rotate plugs. In the base class, limits as well as locking are // checked by this method. // // The compute, validateAndSetValue, and rotateTo functions // all use this method. // protected override void checkAndSetRotation(MDataBlock block, MPlug plug, MEulerRotation newRotation, MSpace.Space space) { MDGContext context = block.context; updateMatrixAttrs(context); MEulerRotation outRotation = newRotation; if (context.isNormal) { // For easy reading. // MPxTransformationMatrix xformMat = baseTransformationMatrix; // Get the current translation in transform space for // clamping and locking. // MEulerRotation savedRotation = xformMat.eulerRotation(MSpace.Space.kTransform); // Translate to transform space, since the limit test needs the // values in transform space. The locking test needs the values // in the same space as the savedR value - which is transform // space as well. // baseTransformationMatrix.rotateTo(newRotation, space); outRotation = xformMat.eulerRotation(MSpace.Space.kTransform); // Now that everything is in the same space, apply limits // and change the value to adhere to plug locking. // outRotation = applyRotationLimits(outRotation, block); outRotation = applyRotationLocks(outRotation, savedRotation); // The value that remain is in transform space. // xformMat.rotateTo(outRotation, MSpace.Space.kTransform); // Get the value that was just set. It needs to be in transform // space since it is used to set the datablock values at the // end of this method. Getting the vaolue right before setting // ensures that the transformation matrix and data block will // be synchronized. // outRotation = xformMat.eulerRotation(MSpace.Space.kTransform); } else { // Get the rotation for clamping and locking. This will get the // rotate value in transform space. // double[] s3 = block.inputValue(rotate).Double3; MEulerRotation savedRotation = new MEulerRotation(s3[0], s3[1], s3[2]); // Create a local transformation matrix for non-normal context // calculations. // MPxTransformationMatrix local = createTransformationMatrix(); if (null == local) { throw new InvalidOperationException("rockingTransformCheck::checkAndSetRotation internal error"); } // Fill the newly created transformation matrix. // computeLocalTransformation(local, block); // Translate the values to transform space. This will allow the // limit and locking tests to work properly. // local.rotateTo(newRotation, space); outRotation = local.eulerRotation(MSpace.Space.kTransform); // Apply limits // outRotation = applyRotationLimits(outRotation, block); outRotation = applyRotationLocks(outRotation, savedRotation); local.rotateTo(outRotation, MSpace.Space.kTransform); // Get the rotate value in transform space for placement in the // data block. // outRotation = local.eulerRotation(MSpace.Space.kTransform); local.Dispose(); } MDataHandle handle = block.outputValue(plug); if (plug.equalEqual(rotate)) { handle.set(outRotation.x, outRotation.y, outRotation.z); } else if (plug.equalEqual(rotateX)) { handle.set(outRotation.x); } else if (plug.equalEqual(rotateY)) { handle.set(outRotation.y); } else { handle.set(outRotation.z); } return; }
public override bool setInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { MGlobal.displayInfo("testHLSLShader::setInternalValueInContext"); return(base.setInternalValueInContext(plug, dataHandle, ctx)); }
public override bool setInternalValueInContext(MPlug plug, MDataHandle dataHandle, MDGContext ctx) { MGlobal.displayInfo("testHLSLShader::setInternalValueInContext"); return base.setInternalValueInContext(plug, dataHandle, ctx); }