- This topic has 22 replies, 2 voices, and was last updated 1 year ago by kdv.
-
AuthorPosts
-
2023-11-02 at 8:53 am #68142David DuperronCustomer
@kdv77kdv
I found something quite odd but interesting, that is apparently not in line with what you mentionned here:They don’t work at all. You can read them, you can change them, but that’s all.
The “Userdata/CustomProps” dictionnary which is part of the Object3D javascript object IS changed when I manipulate my Object with puzzles, even if I do not explicitely tell my application to write the data in the object’s dictionnary.
In other words, in my Application, I create from scratch a custom dictionnary (addedObjectsDictionnary) where I import a blender created CustomProps dictionnary, name it with a new unique ID. This dictionnary is updated when I make modifications on my object (color, position, rotation, etc…), but for some reason, the “Userdata/CustomProps” dictionnary inside the 3D object is also changed!
And the reason why my objects where linked previously (I guess!) was that I did not make the “import customprops” step and simply duplicated my puzzle created dictionnary and asigned a new UID. But inside the 3D object they were still linked.
Here are two screenshots of the console log for one of my objects before and after a modification (obtained with getObjectByName, no other manipulation). And as I said, I never explicitely tell my application to write something in the Object3D object…
Before:
Hoping this is clear…?
2023-11-02 at 12:58 pm #68148kdvParticipantAnd the reason why my objects where linked
Linked by what? What do you want to do but can’t do?
By default objects from appended scenes are linked with nothing. They are absolutely different objects having the same names and names of their materials. For that reason you can’t click/drag them independently until you change their names to unique ones. The same is with their materials:
set color
/replace texture
will make changes in all found materials having the same name. Puzzles work with names only.Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2023-11-02 at 1:13 pm #68149David DuperronCustomerThe objects DO HAVE independant and unique names, as well as their materials. I was able to change the colors, positions, scale, etc… independently, but as soon as I wanted to WRITE these data in my dictionnary, these parameters are “synchronized” if I do not create a new set of customProps… I’ll try to make a simple demo of this particular behaviour, it should me much simplier…
2023-11-02 at 3:00 pm #68152David DuperronCustomerHere is a simple demo showing the behaviour I do not understand:
Clone demo
Several keyborad inputs will trigger the following steps:-
“M” will append a simple cube, add its custom properties (defined in blender) as a new entry in the addedObjectsDictionnary and give it a named material, and a color according to the imported property
“N” will duplicate and rename the first appended cube, move it and COPY the first cube’s key in the addedObjectsDictionnary, as a new key, named after the second cube: duplicate_cube1.
“O” will again duplicate the first cube, rename it duplicate_cube2, move it, and this time, re-import the custom properties to define the new key in addedObjectsDictionnary.
“P” will lastly change the color for duplicate_cube1, and store the new color in the dictionnary for that key.But you will see that in the dictionnary, the color has changed for both appended_cube AND duplicate_cube1! How is that possible??
A click on the object prints the Object3D javascript object in the console.2023-11-02 at 3:10 pm #68153kdvParticipantzip. puzzles.
But you will see that in the dictionnary, the color has changed for both appended_cube AND duplicate_cube1!
No. I see that visually color changes for one cube but in custom props the new value appears only for the first appended cube. And I would say that’s not correct. Some mistake in your logic…
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2023-11-02 at 3:22 pm #68157David DuperronCustomerOh yes sorry. here is the zipped project:
I agree! but if you log the object “addedObjectDictionnary” after all these operations, you will see that the color has changed for two objects whereas the puzzles should only change one of them.- This reply was modified 1 year ago by David Duperron.
Attachments:
You must be logged in to view attached files.2023-11-02 at 4:14 pm #68161kdvParticipant -
AuthorPosts
- You must be logged in to reply to this topic.