summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp13
-rw-r--r--core/bind/core_bind.h9
-rw-r--r--core/math/a_star.cpp28
-rw-r--r--core/math/a_star.h31
-rw-r--r--core/math/triangulate.cpp16
-rw-r--r--core/math/triangulate.h2
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/os/os.h2
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--doc/base/classes.xml2
-rw-r--r--platform/android/dir_access_jandroid.cpp4
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotIO.java5
-rw-r--r--platform/windows/os_windows.cpp2
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/os_x11.cpp2
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--scene/gui/label.cpp6
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--tools/editor/project_manager.cpp49
-rw-r--r--tools/editor/project_manager.h2
-rw-r--r--tools/editor/scene_tree_dock.cpp35
22 files changed, 152 insertions, 68 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 4e815d044d..df49ecebcf 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -480,9 +480,9 @@ void _OS::set_use_vsync(bool p_enable) {
OS::get_singleton()->set_use_vsync(p_enable);
}
-bool _OS::is_vsnc_enabled() const {
+bool _OS::is_vsync_enabled() const {
- return OS::get_singleton()->is_vsnc_enabled();
+ return OS::get_singleton()->is_vsync_enabled();
}
@@ -1172,7 +1172,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name);
ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync);
- ObjectTypeDB::bind_method(_MD("is_vsnc_enabled"),&_OS::is_vsnc_enabled);
+ ObjectTypeDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled);
ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version);
@@ -2043,6 +2043,13 @@ _Directory::~_Directory() {
memdelete(d);
}
+_Marshalls* _Marshalls::singleton=NULL;
+
+_Marshalls *_Marshalls::get_singleton()
+{
+ return singleton;
+}
+
String _Marshalls::variant_to_base64(const Variant& p_var) {
int len;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 14203ae863..2fb7f93cef 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -318,7 +318,7 @@ public:
Error set_thread_name(const String& p_name);
void set_use_vsync(bool p_enable);
- bool is_vsnc_enabled() const;
+ bool is_vsync_enabled() const;
Dictionary get_engine_version() const;
@@ -503,6 +503,8 @@ class _Marshalls : public Reference {
OBJ_TYPE(_Marshalls,Reference);
+ static _Marshalls* singleton;
+
protected:
static void _bind_methods();
@@ -510,6 +512,8 @@ protected:
public:
+ static _Marshalls* get_singleton();
+
String variant_to_base64(const Variant& p_var);
Variant base64_to_variant(const String& p_str);
@@ -519,7 +523,8 @@ public:
String utf8_to_base64(const String& p_str);
String base64_to_utf8(const String& p_str);
- _Marshalls() {};
+ _Marshalls() { singleton = this; }
+ ~_Marshalls() { singleton = NULL; }
};
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 5bbbbdaa5a..198d9f6076 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* a_star.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "a_star.h"
#include "geometry.h"
diff --git a/core/math/a_star.h b/core/math/a_star.h
index a0517b5941..26f3a85046 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -1,8 +1,39 @@
+/*************************************************************************/
+/* a_star.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef ASTAR_H
#define ASTAR_H
#include "reference.h"
#include "self_list.h"
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
class AStar: public Reference {
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 1f5d5ed6b3..eaf019f200 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -71,7 +71,7 @@ bool Triangulate::is_inside_triangle(float Ax, float Ay,
return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
};
-bool Triangulate::snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,int *V)
+bool Triangulate::snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,const Vector<int>& V)
{
int p;
float Ax, Ay, Bx, By, Cx, Cy, Px, Py;
@@ -107,8 +107,8 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
if ( n < 3 ) return false;
-
- int *V = (int*)alloca(sizeof(int)*n);
+ Vector<int> V;
+ V.resize(n);
/* we want a counter-clockwise polygon in V */
@@ -122,7 +122,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
/* remove nv-2 Vertices, creating 1 triangle every time */
int count = 2*nv; /* error detection */
- for(int m=0, v=nv-1; nv>2; )
+ for(int v=nv-1; nv>2; )
{
/* if we loop, it is probably a non-simple polygon */
if (0 >= (count--))
@@ -144,18 +144,10 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
a = V[u]; b = V[v]; c = V[w];
/* output Triangle */
- /*
- result.push_back( contour[a] );
- result.push_back( contour[b] );
- result.push_back( contour[c] );
-*/
-
result.push_back( a );
result.push_back( b );
result.push_back( c );
- m++;
-
/* remove v from remaining polygon */
for(s=v,t=v+1;t<nv;s++,t++)
V[s] = V[t];
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index 7dcc91b2fd..ef622b5005 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -56,7 +56,7 @@ public:
private:
- static bool snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,int *V);
+ static bool snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,const Vector<int>& V);
};
diff --git a/core/os/os.cpp b/core/os/os.cpp
index ee32476234..11a315a01b 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -542,7 +542,7 @@ void OS::set_use_vsync(bool p_enable) {
}
-bool OS::is_vsnc_enabled() const{
+bool OS::is_vsync_enabled() const{
return true;
}
diff --git a/core/os/os.h b/core/os/os.h
index c2b46a5420..037fcac039 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -431,7 +431,7 @@ public:
virtual void set_context(int p_context);
virtual void set_use_vsync(bool p_enable);
- virtual bool is_vsnc_enabled() const;
+ virtual bool is_vsync_enabled() const;
Dictionary get_engine_version() const;
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index c3a127afb9..4c9d121781 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -177,7 +177,7 @@ void register_core_singletons() {
Globals::get_singleton()->add_singleton( Globals::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) );
Globals::get_singleton()->add_singleton( Globals::Singleton("PathRemap",PathRemap::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("OS",_OS::get_singleton() ) );
- Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_marshalls ) );
+ Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_Marshalls::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("TranslationServer",TranslationServer::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("TS",TranslationServer::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("Input",Input::get_singleton() ) );
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index d0a7157d46..f1155be854 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -24152,7 +24152,7 @@
Return true if the window is resizable.
</description>
</method>
- <method name="is_vsnc_enabled" qualifiers="const">
+ <method name="is_vsync_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 57376f8103..06be1f747d 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -154,7 +154,7 @@ Error DirAccessJAndroid::change_dir(String p_dir){
String DirAccessJAndroid::get_current_dir(){
- return "/"+current_dir;
+ return "res://"+current_dir;
}
bool DirAccessJAndroid::file_exists(String p_file){
@@ -268,6 +268,6 @@ DirAccessJAndroid::DirAccessJAndroid() {
DirAccessJAndroid::~DirAccessJAndroid() {
- list_dir_end();;
+ list_dir_end();
}
#endif
diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java
index 55e330924a..128a9b2f7b 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java
@@ -288,6 +288,11 @@ public class GodotIO {
try {
ad.files = am.list(path);
+ // no way to find path is directory or file exactly.
+ // but if ad.files.length==0, then it's an empty directory or file.
+ if (ad.files.length==0) {
+ return -1;
+ }
} catch (IOException e) {
System.out.printf("Exception on dir_open: %s\n",e);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 286f5fb0b7..3987044d80 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2388,7 +2388,7 @@ void OS_Windows::set_use_vsync(bool p_enable) {
gl_context->set_use_vsync(p_enable);
}
-bool OS_Windows::is_vsnc_enabled() const{
+bool OS_Windows::is_vsync_enabled() const{
if (gl_context)
return gl_context->is_using_vsync();
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 903dd10c70..11fa094b88 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -295,7 +295,7 @@ public:
virtual String get_joy_guid(int p_device) const;
virtual void set_use_vsync(bool p_enable);
- virtual bool is_vsnc_enabled() const;
+ virtual bool is_vsync_enabled() const;
OS_Windows(HINSTANCE _hInstance);
~OS_Windows();
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 5f1ab5b4aa..0172dca4c4 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1951,7 +1951,7 @@ void OS_X11::set_use_vsync(bool p_enable) {
return context_gl->set_use_vsync(p_enable);
}
-bool OS_X11::is_vsnc_enabled() const {
+bool OS_X11::is_vsync_enabled() const {
if (context_gl)
return context_gl->is_using_vsync();
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index b27f71406a..efa7e44afe 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -264,7 +264,7 @@ public:
virtual void set_context(int p_context);
virtual void set_use_vsync(bool p_enable);
- virtual bool is_vsnc_enabled() const;
+ virtual bool is_vsync_enabled() const;
void run();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 3b15776c55..f95b151024 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -118,19 +118,19 @@ void Label::_notification(int p_what) {
//nothing
} break;
case VALIGN_CENTER: {
- vbegin=(size.y - lines_visible * font_h) / 2;
+ vbegin=(size.y - (lines_visible * font_h - line_spacing)) / 2;
vsep=0;
} break;
case VALIGN_BOTTOM: {
- vbegin=size.y - lines_visible * font_h;
+ vbegin=size.y - (lines_visible * font_h - line_spacing);
vsep=0;
} break;
case VALIGN_FILL: {
vbegin=0;
if (lines_visible>1) {
- vsep=(size.y - lines_visible * font_h) / (lines_visible - 1);
+ vsep=(size.y - (lines_visible * font_h - line_spacing)) / (lines_visible - 1);
} else {
vsep=0;
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index f7d74b2b49..eecc730f5c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -853,7 +853,7 @@ void LineEdit::_reset_caret_blink_timer() {
void LineEdit::_toggle_draw_caret() {
draw_caret = !draw_caret;
- if (is_visible()) {
+ if (is_visible() && has_focus() && window_has_focus) {
update();
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index c879b7b562..871a3ca68f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3458,7 +3458,7 @@ void TextEdit::_reset_caret_blink_timer() {
void TextEdit::_toggle_draw_caret() {
draw_caret = !draw_caret;
- if (is_visible()) {
+ if (is_visible() && has_focus() && window_has_focus) {
update();
}
}
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 1c99982155..069d7cef81 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -141,7 +141,7 @@ private:
}
String sp = p.simplify_path();
project_path->set_text(sp);
- _path_text_changed(p);
+ _path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
@@ -150,7 +150,7 @@ private:
String p = p_path;
String sp = p.simplify_path();
project_path->set_text(sp);
- _path_text_changed(p);
+ _path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
@@ -335,7 +335,7 @@ private:
hide();
- emit_signal("project_created");
+ emit_signal("project_created", dir);
}
@@ -882,6 +882,7 @@ void ProjectManager::_load_recent_projects() {
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
+ vb->set_name("project");
hb->add_child(vb);
Control *ec = memnew( Control );
ec->set_custom_minimum_size(Size2(0,1));
@@ -891,6 +892,7 @@ void ProjectManager::_load_recent_projects() {
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
+ fpath->set_name("path");
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
@@ -912,6 +914,43 @@ void ProjectManager::_load_recent_projects() {
tabs->set_current_tab(0);
}
+void ProjectManager::_on_project_created(const String& dir) {
+ bool has_already=false;
+ for (int i=0;i<scroll_childs->get_child_count();i++) {
+ HBoxContainer *hb=scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ Label *fpath=hb->get_node(NodePath("project/path"))->cast_to<Label>();
+ if (fpath->get_text()==dir) {
+ has_already=true;
+ break;
+ }
+ }
+ if (has_already) {
+ _update_scroll_pos(dir);
+ } else {
+ _load_recent_projects();
+ scroll->connect("draw", this, "_update_scroll_pos", varray(dir), CONNECT_ONESHOT);
+ }
+}
+
+void ProjectManager::_update_scroll_pos(const String& dir) {
+ for (int i=0;i<scroll_childs->get_child_count();i++) {
+ HBoxContainer *hb=scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ Label *fpath=hb->get_node(NodePath("project/path"))->cast_to<Label>();
+ if (fpath->get_text()==dir) {
+ last_clicked=hb->get_meta("name");
+ selected_list.clear();
+ selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
+ _update_project_buttons();
+ int last_y_visible=scroll->get_v_scroll()+scroll->get_size().y;
+ int offset_diff=(hb->get_pos().y + hb->get_size().y)-last_y_visible;
+
+ if (offset_diff>0)
+ scroll->set_v_scroll(scroll->get_v_scroll()+offset_diff);
+ break;
+ }
+ }
+}
+
void ProjectManager::_open_project_confirm() {
for (Map<String,String>::Element *E=selected_list.front(); E; E=E->next()) {
@@ -1164,6 +1203,8 @@ void ProjectManager::_bind_methods() {
ObjectTypeDB::bind_method("_erase_project_confirm",&ProjectManager::_erase_project_confirm);
ObjectTypeDB::bind_method("_exit_dialog",&ProjectManager::_exit_dialog);
ObjectTypeDB::bind_method("_load_recent_projects",&ProjectManager::_load_recent_projects);
+ ObjectTypeDB::bind_method("_on_project_created",&ProjectManager::_on_project_created);
+ ObjectTypeDB::bind_method("_update_scroll_pos",&ProjectManager::_update_scroll_pos);
ObjectTypeDB::bind_method("_panel_draw",&ProjectManager::_panel_draw);
ObjectTypeDB::bind_method("_panel_input",&ProjectManager::_panel_input);
ObjectTypeDB::bind_method("_unhandled_input",&ProjectManager::_unhandled_input);
@@ -1382,7 +1423,7 @@ ProjectManager::ProjectManager() {
npdialog = memnew( NewProjectDialog );
gui_base->add_child(npdialog);
- npdialog->connect("project_created", this,"_load_recent_projects");
+ npdialog->connect("project_created", this,"_on_project_created");
_load_recent_projects();
if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) {
diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h
index 46f7aea3a5..af2d47aeb3 100644
--- a/tools/editor/project_manager.h
+++ b/tools/editor/project_manager.h
@@ -85,6 +85,8 @@ class ProjectManager : public Control {
void _scan_begin(const String& p_base);
void _load_recent_projects();
+ void _on_project_created(const String& dir);
+ void _update_scroll_pos(const String& dir);
void _scan_dir(DirAccess *da,float pos, float total,List<String> *r_projects);
void _install_project(const String& p_zip_path,const String& p_title);
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 619ff12296..b9cce34454 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -1630,7 +1630,7 @@ static bool _is_node_visible(Node* p_node) {
static bool _has_visible_children(Node* p_node) {
- bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false;
+ bool collapsed = p_node->is_displayed_folded();
if (collapsed)
return false;
@@ -1653,7 +1653,7 @@ static Node* _find_last_visible(Node* p_node) {
Node* last=NULL;
- bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false;
+ bool collapsed = p_node->is_displayed_folded();
if (!collapsed) {
for(int i=0;i<p_node->get_child_count();i++) {
@@ -1688,36 +1688,9 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) {
ERR_EXPLAIN("Cannot perform drop above the root node!");
ERR_FAIL();
}
- Node* upper_sibling=NULL;
- for(int i=0;i<to_node->get_index();i++) {
- Node *c =to_node->get_parent()->get_child(i);
- if (_is_node_visible(c)) {
- upper_sibling=c;
- }
- }
-
-
- if (upper_sibling) {
- //quite complicated, look for next visible in tree
- upper_sibling=_find_last_visible(upper_sibling);
-
- if (upper_sibling->get_parent()==to_node->get_parent()) {
- //just insert over this node because nothing is above at an upper level
- to_pos=to_node->get_index();
- to_node=to_node->get_parent();
- } else {
- to_pos=-1; //insert last in whathever is up
- to_node=upper_sibling->get_parent(); //insert at a parent of whathever is up
- }
-
-
- } else {
- //just insert over this node because nothing is above at the same level
- to_pos=to_node->get_index();
- to_node=to_node->get_parent();
-
- }
+ to_pos=to_node->get_index();
+ to_node=to_node->get_parent();
} else if (p_type==1) {
//drop at below selected node