[Verse-dev] Bitmap layer ids

Emil Brink verse-dev@blender.org
Mon, 16 Aug 2004 17:41:18 +0200 (MEST)



On Mon, 16 Aug 2004, Marcus Hoffmann wrote:

> Eskil wrote:
>
> > if you call thees two commands:
> >
> > verse_send_g_layer_create(node_id, 2, "my_layer", VN_G_LAYER_VERTEX_XYZ,
> > 0, 0);
> > verse_send_g_layer_create(node_id, 2, "others_layer",
> > VN_G_LAYER_VERTEX_XYZ, 0, 0);
> >
> > This is fully legal to do, and it means you want to create a layer and
> > then rename it. If the user actually wanted to create two layers he or
> > she used the api in the wrong way. I would argue that in this case Verse
> > knows very well what it is doing because it is likely only to send the
> > later call in order to optimize the network usage since it knows that
> > the first will be over written by the second.
>
> This is hell for the server....

It seems to work fairly well in Eskil's reference server code, or at
least the code is not huge or so.

> How will i know the users intention?? What if he wants to create two
> layers???

The above example does not include timing information, so it's a bit
hard to parse. If both commands are to be emitted at once, then the
client needs to "fool" the event compression system by using differ-
ent IDs, as mentioned earlier. If the commands happen with "long"
time inbetween, then event compression won't be a problem and the
command will act as a rename. This sounds more complicated than it is
in practice.

> And the next thing: if you (the client) send a create command, its my (the
> servers) task to find a new id for it and send it back to the user. If your
> idea is to do the renaming (or maybe other changes too) with a create
> command, i have to search the hole id lists EVERY TIME to look if the
> client-sent ID is already existing or not!

Well... Yes, but since the address of the command includes only the
numerical ID, and not the name, this is a rather simple operation.
Since you, the server, are responsible for assigning layer IDs, and
they are assumed to be in 0,1,2,... order (this might need to be made
into a requirement by the spec), the "search" is supposed to be a
simple array look-up.

> And another thing: What if a second user that is creating offline a geometry
> using first his internal client IDs. Then he starts to upload the hole
> scene. And he has one or more layers with his internal IDs that correspond
> to IDs on the server.......

Hm.. If you create data intended for Verse offline, then of course
you must use some kind of mapping scheme between whatever layer IDs
you need in the static (offline) data and the ones assigned to the
layers by the server once the data "goes live". The "VNF" simplistic
file format and loader tool used in Verse1 had a simple name-based
scheme for this.

> What I'm going to do now (in my current version of the server) is
> to ignore his IDs and give him new ones that are unique in my verse
> world. If I would look for existing IDs if a create command arrives
> this would end up in overwriting another geomtry!! So this is
> really a thing that has to be discussed i think!

Well, yes, this is the correct way to do it. I believe, after having
talked to Eskil a bit today, that I (too) was confused. All IDs are
server-assigned, *except* vertex and polygon IDs, which are pickable
by the client.

The ID in a layer (or node) creation command that comes from a client
is used to check if the layer already exists, in which case the
command becomes a rename (or possibly type-change, depending on the
node). If it does not exist, then the command is in fact a "true"
creation, and the server will create the layer and pick a new ID to
use in the subsequent notification to subscribers of the node.

I hope that further clears it up.

Regards,

/Emil