summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/array.cpp10
-rw-r--r--core/array.h3
-rw-r--r--core/globals.cpp3
-rw-r--r--core/variant_call.cpp4
-rw-r--r--doc/base/classes.xml17
-rw-r--r--platform/osx/detect.py2
-rw-r--r--platform/windows/os_windows.cpp12
-rw-r--r--[-rwxr-xr-x]platform/x11/os_x11.cpp21
-rw-r--r--scene/gui/button_array.cpp20
-rw-r--r--scene/gui/button_array.h4
-rw-r--r--scene/main/node.cpp6
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/resources/default_theme/default_theme.cpp21
-rwxr-xr-xtools/dist/osx_template.app/Contents/Info.plist4
-rwxr-xr-xtools/dist/osx_tools.app/Contents/Info.plist4
15 files changed, 89 insertions, 43 deletions
diff --git a/core/array.cpp b/core/array.cpp
index 683a43e3d0..f7ca67b6a3 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -150,6 +150,16 @@ void Array::erase(const Variant& p_value) {
_p->array.erase(p_value);
}
+Variant Array::front() const {
+ ERR_FAIL_COND_V(_p->array.size() == 0, Variant());
+ return operator[](0);
+}
+
+Variant Array::back() const {
+ ERR_FAIL_COND_V(_p->array.size() == 0, Variant());
+ return operator[](_p->array.size() - 1);
+}
+
int Array::find(const Variant& p_value, int p_from) const {
return _p->array.find(p_value, p_from);
diff --git a/core/array.h b/core/array.h
index eb79b0cf33..fb417b6ec0 100644
--- a/core/array.h
+++ b/core/array.h
@@ -67,6 +67,9 @@ public:
void insert(int p_pos, const Variant& p_value);
void remove(int p_pos);
+ Variant front() const;
+ Variant back() const;
+
void sort();
void sort_custom(Object *p_obj,const StringName& p_function);
void invert();
diff --git a/core/globals.cpp b/core/globals.cpp
index bef40ff330..78b97882be 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -54,7 +54,8 @@ String Globals::localize_path(const String& p_path) const {
if (resource_path=="")
return p_path; //not initialied yet
- if (p_path.begins_with("res://") || p_path.begins_with("user://") || p_path.is_abs_path())
+ if (p_path.begins_with("res://") || p_path.begins_with("user://") ||
+ (p_path.is_abs_path() && !p_path.begins_with(resource_path)))
return p_path.simplify_path();
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 9b6fa27cf4..0379ae019b 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -472,6 +472,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1(Array,resize);
VCALL_LOCALMEM2(Array,insert);
VCALL_LOCALMEM1(Array,remove);
+ VCALL_LOCALMEM0R(Array,front);
+ VCALL_LOCALMEM0R(Array,back);
VCALL_LOCALMEM2R(Array,find);
VCALL_LOCALMEM2R(Array,rfind);
VCALL_LOCALMEM1R(Array,find_last);
@@ -1576,6 +1578,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC2(ARRAY,NIL,Array,insert,INT,"pos",NIL,"value",varray());
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
+ ADDFUNC0(ARRAY,NIL,Array,front,varray());
+ ADDFUNC0(ARRAY,NIL,Array,back,varray());
ADDFUNC2(ARRAY,INT,Array,find,NIL,"what",INT,"from",varray(0));
ADDFUNC2(ARRAY,INT,Array,rfind,NIL,"what",INT,"from",varray(-1));
ADDFUNC1(ARRAY,INT,Array,find_last,NIL,"value",varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index edd1eca925..b767c98060 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -4656,6 +4656,20 @@
Remove the first occurrence of a value from the array.
</description>
</method>
+ <method name="front">
+ <return type="Variant">
+ </return>
+ <description>
+ Returns the first element of the array if the array is not empty (size>0).
+ </description>
+ </method>
+ <method name="back">
+ <return type="Variant">
+ </return>
+ <description>
+ Returns the last element of the array if the array is not empty (size>0).
+ </description>
+ </method>
<method name="find">
<return type="int">
</return>
@@ -22621,7 +22635,7 @@
Nodes are the base bricks with which Godot games are developed. They can be set as children of other nodes, resulting in a tree arrangement. A given node can contain any number of nodes as children (but there is only one scene tree root node) with the requirement that all siblings (direct children of a node) should have unique names.
Any tree of nodes is called a [i]scene[/i]. Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of the projects. Nodes can optionally be added to groups. This makes it easy to reach a number of nodes from the code (for example an "enemies" group) to perform grouped actions.
[b]Scene tree:[/b] The [SceneTree] contains the active tree of nodes. When a node is added to the scene tree, it receives the NOTIFICATION_ENTER_TREE notification and its [method _enter_tree] callback is triggered. Children nodes are always added [i]after[/i] their parent node, i.e. the [method _enter_tree] callback of a parent node will be triggered before its child's.
- Once all nodes have been added in the scene tree, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, from the children up to the parent nodes.
+ Once all nodes have been added in the scene tree for the first time, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, from the children up to the parent nodes.
It means that when adding a scene to the scene tree, the following order will be used for the callbacks: [method _enter_tree] of the parent, [method _enter_tree] of the children, [method _ready] of the children and finally [method _ready] of the parent (and that recursively for the whole scene).
[b]Processing:[/b] Nodes can be set to the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback [method _process], toggled with [method set_process]) happens as fast as possible and is dependent on the frame rate, so the processing time [i]delta[/i] is variable. Fixed processing (callback [method _fixed_process], toggled with [method set_fixed_process]) happens a fixed amount of times per second (by default 60) and is useful to link itself to the physics.
Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
@@ -23255,6 +23269,7 @@
<constant name="NOTIFICATION_MOVED_IN_PARENT" value="12">
</constant>
<constant name="NOTIFICATION_READY" value="13">
+ Notification received the first time the object is added into the scene tree, but after all it's children have received it.
</constant>
<constant name="NOTIFICATION_FIXED_PROCESS" value="16">
</constant>
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 9191f1aabc..ccd86177ab 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -80,10 +80,12 @@ def configure(env):
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
+ env.Append(CPPFLAGS=["-mmacosx-version-min=10.9"])
env.Append(LIBS=['pthread'])
#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+ env.Append(LINKFLAGS=["-mmacosx-version-min=10.9"])
if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 3987044d80..04afe63e64 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1329,10 +1329,18 @@ void OS_Windows::vprint(const char* p_format, va_list p_list, bool p_stderr) {
MultiByteToWideChar(CP_UTF8,0,buf,len,wbuf,wlen);
wbuf[wlen]=0;
+// Recent MinGW and MSVC compilers seem to disagree on the case here
+#ifdef __MINGW32__
if (p_stderr)
- fwprintf(stderr,L"%s",wbuf);
+ fwprintf(stderr, L"%S", wbuf);
else
- wprintf(L"%s",wbuf);
+ wprintf(L"%S", wbuf);
+#else // MSVC
+ if (p_stderr)
+ fwprintf(stderr, L"%s", wbuf);
+ else
+ wprintf(L"%s", wbuf);
+#endif
#ifdef STDOUT_FILE
//vwfprintf(stdo,p_format,p_list);
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 65f546e2ee..0172dca4c4 100755..100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -880,9 +880,6 @@ bool OS_X11::is_window_minimized() const {
}
void OS_X11::set_window_maximized(bool p_enabled) {
-
- if (is_window_maximized() == p_enabled) return;
-
// Using EWMH -- Extended Window Manager Hints
XEvent xev;
Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False);
@@ -901,23 +898,6 @@ void OS_X11::set_window_maximized(bool p_enabled) {
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
maximized = p_enabled;
-
- //wait until the window has been resized and update video mode
- while (true) {
- XEvent ev;
- XNextEvent(x11_display, &ev);
- if (ev.type == ConfigureNotify) {
- XConfigureEvent &xc = ev.xconfigure;
- if (xc.send_event == 1 &&
- (xc.width == get_screen_size(get_current_screen()).width || (!p_enabled && xc.width < current_videomode.width))) {
-
- current_videomode.width=xc.width;
- current_videomode.height=xc.height;
- break;
- };
- }
- };
-
}
bool OS_X11::is_window_maximized() const {
@@ -2010,7 +1990,6 @@ OS_X11::OS_X11() {
AudioDriverManagerSW::add_driver(&driver_alsa);
#endif
- maximized = false;
minimized = false;
xim_style=0L;
mouse_mode=MOUSE_MODE_VISIBLE;
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
index df1872380d..4acac1d48e 100644
--- a/scene/gui/button_array.cpp
+++ b/scene/gui/button_array.cpp
@@ -267,9 +267,9 @@ void ButtonArray::_notification(int p_what) {
} else {
if (hover==i)
draw_style_box(style_hover,r);
- else
+ else if (!flat)
draw_style_box(style_normal,r);
- sbsize=style_selected->get_minimum_size();
+ sbsize=style_normal->get_minimum_size();
sbofs=style_normal->get_offset();
f=font_normal;
c=color_normal;
@@ -388,6 +388,17 @@ ButtonArray::Align ButtonArray::get_align() const {
return align;
}
+void ButtonArray::set_flat(bool p_flat) {
+
+ flat=p_flat;
+ update();
+}
+
+bool ButtonArray::is_flat() const {
+
+ return flat;
+}
+
void ButtonArray::add_button(const String& p_text,const String& p_tooltip) {
@@ -525,6 +536,8 @@ void ButtonArray::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_button_tooltip","button_idx"),&ButtonArray::get_button_tooltip);
ObjectTypeDB::bind_method(_MD("get_button_icon:Texture","button_idx"),&ButtonArray::get_button_icon);
ObjectTypeDB::bind_method(_MD("get_button_count"),&ButtonArray::get_button_count);
+ ObjectTypeDB::bind_method(_MD("set_flat","enabled"),&ButtonArray::set_flat);
+ ObjectTypeDB::bind_method(_MD("is_flat"),&ButtonArray::is_flat);
ObjectTypeDB::bind_method(_MD("get_selected"),&ButtonArray::get_selected);
ObjectTypeDB::bind_method(_MD("get_hovered"),&ButtonArray::get_hovered);
ObjectTypeDB::bind_method(_MD("set_selected","button_idx"),&ButtonArray::set_selected);
@@ -539,6 +552,8 @@ void ButtonArray::_bind_methods() {
BIND_CONSTANT( ALIGN_FILL );
BIND_CONSTANT( ALIGN_EXPAND_FILL );
+ ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flat" ), _SCS("set_flat"),_SCS("is_flat") );
+
ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::INT,"button_idx")));
}
@@ -549,5 +564,6 @@ ButtonArray::ButtonArray(Orientation p_orientation) {
selected=-1;
set_focus_mode(FOCUS_ALL);
hover=-1;
+ flat=false;
min_button_size = -1;
}
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
index 62997a8e36..81be3e41c3 100644
--- a/scene/gui/button_array.h
+++ b/scene/gui/button_array.h
@@ -59,6 +59,7 @@ private:
int selected;
int hover;
+ bool flat;
double min_button_size;
Vector<Button> buttons;
@@ -79,6 +80,9 @@ public:
void set_align(Align p_align);
Align get_align() const;
+ void set_flat(bool p_flat);
+ bool is_flat() const;
+
void add_button(const String& p_button,const String& p_tooltip="");
void add_icon_button(const Ref<Texture>& p_icon,const String& p_button="",const String& p_tooltip="");
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f4fb48682c..78a5cb7302 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -172,7 +172,10 @@ void Node::_propagate_ready() {
data.children[i]->_propagate_ready();
}
data.blocked--;
- notification(NOTIFICATION_READY);
+ if(!data.ready_notified) {
+ data.ready_notified=true;
+ notification(NOTIFICATION_READY);
+ }
}
@@ -2999,6 +3002,7 @@ Node::Node() {
data.fixed_process=false;
data.idle_process=false;
data.inside_tree=false;
+ data.ready_notified=false;
data.owner=NULL;
data.OW=NULL;
diff --git a/scene/main/node.h b/scene/main/node.h
index f18dc81195..7b1444f607 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -103,6 +103,7 @@ private:
StringName name;
SceneTree *tree;
bool inside_tree;
+ bool ready_notified;
#ifdef TOOLS_ENABLED
NodePath import_path; //path used when imported, used by scene editors to keep tracking
#endif
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 4c759bddef..439b5fa66f 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -899,10 +899,9 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref
// HButtonArray
-
- t->set_stylebox("normal","HButtonArray", make_stylebox( button_normal_png,4,4,4,4,0,4,22,4) );
- t->set_stylebox("selected","HButtonArray", make_stylebox( button_pressed_png,4,4,4,4,0,4,22,4) );
- t->set_stylebox("hover","HButtonArray", make_stylebox( button_hover_png,4,4,4,4) );
+ t->set_stylebox("normal","HButtonArray", sb_button_normal);
+ t->set_stylebox("selected","HButtonArray", sb_button_pressed);
+ t->set_stylebox("hover","HButtonArray", sb_button_hover);
t->set_font("font","HButtonArray", default_font);
t->set_font("font_selected","HButtonArray", default_font);
@@ -910,17 +909,17 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref
t->set_color("font_color","HButtonArray", control_font_color_low );
t->set_color("font_color_selected","HButtonArray", control_font_color_hover );
- t->set_constant("icon_separator","HButtonArray", 4 *scale );
- t->set_constant("button_separator","HButtonArray", 8 *scale );
+ t->set_constant("icon_separator","HButtonArray", 2 *scale );
+ t->set_constant("button_separator","HButtonArray", 4 *scale );
t->set_stylebox("focus","HButtonArray", focus );
// VButtonArray
- t->set_stylebox("normal","VButtonArray", make_stylebox( button_normal_png,4,4,4,4,0,4,22,4) );
- t->set_stylebox("selected","VButtonArray", make_stylebox( button_pressed_png,4,4,4,4,0,4,22,4) );
- t->set_stylebox("hover","VButtonArray", make_stylebox( button_hover_png,4,4,4,4) );
+ t->set_stylebox("normal","VButtonArray", sb_button_normal);
+ t->set_stylebox("selected","VButtonArray", sb_button_pressed);
+ t->set_stylebox("hover","VButtonArray", sb_button_hover);
t->set_font("font","VButtonArray", default_font);
t->set_font("font_selected","VButtonArray", default_font);
@@ -928,8 +927,8 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref
t->set_color("font_color","VButtonArray", control_font_color_low );
t->set_color("font_color_selected","VButtonArray", control_font_color_hover );
- t->set_constant("icon_separator","VButtonArray", 4 *scale);
- t->set_constant("button_separator","VButtonArray", 8 *scale);
+ t->set_constant("icon_separator","VButtonArray", 2 *scale);
+ t->set_constant("button_separator","VButtonArray", 4 *scale);
t->set_stylebox("focus","VButtonArray", focus );
diff --git a/tools/dist/osx_template.app/Contents/Info.plist b/tools/dist/osx_template.app/Contents/Info.plist
index 5146c875bc..eee787bdaf 100755
--- a/tools/dist/osx_template.app/Contents/Info.plist
+++ b/tools/dist/osx_template.app/Contents/Info.plist
@@ -27,11 +27,11 @@
<key>NSHumanReadableCopyright</key>
<string>$copyright</string>
<key>LSMinimumSystemVersion</key>
- <string>10.6.0</string>
+ <string>10.9.0</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
- <string>10.6.0</string>
+ <string>10.9.0</string>
</dict>
<key>NSHighResolutionCapable</key>
$highres
diff --git a/tools/dist/osx_tools.app/Contents/Info.plist b/tools/dist/osx_tools.app/Contents/Info.plist
index 2a3e727133..868bbb071d 100755
--- a/tools/dist/osx_tools.app/Contents/Info.plist
+++ b/tools/dist/osx_tools.app/Contents/Info.plist
@@ -27,11 +27,11 @@
<key>NSHumanReadableCopyright</key>
<string>© 2007-2016 Juan Linietsky, Ariel Manzur</string>
<key>LSMinimumSystemVersion</key>
- <string>10.6.0</string>
+ <string>10.9.0</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
- <string>10.6.0</string>
+ <string>10.9.0</string>
</dict>
<key>NSHighResolutionCapable</key>
<true/>