X Tutup
Skip to content

Organize toggle files button logic in shader editor#109998

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:shader-toggle-files-organize
Oct 24, 2025
Merged

Organize toggle files button logic in shader editor#109998
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:shader-toggle-files-organize

Conversation

@aaronfranke
Copy link
Member

In the current master, this code is in the toggle files panel case:

if (index != -1) {
	ERR_FAIL_INDEX(index, (int)edited_shaders.size());
	TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor);
	if (editor) {
		editor->get_code_editor()->update_toggle_files_button();
	} else {
		VisualShaderEditor *vs_editor = Object::cast_to<VisualShaderEditor>(edited_shaders[index].shader_editor);
		if (vs_editor) {
			vs_editor->update_toggle_files_button();
		}
	}
}

It's a bit disorganized for the main shader editor code to know about each language, when an abstract function will do:

if (index != -1) {
	ERR_FAIL_INDEX(index, (int)edited_shaders.size());
	ShaderEditor *shader_editor = edited_shaders[index].shader_editor;
	ERR_FAIL_NULL(shader_editor);
	shader_editor->update_toggle_files_button();
}

This is a prerequisite cleanup to PR #64596, I'm opening a separate PR for this change so it can be reviewed and merged in advance of the rest, making the changes in PR #64596 smaller.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Code looks good to me.

@aaronfranke aaronfranke force-pushed the shader-toggle-files-organize branch from b7e1047 to 23fa9d8 Compare September 25, 2025 00:58
@clayjohn clayjohn requested a review from KoBeWi September 25, 2025 03:13
Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

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

Looks good

@Repiteo Repiteo merged commit b137476 into godotengine:master Oct 24, 2025
39 of 40 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 24, 2025

Thanks!

@aaronfranke aaronfranke deleted the shader-toggle-files-organize branch October 25, 2025 02:57
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.

5 participants

X Tutup