Jump to content

material.diffuseTexture not defined? Also no typehinting with Typescript


Carharttguy
 Share

Recommended Posts

Hello

I have this situation:

I load a .obj file without a .mtl file and set the material manually this way:
68YSsFV.png

This works, but than, somewhere else in my code I try to get that mesh and set some material properties:
jZfoizC.png

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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:
uh3YvF6.png

And the red dotted line again, showing the error:
jnicUYo.png

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...