summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/allocators.h2
-rw-r--r--core/array.cpp2
-rw-r--r--core/array.h2
-rw-r--r--core/balloon_allocator.h2
-rw-r--r--core/bind/core_bind.cpp15
-rw-r--r--core/bind/core_bind.h1
-rw-r--r--core/color.cpp2
-rw-r--r--core/color.h2
-rw-r--r--core/command_queue_mt.cpp2
-rw-r--r--core/command_queue_mt.h2
-rw-r--r--core/compressed_translation.cpp2
-rw-r--r--core/compressed_translation.h2
-rw-r--r--core/core_string_names.cpp3
-rw-r--r--core/core_string_names.h3
-rw-r--r--core/dictionary.cpp2
-rw-r--r--core/dictionary.h2
-rw-r--r--core/dvector.cpp2
-rw-r--r--core/dvector.h2
-rw-r--r--core/error_list.h2
-rw-r--r--core/error_macros.cpp2
-rw-r--r--core/error_macros.h2
-rw-r--r--core/event_queue.cpp20
-rw-r--r--core/event_queue.h2
-rw-r--r--core/fpstr.cpp2
-rw-r--r--core/fpstr.h2
-rw-r--r--core/global_constants.cpp2
-rw-r--r--core/global_constants.h2
-rw-r--r--core/globals.cpp2
-rw-r--r--core/globals.h2
-rw-r--r--core/hash_map.h2
-rw-r--r--core/hashfuncs.h2
-rw-r--r--core/image.cpp14
-rw-r--r--core/image.h3
-rw-r--r--core/image_quantize.cpp2
-rw-r--r--core/input_map.cpp2
-rw-r--r--core/input_map.h2
-rw-r--r--core/int_types.h2
-rw-r--r--core/io/compression.cpp2
-rw-r--r--core/io/compression.h52
-rw-r--r--core/io/config_file.cpp2
-rw-r--r--core/io/config_file.h2
-rw-r--r--core/io/file_access_buffered.cpp2
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/io/file_access_buffered_fa.h2
-rw-r--r--core/io/file_access_compressed.cpp2
-rw-r--r--core/io/file_access_compressed.h148
-rw-r--r--core/io/file_access_memory.cpp44
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_network.cpp3
-rw-r--r--core/io/file_access_network.h2
-rw-r--r--core/io/file_access_pack.cpp17
-rw-r--r--core/io/file_access_pack.h6
-rw-r--r--core/io/file_access_zip.cpp2
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/io/image_loader.cpp2
-rw-r--r--core/io/image_loader.h2
-rw-r--r--core/io/ip.cpp4
-rw-r--r--core/io/ip.h2
-rw-r--r--core/io/ip_address.cpp2
-rw-r--r--core/io/ip_address.h2
-rw-r--r--core/io/json.cpp2
-rw-r--r--core/io/json.h2
-rw-r--r--core/io/marshalls.cpp2
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--core/io/packet_peer.h2
-rw-r--r--core/io/resource_format_binary.cpp4
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_format_xml.cpp17
-rw-r--r--core/io/resource_format_xml.h4
-rw-r--r--core/io/resource_loader.cpp46
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.cpp2
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/stream_peer.cpp2
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/stream_peer_tcp.cpp2
-rw-r--r--core/io/stream_peer_tcp.h2
-rw-r--r--core/io/tcp_server.cpp2
-rw-r--r--core/io/tcp_server.h2
-rw-r--r--core/io/translation_loader_po.cpp2
-rw-r--r--core/io/translation_loader_po.h2
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/io/xml_parser.h2
-rw-r--r--core/io/zip_io.h2
-rw-r--r--core/list.h2
-rw-r--r--core/map.h2
-rw-r--r--core/math/aabb.cpp2
-rw-r--r--core/math/aabb.h14
-rw-r--r--core/math/bezier_curve.cpp2
-rw-r--r--core/math/bezier_curve.h2
-rw-r--r--core/math/bsp_tree.cpp2
-rw-r--r--core/math/bsp_tree.h2
-rw-r--r--core/math/camera_matrix.cpp2
-rw-r--r--core/math/camera_matrix.h2
-rw-r--r--core/math/face3.cpp2
-rw-r--r--core/math/face3.h2
-rw-r--r--core/math/geometry.cpp2
-rw-r--r--core/math/geometry.h2
-rw-r--r--core/math/math_2d.cpp21
-rw-r--r--core/math/math_2d.h10
-rw-r--r--core/math/math_defs.cpp6
-rw-r--r--core/math/math_defs.h66
-rw-r--r--core/math/math_funcs.cpp6
-rw-r--r--core/math/math_funcs.h2
-rw-r--r--core/math/matrix3.cpp2
-rw-r--r--core/math/matrix3.h2
-rw-r--r--core/math/octree.h2
-rw-r--r--core/math/plane.cpp2
-rw-r--r--core/math/plane.h2
-rw-r--r--core/math/quat.cpp2
-rw-r--r--core/math/quat.h2
-rw-r--r--core/math/quick_hull.cpp2
-rw-r--r--core/math/quick_hull.h2
-rw-r--r--core/math/transform.cpp2
-rw-r--r--core/math/transform.h2
-rw-r--r--core/math/triangle_mesh.cpp1082
-rw-r--r--core/math/triangle_mesh.h144
-rw-r--r--core/math/triangulate.cpp2
-rw-r--r--core/math/triangulate.h2
-rw-r--r--core/math/vector3.cpp21
-rw-r--r--core/math/vector3.h2
-rw-r--r--core/message_queue.cpp2
-rw-r--r--core/message_queue.h2
-rw-r--r--core/method_bind.cpp2
-rw-r--r--core/method_bind.h2
-rw-r--r--core/multi_bucket_array.h2
-rw-r--r--core/object.cpp26
-rw-r--r--core/object.h9
-rw-r--r--core/object_type_db.cpp7
-rw-r--r--core/object_type_db.h4
-rw-r--r--core/os/copymem.cpp2
-rw-r--r--core/os/copymem.h2
-rw-r--r--core/os/dir_access.cpp11
-rw-r--r--core/os/dir_access.h4
-rw-r--r--core/os/file_access.cpp2
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/input.cpp4
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/input_event.cpp2
-rw-r--r--core/os/input_event.h2
-rw-r--r--core/os/keyboard.cpp2
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/os/main_loop.cpp2
-rw-r--r--core/os/main_loop.h2
-rw-r--r--core/os/memory.cpp2
-rw-r--r--core/os/memory.h2
-rw-r--r--core/os/memory_pool_dynamic.cpp2
-rw-r--r--core/os/memory_pool_dynamic.h2
-rw-r--r--core/os/memory_pool_dynamic_prealloc.cpp178
-rw-r--r--core/os/memory_pool_dynamic_prealloc.h66
-rw-r--r--core/os/memory_pool_dynamic_static.cpp2
-rw-r--r--core/os/memory_pool_dynamic_static.h2
-rw-r--r--core/os/memory_pool_static.cpp2
-rw-r--r--core/os/memory_pool_static.h2
-rw-r--r--core/os/mutex.cpp2
-rw-r--r--core/os/mutex.h2
-rw-r--r--core/os/os.cpp5
-rw-r--r--core/os/os.h6
-rw-r--r--core/os/pc_joystick_map.h2
-rw-r--r--core/os/semaphore.cpp2
-rw-r--r--core/os/semaphore.h2
-rw-r--r--core/os/shell.cpp2
-rw-r--r--core/os/shell.h2
-rw-r--r--core/os/thread.cpp2
-rw-r--r--core/os/thread.h2
-rw-r--r--core/os/thread_dummy.cpp2
-rw-r--r--core/os/thread_dummy.h2
-rw-r--r--core/os/thread_safe.cpp2
-rw-r--r--core/os/thread_safe.h2
-rw-r--r--core/packed_data_container.cpp2
-rw-r--r--core/packed_data_container.h2
-rw-r--r--core/pair.cpp2
-rw-r--r--core/pair.h2
-rw-r--r--core/path_db.cpp2
-rw-r--r--core/path_db.h2
-rw-r--r--core/path_remap.cpp322
-rw-r--r--core/path_remap.h80
-rw-r--r--core/pool_allocator.cpp2
-rw-r--r--core/pool_allocator.h2
-rw-r--r--core/print_string.cpp2
-rw-r--r--core/print_string.h2
-rw-r--r--core/ref_ptr.cpp2
-rw-r--r--core/ref_ptr.h2
-rw-r--r--core/reference.cpp6
-rw-r--r--core/reference.h3
-rw-r--r--core/register_core_types.cpp8
-rw-r--r--core/register_core_types.h2
-rw-r--r--core/res_ptr.cpp2
-rw-r--r--core/res_ptr.h2
-rw-r--r--core/resource.cpp2
-rw-r--r--core/resource.h2
-rw-r--r--core/rid.cpp2
-rw-r--r--core/rid.h2
-rw-r--r--core/ring_buffer.h2
-rw-r--r--core/safe_refcount.cpp2
-rw-r--r--core/safe_refcount.h2
-rw-r--r--core/script_debugger_debugger.cpp2
-rw-r--r--core/script_debugger_local.cpp2
-rw-r--r--core/script_debugger_local.h2
-rw-r--r--core/script_debugger_remote.cpp2
-rw-r--r--core/script_debugger_remote.h2
-rw-r--r--core/script_language.cpp2
-rw-r--r--core/script_language.h2
-rw-r--r--core/self_list.h2
-rw-r--r--core/set.h2
-rw-r--r--core/simple_type.h2
-rw-r--r--core/sort.h2
-rw-r--r--core/string_db.cpp20
-rw-r--r--core/string_db.h2
-rw-r--r--core/translation.cpp2
-rw-r--r--core/translation.h2
-rw-r--r--core/typedefs.h2
-rw-r--r--core/undo_redo.cpp2
-rw-r--r--core/undo_redo.h2
-rw-r--r--core/ustring.cpp23
-rw-r--r--core/ustring.h3
-rw-r--r--core/variant.cpp31
-rw-r--r--core/variant.h5
-rw-r--r--core/variant_call.cpp8
-rw-r--r--core/variant_call_bind.h2
-rw-r--r--core/variant_op.cpp60
-rw-r--r--core/vector.h11
-rw-r--r--core/vmap.cpp2
-rw-r--r--core/vmap.h2
-rw-r--r--core/vset.cpp2
-rw-r--r--core/vset.h2
228 files changed, 1627 insertions, 1401 deletions
diff --git a/core/allocators.h b/core/allocators.h
index 42eb4effaf..16e516e87b 100644
--- a/core/allocators.h
+++ b/core/allocators.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/array.cpp b/core/array.cpp
index 728ea5941c..ab9f19d6a0 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/array.h b/core/array.h
index 0b8240558f..904309b257 100644
--- a/core/array.h
+++ b/core/array.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/balloon_allocator.h b/core/balloon_allocator.h
index d99f805f52..177c744669 100644
--- a/core/balloon_allocator.h
+++ b/core/balloon_allocator.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 5839467388..cde328bc6f 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -500,6 +500,10 @@ uint32_t _OS::get_ticks_msec() const {
return OS::get_singleton()->get_ticks_msec();
}
+uint32_t _OS::get_splash_tick_msec() const {
+
+ return OS::get_singleton()->get_splash_tick_msec();
+}
bool _OS::can_use_threads() const {
@@ -709,13 +713,13 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count);
ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen);
- ObjectTypeDB::bind_method(_MD("set_current_screen"),&_OS::set_current_screen);
- ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0));
+ ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen);
+ ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0));
+ ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position);
- ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position);
+ ObjectTypeDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position);
ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size);
- ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size);
+ ObjectTypeDB::bind_method(_MD("set_window_size","size"),&_OS::set_window_size);
ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen);
ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen);
ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable);
@@ -765,6 +769,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec);
ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec);
ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec);
+ ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec);
ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale);
ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index f3601e35fb..ea8ca9af92 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -210,6 +210,7 @@ public:
void delay_usec(uint32_t p_usec) const;
void delay_msec(uint32_t p_msec) const;
uint32_t get_ticks_msec() const;
+ uint32_t get_splash_tick_msec() const;
bool can_use_threads() const;
diff --git a/core/color.cpp b/core/color.cpp
index 3116c33a31..ba4751dc2f 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/color.h b/core/color.h
index 491c72d449..d5d5a4ea09 100644
--- a/core/color.h
+++ b/core/color.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 78151b858f..f28617b33c 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 8b74b3b561..0985f3cfe7 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp
index 0c97f459f8..45fd4b5080 100644
--- a/core/compressed_translation.cpp
+++ b/core/compressed_translation.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/compressed_translation.h b/core/compressed_translation.h
index a0b94116de..c41e2afb53 100644
--- a/core/compressed_translation.h
+++ b/core/compressed_translation.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index 75cb48137b..d0cd19768f 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -42,6 +42,7 @@ CoreStringNames::CoreStringNames() {
_iter_init=StaticCString::create("_iter_init");
_iter_next=StaticCString::create("_iter_next");
_iter_get=StaticCString::create("_iter_get");
+ get_rid=StaticCString::create("get_rid");
}
diff --git a/core/core_string_names.h b/core/core_string_names.h
index e2982acc1a..8bda1f3f79 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -56,6 +56,7 @@ public:
StringName _iter_init;
StringName _iter_next;
StringName _iter_get;
+ StringName get_rid;
};
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 2d503bae50..b2d31f230d 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/dictionary.h b/core/dictionary.h
index de5be0fc6b..8cbabfc65d 100644
--- a/core/dictionary.h
+++ b/core/dictionary.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/dvector.cpp b/core/dvector.cpp
index e0a378a427..60aa2e079f 100644
--- a/core/dvector.cpp
+++ b/core/dvector.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/dvector.h b/core/dvector.h
index 29be417844..2c75bbf9eb 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/error_list.h b/core/error_list.h
index 2127938769..124027172e 100644
--- a/core/error_list.h
+++ b/core/error_list.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index bd08cbb2f5..53bce56626 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/error_macros.h b/core/error_macros.h
index 6cd38755c0..18b08d8e0e 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/event_queue.cpp b/core/event_queue.cpp
index cf6e742f79..1afd686f86 100644
--- a/core/event_queue.cpp
+++ b/core/event_queue.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -56,28 +56,36 @@ Error EventQueue::push_call(uint32_t p_instance_ID, const StringName& p_method,
buffer_end+=sizeof(Event);
- if (args==1) {
+ if (args>=1) {
Variant * v = memnew_placement( &event_buffer[ buffer_end ], Variant );
buffer_end+=sizeof(Variant);
*v=p_arg1;
- } else if (args==2) {
+ }
+
+ if (args>=2) {
Variant * v = memnew_placement( &event_buffer[ buffer_end ], Variant );
buffer_end+=sizeof(Variant);
*v=p_arg2;
- } else if (args==3) {
+ }
+
+ if (args>=3) {
Variant * v = memnew_placement( &event_buffer[ buffer_end ], Variant );
buffer_end+=sizeof(Variant);
*v=p_arg3;
- } else if (args==4) {
+ }
+
+ if (args>=4) {
Variant * v = memnew_placement( &event_buffer[ buffer_end ], Variant );
buffer_end+=sizeof(Variant);
*v=p_arg4;
- } else if (args==5) {
+ }
+
+ if (args>=5) {
Variant * v = memnew_placement( &event_buffer[ buffer_end ], Variant );
buffer_end+=sizeof(Variant);
diff --git a/core/event_queue.h b/core/event_queue.h
index 0647c02777..51ed7373eb 100644
--- a/core/event_queue.h
+++ b/core/event_queue.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/fpstr.cpp b/core/fpstr.cpp
index 25784adb15..20b527d88b 100644
--- a/core/fpstr.cpp
+++ b/core/fpstr.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/fpstr.h b/core/fpstr.h
index d07ae7d5a2..c8ff80806e 100644
--- a/core/fpstr.h
+++ b/core/fpstr.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index fc48a105db..b8d113f67c 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/global_constants.h b/core/global_constants.h
index cd8304bd45..77cd3724c6 100644
--- a/core/global_constants.h
+++ b/core/global_constants.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/globals.cpp b/core/globals.cpp
index a39ace7360..b128914de5 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/globals.h b/core/globals.h
index 580fd0fecd..f739bcfb90 100644
--- a/core/globals.h
+++ b/core/globals.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/hash_map.h b/core/hash_map.h
index da8f038490..eea6d1a153 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index 3b6715a4cd..b12950f160 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/image.cpp b/core/image.cpp
index 17ee569b6b..04b3905489 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -134,6 +134,18 @@ void Image::get_mipmap_offset_and_size(int p_mipmap,int &r_ofs, int &r_size) con
}
+void Image::get_mipmap_offset_size_and_dimensions(int p_mipmap,int &r_ofs, int &r_size,int &w, int& h) const {
+
+
+ int ofs;
+ _get_mipmap_offset_and_size(p_mipmap,ofs,w,h);
+ int ofs2,w2,h2;
+ _get_mipmap_offset_and_size(p_mipmap+1,ofs2,w2,h2);
+ r_ofs=ofs;
+ r_size=ofs2-ofs;
+
+}
+
void Image::put_pixel(int p_x,int p_y, const Color& p_color,int p_mipmap){
ERR_FAIL_INDEX(p_mipmap,mipmaps+1);
diff --git a/core/image.h b/core/image.h
index f4c96703b9..ddb5e88ebf 100644
--- a/core/image.h
+++ b/core/image.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -236,6 +236,7 @@ public:
int get_mipmap_offset(int p_mipmap) const; //get where the mipmap begins in data
void get_mipmap_offset_and_size(int p_mipmap,int &r_ofs, int &r_size) const; //get where the mipmap begins in data
+ void get_mipmap_offset_size_and_dimensions(int p_mipmap,int &r_ofs, int &r_size,int &w, int& h) const; //get where the mipmap begins in data
/**
* Resize the image, using the prefered interpolation method.
diff --git a/core/image_quantize.cpp b/core/image_quantize.cpp
index d728a32861..a14e0ab72e 100644
--- a/core/image_quantize.cpp
+++ b/core/image_quantize.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 9426b0568e..83b1e757da 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/input_map.h b/core/input_map.h
index bf20645b15..875a39555f 100644
--- a/core/input_map.h
+++ b/core/input_map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/int_types.h b/core/int_types.h
index 31f05b2d35..231196b808 100644
--- a/core/int_types.h
+++ b/core/int_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index ea2f5d2d9c..0bc006b41e 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/compression.h b/core/io/compression.h
index 70742d42d6..106a3f0201 100644
--- a/core/io/compression.h
+++ b/core/io/compression.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,28 +26,28 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef COMPRESSION_H
-#define COMPRESSION_H
-
-#include "typedefs.h"
-
-class Compression
-{
-public:
-
- enum Mode {
- MODE_FASTLZ,
- MODE_DEFLATE
- };
-
-
- static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
- static int get_max_compressed_buffer_size(int p_src_size,Mode p_mode=MODE_FASTLZ);
- static void decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
-
- Compression();
-};
-
-
-
-#endif // COMPRESSION_H
+#ifndef COMPRESSION_H
+#define COMPRESSION_H
+
+#include "typedefs.h"
+
+class Compression
+{
+public:
+
+ enum Mode {
+ MODE_FASTLZ,
+ MODE_DEFLATE
+ };
+
+
+ static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
+ static int get_max_compressed_buffer_size(int p_src_size,Mode p_mode=MODE_FASTLZ);
+ static void decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
+
+ Compression();
+};
+
+
+
+#endif // COMPRESSION_H
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 17ee72f2eb..95ae31f3dd 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/config_file.h b/core/io/config_file.h
index e132e46fea..608f143fb1 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 6927b3772f..ab17cb8118 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index 533cc6c7dd..e6de203cda 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h
index 5de2f66ace..d36c4843e4 100644
--- a/core/io/file_access_buffered_fa.h
+++ b/core/io/file_access_buffered_fa.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index b90a41df54..1d06dc8c4b 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 3039b5c8be..69a03fa14f 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,76 +26,76 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef FILE_ACCESS_COMPRESSED_H
-#define FILE_ACCESS_COMPRESSED_H
-
-#include "io/compression.h"
-#include "os/file_access.h"
-
-class FileAccessCompressed : public FileAccess {
-
- Compression::Mode cmode;
- bool writing;
- int write_pos;
- uint8_t*write_ptr;
- int write_buffer_size;
- int write_max;
- int block_size;
- mutable bool read_eof;
- mutable bool at_end;
-
- struct ReadBlock {
- int csize;
- int offset;
- };
-
- mutable Vector<uint8_t> comp_buffer;
- uint8_t *read_ptr;
- mutable int read_block;
- int read_block_count;
- mutable int read_block_size;
- mutable int read_pos;
- Vector<ReadBlock> read_blocks;
- int read_total;
-
-
-
-
- String magic;
- mutable Vector<uint8_t> buffer;
- FileAccess *f;
-public:
-
- void configure(const String& p_magic, Compression::Mode p_mode=Compression::MODE_FASTLZ, int p_block_size=4096);
-
- Error open_after_magic(FileAccess *p_base);
-
- virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
- virtual void close(); ///< close a file
- virtual bool is_open() const; ///< true when file is open
-
- virtual void seek(size_t p_position); ///< seek to a given position
- virtual void seek_end(int64_t p_position=0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
- virtual size_t get_len() const; ///< get size of the file
-
- virtual bool eof_reached() const; ///< reading passed EOF
-
- virtual uint8_t get_8() const; ///< get a byte
- virtual int get_buffer(uint8_t *p_dst, int p_length) const;
-
- virtual Error get_error() const; ///< get last error
-
- virtual void store_8(uint8_t p_dest); ///< store a byte
-
- virtual bool file_exists(const String& p_name); ///< return true if a file exists
-
- virtual uint64_t _get_modified_time(const String& p_file);
-
-
- FileAccessCompressed();
- virtual ~FileAccessCompressed();
-
-};
-
-#endif // FILE_ACCESS_COMPRESSED_H
+#ifndef FILE_ACCESS_COMPRESSED_H
+#define FILE_ACCESS_COMPRESSED_H
+
+#include "io/compression.h"
+#include "os/file_access.h"
+
+class FileAccessCompressed : public FileAccess {
+
+ Compression::Mode cmode;
+ bool writing;
+ int write_pos;
+ uint8_t*write_ptr;
+ int write_buffer_size;
+ int write_max;
+ int block_size;
+ mutable bool read_eof;
+ mutable bool at_end;
+
+ struct ReadBlock {
+ int csize;
+ int offset;
+ };
+
+ mutable Vector<uint8_t> comp_buffer;
+ uint8_t *read_ptr;
+ mutable int read_block;
+ int read_block_count;
+ mutable int read_block_size;
+ mutable int read_pos;
+ Vector<ReadBlock> read_blocks;
+ int read_total;
+
+
+
+
+ String magic;
+ mutable Vector<uint8_t> buffer;
+ FileAccess *f;
+public:
+
+ void configure(const String& p_magic, Compression::Mode p_mode=Compression::MODE_FASTLZ, int p_block_size=4096);
+
+ Error open_after_magic(FileAccess *p_base);
+
+ virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
+ virtual void close(); ///< close a file
+ virtual bool is_open() const; ///< true when file is open
+
+ virtual void seek(size_t p_position); ///< seek to a given position
+ virtual void seek_end(int64_t p_position=0); ///< seek from the end of file
+ virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_len() const; ///< get size of the file
+
+ virtual bool eof_reached() const; ///< reading passed EOF
+
+ virtual uint8_t get_8() const; ///< get a byte
+ virtual int get_buffer(uint8_t *p_dst, int p_length) const;
+
+ virtual Error get_error() const; ///< get last error
+
+ virtual void store_8(uint8_t p_dest); ///< store a byte
+
+ virtual bool file_exists(const String& p_name); ///< return true if a file exists
+
+ virtual uint64_t _get_modified_time(const String& p_file);
+
+
+ FileAccessCompressed();
+ virtual ~FileAccessCompressed();
+
+};
+
+#endif // FILE_ACCESS_COMPRESSED_H
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index a1dd2e48bb..2880c4ebda 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -39,7 +39,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
if (!files) {
files = memnew((Map<String, Vector<uint8_t> >));
- };
+ }
String name;
if (Globals::get_singleton())
@@ -49,7 +49,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
name = DirAccess::normalize_path(name);
(*files)[name] = p_data;
-};
+}
void FileAccessMemory::cleanup() {
@@ -57,13 +57,13 @@ void FileAccessMemory::cleanup() {
return;
memdelete(files);
-};
+}
FileAccess* FileAccessMemory::create() {
return memnew(FileAccessMemory);
-};
+}
bool FileAccessMemory::file_exists(const String& p_name) {
@@ -71,7 +71,7 @@ bool FileAccessMemory::file_exists(const String& p_name) {
name = DirAccess::normalize_path(name);
return files && (files->find(name) != NULL);
-};
+}
Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
@@ -89,57 +89,57 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
pos = 0;
return OK;
-};
+}
void FileAccessMemory::close() {
data = NULL;
-};
+}
bool FileAccessMemory::is_open() const {
return data != NULL;
-};
+}
void FileAccessMemory::seek(size_t p_position) {
ERR_FAIL_COND(!data);
pos = p_position;
-};
+}
void FileAccessMemory::seek_end(int64_t p_position) {
ERR_FAIL_COND(!data);
pos = length + p_position;
-};
+}
size_t FileAccessMemory::get_pos() const {
ERR_FAIL_COND_V(!data, 0);
return pos;
-};
+}
size_t FileAccessMemory::get_len() const {
ERR_FAIL_COND_V(!data, 0);
return length;
-};
+}
bool FileAccessMemory::eof_reached() const {
return pos >= length;
-};
+}
uint8_t FileAccessMemory::get_8() const {
- uint8_t ret;
+ uint8_t ret = 0;
if (pos < length) {
ret = data[pos];
- };
+ }
++pos;
return ret;
-};
+}
int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
@@ -156,19 +156,19 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
pos += p_length;
return read;
-};
+}
Error FileAccessMemory::get_error() const {
return pos >= length ? ERR_FILE_EOF : OK;
-};
+}
void FileAccessMemory::store_8(uint8_t p_byte) {
ERR_FAIL_COND(!data);
ERR_FAIL_COND(pos >= length);
data[pos++] = p_byte;
-};
+}
void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
@@ -176,11 +176,11 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
int write = MIN(p_length, left);
if (write < p_length) {
WARN_PRINT("Writing less data than requested");
- };
+ }
copymem(&data[pos], p_src, write);
pos += p_length;
-};
+}
FileAccessMemory::FileAccessMemory() {
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index a02a022a4f..5a9ec2b3c6 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 26194040b0..850e055129 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -254,6 +254,7 @@ FileAccessNetworkClient::~FileAccessNetworkClient() {
quit=true;
sem->post();
Thread::wait_to_finish(thread);
+ memdelete(thread);
}
memdelete(blockrequest_mutex);
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index f338bea43f..2190cdb0ea 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index afbd7e3d46..bf1211f2b3 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -107,6 +107,21 @@ PackedData::PackedData() {
add_pack_source(memnew(PackedSourcePCK));
}
+void PackedData::_free_packed_dirs(PackedDir *p_dir) {
+
+ for (Map<String,PackedDir*>::Element *E=p_dir->subdirs.front();E;E=E->next())
+ _free_packed_dirs(E->get());
+ memdelete(p_dir);
+}
+
+PackedData::~PackedData() {
+
+ for(int i=0;i<sources.size();i++) {
+ memdelete(sources[i]);
+ }
+ _free_packed_dirs(root);
+}
+
//////////////////////////////////////////////////////////////////
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 2d0cf5b32e..5bf5ad012c 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -96,6 +96,8 @@ private:
static PackedData *singleton;
bool disabled;
+ void _free_packed_dirs(PackedDir *p_dir);
+
public:
void add_pack_source(PackSource* p_source);
@@ -111,6 +113,7 @@ public:
_FORCE_INLINE_ bool has_path(const String& p_path);
PackedData();
+ ~PackedData();
};
class PackSource {
@@ -119,6 +122,7 @@ public:
virtual bool try_open_pack(const String& p_path)=0;
virtual FileAccess* get_file(const String& p_path, PackedData::PackedFile* p_file)=0;
+ virtual ~PackSource() {}
};
class PackedSourcePCK : public PackSource {
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 55c0dedad9..7a1b6454bd 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -150,7 +150,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
bool ZipArchive::try_open_pack(const String& p_name) {
- printf("opening pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
+ //printf("opening pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0)
return false;
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index c7906018e9..dbd009e319 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/http_client.h b/core/io/http_client.h
index d0ebaa4596..21281f38c5 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 180df8964b..d3390ae199 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 665cc0b460..ff972696ea 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 6ef6b31188..523f9f472b 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -183,7 +183,7 @@ void IP::erase_resolve_item(ResolverID p_id) {
GLOBAL_LOCK_FUNCTION;
- resolver->queue[p_id].status=IP::RESOLVER_STATUS_DONE;
+ resolver->queue[p_id].status=IP::RESOLVER_STATUS_NONE;
}
diff --git a/core/io/ip.h b/core/io/ip.h
index 0181dc7d12..6f50a190e6 100644
--- a/core/io/ip.h
+++ b/core/io/ip.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index a1400adbb6..c5506f1a74 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index 3cd8bb7733..e55f45a2d7 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 88a23eb4cd..14890abd26 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/json.h b/core/io/json.h
index d113d0e4ef..78b6303451 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index c6c15af5e0..b0d24abfe3 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index bb8d3b336a..df673debf5 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index b566ce4b7b..7b5ea65a4b 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index e9d6be4fb9..3448ebde1b 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index ead6984650..3d7d2f2367 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -390,7 +390,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(res_path.get_base_dir()+"/"+path);
+ path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
}
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index cc26357bfb..ab2e640a86 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index 033b4d5e5a..9de33e7ef3 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -309,6 +309,7 @@ Error ResourceInteractiveLoaderXML::_parse_array_element(Vector<char> &buff,bool
buff_max++;
buff.resize(buff_max);
+ buffptr=buff.ptr();
}
@@ -458,7 +459,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
path=path.replace("local://",local_path+"::");
else if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir()+"/"+path);
+ path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
@@ -1423,7 +1424,7 @@ Error ResourceInteractiveLoaderXML::poll() {
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir()+"/"+path);
+ path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
@@ -1601,7 +1602,7 @@ void ResourceInteractiveLoaderXML::get_dependencies(FileAccess *f,List<String> *
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir()+"/"+path);
+ path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
if (path.ends_with("*")) {
@@ -2243,12 +2244,12 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
List<Variant> keys;
dict.get_key_list(&keys);
+ keys.sort();
for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
//if (!_check_type(dict[E->get()]))
// continue;
-
bool ok;
write_property("",E->get(),&ok);
ERR_CONTINUE(!ok);
@@ -2438,7 +2439,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo
return;
if (!p_main && (!bundle_resources ) && res->get_path().length() && res->get_path().find("::") == -1 ) {
- external_resources.insert(res);
+ external_resources.push_back(res);
return;
}
@@ -2448,6 +2449,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo
List<PropertyInfo> property_list;
res->get_property_list( &property_list );
+ property_list.sort();
List<PropertyInfo>::Element *I=property_list.front();
@@ -2525,7 +2527,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
enter_tag("resource_file","type=\""+p_resource->get_type()+"\" subresource_count=\""+itos(saved_resources.size()+external_resources.size())+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\"");
write_string("\n",false);
- for(Set<RES>::Element *E=external_resources.front();E;E=E->next()) {
+ for(List<RES>::Element *E=external_resources.front();E;E=E->next()) {
write_tabs();
String p = E->get()->get_path();
@@ -2562,6 +2564,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
List<PropertyInfo> property_list;
res->get_property_list(&property_list);
+// property_list.sort();
for(List<PropertyInfo>::Element *PE = property_list.front();PE;PE=PE->next()) {
diff --git a/core/io/resource_format_xml.h b/core/io/resource_format_xml.h
index 40aaa01451..711b607668 100644
--- a/core/io/resource_format_xml.h
+++ b/core/io/resource_format_xml.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -125,7 +125,7 @@ class ResourceFormatSaverXMLInstance {
int depth;
Map<RES,int> resource_map;
List<RES> saved_resources;
- Set<RES> external_resources;
+ List<RES> external_resources;
void enter_tag(const char* p_tag,const String& p_args=String());
void exit_tag(const char* p_tag);
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index d2610d5d4f..03b6c9759b 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -117,6 +117,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoader::load_interactive(const Stri
RES ResourceFormatLoader::load(const String &p_path,const String& p_original_path) {
+ String path=p_path;
//or this must be implemented
Ref<ResourceInteractiveLoader> ril = load_interactive(p_path);
@@ -150,9 +151,13 @@ void ResourceFormatLoader::get_dependencies(const String& p_path,List<String> *p
RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_no_cache) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
- local_path=find_complete_path(p_path,p_type_hint);
+ local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",RES());
if (!p_no_cache && ResourceCache::has(local_path)) {
@@ -209,7 +214,11 @@ RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_n
Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
String extension=p_path.extension();
bool found=false;
@@ -283,9 +292,13 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
- local_path=find_complete_path(p_path,p_type_hint);
+ local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>());
@@ -340,7 +353,13 @@ void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_l
void ResourceLoader::get_dependencies(const String& p_path,List<String> *p_dependencies) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
+
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension();
@@ -359,7 +378,11 @@ void ResourceLoader::get_dependencies(const String& p_path,List<String> *p_depen
String ResourceLoader::guess_full_filename(const String &p_path,const String& p_type) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
return find_complete_path(local_path,p_type);
@@ -367,7 +390,12 @@ String ResourceLoader::guess_full_filename(const String &p_path,const String& p_
String ResourceLoader::get_resource_type(const String &p_path) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path;
+ if (p_path.is_rel_path())
+ local_path="res://"+p_path;
+ else
+ local_path = Globals::get_singleton()->localize_path(p_path);
+
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension();
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index ab23158785..d25727f19f 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 598f517d76..fdb9a53f0d 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index e307668721..05cbe7f98e 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 0eae660373..b00b462eb6 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 84552cfd3e..e83fc71b93 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index f83c174084..c2343790ea 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index d447ded78b..0e37303516 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index bce9e19ae3..803df87086 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index fff00e5ce0..b59f3293d7 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index 0d42cebb41..c32b25c407 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 7a0c4e10dc..9d8ad97a29 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 1d69f8e5e7..1ff458f325 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index 9debbf9e2f..418a8efa70 100644
--- a/core/io/xml_parser.h
+++ b/core/io/xml_parser.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index 798265cc48..c4b4d6b34d 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/list.h b/core/list.h
index ef30e43d21..6deb150ef6 100644
--- a/core/list.h
+++ b/core/list.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/map.h b/core/map.h
index 05abdc510e..e45c833bcb 100644
--- a/core/map.h
+++ b/core/map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp
index 576e4fa928..435df66aab 100644
--- a/core/math/aabb.cpp
+++ b/core/math/aabb.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/aabb.h b/core/math/aabb.h
index 089d5d15f7..4781e5c263 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -110,17 +110,17 @@ public:
inline bool AABB::intersects(const AABB& p_aabb) const {
- if ( pos.x > (p_aabb.pos.x + p_aabb.size.x) )
+ if ( pos.x >= (p_aabb.pos.x + p_aabb.size.x) )
return false;
- if ( (pos.x+size.x) < p_aabb.pos.x )
+ if ( (pos.x+size.x) <= p_aabb.pos.x )
return false;
- if ( pos.y > (p_aabb.pos.y + p_aabb.size.y) )
+ if ( pos.y >= (p_aabb.pos.y + p_aabb.size.y) )
return false;
- if ( (pos.y+size.y) < p_aabb.pos.y )
+ if ( (pos.y+size.y) <= p_aabb.pos.y )
return false;
- if ( pos.z > (p_aabb.pos.z + p_aabb.size.z) )
+ if ( pos.z >= (p_aabb.pos.z + p_aabb.size.z) )
return false;
- if ( (pos.z+size.z) < p_aabb.pos.z )
+ if ( (pos.z+size.z) <= p_aabb.pos.z )
return false;
return true;
diff --git a/core/math/bezier_curve.cpp b/core/math/bezier_curve.cpp
index 2676804945..c9467a77e4 100644
--- a/core/math/bezier_curve.cpp
+++ b/core/math/bezier_curve.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/bezier_curve.h b/core/math/bezier_curve.h
index 6cc4c730db..de14d68987 100644
--- a/core/math/bezier_curve.h
+++ b/core/math/bezier_curve.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp
index 7f838b1215..d71b7551d9 100644
--- a/core/math/bsp_tree.cpp
+++ b/core/math/bsp_tree.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h
index 03bfd947cb..b980d9590b 100644
--- a/core/math/bsp_tree.h
+++ b/core/math/bsp_tree.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index fbe5f8c741..f1afa33a4b 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index 767236ea04..52b84f4870 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/face3.cpp b/core/math/face3.cpp
index 1adc95e4e9..354372df74 100644
--- a/core/math/face3.cpp
+++ b/core/math/face3.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/face3.h b/core/math/face3.h
index 5a509299a2..eccbc78122 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 2d525dd1ce..14adde74e7 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 4ad4db8523..b438b41d61 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index 3aaa539fbb..0a3963f88f 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -230,6 +230,23 @@ Vector2 Vector2::cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, co
+ Vector2 p0=p_pre_a;
+ Vector2 p1=*this;
+ Vector2 p2=p_b;
+ Vector2 p3=p_post_b;
+
+ float t = p_t;
+ float t2 = t * t;
+ float t3 = t2 * t;
+
+ Vector2 out;
+ out = 0.5f * ( ( p1 * 2.0f) +
+ ( -p0 + p2 ) * t +
+ ( 2.0f * p0 - 5.0f * p1 + 4 * p2 - p3 ) * t2 +
+ ( -p0 + 3.0f * p1 - 3.0f * p2 + p3 ) * t3 );
+ return out;
+
+/*
float mu = p_t;
float mu2 = mu*mu;
@@ -239,7 +256,7 @@ Vector2 Vector2::cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, co
Vector2 a3 = *this;
return ( a0*mu*mu2 + a1*mu2 + a2*mu + a3 );
-
+*/
/*
float t = p_t;
real_t t2 = t*t;
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index 5bc1b5f0be..ac315fddb7 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -214,13 +214,13 @@ struct Rect2 {
float get_area() const { return size.width*size.height; }
inline bool intersects(const Rect2& p_rect) const {
- if ( pos.x > (p_rect.pos.x + p_rect.size.width) )
+ if ( pos.x >= (p_rect.pos.x + p_rect.size.width) )
return false;
- if ( (pos.x+size.width) < p_rect.pos.x )
+ if ( (pos.x+size.width) <= p_rect.pos.x )
return false;
- if ( pos.y > (p_rect.pos.y + p_rect.size.height) )
+ if ( pos.y >= (p_rect.pos.y + p_rect.size.height) )
return false;
- if ( (pos.y+size.height) < p_rect.pos.y )
+ if ( (pos.y+size.height) <= p_rect.pos.y )
return false;
return true;
diff --git a/core/math/math_defs.cpp b/core/math/math_defs.cpp
index ca43bc7ae3..51aaa6800e 100644
--- a/core/math/math_defs.cpp
+++ b/core/math/math_defs.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,5 +26,5 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "math_defs.h"
-
+#include "math_defs.h"
+
diff --git a/core/math/math_defs.h b/core/math/math_defs.h
index dd0390240a..7cb6c7f499 100644
--- a/core/math/math_defs.h
+++ b/core/math/math_defs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,35 +26,35 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef MATH_DEFS_H
-#define MATH_DEFS_H
-
-#define CMP_EPSILON 0.00001
-#define CMP_EPSILON2 (CMP_EPSILON*CMP_EPSILON)
-#define CMP_NORMALIZE_TOLERANCE 0.000001
-#define CMP_POINT_IN_PLANE_EPSILON 0.00001
-
-/**
- * "Real" is a type that will be translated to either floats or fixed depending
- * on the compilation setting
- */
-
-enum ClockDirection {
-
- CLOCKWISE,
- COUNTERCLOCKWISE
-};
-
-
-#ifdef REAL_T_IS_DOUBLE
-
-typedef double real_t;
-
-#else
-
-typedef float real_t;
-
-#endif
-
-
-#endif // MATH_DEFS_H
+#ifndef MATH_DEFS_H
+#define MATH_DEFS_H
+
+#define CMP_EPSILON 0.00001
+#define CMP_EPSILON2 (CMP_EPSILON*CMP_EPSILON)
+#define CMP_NORMALIZE_TOLERANCE 0.000001
+#define CMP_POINT_IN_PLANE_EPSILON 0.00001
+
+/**
+ * "Real" is a type that will be translated to either floats or fixed depending
+ * on the compilation setting
+ */
+
+enum ClockDirection {
+
+ CLOCKWISE,
+ COUNTERCLOCKWISE
+};
+
+
+#ifdef REAL_T_IS_DOUBLE
+
+typedef double real_t;
+
+#else
+
+typedef float real_t;
+
+#endif
+
+
+#endif // MATH_DEFS_H
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index ad48ceaac0..6ad5c7499b 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -48,8 +48,8 @@ uint32_t Math::rand_from_seed(uint32_t *seed) {
s = 0x12345987;
k = s / 127773;
s = 16807 * (s - k * 127773) - 2836 * k;
- if (s < 0)
- s += 2147483647;
+// if (s < 0)
+// s += 2147483647;
(*seed) = s;
return (s & Math::RANDOM_MAX);
#else
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 6d43ed8e64..33175ed2fc 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index ff62e7786b..10f1461fdc 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/matrix3.h b/core/math/matrix3.h
index f68703ca23..98feb2dbbd 100644
--- a/core/math/matrix3.h
+++ b/core/math/matrix3.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/octree.h b/core/math/octree.h
index b64ba381c0..84de388178 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index 88c7be5f63..f9395a002a 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/plane.h b/core/math/plane.h
index 608ec26926..604b880266 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index 950a4756ad..e0c4b0793c 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/quat.h b/core/math/quat.h
index 04901116b8..de4aedaeec 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index a417cdaddf..80ae0f04e1 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index d7f056d366..cb486a0b6f 100644
--- a/core/math/quick_hull.h
+++ b/core/math/quick_hull.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/transform.cpp b/core/math/transform.cpp
index bb874facbd..a6f4f626cc 100644
--- a/core/math/transform.cpp
+++ b/core/math/transform.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/transform.h b/core/math/transform.h
index b1a0ea1ab8..a992843d70 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 111ceca185..70cb639fc2 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,543 +26,543 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "triangle_mesh.h"
-#include "sort.h"
-
-
-
-int TriangleMesh::_create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_depth,int&max_depth,int&max_alloc) {
-
-
- if (p_depth>max_depth) {
- max_depth=p_depth;
- }
-
- if (p_size==1) {
-
-
- return p_bb[p_from]-p_bvh;
- } else if (p_size==0) {
-
- return -1;
- }
-
-
- AABB aabb;
- aabb=p_bb[p_from]->aabb;
- for(int i=1;i<p_size;i++) {
-
- aabb.merge_with(p_bb[p_from+i]->aabb);
- }
-
- int li=aabb.get_longest_axis_index();
-
- switch(li) {
-
- case Vector3::AXIS_X: {
- SortArray<BVH*,BVHCmpX> sort_x;
- sort_x.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
- //sort_x.sort(&p_bb[p_from],p_size);
- } break;
- case Vector3::AXIS_Y: {
- SortArray<BVH*,BVHCmpY> sort_y;
- sort_y.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
- //sort_y.sort(&p_bb[p_from],p_size);
- } break;
- case Vector3::AXIS_Z: {
- SortArray<BVH*,BVHCmpZ> sort_z;
- sort_z.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
- //sort_z.sort(&p_bb[p_from],p_size);
-
- } break;
- }
-
-
- int left = _create_bvh(p_bvh,p_bb,p_from,p_size/2,p_depth+1,max_depth,max_alloc);
- int right = _create_bvh(p_bvh,p_bb,p_from+p_size/2,p_size-p_size/2,p_depth+1,max_depth,max_alloc);
-
- int index=max_alloc++;
- BVH *_new = &p_bvh[index];
- _new->aabb=aabb;
- _new->center=aabb.pos+aabb.size*0.5;
- _new->face_index=-1;
- _new->left=left;
- _new->right=right;
-
- return index;
-
-}
-
-
-void TriangleMesh::create(const DVector<Vector3>& p_faces) {
-
- valid=false;
-
- int fc=p_faces.size();
- ERR_FAIL_COND(!fc || ((fc%3) != 0));
- fc/=3;
- triangles.resize(fc);
-
- bvh.resize(fc*3); //will never be larger than this (todo make better)
- DVector<BVH>::Write bw = bvh.write();
-
- {
-
- //create faces and indices and base bvh
- //except for the Set for repeated triangles, everything
- //goes in-place.
-
- DVector<Vector3>::Read r = p_faces.read();
- DVector<Triangle>::Write w = triangles.write();
- Map<Vector3,int> db;
-
- for(int i=0;i<fc;i++) {
-
- Triangle&f=w[i];
- const Vector3 *v=&r[i*3];
-
- for(int j=0;j<3;j++) {
-
- int vidx=-1;
- Vector3 vs=v[j].snapped(0.0001);
- Map<Vector3,int>::Element *E=db.find(vs);
- if (E) {
- vidx=E->get();
- } else {
- vidx=db.size();
- db[vs]=vidx;
- }
-
- f.indices[j]=vidx;
- if (j==0)
- bw[i].aabb.pos=vs;
- else
- bw[i].aabb.expand_to(vs);
- }
-
- f.normal=Face3(r[i*3+0],r[i*3+1],r[i*3+2]).get_plane().get_normal();
-
- bw[i].left=-1;
- bw[i].right=-1;
- bw[i].face_index=i;
- bw[i].center=bw[i].aabb.pos+bw[i].aabb.size*0.5;
- }
-
- vertices.resize(db.size());
- DVector<Vector3>::Write vw = vertices.write();
- for (Map<Vector3,int>::Element *E=db.front();E;E=E->next()) {
- vw[E->get()]=E->key();
- }
-
- }
-
- DVector<BVH*> bwptrs;
- bwptrs.resize(fc);
- DVector<BVH*>::Write bwp = bwptrs.write();
- for(int i=0;i<fc;i++) {
-
- bwp[i]=&bw[i];
- }
-
- max_depth=0;
- int max_alloc=fc;
- int max=_create_bvh(bw.ptr(),bwp.ptr(),0,fc,1,max_depth,max_alloc);
-
- bw=DVector<BVH>::Write(); //clearup
- bvh.resize(max_alloc); //resize back
-
- valid=true;
-
-}
-
-
-Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const {
-
- uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
-
- enum {
- TEST_AABB_BIT=0,
- VISIT_LEFT_BIT=1,
- VISIT_RIGHT_BIT=2,
- VISIT_DONE_BIT=3,
- VISITED_BIT_SHIFT=29,
- NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
- VISITED_BIT_MASK=~NODE_IDX_MASK,
-
-
- };
-
- int n_count=0;
- Vector3 n;
-
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
- int level=0;
-
- DVector<Triangle>::Read trianglesr = triangles.read();
- DVector<Vector3>::Read verticesr=vertices.read();
- DVector<BVH>::Read bvhr=bvh.read();
-
- const Triangle *triangleptr=trianglesr.ptr();
- const Vector3 *vertexptr=verticesr.ptr();
- int pos=bvh.size()-1;
- const BVH *bvhptr = bvhr.ptr();
-
- stack[0]=pos;
- while(true) {
-
- uint32_t node = stack[level]&NODE_IDX_MASK;
- const BVH &b = bvhptr[ node ];
- bool done=false;
-
- switch(stack[level]>>VISITED_BIT_SHIFT) {
- case TEST_AABB_BIT: {
-
-
- bool valid = b.aabb.intersects(p_aabb);
- if (!valid) {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- if (b.face_index>=0) {
-
- const Triangle &s=triangleptr[ b.face_index ];
- n+=s.normal;
- n_count++;
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
- }
- }
-
- } continue;
- case VISIT_LEFT_BIT: {
-
- stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.left|TEST_AABB_BIT;
- level++;
-
- } continue;
- case VISIT_RIGHT_BIT: {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.right|TEST_AABB_BIT;
- level++;
- } continue;
- case VISIT_DONE_BIT: {
-
- if (level==0) {
- done=true;
- break;
- } else
- level--;
-
- } continue;
- }
-
-
- if (done)
- break;
- }
-
-
- if (n_count>0)
- n/=n_count;
-
- return n;
-
-}
-
-
-bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const {
-
-
- uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
-
- enum {
- TEST_AABB_BIT=0,
- VISIT_LEFT_BIT=1,
- VISIT_RIGHT_BIT=2,
- VISIT_DONE_BIT=3,
- VISITED_BIT_SHIFT=29,
- NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
- VISITED_BIT_MASK=~NODE_IDX_MASK,
-
-
- };
-
- Vector3 n = (p_end-p_begin).normalized();
- real_t d=1e10;
- bool inters=false;
-
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
- int level=0;
- //AABB ray_aabb;
- //ray_aabb.pos=p_begin;
- //ray_aabb.expand_to(p_end);
-
-
- DVector<Triangle>::Read trianglesr = triangles.read();
- DVector<Vector3>::Read verticesr=vertices.read();
- DVector<BVH>::Read bvhr=bvh.read();
-
- const Triangle *triangleptr=trianglesr.ptr();
- const Vector3 *vertexptr=verticesr.ptr();
- int pos=bvh.size()-1;
- const BVH *bvhptr = bvhr.ptr();
-
- stack[0]=pos;
- while(true) {
-
- uint32_t node = stack[level]&NODE_IDX_MASK;
- const BVH &b = bvhptr[ node ];
- bool done=false;
-
- switch(stack[level]>>VISITED_BIT_SHIFT) {
- case TEST_AABB_BIT: {
-
-
- bool valid = b.aabb.intersects_segment(p_begin,p_end);
-// bool valid = b.aabb.intersects(ray_aabb);
-
- if (!valid) {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- if (b.face_index>=0) {
-
- const Triangle &s=triangleptr[ b.face_index ];
- Face3 f3(vertexptr[ s.indices[0] ],vertexptr[ s.indices[1] ],vertexptr[ s.indices[2] ]);
-
-
- Vector3 res;
-
- if (f3.intersects_segment(p_begin,p_end,&res)) {
-
-
- float nd = n.dot(res);
- if (nd<d) {
-
- d=nd;
- r_point=res;
- r_normal=f3.get_plane().get_normal();
- inters=true;
- }
-
- }
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
- }
- }
-
- } continue;
- case VISIT_LEFT_BIT: {
-
- stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.left|TEST_AABB_BIT;
- level++;
-
- } continue;
- case VISIT_RIGHT_BIT: {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.right|TEST_AABB_BIT;
- level++;
- } continue;
- case VISIT_DONE_BIT: {
-
- if (level==0) {
- done=true;
- break;
- } else
- level--;
-
- } continue;
- }
-
-
- if (done)
- break;
- }
-
-
- if (inters) {
-
- if (n.dot(r_normal)>0)
- r_normal=-r_normal;
- }
-
- return inters;
-}
-
-
-bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const {
-
-
- uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
-
- enum {
- TEST_AABB_BIT=0,
- VISIT_LEFT_BIT=1,
- VISIT_RIGHT_BIT=2,
- VISIT_DONE_BIT=3,
- VISITED_BIT_SHIFT=29,
- NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
- VISITED_BIT_MASK=~NODE_IDX_MASK,
-
-
- };
-
- Vector3 n = p_dir;
- real_t d=1e20;
- bool inters=false;
-
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
- int level=0;
-
- DVector<Triangle>::Read trianglesr = triangles.read();
- DVector<Vector3>::Read verticesr=vertices.read();
- DVector<BVH>::Read bvhr=bvh.read();
-
- const Triangle *triangleptr=trianglesr.ptr();
- const Vector3 *vertexptr=verticesr.ptr();
- int pos=bvh.size()-1;
- const BVH *bvhptr = bvhr.ptr();
-
- stack[0]=pos;
- while(true) {
-
- uint32_t node = stack[level]&NODE_IDX_MASK;
- const BVH &b = bvhptr[ node ];
- bool done=false;
-
- switch(stack[level]>>VISITED_BIT_SHIFT) {
- case TEST_AABB_BIT: {
-
-
- bool valid = b.aabb.intersects_ray(p_begin,p_dir);
- if (!valid) {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- if (b.face_index>=0) {
-
- const Triangle &s=triangleptr[ b.face_index ];
- Face3 f3(vertexptr[ s.indices[0] ],vertexptr[ s.indices[1] ],vertexptr[ s.indices[2] ]);
-
-
- Vector3 res;
-
- if (f3.intersects_ray(p_begin,p_dir,&res)) {
-
-
- float nd = n.dot(res);
- if (nd<d) {
-
- d=nd;
- r_point=res;
- r_normal=f3.get_plane().get_normal();
- inters=true;
- }
-
- }
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
-
- } else {
-
- stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
- }
- }
-
- } continue;
- case VISIT_LEFT_BIT: {
-
- stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.left|TEST_AABB_BIT;
- level++;
-
- } continue;
- case VISIT_RIGHT_BIT: {
-
- stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
- stack[level+1]=b.right|TEST_AABB_BIT;
- level++;
- } continue;
- case VISIT_DONE_BIT: {
-
- if (level==0) {
- done=true;
- break;
- } else
- level--;
-
- } continue;
- }
-
-
- if (done)
- break;
- }
-
-
- if (inters) {
-
- if (n.dot(r_normal)>0)
- r_normal=-r_normal;
- }
-
- return inters;
-}
-
-bool TriangleMesh::is_valid() const {
-
- return valid;
-}
-
-DVector<Face3> TriangleMesh::get_faces() const {
-
- if (!valid)
- return DVector<Face3>();
-
- DVector<Face3> faces;
- int ts = triangles.size();
- faces.resize(triangles.size());
-
- DVector<Face3>::Write w=faces.write();
- DVector<Triangle>::Read r = triangles.read();
- DVector<Vector3>::Read rv = vertices.read();
-
- for(int i=0;i<ts;i++) {
- for(int j=0;j<3;j++) {
- w[i].vertex[j]=rv[r[i].indices[j]];
- }
- }
-
- w = DVector<Face3>::Write();
- return faces;
-}
-
-TriangleMesh::TriangleMesh() {
-
- valid=false;
- max_depth=0;
-}
+#include "triangle_mesh.h"
+#include "sort.h"
+
+
+
+int TriangleMesh::_create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_depth,int&max_depth,int&max_alloc) {
+
+
+ if (p_depth>max_depth) {
+ max_depth=p_depth;
+ }
+
+ if (p_size==1) {
+
+
+ return p_bb[p_from]-p_bvh;
+ } else if (p_size==0) {
+
+ return -1;
+ }
+
+
+ AABB aabb;
+ aabb=p_bb[p_from]->aabb;
+ for(int i=1;i<p_size;i++) {
+
+ aabb.merge_with(p_bb[p_from+i]->aabb);
+ }
+
+ int li=aabb.get_longest_axis_index();
+
+ switch(li) {
+
+ case Vector3::AXIS_X: {
+ SortArray<BVH*,BVHCmpX> sort_x;
+ sort_x.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
+ //sort_x.sort(&p_bb[p_from],p_size);
+ } break;
+ case Vector3::AXIS_Y: {
+ SortArray<BVH*,BVHCmpY> sort_y;
+ sort_y.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
+ //sort_y.sort(&p_bb[p_from],p_size);
+ } break;
+ case Vector3::AXIS_Z: {
+ SortArray<BVH*,BVHCmpZ> sort_z;
+ sort_z.nth_element(0,p_size,p_size/2,&p_bb[p_from]);
+ //sort_z.sort(&p_bb[p_from],p_size);
+
+ } break;
+ }
+
+
+ int left = _create_bvh(p_bvh,p_bb,p_from,p_size/2,p_depth+1,max_depth,max_alloc);
+ int right = _create_bvh(p_bvh,p_bb,p_from+p_size/2,p_size-p_size/2,p_depth+1,max_depth,max_alloc);
+
+ int index=max_alloc++;
+ BVH *_new = &p_bvh[index];
+ _new->aabb=aabb;
+ _new->center=aabb.pos+aabb.size*0.5;
+ _new->face_index=-1;
+ _new->left=left;
+ _new->right=right;
+
+ return index;
+
+}
+
+
+void TriangleMesh::create(const DVector<Vector3>& p_faces) {
+
+ valid=false;
+
+ int fc=p_faces.size();
+ ERR_FAIL_COND(!fc || ((fc%3) != 0));
+ fc/=3;
+ triangles.resize(fc);
+
+ bvh.resize(fc*3); //will never be larger than this (todo make better)
+ DVector<BVH>::Write bw = bvh.write();
+
+ {
+
+ //create faces and indices and base bvh
+ //except for the Set for repeated triangles, everything
+ //goes in-place.
+
+ DVector<Vector3>::Read r = p_faces.read();
+ DVector<Triangle>::Write w = triangles.write();
+ Map<Vector3,int> db;
+
+ for(int i=0;i<fc;i++) {
+
+ Triangle&f=w[i];
+ const Vector3 *v=&r[i*3];
+
+ for(int j=0;j<3;j++) {
+
+ int vidx=-1;
+ Vector3 vs=v[j].snapped(0.0001);
+ Map<Vector3,int>::Element *E=db.find(vs);
+ if (E) {
+ vidx=E->get();
+ } else {
+ vidx=db.size();
+ db[vs]=vidx;
+ }
+
+ f.indices[j]=vidx;
+ if (j==0)
+ bw[i].aabb.pos=vs;
+ else
+ bw[i].aabb.expand_to(vs);
+ }
+
+ f.normal=Face3(r[i*3+0],r[i*3+1],r[i*3+2]).get_plane().get_normal();
+
+ bw[i].left=-1;
+ bw[i].right=-1;
+ bw[i].face_index=i;
+ bw[i].center=bw[i].aabb.pos+bw[i].aabb.size*0.5;
+ }
+
+ vertices.resize(db.size());
+ DVector<Vector3>::Write vw = vertices.write();
+ for (Map<Vector3,int>::Element *E=db.front();E;E=E->next()) {
+ vw[E->get()]=E->key();
+ }
+
+ }
+
+ DVector<BVH*> bwptrs;
+ bwptrs.resize(fc);
+ DVector<BVH*>::Write bwp = bwptrs.write();
+ for(int i=0;i<fc;i++) {
+
+ bwp[i]=&bw[i];
+ }
+
+ max_depth=0;
+ int max_alloc=fc;
+ int max=_create_bvh(bw.ptr(),bwp.ptr(),0,fc,1,max_depth,max_alloc);
+
+ bw=DVector<BVH>::Write(); //clearup
+ bvh.resize(max_alloc); //resize back
+
+ valid=true;
+
+}
+
+
+Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const {
+
+ uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
+
+ enum {
+ TEST_AABB_BIT=0,
+ VISIT_LEFT_BIT=1,
+ VISIT_RIGHT_BIT=2,
+ VISIT_DONE_BIT=3,
+ VISITED_BIT_SHIFT=29,
+ NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
+ VISITED_BIT_MASK=~NODE_IDX_MASK,
+
+
+ };
+
+ int n_count=0;
+ Vector3 n;
+
+ //for(int i=0;i<max_depth;i++)
+ // stack[i]=0;
+
+ int level=0;
+
+ DVector<Triangle>::Read trianglesr = triangles.read();
+ DVector<Vector3>::Read verticesr=vertices.read();
+ DVector<BVH>::Read bvhr=bvh.read();
+
+ const Triangle *triangleptr=trianglesr.ptr();
+ const Vector3 *vertexptr=verticesr.ptr();
+ int pos=bvh.size()-1;
+ const BVH *bvhptr = bvhr.ptr();
+
+ stack[0]=pos;
+ while(true) {
+
+ uint32_t node = stack[level]&NODE_IDX_MASK;
+ const BVH &b = bvhptr[ node ];
+ bool done=false;
+
+ switch(stack[level]>>VISITED_BIT_SHIFT) {
+ case TEST_AABB_BIT: {
+
+
+ bool valid = b.aabb.intersects(p_aabb);
+ if (!valid) {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ if (b.face_index>=0) {
+
+ const Triangle &s=triangleptr[ b.face_index ];
+ n+=s.normal;
+ n_count++;
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
+ }
+ }
+
+ } continue;
+ case VISIT_LEFT_BIT: {
+
+ stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.left|TEST_AABB_BIT;
+ level++;
+
+ } continue;
+ case VISIT_RIGHT_BIT: {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.right|TEST_AABB_BIT;
+ level++;
+ } continue;
+ case VISIT_DONE_BIT: {
+
+ if (level==0) {
+ done=true;
+ break;
+ } else
+ level--;
+
+ } continue;
+ }
+
+
+ if (done)
+ break;
+ }
+
+
+ if (n_count>0)
+ n/=n_count;
+
+ return n;
+
+}
+
+
+bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const {
+
+
+ uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
+
+ enum {
+ TEST_AABB_BIT=0,
+ VISIT_LEFT_BIT=1,
+ VISIT_RIGHT_BIT=2,
+ VISIT_DONE_BIT=3,
+ VISITED_BIT_SHIFT=29,
+ NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
+ VISITED_BIT_MASK=~NODE_IDX_MASK,
+
+
+ };
+
+ Vector3 n = (p_end-p_begin).normalized();
+ real_t d=1e10;
+ bool inters=false;
+
+ //for(int i=0;i<max_depth;i++)
+ // stack[i]=0;
+
+ int level=0;
+ //AABB ray_aabb;
+ //ray_aabb.pos=p_begin;
+ //ray_aabb.expand_to(p_end);
+
+
+ DVector<Triangle>::Read trianglesr = triangles.read();
+ DVector<Vector3>::Read verticesr=vertices.read();
+ DVector<BVH>::Read bvhr=bvh.read();
+
+ const Triangle *triangleptr=trianglesr.ptr();
+ const Vector3 *vertexptr=verticesr.ptr();
+ int pos=bvh.size()-1;
+ const BVH *bvhptr = bvhr.ptr();
+
+ stack[0]=pos;
+ while(true) {
+
+ uint32_t node = stack[level]&NODE_IDX_MASK;
+ const BVH &b = bvhptr[ node ];
+ bool done=false;
+
+ switch(stack[level]>>VISITED_BIT_SHIFT) {
+ case TEST_AABB_BIT: {
+
+
+ bool valid = b.aabb.intersects_segment(p_begin,p_end);
+// bool valid = b.aabb.intersects(ray_aabb);
+
+ if (!valid) {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ if (b.face_index>=0) {
+
+ const Triangle &s=triangleptr[ b.face_index ];
+ Face3 f3(vertexptr[ s.indices[0] ],vertexptr[ s.indices[1] ],vertexptr[ s.indices[2] ]);
+
+
+ Vector3 res;
+
+ if (f3.intersects_segment(p_begin,p_end,&res)) {
+
+
+ float nd = n.dot(res);
+ if (nd<d) {
+
+ d=nd;
+ r_point=res;
+ r_normal=f3.get_plane().get_normal();
+ inters=true;
+ }
+
+ }
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
+ }
+ }
+
+ } continue;
+ case VISIT_LEFT_BIT: {
+
+ stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.left|TEST_AABB_BIT;
+ level++;
+
+ } continue;
+ case VISIT_RIGHT_BIT: {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.right|TEST_AABB_BIT;
+ level++;
+ } continue;
+ case VISIT_DONE_BIT: {
+
+ if (level==0) {
+ done=true;
+ break;
+ } else
+ level--;
+
+ } continue;
+ }
+
+
+ if (done)
+ break;
+ }
+
+
+ if (inters) {
+
+ if (n.dot(r_normal)>0)
+ r_normal=-r_normal;
+ }
+
+ return inters;
+}
+
+
+bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const {
+
+
+ uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
+
+ enum {
+ TEST_AABB_BIT=0,
+ VISIT_LEFT_BIT=1,
+ VISIT_RIGHT_BIT=2,
+ VISIT_DONE_BIT=3,
+ VISITED_BIT_SHIFT=29,
+ NODE_IDX_MASK=(1<<VISITED_BIT_SHIFT)-1,
+ VISITED_BIT_MASK=~NODE_IDX_MASK,
+
+
+ };
+
+ Vector3 n = p_dir;
+ real_t d=1e20;
+ bool inters=false;
+
+ //for(int i=0;i<max_depth;i++)
+ // stack[i]=0;
+
+ int level=0;
+
+ DVector<Triangle>::Read trianglesr = triangles.read();
+ DVector<Vector3>::Read verticesr=vertices.read();
+ DVector<BVH>::Read bvhr=bvh.read();
+
+ const Triangle *triangleptr=trianglesr.ptr();
+ const Vector3 *vertexptr=verticesr.ptr();
+ int pos=bvh.size()-1;
+ const BVH *bvhptr = bvhr.ptr();
+
+ stack[0]=pos;
+ while(true) {
+
+ uint32_t node = stack[level]&NODE_IDX_MASK;
+ const BVH &b = bvhptr[ node ];
+ bool done=false;
+
+ switch(stack[level]>>VISITED_BIT_SHIFT) {
+ case TEST_AABB_BIT: {
+
+
+ bool valid = b.aabb.intersects_ray(p_begin,p_dir);
+ if (!valid) {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ if (b.face_index>=0) {
+
+ const Triangle &s=triangleptr[ b.face_index ];
+ Face3 f3(vertexptr[ s.indices[0] ],vertexptr[ s.indices[1] ],vertexptr[ s.indices[2] ]);
+
+
+ Vector3 res;
+
+ if (f3.intersects_ray(p_begin,p_dir,&res)) {
+
+
+ float nd = n.dot(res);
+ if (nd<d) {
+
+ d=nd;
+ r_point=res;
+ r_normal=f3.get_plane().get_normal();
+ inters=true;
+ }
+
+ }
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+
+ } else {
+
+ stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
+ }
+ }
+
+ } continue;
+ case VISIT_LEFT_BIT: {
+
+ stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.left|TEST_AABB_BIT;
+ level++;
+
+ } continue;
+ case VISIT_RIGHT_BIT: {
+
+ stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
+ stack[level+1]=b.right|TEST_AABB_BIT;
+ level++;
+ } continue;
+ case VISIT_DONE_BIT: {
+
+ if (level==0) {
+ done=true;
+ break;
+ } else
+ level--;
+
+ } continue;
+ }
+
+
+ if (done)
+ break;
+ }
+
+
+ if (inters) {
+
+ if (n.dot(r_normal)>0)
+ r_normal=-r_normal;
+ }
+
+ return inters;
+}
+
+bool TriangleMesh::is_valid() const {
+
+ return valid;
+}
+
+DVector<Face3> TriangleMesh::get_faces() const {
+
+ if (!valid)
+ return DVector<Face3>();
+
+ DVector<Face3> faces;
+ int ts = triangles.size();
+ faces.resize(triangles.size());
+
+ DVector<Face3>::Write w=faces.write();
+ DVector<Triangle>::Read r = triangles.read();
+ DVector<Vector3>::Read rv = vertices.read();
+
+ for(int i=0;i<ts;i++) {
+ for(int j=0;j<3;j++) {
+ w[i].vertex[j]=rv[r[i].indices[j]];
+ }
+ }
+
+ w = DVector<Face3>::Write();
+ return faces;
+}
+
+TriangleMesh::TriangleMesh() {
+
+ valid=false;
+ max_depth=0;
+}
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index ab0cb713b1..87d8ce8e6c 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,74 +26,74 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef TRIANGLE_MESH_H
-#define TRIANGLE_MESH_H
-
-#include "reference.h"
-#include "face3.h"
-class TriangleMesh : public Reference {
-
- OBJ_TYPE( TriangleMesh, Reference);
-
- struct Triangle {
-
- Vector3 normal;
- int indices[3];
- };
-
- DVector<Triangle> triangles;
- DVector<Vector3> vertices;
-
- struct BVH {
-
- AABB aabb;
- Vector3 center; //used for sorting
- int left;
- int right;
-
- int face_index;
- };
-
- struct BVHCmpX {
-
- bool operator()(const BVH* p_left, const BVH* p_right) const {
-
- return p_left->center.x < p_right->center.x;
- }
- };
-
- struct BVHCmpY {
-
- bool operator()(const BVH* p_left, const BVH* p_right) const {
-
- return p_left->center.y < p_right->center.y;
- }
- };
- struct BVHCmpZ {
-
- bool operator()(const BVH* p_left, const BVH* p_right) const {
-
- return p_left->center.z < p_right->center.z;
- }
- };
-
- int _create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_depth,int&max_depth,int&max_alloc);
-
- DVector<BVH> bvh;
- int max_depth;
- bool valid;
-
-public:
-
- bool is_valid() const;
- bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const;
- bool intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const;
- Vector3 get_area_normal(const AABB& p_aabb) const;
- DVector<Face3> get_faces() const;
-
-
- void create(const DVector<Vector3>& p_faces);
- TriangleMesh();
-};
-
-#endif // TRIANGLE_MESH_H
+#ifndef TRIANGLE_MESH_H
+#define TRIANGLE_MESH_H
+
+#include "reference.h"
+#include "face3.h"
+class TriangleMesh : public Reference {
+
+ OBJ_TYPE( TriangleMesh, Reference);
+
+ struct Triangle {
+
+ Vector3 normal;
+ int indices[3];
+ };
+
+ DVector<Triangle> triangles;
+ DVector<Vector3> vertices;
+
+ struct BVH {
+
+ AABB aabb;
+ Vector3 center; //used for sorting
+ int left;
+ int right;
+
+ int face_index;
+ };
+
+ struct BVHCmpX {
+
+ bool operator()(const BVH* p_left, const BVH* p_right) const {
+
+ return p_left->center.x < p_right->center.x;
+ }
+ };
+
+ struct BVHCmpY {
+
+ bool operator()(const BVH* p_left, const BVH* p_right) const {
+
+ return p_left->center.y < p_right->center.y;
+ }
+ };
+ struct BVHCmpZ {
+
+ bool operator()(const BVH* p_left, const BVH* p_right) const {
+
+ return p_left->center.z < p_right->center.z;
+ }
+ };
+
+ int _create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_depth,int&max_depth,int&max_alloc);
+
+ DVector<BVH> bvh;
+ int max_depth;
+ bool valid;
+
+public:
+
+ bool is_valid() const;
+ bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const;
+ bool intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const;
+ Vector3 get_area_normal(const AABB& p_aabb) const;
+ DVector<Face3> get_faces() const;
+
+
+ void create(const DVector<Vector3>& p_faces);
+ TriangleMesh();
+};
+
+#endif // TRIANGLE_MESH_H
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 4a870def4b..b13e13c47d 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index b20b37bd44..927b7efb8d 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index cf6fd9242e..a3877eb9ff 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -27,27 +27,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "vector3.h"
-
+#include "matrix3.h"
void Vector3::rotate(const Vector3& p_axis,float p_phi) {
- Vector3 axis1 = cross(p_axis);
- float l = axis1.length();
- if (l==0)
- return;
- axis1/=l;
- Vector3 axis2 = axis1.cross(p_axis).normalized();
-
- float _x = axis1.dot(*this);
- float _y = axis2.dot(*this);
-
- float ang = Math::atan2(_x,_y);
-
- ang+=p_phi;
-
- *this=((axis1 * Math::cos(ang)) + (axis2 * Math::sin(ang))) * length();
-
+ *this=Matrix3(p_axis,p_phi).xform(*this);
}
Vector3 Vector3::rotated(const Vector3& p_axis,float p_phi) const {
diff --git a/core/math/vector3.h b/core/math/vector3.h
index d2f2408829..d27b611379 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index dbf6217dc2..cfbdb37b88 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/message_queue.h b/core/message_queue.h
index 691c289813..5cee21847b 100644
--- a/core/message_queue.h
+++ b/core/message_queue.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/method_bind.cpp b/core/method_bind.cpp
index 6ee4882571..3429e5f0af 100644
--- a/core/method_bind.cpp
+++ b/core/method_bind.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/method_bind.h b/core/method_bind.h
index 6ea9340ad5..d32050cc5d 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/multi_bucket_array.h b/core/multi_bucket_array.h
index a24af941f8..d85c9de583 100644
--- a/core/multi_bucket_array.h
+++ b/core/multi_bucket_array.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/object.cpp b/core/object.cpp
index 2b83f728d1..07e24655c2 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -33,6 +33,7 @@
#include "message_queue.h"
#include "core_string_names.h"
#include "translation.h"
+#include "os/os.h"
#ifdef DEBUG_ENABLED
@@ -1503,6 +1504,10 @@ void Object::_bind_methods() {
ObjectTypeDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE);
ObjectTypeDB::bind_method(_MD("tr","message"),&Object::tr);
+ ObjectTypeDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion);
+
+ ObjectTypeDB::add_virtual_method("Object",MethodInfo("free"),false);
+
ADD_SIGNAL( MethodInfo("script_changed"));
BIND_VMETHOD( MethodInfo("_notification",PropertyInfo(Variant::INT,"what")) );
@@ -1566,6 +1571,10 @@ void Object::get_translatable_strings(List<String> *p_strings) const {
}
+bool Object::is_queued_for_deletion() const {
+ return _is_queued_for_deletion;
+}
+
#ifdef TOOLS_ENABLED
void Object::set_edited(bool p_edited) {
@@ -1587,6 +1596,7 @@ Object::Object() {
_instance_ID=0;
_instance_ID = ObjectDB::add_instance(this);
_can_translate=true;
+ _is_queued_for_deletion=false;
script_instance=NULL;
#ifdef TOOLS_ENABLED
@@ -1719,8 +1729,20 @@ void ObjectDB::cleanup() {
GLOBAL_LOCK_FUNCTION;
if (instances.size()) {
-
+
WARN_PRINT("ObjectDB Instances still exist!");
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ const uint32_t *K=NULL;
+ while((K=instances.next(K))) {
+
+ String node_name;
+ if (instances[*K]->is_type("Node"))
+ node_name=" - Node Name: "+String(instances[*K]->call("get_name"));
+ if (instances[*K]->is_type("Resoucre"))
+ node_name=" - Resource Name: "+String(instances[*K]->call("get_name"))+" Path: "+String(instances[*K]->call("get_path"));
+ print_line("Leaked Instance: "+String(instances[*K]->get_type())+":"+itos(*K)+node_name);
+ }
+ }
}
instances.clear();
instance_checks.clear();
diff --git a/core/object.h b/core/object.h
index eb885f5d20..44464ab199 100644
--- a/core/object.h
+++ b/core/object.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -111,6 +111,9 @@ struct PropertyInfo {
PropertyInfo( Variant::Type p_type, const String p_name, PropertyHint p_hint=PROPERTY_HINT_NONE, const String& p_hint_string="",uint32_t p_usage=PROPERTY_USAGE_DEFAULT) {
type=p_type; name=p_name; hint=p_hint; hint_string=p_hint_string; usage=p_usage;
}
+ bool operator<(const PropertyInfo& p_info) const {
+ return name<p_info.name;
+ }
};
@@ -397,7 +400,6 @@ friend void postinitialize_handler(Object*);
protected:
-
virtual bool _use_builtin_script() const { return false; }
virtual void _initialize_typev() { initialize_type(); }
virtual bool _setv(const StringName& p_name,const Variant &p_property) { return false; };
@@ -589,6 +591,9 @@ public:
StringName XL_MESSAGE(const StringName& p_message) const; //translate message (internationalization)
StringName tr(const StringName& p_message) const; //translate message (alternative)
+ bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
+ bool is_queued_for_deletion() const;
+
_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; }
_FORCE_INLINE_ bool can_translate_messages() const { return _can_translate; }
Object();
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp
index 1047d7eba5..a2cae50940 100644
--- a/core/object_type_db.cpp
+++ b/core/object_type_db.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -804,12 +804,13 @@ else goto set_defvals;
}
-void ObjectTypeDB::add_virtual_method(const StringName& p_type,const MethodInfo& p_method ) {
+void ObjectTypeDB::add_virtual_method(const StringName& p_type, const MethodInfo& p_method , bool p_virtual) {
ERR_FAIL_COND(!types.has(p_type));
#ifdef DEBUG_METHODS_ENABLED
MethodInfo mi=p_method;
- mi.flags|=METHOD_FLAG_VIRTUAL;
+ if (p_virtual)
+ mi.flags|=METHOD_FLAG_VIRTUAL;
types[p_type].virtual_methods.push_back(mi);
#endif
diff --git a/core/object_type_db.h b/core/object_type_db.h
index 617a0a7c20..27c1506960 100644
--- a/core/object_type_db.h
+++ b/core/object_type_db.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -468,7 +468,7 @@ public:
static void get_method_list(StringName p_type,List<MethodInfo> *p_methods,bool p_no_inheritance=false);
static MethodBind *get_method(StringName p_type, StringName p_name);
- static void add_virtual_method(const StringName& p_type,const MethodInfo& p_method );
+ static void add_virtual_method(const StringName& p_type,const MethodInfo& p_method,bool p_virtual=true );
static void get_virtual_methods(const StringName& p_type,List<MethodInfo> * p_methods,bool p_no_inheritance=false );
static void bind_integer_constant(const StringName& p_type, const StringName &p_name, int p_constant);
diff --git a/core/os/copymem.cpp b/core/os/copymem.cpp
index 4a36b6f6d1..54baf1e232 100644
--- a/core/os/copymem.cpp
+++ b/core/os/copymem.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/copymem.h b/core/os/copymem.h
index 09e8c6903e..a5d640edbf 100644
--- a/core/os/copymem.h
+++ b/core/os/copymem.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 53fe792c46..a1031cf5f0 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -399,6 +399,15 @@ Error DirAccess::copy(String p_from,String p_to) {
return err;
}
+bool DirAccess::exists(String p_dir) {
+
+ DirAccess* da = DirAccess::create_for_path(p_dir);
+ bool valid = da->change_dir(p_dir)==OK;
+ memdelete(da);
+ return valid;
+
+}
+
DirAccess::DirAccess(){
_access_type=ACCESS_FILESYSTEM;
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index dc56f2308e..3df9bca45a 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -93,7 +93,7 @@ public:
virtual bool file_exists(String p_file)=0;
virtual bool dir_exists(String p_dir)=0;
-
+ static bool exists(String p_dir);
virtual size_t get_space_left()=0;
virtual Error copy(String p_from,String p_to);
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index ffa0cad8e4..ef7efd27e1 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 793e971a4c..8e34013796 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 5d4b3a834d..2b939ede46 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -56,7 +56,7 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis);
ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name);
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
- ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos);
+ //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want
ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed);
ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask);
ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode);
diff --git a/core/os/input.h b/core/os/input.h
index 387a43a35a..ce14c2166e 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 27c7c10aef..fc23012281 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 218ff327d1..811d5504d5 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index e2a992ecb9..10e64c3961 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index b4ec5da26f..eaf656dd4d 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index d01331a256..83d3155b03 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 6eb5881175..bf9fe83a43 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index ca5bacf9cd..617e40e92a 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory.h b/core/os/memory.h
index 6fc3d8f3eb..4497fcc200 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_dynamic.cpp b/core/os/memory_pool_dynamic.cpp
index 4df554f18d..d1c41aff84 100644
--- a/core/os/memory_pool_dynamic.cpp
+++ b/core/os/memory_pool_dynamic.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_dynamic.h b/core/os/memory_pool_dynamic.h
index ca517daf41..00999ee24d 100644
--- a/core/os/memory_pool_dynamic.h
+++ b/core/os/memory_pool_dynamic.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_dynamic_prealloc.cpp b/core/os/memory_pool_dynamic_prealloc.cpp
index c5823366c1..c7c25f32d1 100644
--- a/core/os/memory_pool_dynamic_prealloc.cpp
+++ b/core/os/memory_pool_dynamic_prealloc.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,91 +26,91 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "memory_pool_dynamic_prealloc.h"
-#include "os/memory.h"
-
-#include "print_string.h"
-MemoryPoolDynamicPrealloc::ID MemoryPoolDynamicPrealloc::alloc(size_t p_amount,const char* p_description) {
-
-
-// print_line("dynpool - allocating: "+itos(p_amount));
- ID id = pool_alloc->alloc(p_amount);
-// print_line("dynpool - free: "+itos(pool_alloc->get_free_mem()));
- return id;
-
-}
-
-void MemoryPoolDynamicPrealloc::free(ID p_id) {
-
- pool_alloc->free(p_id);
-}
-
-Error MemoryPoolDynamicPrealloc::realloc(ID p_id, size_t p_amount) {
-
- return pool_alloc->resize(p_id,p_amount);
-}
-
-bool MemoryPoolDynamicPrealloc::is_valid(ID p_id) {
-
- return true;
-}
-
-size_t MemoryPoolDynamicPrealloc::get_size(ID p_id) const {
-
- return pool_alloc->get_size(p_id);
-}
-
-const char* MemoryPoolDynamicPrealloc::get_description(ID p_id) const {
-
- return "";
-}
-
-Error MemoryPoolDynamicPrealloc::lock(ID p_id) {
-
-// print_line("lock: "+itos(p_id));
- return pool_alloc->lock(p_id);
-}
-
-void * MemoryPoolDynamicPrealloc::get(ID p_ID) {
-
-// print_line("get: "+itos(p_ID));
- return pool_alloc->get(p_ID);
-}
-
-Error MemoryPoolDynamicPrealloc::unlock(ID p_id) {
-
-// print_line("unlock: "+itos(p_id));
- pool_alloc->unlock(p_id);
- return OK;
-}
-
-bool MemoryPoolDynamicPrealloc::is_locked(ID p_id) const {
-
- return pool_alloc->is_locked(p_id);
-}
-
-
-size_t MemoryPoolDynamicPrealloc::get_available_mem() const {
-
- return pool_alloc->get_free_mem();
-}
-
-size_t MemoryPoolDynamicPrealloc::get_total_usage() const {
-
- return pool_alloc->get_used_mem();
-}
-
-
-
-MemoryPoolDynamicPrealloc::MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align, int p_max_entries) {
-
- pool_alloc = memnew( PoolAllocator(p_mem,p_size,p_align,true,p_max_entries));
-
-}
-
-MemoryPoolDynamicPrealloc::~MemoryPoolDynamicPrealloc() {
-
-
- memdelete( pool_alloc );
-}
-
+#include "memory_pool_dynamic_prealloc.h"
+#include "os/memory.h"
+
+#include "print_string.h"
+MemoryPoolDynamicPrealloc::ID MemoryPoolDynamicPrealloc::alloc(size_t p_amount,const char* p_description) {
+
+
+// print_line("dynpool - allocating: "+itos(p_amount));
+ ID id = pool_alloc->alloc(p_amount);
+// print_line("dynpool - free: "+itos(pool_alloc->get_free_mem()));
+ return id;
+
+}
+
+void MemoryPoolDynamicPrealloc::free(ID p_id) {
+
+ pool_alloc->free(p_id);
+}
+
+Error MemoryPoolDynamicPrealloc::realloc(ID p_id, size_t p_amount) {
+
+ return pool_alloc->resize(p_id,p_amount);
+}
+
+bool MemoryPoolDynamicPrealloc::is_valid(ID p_id) {
+
+ return true;
+}
+
+size_t MemoryPoolDynamicPrealloc::get_size(ID p_id) const {
+
+ return pool_alloc->get_size(p_id);
+}
+
+const char* MemoryPoolDynamicPrealloc::get_description(ID p_id) const {
+
+ return "";
+}
+
+Error MemoryPoolDynamicPrealloc::lock(ID p_id) {
+
+// print_line("lock: "+itos(p_id));
+ return pool_alloc->lock(p_id);
+}
+
+void * MemoryPoolDynamicPrealloc::get(ID p_ID) {
+
+// print_line("get: "+itos(p_ID));
+ return pool_alloc->get(p_ID);
+}
+
+Error MemoryPoolDynamicPrealloc::unlock(ID p_id) {
+
+// print_line("unlock: "+itos(p_id));
+ pool_alloc->unlock(p_id);
+ return OK;
+}
+
+bool MemoryPoolDynamicPrealloc::is_locked(ID p_id) const {
+
+ return pool_alloc->is_locked(p_id);
+}
+
+
+size_t MemoryPoolDynamicPrealloc::get_available_mem() const {
+
+ return pool_alloc->get_free_mem();
+}
+
+size_t MemoryPoolDynamicPrealloc::get_total_usage() const {
+
+ return pool_alloc->get_used_mem();
+}
+
+
+
+MemoryPoolDynamicPrealloc::MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align, int p_max_entries) {
+
+ pool_alloc = memnew( PoolAllocator(p_mem,p_size,p_align,true,p_max_entries));
+
+}
+
+MemoryPoolDynamicPrealloc::~MemoryPoolDynamicPrealloc() {
+
+
+ memdelete( pool_alloc );
+}
+
diff --git a/core/os/memory_pool_dynamic_prealloc.h b/core/os/memory_pool_dynamic_prealloc.h
index 698885561a..3523079bac 100644
--- a/core/os/memory_pool_dynamic_prealloc.h
+++ b/core/os/memory_pool_dynamic_prealloc.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,35 +26,35 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef MEMORY_POOL_DYNAMIC_PREALLOC_H
-#define MEMORY_POOL_DYNAMIC_PREALLOC_H
-
-#include "pool_allocator.h"
-#include "core/os/memory_pool_dynamic.h"
-
-class MemoryPoolDynamicPrealloc : public MemoryPoolDynamic {
-
- PoolAllocator *pool_alloc;
-
-public:
-
- virtual ID alloc(size_t p_amount,const char* p_description);
- virtual void free(ID p_id);
- virtual Error realloc(ID p_id, size_t p_amount);
- virtual bool is_valid(ID p_id);
- virtual size_t get_size(ID p_id) const;
- virtual const char* get_description(ID p_id) const;
-
- virtual Error lock(ID p_id);
- virtual void * get(ID p_ID);
- virtual Error unlock(ID p_id);
- virtual bool is_locked(ID p_id) const;
-
- virtual size_t get_available_mem() const;
- virtual size_t get_total_usage() const;
-
- MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align = 16, int p_max_entries=PoolAllocator::DEFAULT_MAX_ALLOCS);
- ~MemoryPoolDynamicPrealloc();
-};
-
-#endif // MEMORY_POOL_DYNAMIC_PREALLOC_H
+#ifndef MEMORY_POOL_DYNAMIC_PREALLOC_H
+#define MEMORY_POOL_DYNAMIC_PREALLOC_H
+
+#include "pool_allocator.h"
+#include "core/os/memory_pool_dynamic.h"
+
+class MemoryPoolDynamicPrealloc : public MemoryPoolDynamic {
+
+ PoolAllocator *pool_alloc;
+
+public:
+
+ virtual ID alloc(size_t p_amount,const char* p_description);
+ virtual void free(ID p_id);
+ virtual Error realloc(ID p_id, size_t p_amount);
+ virtual bool is_valid(ID p_id);
+ virtual size_t get_size(ID p_id) const;
+ virtual const char* get_description(ID p_id) const;
+
+ virtual Error lock(ID p_id);
+ virtual void * get(ID p_ID);
+ virtual Error unlock(ID p_id);
+ virtual bool is_locked(ID p_id) const;
+
+ virtual size_t get_available_mem() const;
+ virtual size_t get_total_usage() const;
+
+ MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align = 16, int p_max_entries=PoolAllocator::DEFAULT_MAX_ALLOCS);
+ ~MemoryPoolDynamicPrealloc();
+};
+
+#endif // MEMORY_POOL_DYNAMIC_PREALLOC_H
diff --git a/core/os/memory_pool_dynamic_static.cpp b/core/os/memory_pool_dynamic_static.cpp
index 93f94d7726..029ef450cd 100644
--- a/core/os/memory_pool_dynamic_static.cpp
+++ b/core/os/memory_pool_dynamic_static.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h
index d10cdb3d0a..a870f3070c 100644
--- a/core/os/memory_pool_dynamic_static.h
+++ b/core/os/memory_pool_dynamic_static.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_static.cpp b/core/os/memory_pool_static.cpp
index 9dd5baf4e4..d3617eac73 100644
--- a/core/os/memory_pool_static.cpp
+++ b/core/os/memory_pool_static.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/memory_pool_static.h b/core/os/memory_pool_static.h
index f2b372d03b..40bd1aaf0e 100644
--- a/core/os/memory_pool_static.h
+++ b/core/os/memory_pool_static.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp
index 03d423ae04..be984c080b 100644
--- a/core/os/mutex.cpp
+++ b/core/os/mutex.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/mutex.h b/core/os/mutex.h
index 241d70e232..ac6d36d635 100644
--- a/core/os/mutex.h
+++ b/core/os/mutex.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 5e0e5eed77..f292456079 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -43,6 +43,9 @@ OS* OS::get_singleton() {
uint32_t OS::get_ticks_msec() const
{ return get_ticks_usec()/1000; }
+uint64_t OS::get_splash_tick_msec() const {
+ return _msec_splash;
+}
uint64_t OS::get_unix_time() const {
return 0;
diff --git a/core/os/os.h b/core/os/os.h
index d4ac433644..2f9957c2f8 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -51,6 +51,7 @@ class OS {
String _local_clipboard;
uint64_t frames_drawn;
uint32_t _frame_delay;
+ uint64_t _msec_splash;
bool _no_window;
int _exit_code;
int _orientation;
@@ -251,6 +252,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const=0;
virtual uint64_t get_ticks_usec() const=0;
uint32_t get_ticks_msec() const;
+ uint64_t get_splash_tick_msec() const;
void set_frame_delay(uint32_t p_msec);
uint32_t get_frame_delay() const;
@@ -384,6 +386,8 @@ public:
void set_time_scale(float p_scale);
float get_time_scale() const;
+
+
OS();
virtual ~OS();
diff --git a/core/os/pc_joystick_map.h b/core/os/pc_joystick_map.h
index 171723439b..111dc9b3a8 100644
--- a/core/os/pc_joystick_map.h
+++ b/core/os/pc_joystick_map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/semaphore.cpp b/core/os/semaphore.cpp
index 3abab34886..8cb431d2cc 100644
--- a/core/os/semaphore.cpp
+++ b/core/os/semaphore.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/semaphore.h b/core/os/semaphore.h
index b188f07399..e8ad9d3c3a 100644
--- a/core/os/semaphore.h
+++ b/core/os/semaphore.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/shell.cpp b/core/os/shell.cpp
index 565929eae5..3746dc6804 100644
--- a/core/os/shell.cpp
+++ b/core/os/shell.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/shell.h b/core/os/shell.h
index 38b29c6eca..7ef5abbdef 100644
--- a/core/os/shell.h
+++ b/core/os/shell.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index d8d9f3e291..96b0f561ca 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread.h b/core/os/thread.h
index 864fc6db05..590fee1fc6 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread_dummy.cpp b/core/os/thread_dummy.cpp
index 1974bf615b..4e139f6379 100644
--- a/core/os/thread_dummy.cpp
+++ b/core/os/thread_dummy.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h
index b681005fb6..a83e42ff98 100644
--- a/core/os/thread_dummy.h
+++ b/core/os/thread_dummy.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread_safe.cpp b/core/os/thread_safe.cpp
index 9c7648be94..9a20db6a9d 100644
--- a/core/os/thread_safe.cpp
+++ b/core/os/thread_safe.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/os/thread_safe.h b/core/os/thread_safe.h
index 8b20c31cc9..62d2181279 100644
--- a/core/os/thread_safe.h
+++ b/core/os/thread_safe.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp
index 65a6433912..fa17e93aa8 100644
--- a/core/packed_data_container.cpp
+++ b/core/packed_data_container.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/packed_data_container.h b/core/packed_data_container.h
index b223d3bcfe..f4152bbb4d 100644
--- a/core/packed_data_container.h
+++ b/core/packed_data_container.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/pair.cpp b/core/pair.cpp
index 4b6f350351..17076bb379 100644
--- a/core/pair.cpp
+++ b/core/pair.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/pair.h b/core/pair.h
index d4cf3630ee..83fc837fff 100644
--- a/core/pair.h
+++ b/core/pair.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/path_db.cpp b/core/path_db.cpp
index 1027ce7318..d3dc3aceb8 100644
--- a/core/path_db.cpp
+++ b/core/path_db.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/path_db.h b/core/path_db.h
index 561dc01672..b4f13d50be 100644
--- a/core/path_db.h
+++ b/core/path_db.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/path_remap.cpp b/core/path_remap.cpp
index 34675c4575..2ef39470a0 100644
--- a/core/path_remap.cpp
+++ b/core/path_remap.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,163 +26,163 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "path_remap.h"
-#include "globals.h"
-#include "os/os.h"
-#include "translation.h"
-PathRemap* PathRemap::singleton=NULL;
-
-PathRemap* PathRemap::get_singleton() {
-
- return singleton;
-}
-
-void PathRemap::add_remap(const String& p_from, const String& p_to,const String& p_locale) {
-
- if (!remap.has(p_from)) {
- remap[p_from]=RemapData();
- }
-
- if (p_locale==String())
- remap[p_from].always=p_to;
- else
- remap[p_from].locale[p_locale]=p_to;
-}
-
-
-String PathRemap::get_remap(const String& p_from) const {
-
- const RemapData *ptr=remap.getptr(p_from);
- if (!ptr) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap failed: "+p_from);
- return p_from;
- } else {
-
- String locale = TranslationServer::get_singleton()->get_locale();
-
- if (ptr->locale.has(locale)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
- return ptr->locale[locale];
- }
-
- int p = locale.find("_");
- if (p!=-1) {
- locale=locale.substr(0,p);
- if (ptr->locale.has(locale)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
- return ptr->locale[locale];
- }
- }
-
- if (ptr->always!=String()) {
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("remap found: "+p_from+" -> "+ptr->always);
- }
- return ptr->always;
- }
-
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap failed: "+p_from);
-
- return p_from;
- }
-}
-bool PathRemap::has_remap(const String& p_from) const{
-
- return remap.has(p_from);
-}
-
-void PathRemap::erase_remap(const String& p_from){
-
- ERR_FAIL_COND(!remap.has(p_from));
- remap.erase(p_from);
-}
-
-void PathRemap::clear_remaps() {
-
- remap.clear();
-}
-
-void PathRemap::load_remaps() {
-
- // default remaps first
- DVector<String> remaps = Globals::get_singleton()->get("remap/all");
-
- {
- int rlen = remaps.size();
-
- ERR_FAIL_COND( rlen%2 );
- DVector<String>::Read r = remaps.read();
- for(int i=0;i<rlen/2;i++) {
-
- String from = r[i*2+0];
- String to = r[i*2+1];
- add_remap(from,to);
- }
- }
-
-
- // platform remaps second, so override
- remaps = Globals::get_singleton()->get("remap/"+OS::get_singleton()->get_name());
-// remaps = Globals::get_singleton()->get("remap/PSP");
- {
- int rlen = remaps.size();
-
- ERR_FAIL_COND( rlen%2 );
- DVector<String>::Read r = remaps.read();
- for(int i=0;i<rlen/2;i++) {
-
- String from = r[i*2+0];
- String to = r[i*2+1];
-// print_line("add remap: "+from+" -> "+to);
- add_remap(from,to);
- }
- }
-
-
- //locale based remaps
-
- if (Globals::get_singleton()->has("locale/translation_remaps")) {
-
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
- List<Variant> rk;
- remaps.get_key_list(&rk);
- for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
-
- String source = E->get();
- StringArray sa = remaps[E->get()];
- int sas = sa.size();
- StringArray::Read r = sa.read();
-
- for(int i=0;i<sas;i++) {
-
- String s = r[i];
- int qp = s.find_last(":");
- if (qp!=-1) {
- String path = s.substr(0,qp);
- String locale = s.substr(qp+1,s.length());
- add_remap(source,path,locale);
- }
- }
- }
-
- }
-
-}
-
-void PathRemap::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String()));
- ObjectTypeDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap);
- ObjectTypeDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap);
- ObjectTypeDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap);
- ObjectTypeDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps);
-}
-
-PathRemap::PathRemap() {
-
- singleton=this;
-}
+#include "path_remap.h"
+#include "globals.h"
+#include "os/os.h"
+#include "translation.h"
+PathRemap* PathRemap::singleton=NULL;
+
+PathRemap* PathRemap::get_singleton() {
+
+ return singleton;
+}
+
+void PathRemap::add_remap(const String& p_from, const String& p_to,const String& p_locale) {
+
+ if (!remap.has(p_from)) {
+ remap[p_from]=RemapData();
+ }
+
+ if (p_locale==String())
+ remap[p_from].always=p_to;
+ else
+ remap[p_from].locale[p_locale]=p_to;
+}
+
+
+String PathRemap::get_remap(const String& p_from) const {
+
+ const RemapData *ptr=remap.getptr(p_from);
+ if (!ptr) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ print_line("remap failed: "+p_from);
+ return p_from;
+ } else {
+
+ String locale = TranslationServer::get_singleton()->get_locale();
+
+ if (ptr->locale.has(locale)) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
+ return ptr->locale[locale];
+ }
+
+ int p = locale.find("_");
+ if (p!=-1) {
+ locale=locale.substr(0,p);
+ if (ptr->locale.has(locale)) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
+ return ptr->locale[locale];
+ }
+ }
+
+ if (ptr->always!=String()) {
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line("remap found: "+p_from+" -> "+ptr->always);
+ }
+ return ptr->always;
+ }
+
+ if (OS::get_singleton()->is_stdout_verbose())
+ print_line("remap failed: "+p_from);
+
+ return p_from;
+ }
+}
+bool PathRemap::has_remap(const String& p_from) const{
+
+ return remap.has(p_from);
+}
+
+void PathRemap::erase_remap(const String& p_from){
+
+ ERR_FAIL_COND(!remap.has(p_from));
+ remap.erase(p_from);
+}
+
+void PathRemap::clear_remaps() {
+
+ remap.clear();
+}
+
+void PathRemap::load_remaps() {
+
+ // default remaps first
+ DVector<String> remaps = Globals::get_singleton()->get("remap/all");
+
+ {
+ int rlen = remaps.size();
+
+ ERR_FAIL_COND( rlen%2 );
+ DVector<String>::Read r = remaps.read();
+ for(int i=0;i<rlen/2;i++) {
+
+ String from = r[i*2+0];
+ String to = r[i*2+1];
+ add_remap(from,to);
+ }
+ }
+
+
+ // platform remaps second, so override
+ remaps = Globals::get_singleton()->get("remap/"+OS::get_singleton()->get_name());
+// remaps = Globals::get_singleton()->get("remap/PSP");
+ {
+ int rlen = remaps.size();
+
+ ERR_FAIL_COND( rlen%2 );
+ DVector<String>::Read r = remaps.read();
+ for(int i=0;i<rlen/2;i++) {
+
+ String from = r[i*2+0];
+ String to = r[i*2+1];
+// print_line("add remap: "+from+" -> "+to);
+ add_remap(from,to);
+ }
+ }
+
+
+ //locale based remaps
+
+ if (Globals::get_singleton()->has("locale/translation_remaps")) {
+
+ Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ List<Variant> rk;
+ remaps.get_key_list(&rk);
+ for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
+
+ String source = E->get();
+ StringArray sa = remaps[E->get()];
+ int sas = sa.size();
+ StringArray::Read r = sa.read();
+
+ for(int i=0;i<sas;i++) {
+
+ String s = r[i];
+ int qp = s.find_last(":");
+ if (qp!=-1) {
+ String path = s.substr(0,qp);
+ String locale = s.substr(qp+1,s.length());
+ add_remap(source,path,locale);
+ }
+ }
+ }
+
+ }
+
+}
+
+void PathRemap::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String()));
+ ObjectTypeDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap);
+ ObjectTypeDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap);
+ ObjectTypeDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap);
+ ObjectTypeDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps);
+}
+
+PathRemap::PathRemap() {
+
+ singleton=this;
+}
diff --git a/core/path_remap.h b/core/path_remap.h
index a463cf259e..cb2a045668 100644
--- a/core/path_remap.h
+++ b/core/path_remap.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -26,42 +26,42 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PATH_REMAP_H
-#define PATH_REMAP_H
-
-#include "hash_map.h"
-#include "ustring.h"
-#include "object.h"
-
-
-class PathRemap : public Object {
-
- OBJ_TYPE(PathRemap,Object);
-
- static PathRemap* singleton;
- struct RemapData {
- String always;
- Map<String,String> locale;
- };
-
- HashMap<String,RemapData> remap;
-protected:
-
- static void _bind_methods();
-public:
-
- void add_remap(const String& p_from, const String& p_to,const String& p_locale=String());
- bool has_remap(const String& p_from) const;
- //_FORCE_INLINE_ String get_remap(const String& p_from) const { const String *ptr=remap.getptr(p_from); if (!ptr) return p_from; else return *ptr; }
- String get_remap(const String& p_from) const;
- void erase_remap(const String& p_from);
- void clear_remaps();
-
- void load_remaps();
-
- static PathRemap* get_singleton();
-
- PathRemap();
-};
-
-#endif // PATH_REMAP_H
+#ifndef PATH_REMAP_H
+#define PATH_REMAP_H
+
+#include "hash_map.h"
+#include "ustring.h"
+#include "object.h"
+
+
+class PathRemap : public Object {
+
+ OBJ_TYPE(PathRemap,Object);
+
+ static PathRemap* singleton;
+ struct RemapData {
+ String always;
+ Map<String,String> locale;
+ };
+
+ HashMap<String,RemapData> remap;
+protected:
+
+ static void _bind_methods();
+public:
+
+ void add_remap(const String& p_from, const String& p_to,const String& p_locale=String());
+ bool has_remap(const String& p_from) const;
+ //_FORCE_INLINE_ String get_remap(const String& p_from) const { const String *ptr=remap.getptr(p_from); if (!ptr) return p_from; else return *ptr; }
+ String get_remap(const String& p_from) const;
+ void erase_remap(const String& p_from);
+ void clear_remaps();
+
+ void load_remaps();
+
+ static PathRemap* get_singleton();
+
+ PathRemap();
+};
+
+#endif // PATH_REMAP_H
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 5af168ce82..d7dca45836 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/pool_allocator.h b/core/pool_allocator.h
index 4b94ae48d6..4b0f931eb3 100644
--- a/core/pool_allocator.h
+++ b/core/pool_allocator.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/print_string.cpp b/core/print_string.cpp
index ae15d05a35..a06d4de237 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/print_string.h b/core/print_string.h
index c3e91f32fa..854f8ec2e5 100644
--- a/core/print_string.h
+++ b/core/print_string.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/ref_ptr.cpp b/core/ref_ptr.cpp
index f0758f66ce..ddb8054e3b 100644
--- a/core/ref_ptr.cpp
+++ b/core/ref_ptr.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/ref_ptr.h b/core/ref_ptr.h
index 007977d993..d1ee6a3a7d 100644
--- a/core/ref_ptr.h
+++ b/core/ref_ptr.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/reference.cpp b/core/reference.cpp
index 2fc941310d..509e132b5a 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -59,6 +59,10 @@ void Reference::_bind_methods() {
ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference);
}
+int Reference::reference_get_count() const {
+ return refcount.get();
+}
+
void Reference::reference(){
refcount.ref();
diff --git a/core/reference.h b/core/reference.h
index 64d7a7acad..544da41044 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -53,6 +53,7 @@ public:
bool init_ref();
void reference();
bool unreference();
+ int reference_get_count() const;
Reference();
~Reference();
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 4935136eeb..8754946bb1 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -205,12 +205,14 @@ void unregister_core_types() {
if (ip)
memdelete(ip);
+
+ ObjectDB::cleanup();
+
unregister_variant_methods();
- CoreStringNames::free();
ObjectTypeDB::cleanup();
ResourceCache::clear();
- ObjectDB::cleanup();
+ CoreStringNames::free();
StringName::cleanup();
if (_global_mutex) {
diff --git a/core/register_core_types.h b/core/register_core_types.h
index 9f89a3ffeb..a84849c969 100644
--- a/core/register_core_types.h
+++ b/core/register_core_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/res_ptr.cpp b/core/res_ptr.cpp
index b9bd931570..fcff285e8f 100644
--- a/core/res_ptr.cpp
+++ b/core/res_ptr.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/res_ptr.h b/core/res_ptr.h
index 69da69bf52..21f7fb6a2c 100644
--- a/core/res_ptr.h
+++ b/core/res_ptr.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/resource.cpp b/core/resource.cpp
index 560ca9a1f2..6e65693350 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/resource.h b/core/resource.h
index 8a637e7996..cf7ffcbd2c 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/rid.cpp b/core/rid.cpp
index 3dc4c6aed4..0870e6ab2d 100644
--- a/core/rid.cpp
+++ b/core/rid.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/rid.h b/core/rid.h
index 4d4e11c251..e6582757ee 100644
--- a/core/rid.h
+++ b/core/rid.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/ring_buffer.h b/core/ring_buffer.h
index 71105e7bf1..de33de0c76 100644
--- a/core/ring_buffer.h
+++ b/core/ring_buffer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index 3d867448e8..afe2a4eb33 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index 4357786732..481b9fa7e9 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_debugger_debugger.cpp b/core/script_debugger_debugger.cpp
index 6ff60e6ff4..5c592a130c 100644
--- a/core/script_debugger_debugger.cpp
+++ b/core/script_debugger_debugger.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index 5e153a4912..2266b05f6d 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_debugger_local.h b/core/script_debugger_local.h
index 159dd15e58..45ff1d4466 100644
--- a/core/script_debugger_local.h
+++ b/core/script_debugger_local.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index cd8303b542..33e9dc0fd9 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 861bcccff7..89b9947c4b 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 81a9e2b062..68ac7d0ae7 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/script_language.h b/core/script_language.h
index 802eff190a..07ad571fda 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/self_list.h b/core/self_list.h
index 729b9fb680..b414baaba6 100644
--- a/core/self_list.h
+++ b/core/self_list.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/set.h b/core/set.h
index 95f38d7108..91c4e3f9c4 100644
--- a/core/set.h
+++ b/core/set.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/simple_type.h b/core/simple_type.h
index fac6dceee8..84e08bf0b4 100644
--- a/core/simple_type.h
+++ b/core/simple_type.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/sort.h b/core/sort.h
index 583437a099..65664d0ed8 100644
--- a/core/sort.h
+++ b/core/sort.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/string_db.cpp b/core/string_db.cpp
index ffb7dc194b..57fdd6e70f 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "string_db.h"
#include "print_string.h"
-
+#include "os/os.h"
StaticCString StaticCString::create(const char *p_ptr) {
StaticCString scs; scs.ptr=p_ptr; return scs;
}
@@ -55,15 +55,29 @@ void StringName::setup() {
void StringName::cleanup() {
_global_lock();
+ int lost_strings=0;
for(int i=0;i<STRING_TABLE_LEN;i++) {
while(_table[i]) {
_Data*d=_table[i];
- _table[i]=_table[i]->next;
+ lost_strings++;
+ if (OS::get_singleton()->is_stdout_verbose()) {
+
+ if (d->cname) {
+ print_line("Orphan StringName: "+String(d->cname));
+ } else {
+ print_line("Orphan StringName: "+String(d->name));
+ }
+ }
+
+ _table[i]=_table[i]->next;
memdelete(d);
}
}
+ if (OS::get_singleton()->is_stdout_verbose() && lost_strings) {
+ print_line("StringName: "+itos(lost_strings)+" unclaimed string names at exit.");
+ }
_global_unlock();
}
diff --git a/core/string_db.h b/core/string_db.h
index 45afbbe6fc..912d7513ad 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/translation.cpp b/core/translation.cpp
index 6ad34651b2..8247cd1201 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/translation.h b/core/translation.h
index d690320cd0..54118cd3b5 100644
--- a/core/translation.h
+++ b/core/translation.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/typedefs.h b/core/typedefs.h
index 442ed9ae0b..ae1eb1f5e7 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 2c4d9e16a8..f266595772 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/undo_redo.h b/core/undo_redo.h
index ff729e1767..d1b2d3de9e 100644
--- a/core/undo_redo.h
+++ b/core/undo_redo.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 09d3d95b68..ffd22c1f8f 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -498,6 +498,27 @@ String String::capitalize() const {
return cap;
}
+
+String String::camelcase_to_underscore() const {
+ const CharType * cstr = c_str();
+ String newString;
+ const char A = 'A', Z = 'Z';
+ int startIndex = 0;
+
+ for ( int i = 1; i < this->size()-1; i++ ) {
+ bool isCapital = cstr[i] >= A && cstr[i] <= Z;
+
+ if ( isCapital ) {
+ newString += "_" + this->substr(startIndex, i-startIndex);
+ startIndex = i;
+ }
+ }
+
+ newString += "_" + this->substr(startIndex, this->size()-startIndex);
+
+ return newString;
+}
+
int String::get_slice_count(String p_splitter) const{
if (empty())
diff --git a/core/ustring.h b/core/ustring.h
index d4b854ea76..53ed319862 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -149,6 +149,7 @@ public:
static double to_double(const CharType* p_str, const CharType **r_end=NULL);
static int64_t to_int(const CharType* p_str,int p_len=-1);
String capitalize() const;
+ String camelcase_to_underscore() const;
int get_slice_count(String p_splitter) const;
String get_slice(String p_splitter,int p_slice) const;
diff --git a/core/variant.cpp b/core/variant.cpp
index 667a7d8648..c06afb2984 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -32,7 +32,7 @@
#include "scene/main/node.h"
#include "scene/gui/control.h"
#include "io/marshalls.h"
-
+#include "core_string_names.h"
@@ -214,7 +214,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
static const Type valid[]={
INT,
REAL,
- STRING,
+ //STRING,
NIL,
};
@@ -225,7 +225,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
static const Type valid[]={
BOOL,
REAL,
- STRING,
+ //STRING,
NIL,
};
@@ -237,7 +237,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
static const Type valid[]={
BOOL,
INT,
- STRING,
+ //STRING,
NIL,
};
@@ -456,6 +456,15 @@ bool Variant::operator==(const Variant& p_variant) const {
}
+bool Variant::operator<(const Variant& p_variant) const {
+ if (type!=p_variant.type) //if types differ, then order by type first
+ return type<p_variant.type;
+ bool v;
+ Variant r;
+ evaluate(OP_LESS,*this,p_variant,r,v);
+ return r;
+}
+
bool Variant::is_zero() const {
switch( type ) {
@@ -523,7 +532,7 @@ bool Variant::is_zero() const {
} break;
case QUAT: {
- *reinterpret_cast<const Quat*>(_data._mem)==Quat();
+ return *reinterpret_cast<const Quat*>(_data._mem)==Quat();
} break;
case MATRIX3: {
@@ -1430,8 +1439,16 @@ Variant::operator RID() const {
return *reinterpret_cast<const RID*>(_data._mem);
else if (type==OBJECT && !_get_obj().ref.is_null()) {
return _get_obj().ref.get_rid();
- } else
+ } else if (type==OBJECT && _get_obj().obj) {
+ Variant::CallError ce;
+ Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid,NULL,0,ce);
+ if (ce.error==Variant::CallError::CALL_OK && ret.get_type()==Variant::_RID) {
+ return ret;
+ }
+ return RID();
+ } else {
return RID();
+ }
}
Variant::operator Object*() const {
diff --git a/core/variant.h b/core/variant.h
index d5d4792422..85c7b92c0d 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -408,7 +408,8 @@ public:
//argsVariant call()
- bool operator==(const Variant& p_variant) const;
+ bool operator==(const Variant& p_variant) const;
+ bool operator<(const Variant& p_variant) const;
uint32_t hash() const;
bool booleanize(bool &valid) const;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index c6b498ff28..c48336d2ff 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -426,6 +426,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0(Array,sort);
VCALL_LOCALMEM2(Array,sort_custom);
VCALL_LOCALMEM0(Array,invert);
+ VCALL_LOCALMEM0R(Array,is_shared);
static void _call_ByteArray_get_string_from_ascii(Variant& r_ret,Variant& p_self,const Variant** p_args) {
@@ -1031,7 +1032,7 @@ Variant Variant::construct(const Variant::Type p_type,const Variant** p_args,int
case STRING_ARRAY: return (StringArray(*p_args[0]));
case VECTOR2_ARRAY: return (Vector2Array(*p_args[0])); // 25
case VECTOR3_ARRAY: return (Vector3Array(*p_args[0])); // 25
- case COLOR_ARRAY: return (Color(*p_args[0]));
+ case COLOR_ARRAY: return (ColorArray(*p_args[0]));
default: return Variant();
}
}
@@ -1111,6 +1112,7 @@ void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_lis
const _VariantCall::ConstructData &cd = E->get();
MethodInfo mi;
mi.name=Variant::get_type_name(p_type);
+ mi.return_val.type=p_type;
for(int i=0;i<cd.arg_count;i++) {
PropertyInfo pi;
@@ -1133,6 +1135,7 @@ void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_lis
pi.name="from";
pi.type=Variant::Type(i);
mi.arguments.push_back(pi);
+ mi.return_val.type=p_type;
p_list->push_back(mi);
}
}
@@ -1378,6 +1381,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(ARRAY,NIL,Array,sort,varray());
ADDFUNC2(ARRAY,NIL,Array,sort_custom,OBJECT,"obj",STRING,"func",varray());
ADDFUNC0(ARRAY,NIL,Array,invert,varray());
+ ADDFUNC0(ARRAY,BOOL,Array,is_shared,varray());
ADDFUNC0(RAW_ARRAY,INT,ByteArray,size,varray());
ADDFUNC2(RAW_ARRAY,NIL,ByteArray,set,INT,"idx",INT,"byte",varray());
diff --git a/core/variant_call_bind.h b/core/variant_call_bind.h
index 39fe25e8c7..613669203d 100644
--- a/core/variant_call_bind.h
+++ b/core/variant_call_bind.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 87d9738b06..f68652b8cc 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -165,6 +165,12 @@ r_valid=false;\
return;}
#define DEFAULT_OP_ARRAY_EQ(m_name,m_type)\
+DEFAULT_OP_ARRAY_OP(m_name,m_type,!=,!=,true,false,false)
+
+#define DEFAULT_OP_ARRAY_LT(m_name,m_type)\
+DEFAULT_OP_ARRAY_OP(m_name,m_type,<,!=,false,a_len<array_b.size(),true)
+
+#define DEFAULT_OP_ARRAY_OP(m_name,m_type,m_opa,m_opb,m_ret_def,m_ret_s,m_ret_f)\
case m_name: { \
if (p_a.type!=p_b.type) {\
r_valid=false;\
@@ -174,19 +180,19 @@ case m_name: { \
const DVector<m_type> &array_b=*reinterpret_cast<const DVector<m_type> *>(p_b._data._mem);\
\
int a_len = array_a.size();\
- if (a_len!=array_b.size()){\
- _RETURN( false);\
+ if (a_len m_opa array_b.size()){\
+ _RETURN( m_ret_s);\
}else {\
\
DVector<m_type>::Read ra = array_a.read();\
DVector<m_type>::Read rb = array_b.read();\
\
for(int i=0;i<a_len;i++) {\
- if (ra[i]!=rb[i])\
- _RETURN( false);\
+ if (ra[i] m_opb rb[i])\
+ _RETURN( m_ret_f);\
}\
\
- _RETURN( true);\
+ _RETURN( m_ret_def);\
}\
}
@@ -290,8 +296,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
if (arr_b->size()!=l)
_RETURN( false );
for(int i=0;i<l;i++) {
- if (!(arr_a[i]==arr_b[i]))
+ if (!((*arr_a)[i]==(*arr_b)[i])) {
_RETURN( false );
+ }
}
_RETURN( true );
@@ -356,14 +363,33 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
} break;
DEFAULT_OP_FAIL(INPUT_EVENT);
DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(RAW_ARRAY);
- DEFAULT_OP_FAIL(INT_ARRAY);
- DEFAULT_OP_FAIL(REAL_ARRAY);
- DEFAULT_OP_FAIL(STRING_ARRAY);
- DEFAULT_OP_FAIL(VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(COLOR_ARRAY);
+ case ARRAY: {
+
+ if (p_b.type!=ARRAY)
+ _RETURN( false );
+
+ const Array *arr_a=reinterpret_cast<const Array*>(p_a._data._mem);
+ const Array *arr_b=reinterpret_cast<const Array*>(p_b._data._mem);
+
+ int l = arr_a->size();
+ if (arr_b->size()<l)
+ _RETURN( false );
+ for(int i=0;i<l;i++) {
+ if (!((*arr_a)[i]<(*arr_b)[i])) {
+ _RETURN( true );
+ }
+ }
+
+ _RETURN( false );
+
+ } break;
+ DEFAULT_OP_ARRAY_LT(RAW_ARRAY,uint8_t);
+ DEFAULT_OP_ARRAY_LT(INT_ARRAY,int);
+ DEFAULT_OP_ARRAY_LT(REAL_ARRAY,real_t);
+ DEFAULT_OP_ARRAY_LT(STRING_ARRAY,String);
+ DEFAULT_OP_ARRAY_LT(VECTOR2_ARRAY,Vector3);
+ DEFAULT_OP_ARRAY_LT(VECTOR3_ARRAY,Vector3);
+ DEFAULT_OP_ARRAY_LT(COLOR_ARRAY,Color);
case VARIANT_MAX: {
r_valid=false;
return;
@@ -471,7 +497,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
}
const Array &array_a=*reinterpret_cast<const Array *>(p_a._data._mem);
const Array &array_b=*reinterpret_cast<const Array *>(p_b._data._mem);
- Array sum;
+ Array sum(array_a.is_shared() || array_b.is_shared());
int asize=array_a.size();
int bsize=array_b.size();
sum.resize(asize+bsize);
@@ -2407,7 +2433,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
}
else if (str == "pressed") {
valid=true;
- ie.action.pressed;
+ return ie.action.pressed;
}
}
diff --git a/core/vector.h b/core/vector.h
index 90a9bf715b..04018b9f78 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -149,7 +149,16 @@ public:
sort_custom<_DefaultComparator<T> >();
}
+ void ordered_insert(const T& p_val) {
+ int i;
+ for (i=0; i<size(); i++) {
+ if (p_val < operator[](i)) {
+ break;
+ };
+ };
+ insert(i, p_val);
+ }
void operator=(const Vector& p_from);
Vector(const Vector& p_from);
diff --git a/core/vmap.cpp b/core/vmap.cpp
index 4903a878b1..32481eb9eb 100644
--- a/core/vmap.cpp
+++ b/core/vmap.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/vmap.h b/core/vmap.h
index 516299280b..5ff8f73978 100644
--- a/core/vmap.h
+++ b/core/vmap.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/vset.cpp b/core/vset.cpp
index ffdd158996..c849bf3367 100644
--- a/core/vset.cpp
+++ b/core/vset.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
diff --git a/core/vset.h b/core/vset.h
index 3764b015b0..e1e02ab435 100644
--- a/core/vset.h
+++ b/core/vset.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */