Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp material editing on the importer dialog #7238

Open
reduz opened this issue Jul 8, 2023 · 7 comments
Open

Revamp material editing on the importer dialog #7238

reduz opened this issue Jul 8, 2023 · 7 comments

Comments

@reduz
Copy link
Member

reduz commented Jul 8, 2023

Describe the project you are working on

Godot

Describe the problem or limitation you are having in your project

The long standing problem with 3D in Godot has been the difficulty of editing 3D materials for imported scenes. While there are many ways to do this, most of them has been significantly annoying and don't work smoothly in all workflows.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The idea here is to significantly improve the 3D asset importer to make material assigning and simple material editing possible in those scenes.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Here is a mockup how how the new 3D asset importer dialog will look like:

image

The idea is to have a simplified view of the 3D viewport made exclusively to select and assign materials and edit imported objects easily. The tool icons are as follows:

  • Select on click
  • Display list of items to select on area clicked (from front to back)

  • Select Object Mode
  • Select Mesh Mode
  • Select Material Mode

  • Toggle material preview (toggles preview between edited materials and previous materials). Currently you can't see the materials you have overriden in the 3D asset importer. The new importer will show you those changes by default but it will let you toggle their preview on and off.

  • Preview sun
  • Preview environment
  • Preview settings (these are the same as 3D editor viewport)

  • Batch commands (same as the Actions.. menu currently)

Additionally, you can see some changes in the mesh inspector:

  • Ability to override materials per surface. When you edit a material currently, you edit it for all instances of this material. This lets you override this with another.
  • Ability to do limited editing of the overriden material. This material can be external or built-in, same as with the regular Godot inspector, and allows limited editing (it won't go into sub-resources, so if you want to edit a visual shader or materials in more complexity, you will need to save an external material and edit it later in the regular editor).

Editing Materials

When editing materials (inspected) the user interface will also be a bit different:

image

When you click "enable", we will need to do a small custom logic here with a dialog: It will ask you if you want to select an existing one (file dialog) or customize the one that came with the scene. If you pick customize, a copy of the existing material will be created for you to edit, so the dialog will tell you that further changes to the original material will no longer be tracked (and your customization used instead) until you disable this checkbox.

As mentioned before also, you will be able to do limited material editing directly in the inspector (assigning textures, etc).

FAQ

Q: Why is this type of editing not happening in the Godot main editor itself, like in other engines such as Unity?
A: Godot editor is extremely data driven, meaning what you see is what you get. It does not hide much of what's going on under the hood. This is why the importer dialog and the inspector are two separate things. This is done with the belief that its much less confusing for developers to learn how Godot actually works in a transparent way (and it also makes development and the entire codebase much simpler). That said, for this specific case, I believe that having a dedicated UI for this task, which can be very time consuming, is better in the long term.

Q: Where will the customized built-in materials be saved?
A: Inside the '.import' file next to your asset.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

N/A

@JonqsGames
Copy link

Like the idea, that would be usefull for me especially when prototyping and just want to change color on the fly for tests.
Related to that, could we have a dedicated node type for imported model root node ? This node could expose a lot of the parameter available in importer but for the local instance.

@reduz
Copy link
Member Author

reduz commented Jul 8, 2023

@JonqsGames You can already override everything in the local instances in Godot.

@HotHead007
Copy link

But .import file is excluded in version control so it will cause problems right?
Can't we place it in the same folder as the model?

@Kemeros
Copy link

Kemeros commented Jul 9, 2023

But .import file is excluded in version control so it will cause problems right? Can't we place it in the same folder as the model?

@HotHead007

The .import FILES are in the same folder as your asset files and contain important meta data that must be kept in your repo. Look here for more info.

The .import FOLDER, if i am not mistaken, has changed name. It is now named .godot in Godot 4. It needs to be added in your .gitignore file as it should not be in your repo.

That being said.

Q: Where will the customized built-in materials be saved?
A: Inside the '.import' file.

I'm also confused by that part of the Q&A.

@reduz Are we talking about the .godot folder or the .import file of the imported scene? I'm guessing you mean adding new meta data in the .import file? Otherwise the data would indeed be lost if put inside .godot.

@reduz
Copy link
Member Author

reduz commented Jul 9, 2023

@Kemeros I never mentioned the Godot folder, this is the .import file next to your asset. Will clarify in the OP regardless.

@rick551a
Copy link

rick551a commented Jul 9, 2023

Sadly, making materials shared between models (for example low poly) is now more time-consuming:

See my troubles here: godotengine/godot#79040

@reduz
Copy link
Member Author

reduz commented Jul 10, 2023

@rick551a Just do not use GLTF embedded.

reduz added a commit to reduz/godot that referenced this issue Jan 26, 2024
Implements [7238](godotengine/godot-proposals#7238) (for the most part).

* Ability to select nodes, meshes or materials by clicking.
* Moved mesh/material previews to the inspector area.
* Ability to override materials and edit them directly in the inspector.
* By default, shows overridden materials in the imported scene, with a button to disable them and show original materials.
* Keeps compatibility with the old override format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants