Carharttguy Posted August 8, 2017 Share Posted August 8, 2017 Hello I have this situation: I load a .obj file without a .mtl file and set the material manually this way: This works, but than, somewhere else in my code I try to get that mesh and set some material properties: As you can see, I get an error on the material.diffuseTexture property. I thought it maybe was an error with the .d.ts file in Typescript, but the Javascript console also throws this error. How is it possible that material.diffuseTexture is not found? Edit: Other material properties do actually work, the .wireframe boolean works as expected. Thanks Quote Link to comment Share on other sites More sharing options...
JohnK Posted August 8, 2017 Share Posted August 8, 2017 24 minutes ago, Carharttguy said: As you can see, I get an error on the material.diffuseTexture property Error not shown in post. What error messages do you get in the console? When logged in the console what value do you get for params[2] ? If this is param[2] is correct url check console to see if it has loaded. Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted August 8, 2017 Author Share Posted August 8, 2017 1 hour ago, JohnK said: Error not shown in post. What error messages do you get in the console? When logged in the console what value do you get for params[2] ? If this is param[2] is correct url check console to see if it has loaded. Hi JohnK I meant you can see the red dotted line under diffuseTexture in my code. params[2] is something like this: /ED045E97A673F1D9F637F2198E3FB64C885940EE/files/0947-8748-9565-6312-6800/chest.png This may look like an odd value, but is a correct path. But it never gets loaded, because EntityToTexture.material.diffuseTexture.dispose() doesn't get called in the first place, because material.diffuseTexture isn't found. I get the same problem when I just try to define a new material like this: See the code hinting: And the red dotted line again, showing the error: Really weird, looks like my BJS install is missing this bit. Edit: I redownloaded babylon.2.5.js, babylon.max.2.5.js and babylon.2.5.d.ts and the problem is still there. Even downloaded BJS 3.0 but the problem persists (and I have other breaking changes) Final edit: After replacing every babylonjs file it did actually WORK! But the codehinting is not working and I still see the red dotted line saying 'diffuseTexture property not found on Material", but the texture loads and everything is ok. What could be wrong with the codehinting? Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 8, 2017 Share Posted August 8, 2017 diffuseTexture can only be found in StandardMaterial, and not in Material. Carharttguy 1 Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted August 8, 2017 Author Share Posted August 8, 2017 @Temechon, that's it. Stupid of me. Again a lifesaver, you are. For future reference, I changed the code to: And this works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.