1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fix visual shader graph not correctly updating when multiple tabs opened

This commit is contained in:
Yuri Rubinsky
2022-07-16 09:59:20 +03:00
parent ae5668f81e
commit f05fce405e
6 changed files with 127 additions and 91 deletions

View File

@@ -42,15 +42,21 @@
#include "scene/gui/tree.h"
#include "scene/resources/visual_shader.h"
class VisualShaderEditor;
class VisualShaderNodePlugin : public RefCounted {
GDCLASS(VisualShaderNodePlugin, RefCounted);
protected:
VisualShaderEditor *vseditor = nullptr;
protected:
static void _bind_methods();
GDVIRTUAL2RC(Object *, _create_editor, Ref<Resource>, Ref<VisualShaderNode>)
public:
void set_editor(VisualShaderEditor *p_editor);
virtual Control *create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node);
};
@@ -58,6 +64,8 @@ class VisualShaderGraphPlugin : public RefCounted {
GDCLASS(VisualShaderGraphPlugin, RefCounted);
private:
VisualShaderEditor *editor = nullptr;
struct InputPort {
Button *default_input_button = nullptr;
};
@@ -91,6 +99,7 @@ protected:
static void _bind_methods();
public:
void set_editor(VisualShaderEditor *p_editor);
void register_shader(VisualShader *p_visual_shader);
void set_connections(const List<VisualShader::Connection> &p_connections);
void register_link(VisualShader::Type p_type, int p_id, VisualShaderNode *p_visual_node, GraphNode *p_graph_node);
@@ -324,8 +333,6 @@ class VisualShaderEditor : public VBoxContainer {
void _update_preview();
String _get_description(int p_idx);
static VisualShaderEditor *singleton;
struct DragOp {
VisualShader::Type type = VisualShader::Type::TYPE_MAX;
int node = 0;
@@ -403,9 +410,9 @@ class VisualShaderEditor : public VBoxContainer {
void _duplicate_nodes();
Vector2 selection_center;
List<CopyItem> copy_items_buffer;
List<VisualShader::Connection> copy_connections_buffer;
static Vector2 selection_center;
static List<CopyItem> copy_items_buffer;
static List<VisualShader::Connection> copy_connections_buffer;
void _clear_copy_buffer();
void _copy_nodes(bool p_cut);
@@ -482,7 +489,6 @@ public:
void add_plugin(const Ref<VisualShaderNodePlugin> &p_plugin);
void remove_plugin(const Ref<VisualShaderNodePlugin> &p_plugin);
static VisualShaderEditor *get_singleton() { return singleton; }
VisualShaderGraphPlugin *get_graph_plugin() { return graph_plugin.ptr(); }
void clear_custom_types();