Maya API: My own mesh deformer node isn't "live" enough

I’ve built an MPxNode in maya 2009 API, (based of maya 2009 devkit’s SplitUVNode), which takes an input mesh, modifies its UVs, and outputs an output mesh.

I have a float value which affects how the UVs are modified when I change it.
So in the channel box, when i set the float value, the meshes UVs are changed.
However, my problem is that this isn’t “live” - as in, the change happens ONLY when i release the mouse from the float slider in the AttributeEditor/ChannelBox. This is different from, say, a bend deformer on a mesh which you can drag the Curvature slider and see results in maya dynamically before releasing the mouse.

When i drag my slider, I can see that my node’s float value is changing and that my node’s Compute() method is firing as I drag. But I dont see any changes in the UV Editor (which DO happen when I release the mouse, or type a number into the floatField)

I’m fairly sure everything is done “properly” with regards to the API, i.e. setting up input/output attributes, my mesh and float attributes have attributeAffects on my outputMesh. A hugely simplified psuedo-code version of my compute() method is as follows:



if (plug == outMesh)
{
  MDataHandle inputData = data.inputValue( inMesh, &status );
  MDataHandle inputDataFloat = data.inputValue( floatScaler, &status );
  MDataHandle outputData = data.outputValue( outMesh, &status );

  // Copy the inMesh to the outMesh, and now you can
  // perform operations in-place on the outMesh (from devkit code)
  outputData.set(inputData.asMesh());

  float scaler = inputDataFloat.asFloat();
  MObject mesh = outputData.asMesh();
  MFnMesh meshFn( mesh );

  for uv in uvs:
      # Do stuff with float scaler to modify uvs here. Details unimportant.Then set uvs:
      meshFn.setUV(uv);

  outputData.setClean();
}

Perhaps the UV Editor is not designed to refresh dynamically in this way? Any ideas?

You might want to try converting your MPxNode to a MPxDeformerNode and setting the deformation details in the post constructor like:


void yourDeformer::postConstructor()
{
    setDeformationDetails(MPxDeformerNode::kDeformsUVs);
}

Hopefully that helps!!

Tony

Good idea! I’ll give it a try whenever I get some spare R&D time

Edit: Damn. Looks like that guy only works for 2011 (not 2009)…