diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-04-17 18:36:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 18:36:06 +0200 |
commit | 17304f1aaed434b0547606ff22721d65292d8cf1 (patch) | |
tree | 8b52f567244fe41a2776a49099ee8c7f300bfe40 /editor/plugins/visual_shader_editor_plugin.cpp | |
parent | cfda0e377004a9399255105132ccb1a906e9f12e (diff) | |
parent | 0e1c66d9fced8f9d3a8fbd87ddfd2c29a9ed2679 (diff) | |
download | redot-engine-17304f1aaed434b0547606ff22721d65292d8cf1.tar.gz |
Merge pull request #37949 from reduz/implement-global-shader-uniforms
Implement global and per instance shader uniforms.
Diffstat (limited to 'editor/plugins/visual_shader_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 294ce2c4cd..d5128db0d5 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2261,6 +2261,12 @@ void VisualShaderEditor::_show_preview_text() { } } +static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) { + + RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable); + return RS::global_variable_type_get_shader_datatype(gvt); +} + void VisualShaderEditor::_update_preview() { if (!preview_showed) { @@ -2274,7 +2280,7 @@ void VisualShaderEditor::_update_preview() { ShaderLanguage sl; - Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_types()); + Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_types(), _get_global_variable_type); for (int i = 0; i < preview_text->get_line_count(); i++) { preview_text->set_line_as_marked(i, false); @@ -3291,7 +3297,7 @@ void EditorInspectorShaderModePlugin::parse_begin(Object *p_object) { //do none } -bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) { +bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) { if (p_path == "mode" && p_object->is_class("VisualShader") && p_type == Variant::INT) { |