Maya API: MPlug.setValue wont update thru connections

Hey all,
I’m working on a data streamer in Maya API, so i have a socket reciving alot of data for different attributes and then i use MPlug.setValue() to apply it to the attributes i wish.

However, the locator i’m apply these values to are connected to other locators with regular connections and Set Driven keys, and these values do not update.

so i have two locators, A and B

translate X on A is connected to translate Y on B.
if i use the MPlug.SetValue and set the value of Translate X on A to 10, A will move 10 units, but B wont move at all.

This is the code i use to apply the values


void ApplyData(MStringArray lChannels, MStringArray lData, MFnDagNode &node)
{
	for(unsigned int i = 0; i < lChannels.length(); i++)
	{
		
		MString attrName = lChannels[i];
		MPlug attr = node.findPlug(attrName);
		float value = lData[i].asFloat();
		attr.setValue( value);

	}
}

so either i need to get a pointer to the connected nodes or ask maya to reevaluate the whole scene, the latter sounds like something i wouldn’t want to do.

You will probably need to set the value to dirty to cause B to be reevaluated.

~B)

Seemed like the problem was that the MPlug.SetValue() call has to be in the main thread for maya to continue the evaluation.

Small update:
Using the thread classes maya API provide(MThreadPool) i’ve been able to use the SetValue in another thread, but since these threads wont run in the background without totally freezing maya, im not totally happy yet.