Skip to content

Commit be2f6cf

Browse files
committed
Fixed syntax highlighting of stencil_mode
1 parent cfa4e8e commit be2f6cf

File tree

1 file changed

+52
-16
lines changed

1 file changed

+52
-16
lines changed

editor/plugins/text_shader_editor.cpp

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,35 @@ void ShaderTextEditor::_load_theme_settings() {
254254
}
255255
}
256256

257-
const Vector<ShaderLanguage::ModeInfo> &modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(i));
257+
{
258+
const Vector<ShaderLanguage::ModeInfo> &render_modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(i));
259+
260+
for (int j = 0; j < render_modes.size(); j++) {
261+
const ShaderLanguage::ModeInfo &mode_info = render_modes[j];
262+
263+
if (!mode_info.options.is_empty()) {
264+
for (int k = 0; k < mode_info.options.size(); k++) {
265+
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[k]));
266+
}
267+
} else {
268+
built_ins.push_back(String(mode_info.name));
269+
}
270+
}
271+
}
258272

259-
for (int j = 0; j < modes.size(); j++) {
260-
const ShaderLanguage::ModeInfo &mode_info = modes[j];
273+
{
274+
const Vector<ShaderLanguage::ModeInfo> &stencil_modes = ShaderTypes::get_singleton()->get_stencil_modes(RenderingServer::ShaderMode(i));
261275

262-
if (!mode_info.options.is_empty()) {
263-
for (int k = 0; k < mode_info.options.size(); k++) {
264-
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[k]));
276+
for (int j = 0; j < stencil_modes.size(); j++) {
277+
const ShaderLanguage::ModeInfo &mode_info = stencil_modes[j];
278+
279+
if (!mode_info.options.is_empty()) {
280+
for (int k = 0; k < mode_info.options.size(); k++) {
281+
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[k]));
282+
}
283+
} else {
284+
built_ins.push_back(String(mode_info.name));
265285
}
266-
} else {
267-
built_ins.push_back(String(mode_info.name));
268286
}
269287
}
270288
}
@@ -275,17 +293,35 @@ void ShaderTextEditor::_load_theme_settings() {
275293
}
276294
}
277295

278-
const Vector<ShaderLanguage::ModeInfo> &modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode()));
296+
{
297+
const Vector<ShaderLanguage::ModeInfo> &shader_modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode()));
298+
299+
for (int i = 0; i < shader_modes.size(); i++) {
300+
const ShaderLanguage::ModeInfo &mode_info = shader_modes[i];
301+
302+
if (!mode_info.options.is_empty()) {
303+
for (int j = 0; j < mode_info.options.size(); j++) {
304+
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[j]));
305+
}
306+
} else {
307+
built_ins.push_back(String(mode_info.name));
308+
}
309+
}
310+
}
311+
312+
{
313+
const Vector<ShaderLanguage::ModeInfo> &stencil_modes = ShaderTypes::get_singleton()->get_stencil_modes(RenderingServer::ShaderMode(shader->get_mode()));
279314

280-
for (int i = 0; i < modes.size(); i++) {
281-
const ShaderLanguage::ModeInfo &mode_info = modes[i];
315+
for (int i = 0; i < stencil_modes.size(); i++) {
316+
const ShaderLanguage::ModeInfo &mode_info = stencil_modes[i];
282317

283-
if (!mode_info.options.is_empty()) {
284-
for (int j = 0; j < mode_info.options.size(); j++) {
285-
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[j]));
318+
if (!mode_info.options.is_empty()) {
319+
for (int j = 0; j < mode_info.options.size(); j++) {
320+
built_ins.push_back(String(mode_info.name) + "_" + String(mode_info.options[j]));
321+
}
322+
} else {
323+
built_ins.push_back(String(mode_info.name));
286324
}
287-
} else {
288-
built_ins.push_back(String(mode_info.name));
289325
}
290326
}
291327
}

0 commit comments

Comments
 (0)