Notifications
Clear all

[Closed] [SDK] Paramblock messages

Here’s a more complete outline of the problem.

When tyFlow gets a REFMSG_CHANGE/PART_ALL from an input object, it resets the cache and recomputes the sim.

Input objects can be all kinds of things, but also various tyFlow-related helpers (tyWind, tyIcon, etc).

Those helpers have aesthetic properties that only affect their viewport display (display icon, icon size, etc).

Currently, if a user disables one of the aesthetic properties, the helper’s pblock will send a notification with REFMSG_CHANGE/PART_ALL, which will be received by tyFlow and the sim will reset. But that behavior is very unnecessary and inefficient, as those aesthetic params shouldn’t cause a cache reset on the flow since they have no effect on the simulation.

So I was hoping to be able to tag those params in the pblock definition with something that would be passed around the message system, so I could later filter out certain params from causing a sim reset.

yeah you can do that

in your NotifyRefChanged function of the helper

switch(msg)
{
	case REFMSG_CHANGE:

		if(htarg == pblock)
		{
			ParamID lastparam = pblock->LastNotifyParamID();	

			if(lastparam == show_icon_id)
			{
				GetCOREInterface()->ForceCompleteRedraw();  // you need to force redraw or nothing will happen
				return REF_STOP; 
			}

there may well be other/better ways to achieve this result but i’ll have to think about it

Not sure why that code would go in the helper NotifyRefChanged function…the helper is what’s changing, and it’s tyFlow that receives the message.

And I don’t see how that will work either way…the htarg will be my pblock, yes…but the id will simply be the id of the TYPE_INODE param containing the helper node. It won’t tell me which param of the helper node was changed…unless I’m misunderstanding your approach

it works I’ve tested it

the paramblock that’s changing is a reference target to the helper plugin so when the paramblock sends the message to it’s dependents it’s sent to the helper and then it’s sent to it’s dependents your tyflow. So when the helpers NotifyRefChanged recieves the message from it’s paramblock we can stop it in it’s tracks.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

What is the helper plugin? I think that extended IRefTargMonitor is enough, and it can override NotifyRefChanged
the same way. The good reference in SDK is RefTargMonitor or NotifyMgr.

Klvnk:

Oh shoot I didn’t think about the fact that the helper Object will receive the message before it’s sent further. Your approach makes sense now. I will give it a shot and report back.

Worked like a charm…thanks a lot!

Page 2 / 2