Merge pull request #11076 from hpvb/fix-10935
Fix crash on wrong type drag into the vs editor
This commit is contained in:
commit
fe3bbaa9d0
1 changed files with 358 additions and 349 deletions
|
@ -1397,10 +1397,20 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
|||
|
||||
void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||
|
||||
if (p_from == graph) {
|
||||
if (p_from != graph) {
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary d = p_data;
|
||||
if (d.has("type") && String(d["type"]) == "visual_script_node_drag") {
|
||||
|
||||
if (!d.has("type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (String(d["type"]) == "visual_script_node_drag") {
|
||||
if (!d.has("node_type") || String(d["node_type"]) == "Null") {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 ofs = graph->get_scroll_ofs() + p_point;
|
||||
|
||||
|
@ -1428,7 +1438,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "visual_script_variable_drag") {
|
||||
if (String(d["type"]) == "visual_script_variable_drag") {
|
||||
|
||||
#ifdef OSX_ENABLED
|
||||
bool use_set = Input::get_singleton()->is_key_pressed(KEY_META);
|
||||
|
@ -1473,7 +1483,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "visual_script_function_drag") {
|
||||
if (String(d["type"]) == "visual_script_function_drag") {
|
||||
|
||||
Vector2 ofs = graph->get_scroll_ofs() + p_point;
|
||||
if (graph->is_using_snap()) {
|
||||
|
@ -1506,7 +1516,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "visual_script_signal_drag") {
|
||||
if (String(d["type"]) == "visual_script_signal_drag") {
|
||||
|
||||
Vector2 ofs = graph->get_scroll_ofs() + p_point;
|
||||
if (graph->is_using_snap()) {
|
||||
|
@ -1536,7 +1546,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "resource") {
|
||||
if (String(d["type"]) == "resource") {
|
||||
|
||||
Vector2 ofs = graph->get_scroll_ofs() + p_point;
|
||||
if (graph->is_using_snap()) {
|
||||
|
@ -1566,7 +1576,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "files") {
|
||||
if (String(d["type"]) == "files") {
|
||||
|
||||
Vector2 ofs = graph->get_scroll_ofs() + p_point;
|
||||
if (graph->is_using_snap()) {
|
||||
|
@ -1616,7 +1626,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "nodes") {
|
||||
if (String(d["type"]) == "nodes") {
|
||||
|
||||
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
|
||||
|
@ -1687,7 +1697,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "obj_property") {
|
||||
if (String(d["type"]) == "obj_property") {
|
||||
|
||||
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
|
||||
|
@ -1808,7 +1818,6 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_selected_method(const String &p_method) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue