Three.js: Editor : How to handle the deletion of the material from Material Browser.

Created on 5 Jan 2020  路  13Comments  路  Source: mrdoob/three.js

I would like to start looking back in the material browser implementation's,
so i would like to pick up a scenario which is left to be handled.

I have added option to delete material from the material browser and fallback to default editor material.

That is logic that the library itself does not have; the library doesn't reuse a single material, it creates a random colored material if the user doesn't pass one.

I'm trying to make the editor reflect the library's logic so it serves to teach users how it works.

So, for now, I vote for not adding the DEFAULT_MATERIAL logic.

_Originally posted by @mrdoob in https://github.com/mrdoob/three.js/pull/17495#issuecomment-531590284_

Editor

Most helpful comment

Actually, I vote for removing the random color from the lib and always use white instead.

All 13 comments

Actually, I vote for removing the random color from the lib and always use white instead.

Yes, it's indeed better if the material's default color is always the same and thus deterministic 馃憤.

Actually, I vote for removing the random color from the lib and always use white instead.

Do you mean removing the Random Material and resuing a material or Just using one single color for every material thats created

Also whats the reason behing this

That is logic that the library itself does not have; the library doesn't reuse a single material, it creates a random colored material if the user doesn't pass one.

I'm trying to make the editor reflect the library's logic so it serves to teach users how it works.

I dont think thats what the editor reflects right now, coz it creates a new MeshStandardMaterial for everything that you add in the scene.

I think the idea the is the following:

  • If you add an object to the editor, it has its own material instance. Similar when creating let's say ten meshes in a loop like so: https://jsfiddle.net/jy63m5qp/
  • When a material is deleted, the editor should not fallback to a default material that might be shared with many other objects.
  • https://github.com/mrdoob/three.js/issues/18308#issuecomment-570919539 was implemented via #18325. It's better to use always the same material color rather than creating a random one. Notice that this change does not mean material sharing.

it creates a new MeshStandardMaterial for everything that you add in the scene.

Yes, if the editor should really reflect how the library works, it might be better to use the material default instance e.g.

https://github.com/mrdoob/three.js/blob/0abe06ef133b8ad38ba2e6c619a116d30de5c588/src/objects/Mesh.js#L50

rather than creating an instance of MeshStandardMaterial. Otherwise we should consider to replace MeshBasicMaterial with MeshStandardMaterial in the ctor of Mesh.

Hmm, maybe.

But I think the actual issue here is the idea of deleting a material. I don't think the we should have an option to delete a material.

Hmm, maybe.

But I think the actual issue here is the idea of deleting a material. I don't think the we should have an option to delete a material.

Do you prefer reusing the materials and repurposing them, if thats the case then i feel we should have a way to edit material properties by directly selecting the material through the material browser.

Currently user has to select a mesh in order to edit the material properties. this is not so intuitive

And I second this

Yes, if the editor should really reflect how the library works, it might be better to use the material default instance e.g.

Why do you want to delete a material?

Feels like what you want is to "reset" the material? Or create a new one?

I don't understand the use case.

Everytime an object is created or imported in the scene a new material is created, If i am reusing a a single material for all the objects in the scene then material browser has list of the unusued materials.

So the issue is that the list of materials might become too long and thus confusing during authoring since no materials are ever removed from the list, right?

yup
and also this list will be included in the json which is exported

So the issue is that the list of materials might become too long and thus confusing during authoring since no materials are ever removed from the list, right?

Exactly. The list currently doesn't update when a mesh gets deleted and/or a material is no longer used. The app should take care of it automatically.

and also this list will be included in the json which is exported

I don't think that's true.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jlaquinte picture jlaquinte  路  3Comments

konijn picture konijn  路  3Comments

Bandit picture Bandit  路  3Comments

zsitro picture zsitro  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments