1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Select and move multiple nodes at once

This commit is contained in:
Mariano Javier Suligoy
2015-07-19 01:48:46 -03:00
parent 5b71fc45b7
commit bdd12744fe
9 changed files with 2907 additions and 2783 deletions

View File

@@ -141,9 +141,6 @@ void GraphEdit::_graph_node_moved(Node *p_gn) {
GraphNode *gn=p_gn->cast_to<GraphNode>(); GraphNode *gn=p_gn->cast_to<GraphNode>();
ERR_FAIL_COND(!gn); ERR_FAIL_COND(!gn);
//gn->set_pos(gn->get_offset()+scroll_offset);
top_layer->update(); top_layer->update();
} }
@@ -499,14 +496,104 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
if (p_ev.type==InputEvent::MOUSE_MOTION && (p_ev.mouse_motion.button_mask&BUTTON_MASK_MIDDLE || (p_ev.mouse_motion.button_mask&BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { if (p_ev.type==InputEvent::MOUSE_MOTION && (p_ev.mouse_motion.button_mask&BUTTON_MASK_MIDDLE || (p_ev.mouse_motion.button_mask&BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x ); h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x );
v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y ); v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y );
} else if (p_ev.type== InputEvent::MOUSE_BUTTON) { }
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
just_selected=true;
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->is_selected())
gn->set_offset(gn->get_drag_from()+drag_accum);
}
}
if (p_ev.type== InputEvent::MOUSE_BUTTON) {
const InputEventMouseButton &b=p_ev.mouse_button; const InputEventMouseButton &b=p_ev.mouse_button;
if (b.button_index==2 && b.pressed) if (b.button_index==BUTTON_RIGHT && b.pressed)
{ {
emit_signal("popup_request", Vector2(b.global_x, b.global_y)); emit_signal("popup_request", Vector2(b.global_x, b.global_y));
} }
if (b.button_index==BUTTON_LEFT && !b.pressed && dragging) {
if (!just_selected && drag_accum==Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
//deselect current node
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
gn->set_selected(false);
}
}
if (drag_accum!=Vector2()) {
emit_signal("_begin_node_move");
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->is_selected())
gn->set_drag(false);
}
emit_signal("_end_node_move");
}
dragging = false;
top_layer->update();
}
if (b.button_index==BUTTON_LEFT && b.pressed) {
GraphNode *gn;
for(int i=get_child_count()-1;i>=0;i--) {
gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
break;
}
if (gn) {
if (_filter_input(Vector2(b.x,b.y)))
return;
dragging = true;
drag_accum = Vector2();
just_selected = !gn->is_selected();
if(!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < get_child_count(); i++) {
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
if (o_gn)
o_gn->set_selected(o_gn == gn);
}
}
gn->set_selected(true);
for (int i = 0; i < get_child_count(); i++) {
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
if (!o_gn)
continue;
if (o_gn->is_selected())
o_gn->set_drag(true);
}
} else {
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn)
continue;
gn->set_selected(false);
}
}
}
} }
} }
@@ -564,6 +651,8 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot"))); ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot"))); ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position"))); ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
} }

View File

@@ -49,7 +49,9 @@ private:
String connecting_target_to; String connecting_target_to;
int connecting_target_index; int connecting_target_index;
bool dragging;
bool just_selected;
Vector2 drag_accum;
bool right_disconnects; bool right_disconnects;
bool updating; bool updating;

View File

@@ -160,7 +160,7 @@ void GraphNode::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAW) { if (p_what==NOTIFICATION_DRAW) {
Ref<StyleBox> sb=get_stylebox("frame"); Ref<StyleBox> sb=get_stylebox(selected ? "selectedframe" : "frame");
Ref<Texture> port =get_icon("port"); Ref<Texture> port =get_icon("port");
Ref<Texture> close =get_icon("close"); Ref<Texture> close =get_icon("close");
int close_offset = get_constant("close_offset"); int close_offset = get_constant("close_offset");
@@ -360,6 +360,29 @@ Vector2 GraphNode::get_offset() const {
return offset; return offset;
} }
void GraphNode::set_selected(bool p_selected)
{
selected = p_selected;
update();
}
bool GraphNode::is_selected()
{
return selected;
}
void GraphNode::set_drag(bool p_drag)
{
if (p_drag)
drag_from=get_offset();
else
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
}
Vector2 GraphNode::get_drag_from()
{
return drag_from;
}
void GraphNode::set_show_close_button(bool p_enable){ void GraphNode::set_show_close_button(bool p_enable){
@@ -379,7 +402,6 @@ void GraphNode::_connpos_update() {
int sep=get_constant("separation"); int sep=get_constant("separation");
Ref<StyleBox> sb=get_stylebox("frame"); Ref<StyleBox> sb=get_stylebox("frame");
Ref<Texture> port =get_icon("port");
conn_input_cache.clear(); conn_input_cache.clear();
conn_output_cache.clear(); conn_output_cache.clear();
int vofs=0; int vofs=0;
@@ -510,26 +532,10 @@ void GraphNode::_input_event(const InputEvent& p_ev) {
emit_signal("close_request"); emit_signal("close_request");
return; return;
} }
drag_from=get_offset();
drag_accum=Vector2();
dragging=true;
emit_signal("raise_request"); emit_signal("raise_request");
} }
if (p_ev.type==InputEvent::MOUSE_BUTTON && !p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
dragging=false;
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
}
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
set_offset(drag_from+drag_accum);
}
} }
@@ -576,8 +582,6 @@ void GraphNode::_bind_methods() {
} }
GraphNode::GraphNode() { GraphNode::GraphNode() {
dragging=false;
show_close=false; show_close=false;
connpos_dirty=true; connpos_dirty=true;
} }

View File

@@ -18,7 +18,7 @@ class GraphNode : public Container {
Color color_right; Color color_right;
Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); }; Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); }
}; };
String title; String title;
@@ -46,8 +46,7 @@ class GraphNode : public Container {
void _resort(); void _resort();
Vector2 drag_from; Vector2 drag_from;
Vector2 drag_accum; bool selected;
bool dragging;
protected: protected:
void _input_event(const InputEvent& p_ev); void _input_event(const InputEvent& p_ev);
@@ -79,6 +78,12 @@ public:
void set_offset(const Vector2& p_offset); void set_offset(const Vector2& p_offset);
Vector2 get_offset() const; Vector2 get_offset() const;
void set_selected(bool p_selected);
bool is_selected();
void set_drag(bool p_drag);
Vector2 get_drag_from();
void set_show_close_button(bool p_enable); void set_show_close_button(bool p_enable);
bool is_close_button_visible() const; bool is_close_button_visible() const;

View File

@@ -558,9 +558,11 @@ void make_default_theme() {
// GraphNode // GraphNode
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5); Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
Ref<StyleBoxTexture> graphsbselected = make_stylebox(graph_node_selected_png,6,24,6,5,16,24,16,5);
//graphsb->set_expand_margin_size(MARGIN_LEFT,10); //graphsb->set_expand_margin_size(MARGIN_LEFT,10);
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10); //graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
t->set_stylebox("frame","GraphNode", graphsb ); t->set_stylebox("frame","GraphNode", graphsb );
t->set_stylebox("selectedframe","GraphNode", graphsbselected );
t->set_constant("separation","GraphNode", 1 ); t->set_constant("separation","GraphNode", 1 );
t->set_icon("port","GraphNode", make_icon( graph_port_png ) ); t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) ); t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

View File

@@ -114,6 +114,11 @@ static const unsigned char graph_node_close_png[]={
}; };
static const unsigned char graph_node_selected_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdf,0x7,0x12,0x1,0xc,0x6,0x23,0x98,0xc7,0x50,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x2,0x46,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0xcd,0x6a,0x13,0x51,0x14,0xc7,0x7f,0xe7,0xce,0x34,0x49,0xd,0xa6,0xb1,0x2a,0xe2,0x7,0x74,0xa1,0x6e,0x4,0x85,0xe2,0x3,0xb8,0x72,0x21,0xba,0x16,0x5c,0xb9,0x16,0x4,0x7d,0x84,0x3e,0x82,0x82,0xe0,0xda,0x95,0x2f,0x60,0x71,0xe1,0xca,0x7,0xd0,0x82,0xa5,0x6e,0xd4,0x45,0xc1,0x8f,0x4a,0x6c,0x9a,0x46,0x62,0x66,0xa6,0x73,0xef,0x71,0xe1,0x4c,0x92,0x99,0x4c,0x93,0x36,0xdd,0xc9,0xfc,0x37,0x77,0x3e,0xee,0xfd,0xdd,0x73,0xfe,0xf7,0xc,0xcc,0x11,0x86,0x12,0xc0,0x0,0x5e,0x32,0xa,0x59,0x29,0xe0,0x0,0x9b,0x8c,0xca,0xc8,0x24,0x3,0x1c,0x3,0x16,0x81,0xd3,0x40,0x3,0x98,0xcb,0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,0x29,0xc7,0x33,0x1a,0x3f,0xae,0xbf,0xf0,0x27,0xf6,0x42,0xf6,0xf5,0xfd,0xae,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
static const unsigned char graph_port_png[]={ static const unsigned char graph_port_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0xa,0x8,0x6,0x0,0x0,0x0,0x8d,0x32,0xcf,0xbd,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x17,0x20,0x3,0xeb,0x8f,0x3a,0xdb,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x65,0x49,0x44,0x41,0x54,0x18,0xd3,0x4d,0xd0,0x4f,0x6b,0xda,0x70,0x1c,0x7,0xe0,0xcf,0x37,0x7f,0x7e,0x49,0x66,0xd2,0x64,0x61,0x5,0x61,0x76,0x47,0xf1,0xa4,0x2d,0xdb,0x75,0x5,0x11,0x84,0xb0,0x5e,0xeb,0xd9,0xeb,0xf4,0x6d,0xec,0x2d,0xf8,0x26,0xb6,0x77,0xe0,0x45,0xba,0xa3,0x6c,0xa0,0x3b,0xad,0x39,0xb6,0x36,0x8,0x1b,0x4b,0x32,0xd2,0xc6,0x6c,0x9a,0x4f,0x4f,0x85,0x3e,0x2f,0xe1,0x11,0x0,0x20,0x29,0xd3,0xe9,0xd4,0xda,0x6e,0xb7,0x23,0xdf,0xf7,0xbb,0x0,0x90,0xe7,0xf9,0x8f,0x66,0xb3,0xf9,0x79,0x36,0x9b,0x55,0x22,0x42,0x83,0xa4,0x44,0x51,0xf4,0xea,0xe2,0xe2,0xc3,0xf7,0xf1,0x78,0xdc,0xa,0x82,0x40,0x8,0x20,0xcf,0x32,0x2e,0x97,0xcb,0x4f,0x51,0x14,0xbd,0x25,0xf9,0x5b,0x26,0x93,0x89,0xdd,0xe9,0x74,0xe2,0xf7,0xe7,0xe7,0x27,0x59,0xfa,0x87,0x65,0xb9,0x13,0x0,0xb0,0x1d,0x9b,0xe1,0xcb,0x50,0xbe,0x5e,0x5d,0xdd,0xfe,0xbc,0xbe,0x6e,0x6b,0x49,0x92,0x8c,0x4e,0x7b,0xa7,0xad,0xbf,0x79,0x4e,0xd3,0x54,0x12,0x86,0x21,0xc2,0x30,0x84,0x32,0x95,0xe4,0x79,0xc6,0xde,0xd9,0x59,0x2b,0x49,0xee,0x46,0x86,0xeb,0xba,0x5d,0xfb,0x85,0x23,0x87,0xfd,0x1e,0xb6,0xed,0x40,0xd7,0x35,0x0,0x40,0x7d,0x38,0xa0,0xdc,0xed,0x44,0x37,0x74,0xb8,0xae,0xd7,0x35,0x48,0x62,0xff,0xff,0x1f,0xfc,0x20,0x80,0xae,0xe9,0x78,0x42,0x0,0xca,0xb2,0x90,0x65,0x19,0x58,0xd7,0xd0,0x8a,0xa2,0x58,0xa7,0x69,0x56,0x6b,0xa2,0x51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0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51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0x86,0xe4,0x47,0x21,0x29,0xc3,0xe1,0xf0,0xb8,0xdf,0xef,0x7f,0x6b,0xb7,0xdb,0xaf,0x1b,0x8d,0x86,0x46,0x10,0xf,0xf7,0xf,0x75,0x1c,0xc7,0x77,0x8b,0xc5,0xe2,0xdd,0x7c,0x3e,0xff,0x25,0xcf,0xc3,0x6f,0x6e,0x6f,0x2e,0x1d,0xdb,0xe9,0x9,0x80,0xb2,0x2a,0xd7,0x27,0xad,0x37,0x5f,0x9e,0xc2,0x1f,0x1,0x3a,0xe6,0xa5,0x7b,0xef,0xf2,0xf3,0xcd,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
}; };

View File

@@ -1156,14 +1156,24 @@ void ShaderGraphView::_node_removed(int p_id) {
} }
void ShaderGraphView::_begin_node_move()
{
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action("Move Shader Graph Node");
}
void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) { void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) {
ERR_FAIL_COND(!node_map.has(p_id)); ERR_FAIL_COND(!node_map.has(p_id));
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action("Move Shader Graph Node");
ur->add_do_method(this,"_move_node",p_id,p_to); ur->add_do_method(this,"_move_node",p_id,p_to);
ur->add_undo_method(this,"_move_node",p_id,p_from); ur->add_undo_method(this,"_move_node",p_id,p_from);
}
void ShaderGraphView::_end_node_move()
{
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->commit_action(); ur->commit_action();
} }
@@ -2000,6 +2010,7 @@ void ShaderGraphView::_create_node(int p_id) {
case ShaderGraph::NODE_OUTPUT: { case ShaderGraph::NODE_OUTPUT: {
gn->set_title("Output"); gn->set_title("Output");
gn->set_show_close_button(false);
List<ShaderGraph::SlotInfo> si; List<ShaderGraph::SlotInfo> si;
ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si); ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si);
@@ -2157,7 +2168,9 @@ void ShaderGraphView::add_node(int p_type, const Vector2 &location) {
void ShaderGraphView::_bind_methods() { void ShaderGraphView::_bind_methods() {
ObjectTypeDB::bind_method("_update_graph",&ShaderGraphView::_update_graph); ObjectTypeDB::bind_method("_update_graph",&ShaderGraphView::_update_graph);
ObjectTypeDB::bind_method("_begin_node_move", &ShaderGraphView::_begin_node_move);
ObjectTypeDB::bind_method("_node_moved",&ShaderGraphView::_node_moved); ObjectTypeDB::bind_method("_node_moved",&ShaderGraphView::_node_moved);
ObjectTypeDB::bind_method("_end_node_move", &ShaderGraphView::_end_node_move);
ObjectTypeDB::bind_method("_move_node",&ShaderGraphView::_move_node); ObjectTypeDB::bind_method("_move_node",&ShaderGraphView::_move_node);
ObjectTypeDB::bind_method("_node_removed",&ShaderGraphView::_node_removed); ObjectTypeDB::bind_method("_node_removed",&ShaderGraphView::_node_removed);
ObjectTypeDB::bind_method("_connection_request",&ShaderGraphView::_connection_request); ObjectTypeDB::bind_method("_connection_request",&ShaderGraphView::_connection_request);
@@ -2200,6 +2213,8 @@ ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) {
graph_edit->add_child(ped_popup); graph_edit->add_child(ped_popup);
status = memnew( Label ); status = memnew( Label );
graph_edit->get_top_layer()->add_child(status); graph_edit->get_top_layer()->add_child(status);
graph_edit->connect("_begin_node_move", this, "_begin_node_move");
graph_edit->connect("_end_node_move", this, "_end_node_move");
status->set_pos(Vector2(5,5)); status->set_pos(Vector2(5,5));
status->add_color_override("font_color_shadow",Color(0,0,0)); status->add_color_override("font_color_shadow",Color(0,0,0));
status->add_color_override("font_color",Color(1,0.4,0.3)); status->add_color_override("font_color",Color(1,0.4,0.3));

View File

@@ -141,7 +141,9 @@ class ShaderGraphView : public Node {
void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot); void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
void _node_removed(int p_id); void _node_removed(int p_id);
void _begin_node_move();
void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id); void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id);
void _end_node_move();
void _move_node(int p_id,const Vector2& p_to); void _move_node(int p_id,const Vector2& p_to);
void _scalar_const_changed(double p_value,int p_id); void _scalar_const_changed(double p_value,int p_id);