Skip to content

Show shader editor on shader compilation error#112954

Open
TheDying0fLight wants to merge 1 commit into
godotengine:masterfrom
TheDying0fLight:on-shader-error-show-shader-editor
Open

Show shader editor on shader compilation error#112954
TheDying0fLight wants to merge 1 commit into
godotengine:masterfrom
TheDying0fLight:on-shader-error-show-shader-editor

Conversation

@TheDying0fLight

@TheDying0fLight TheDying0fLight commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Goals:

What I tested:

  • Shader types:
    • Canvas item
    • Spatial
  • Renderer:
    • Forward
    • Mobile
    • Compatibility

Note: I also edited _meta_clicked which is not directly related to the issue but I used that code for inspiration and found it to cause errors when opening shader files and replaced it with my solution. If unwanted I will revert this and can open an extra PR.

@TheDying0fLight

This comment was marked as outdated.

Comment thread servers/rendering/shader_compiler.cpp Outdated
Comment thread servers/rendering/shader_language.cpp
Comment thread servers/rendering/shader_compiler.cpp Outdated
Comment thread editor/debugger/editor_debugger_node.cpp Outdated
@TheDying0fLight

This comment was marked as outdated.

@Chaosus Chaosus added this to the 4.x milestone Nov 21, 2025
@TheDying0fLight
TheDying0fLight marked this pull request as ready for review November 24, 2025 16:40
@TheDying0fLight
TheDying0fLight requested review from a team as code owners November 24, 2025 16:40
@TheDying0fLight
TheDying0fLight requested a review from a team November 24, 2025 16:40
@TheDying0fLight

This comment was marked as outdated.

Comment thread editor/shader/shader_editor_plugin.cpp Outdated
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 8ab246f to 1b21548 Compare February 12, 2026 09:30
@TheDying0fLight
TheDying0fLight requested a review from a team as a code owner February 12, 2026 09:30
Comment thread core/debugger/debugger_marshalls.cpp Outdated

@KoBeWi KoBeWi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work correctly.
The debugger changes need review from someone more familiar with the debugger.

Comment on lines +571 to +572
ScriptEditorPlugin *script_editor = Object::cast_to<ScriptEditorPlugin>(EditorNode::get_editor_data().get_editor_by_name("Script"));
ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_editor_data().get_editor_by_name("Shader"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super hacky. Ideally these plugins should have exposed singletons.
Alternatively, it would be better if you at least fetched the plugins once, e.g. in NOTIFICATION_READY. And also add ERR_FAIL_NULL/DEV_ASSERT to check if they exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added singletons to the plugin classes.

Also I was wondering, this is used in a similar way in other locations. What is the difference or should they also be changed?

ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_editor_data().get_editor_by_name("Shader"));

ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_editor_data().get_editor_by_name("Shader"));

Comment on lines +565 to +566
InspectorDock::get_singleton()->edit_resource(res);
// If no line is specified, only open the file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editing something in the inspector does not open the relevant editor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this line the editor does not switch to the Shader Editor. I tried this by being on the Output dock and reloading the project with a broken shader attached to a node in a open scene. But I just found out that this basically just calls EditorNode::get_singleton()->push_item(res.ptr()) which also works. I will use that instead

@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from bdb1eba to 2f9d4ef Compare February 12, 2026 14:48
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 1f1fb4e to 885b391 Compare March 5, 2026 07:39
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 885b391 to 8263575 Compare April 20, 2026 18:39
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 8263575 to 9c2d8ab Compare May 9, 2026 07:15
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 9c2d8ab to d36bf47 Compare July 23, 2026 11:25
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from d36bf47 to 1d8c848 Compare July 23, 2026 12:39
@TheDying0fLight
TheDying0fLight force-pushed the on-shader-error-show-shader-editor branch from 1d8c848 to a9fe1ab Compare July 23, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shader editor should be shown when shader compilation error is raised

4 participants