babylon-runtime / _r

Code Less, Babylon More
https://babylon-runtime.github.io/
Apache License 2.0
8 stars 1 forks source link

Get objects above in hierarchy inside patch #23

Closed Vinc3r closed 4 years ago

Vinc3r commented 4 years ago

see: https://codesandbox.io/s/github/Vinc3r/codesandbox-project/tree/master/BabylonJS/_runtime/cycle-through-patches/bjs?fontsize=14&hidenavigation=1&module=%2Fcycling-through-meshes.patch&theme=dark

(embeded link for sharing issue)

repo on Github: https://github.com/Vinc3r/codesandbox-project/tree/master/BabylonJS/_runtime/cycle-through-patches/bjs

Take a look on cycling-through-meshes.patch >> be able to get current mesh in the albedoTexture function could be useful to automate texture assignation process (especially for lightmaps, with mesh name detection).

Vinc3r commented 4 years ago

weird, in local server both objects have their materials with new texture assigned, but on codesandbox it seems random

Vinc3r commented 4 years ago

I've update console.log to better see what happens. It seems on "material" level, we have the mesh name, but in case of submaterials we can't. I have also to try parsing "subMeshes", then "materials" in them, to see if it's work.

Vinc3r commented 4 years ago

I've update my github repo, so codesandbox is up to date too: on subMaterials level, when targetting a property (here albedoTexture), we still not getting our material but the subMaterials array


Note that codesandbox do not load the texture on the material case (subMesh asset in the scene), but in local webserver it's working:

    "*:mesh": {
        material: {
            "albedoTexture": function (var1, var2, var3) {
                return _r.load.texture("assets/checker.jpg");