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.

Passing Custom Property from Blender to V3D Scene?

Home Forums Programming Passing Custom Property from Blender to V3D Scene?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1916
    jem
    Customer

    I am looking for a method to pass custom metadata about an object from the Blender file to the Verge3D scene. A method like this could be used to embed data such as the price, weight or other physical attributes of a real-world object in its 3D representation. I did not see an easy way to do this.

    The V3D Object3D base class does contain an object called .userData that can store custom JSON data about the 3D object. I can populate this data programmatically, but I cannot set it from Blender.

    Is there any way to achieve what I am looking for in the current build of Verge3D (1.05)? Any ideas would be appreciated.

    Thank you,
    Jem

    Jeremy Wernick

    #1923

    Hi Jem,

    User-defined data can be exported and accessed as follows:

    1. Create and set a property in Blender
    2. Select Export Extras in the export options (on the left toolbox) upon exporting to glTF
    3. Then your property should appear in .userData
    var obj = v3dApp.scene.getObjectByName(“Cube”);
    obj.userData.myprop // e.g. 123

    We should definitely describe this in the manual.

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

    Chief 3D Verger | LinkedIn | Twitter

    #1931
    jem
    Customer

    I just tested the technique that you described. It works perfectly! This feature is excellent and useful. :good:
    Thanks,
    Jem

    Jeremy Wernick

    #1944

    you’re welcome! :)

    Chief 3D Verger | LinkedIn | Twitter

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