[Solved]Can't replace texture at material slot.

27 September 2018 13:32
HI, devs.
I want to know how to replace texture in material and material slot at runtime.

I want to replace texture assign on texture node(include material slot).
I use this code now.

var Obj= m_scenes.get_object_by_name("Object");
        var image = new Image();
        image.onload = function() {
            m_tex.replace_image(Obj, "environment", image);
        image.src = TEX_ASSETS_PATH + "new Texture...";

This code isn't complitly working.
This source unable to override material slot data. That is only overriding texture path to assigned material.
I want to replace all the material environment texture node on a selected object.
What should I do?
28 September 2018 13:29
Finally, I figure out a solution.
I have to drop off that approach.

First We shouldn't use m_tex when using much texture at each material.
That behavior is able to only replace texture on assign material without inside material slot.

If you want to replaced texture at materials (include mt on material slot) you should use only a material.
When I tried that My problem disappears.
Please register or log in to leave a reply.