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.

version 3.2 -> 3.3 or 3.4 Migration Issue (app.materials array -> object)

Home Forums General Questions version 3.2 -> 3.3 or 3.4 Migration Issue (app.materials array -> object)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34437
    eatdesignlove
    Participant

    I currently use Verge3d ver. 3.2 for my project by using javascript API not puzzle. The reason why I still use ver.3.2 is when I tried to migrate to ver. .3.3 I couldn’t do that smoothly since I found problem in app instance. When I open the materials key, there was no array but object.

    I has been waited for the improvement about the problem I mentioned above, but It didn’t go the way I expected even after releasing ver. 3.4.

    I compared code ver.3.2 and 3.4 and fortunately found differences of them. So I wonder if this is bug or your intention.
    Please refer to the attached code.

    If this difference is your intention, I wonder how I can get materials list of ver.3.3. or 3.4. If this is a bug, I hope it will be fixed for the next version.

    Attachments:
    You must be logged in to view attached files.
    #34455

    Hi,

    That was an intentional change. App.materials was deprecated because it was buggy and didn’t properly track all scene changes, like adding or removing materials. Also, that property wasn’t documented or recommended for use anyway.

    The code that you can see in the 3.4 version is just some backward compatibility measure for old puzzles logic scripts.

    If this difference is your intention, I wonder how I can get materials list of ver.3.3. or 3.4. If this is a bug, I hope it will be fixed for the next version.

    You can get the list of the materials currently used on the scene like this:

    
    var materials = [];
    app.scene.traverse(function(obj) {
        if (obj.material && materials.indexOf(obj.material) === -1) {
            materials.push(obj.material);
        }
    });
    

    Co-founder and lead developer at Soft8Soft.

    #34477
    eatdesignlove
    Participant

    Thank you, Ivan!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.