godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.98k stars 21.16k forks source link

Add more inspector Resource auto-conversions #55727

Open KoBeWi opened 2 years ago

KoBeWi commented 2 years ago

Godot version

3.4 / 4.0

System information

W10

Issue description

The inspector currently supports a couple of implicit conversions for resource fields, i.e. you can drop a different resource than the expected one and it will be automatically converted if possible.

The currently supported conversions are: Texture -> StandardMaterial3D (used as albedo_texture) FontData -> Font (DynamicFont in 3.x) Shader -> ShaderMaterial Image -> ImageTexture

We could add more such conversions. The most obvious one missing is Image -> Image texture. Any more ideas about what could also be converted this way?

btw the conversions are very easy to add, check #41511 for example (the code moved to editor resource picker though).

Steps to reproduce

  1. Have Shader in your project
  2. Drop it onto material field in the inspector
  3. Wow it created ShaderMaterial
  4. We need more of this

Minimal reproduction project

No response

Calinou commented 2 years ago

Would drag-and-dropping a Texture onto a Mesh resource slot be appropriate to create a transparent billboarded QuadMesh with albedo texture assigned automatically? This would speed up the creation of particles in 3D.

KoBeWi commented 2 years ago

The problem is that the current conversions are universal, while the one you mention is useful particularly for 3D particles. We could expand the conversions to be context-aware (e.g. in this case it would only work for a specific property in 3D particles), but that's out of scope of this issue and would need to be editor-only (EditorResourcePicker can be used in plugins).