We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Make Unique and independent copies of Objects

Home Forums Puzzles Make Unique and independent copies of Objects

  • This topic has 22 replies, 2 voices, and was last updated 1 year ago by kdv.
Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #68142
    David Duperron
    Customer

    @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:

    After modification:

    Hoping this is clear…?

    #68148
    kdv
    Participant

    And the reason why my objects where linked

    Linked by what? What do you want to do but can’t do? :scratch:

    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.

    #68149
    David Duperron
    Customer

    The 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…

    #68152
    David Duperron
    Customer

    Here 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.

    #68153
    kdv
    Participant

    zip. 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.

    #68157
    David Duperron
    Customer

    Oh 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.

    Attachments:
    You must be logged in to view attached files.
    #68161
    kdv
    Participant

    :unsure:

    https://v3d.net/piq

    A variant without assigning new materials to clones

    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.

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.