Jump to content

<mesh>.setEnabled() and .isEnabled() Useless


Pryme8
 Share

Recommended Posts

So if one can access mesh._enabled and can modify it directly what is the point of the setters and getters for it?

Why not just strip the _ and make mesh.enabled the standard?

so like mesh.enabled = <Boolean> vs <mesh>.setEnabled(<Boolean>);
and
mesh.enabled == ? vs <mesh>.isEnabled();

Seems redundant.
 

Link to comment
Share on other sites

you cannot access "mesh._enabled" if your  are programming in TypeScript.
its probably defined as "private" in  TypeScript.
unfortunately JavaScript does not have anything equivalent to make a property  private.
so the only thing  you can do is follow some convention like underscore to make the JavaScript programmer  aware they are accessing a private property  and let them know if they do so BABYLON cannot guarantee  proper behavior.

 

 

 

 

 

 

Link to comment
Share on other sites

@satguru

Oh, so the issue is actually that the library is written in TypeScript but OP writes in JavaScript, so he doesn't get the TS warnings while coding and sees the normal, public _mesh variable from the compiled code. I actually did not know that TypeScript private is compiled to public members instead of locally enclosed private variables.

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...