SOLVED VariableChanged Struct is missing its maps?

Hello;

we recently established here that the message MSG_TRANSLATE_POINTS is no longer seriously in use.

I now tried to replace it by MSG_POLYGONS_CHANGED and MSG_POINTS_CHANGED, which both send a VariableChanged struct as data. My attempt looks like follows:

	if (type == MSG_POINTS_CHANGED)
	{	// ONLY sent in case of added or removed points, not when points get moved
		// This seems to trigger after a load/reload as well...?
		GePrint("MSG_POINTS_CHANGED"_s);
		VariableChanged* vc = (VariableChanged*)data;
		GePrint("Old->New Count: " + String::IntToString(vc->old_cnt) + " -> " + String::IntToString(vc->new_cnt));
		// vc->vc_flags = VC_SAFETY | VC_DONTCOPYDATA | VC_DONTCLEARDATA
		if (vc->map == nullptr)
		{
			GePrint("No map"_s);
		} else {
			// old_cnt determines the size of the mapping array
			// Entry i contains the new index for element i
			// This should allow us to remap all existing entries
			// All entries beyond old_cnt must be new
			// NOTOK is possible (removed elements?)
			for (Int32 i = 0; i < vc->old_cnt; i++)
			{
				if (vc->map[i] == NOTOK)
				{
					GePrint("Element dumped: " + String::IntToString(i));
				} else {
					GePrint("Element remapped: " + String::IntToString(i) + " to " + String::IntToString(vc->map[i]));
				}
			}
		}
	}

This code resides within the Message method within a tag that is used on a Point or Polygon object. And it works insofar as I get the message. And the old_cnt and new_cnt values are correct.

What's missing is the map. I get No map all the time, indicating that vc->map is a nullptr. That is the case for points and polygons alike, so I don't replicate the other code branch here, and it happens with any tool I tried (Delete, Add Point, Knife, Melt, Collapse, Dissolve, Subdivide, after that I lost interest in testing).

Without a map these messages are completely useless, as we can never find out which point or polygon has been deleted, or how the indices are moved. However, the documentation for VariableChanged tells us, This is used to keep for example point selections and vertex maps valid.

Is that message deprecated too? How are point selections really kept up to date internally?

Hi @Cairyn I just had a chat with the development team.

I can confirm your behavior, and the maps are still maintained for tools that still use the old modeling kernel (only a few).
There is no replacement since with the new modeling kernel this translation doesn't exist and it does work live without the need of any translation. To give you some idea with the previous modeling Kernel almost 70% of the time spend for a modeling operation was spent in maintaining such maps which is one of the reasons to drop it.

So I'm afraid there is nothing you can do for the moment.
Cheers,
Maxime.

@m_adam Thanks for the confirmation. So, if that message essentially doesn't exist any more, how do e.g. the selection tags update their indices when the object is modified? Are the tools now doing this directly?

(I do have the sinking feeling that this is just not possible any more with the normal SDK, and I would have to implement stuff like MAXON_OBSERVABLE from the "new API" for which I sadly can't find any accessible demo samples...)

The new modeling kernel design is completely different and yes this is somehow the tool that applies on the fly translation to the data that a mesh is carrying.
What you see (a PolygonObject/VertexMap) is still the old modeling kernel (aka old data structure).
When a modeling operation occurs, there is always conversion:
From the old mesh data structure to new one -> Modeling Operation -> Translation from new to old one(aka recreate a PolygonObject and set correct data in the vertex map).

Unfortunately, the new Modeling kernel being not public I can't disclosure more, and I can't give any timestamp of when this modeling kernel will be public.

Unfortunately, there is for the moment no MAXON_ONVSERVABLE you can hook into.
But if you want more documentation about MAXON_OBSERVABLE I warmly recommend you to read Observable.

Cheers,
Maxime.

@m_adam MAXON_OBSERVABLE was just a guess from my side; I am still missing a lot of basic knowledge on the new core. At the moment, I wouldn't even dare to develop anything using the new concepts; I find the docs on the whole thing rather inaccessible. More high-level concepts and basic samples are definitely needed.

This post is deleted!

TEST TEST forbidden to post?

No, it's not 😉

I find the docs on the whole thing rather inaccessible. More high-level concepts and basic samples are definitely needed.

We are aware of this and working towards providing more Aboutness, what you call high-level concepts, for the maxon API documentation. So, to explain things in more commonly understood concepts. But we are just at the beginning of carrying this out and it is a very labor intensive task, so please do not expect immediate results. But we are very much aware of that information need of our users.

@ferdinand said in VariableChanged Struct is missing its maps?:

TEST TEST forbidden to post?

No, it's not

Sorry, that's the message from the system that I got in the other thread, repeatedly. So I tried it here, and it posted without difficulty. Then I tried in the other thread again, and it worked. Then I deleted all these postings. But as the original message that I tried to post was lost to the error, I didn't bother to write it again.

Quite strange error, haven't seen it before, and it didn't come with any explanation WHY it was forbidden to post.