summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/globals.cpp33
-rw-r--r--core/globals.h3
-rw-r--r--core/io/compression.cpp23
-rw-r--r--core/io/compression.h2
-rw-r--r--core/io/networked_multiplayer_peer.cpp20
-rw-r--r--core/io/networked_multiplayer_peer.h28
-rw-r--r--core/io/stream_peer.cpp144
-rw-r--r--core/io/stream_peer.h36
-rw-r--r--core/math/math_2d.h9
-rw-r--r--core/object.cpp121
-rw-r--r--core/object.h16
-rw-r--r--core/object_type_db.cpp2
-rw-r--r--core/os/input_event.cpp46
-rw-r--r--core/path_db.cpp4
-rw-r--r--core/register_core_types.cpp1
-rw-r--r--core/script_language.cpp1
-rw-r--r--core/script_language.h25
-rw-r--r--core/string_db.cpp6
-rw-r--r--core/variant_op.cpp2
-rw-r--r--doc/base/classes.xml109
-rw-r--r--main/input_default.cpp1
-rw-r--r--modules/enet/SCsub8
-rw-r--r--modules/enet/callbacks.c53
-rw-r--r--modules/enet/compress.c654
-rw-r--r--modules/enet/config.py11
-rw-r--r--modules/enet/enet/callbacks.h27
-rw-r--r--modules/enet/enet/enet.h596
-rw-r--r--modules/enet/enet/list.h43
-rw-r--r--modules/enet/enet/protocol.h198
-rw-r--r--modules/enet/enet/time.h18
-rw-r--r--modules/enet/enet/types.h13
-rw-r--r--modules/enet/enet/unix.h47
-rw-r--r--modules/enet/enet/utility.h12
-rw-r--r--modules/enet/enet/win32.h57
-rw-r--r--modules/enet/host.c492
-rw-r--r--modules/enet/list.c75
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp643
-rw-r--r--modules/enet/networked_multiplayer_enet.h111
-rw-r--r--modules/enet/packet.c165
-rw-r--r--modules/enet/peer.c1004
-rw-r--r--modules/enet/protocol.c1914
-rw-r--r--modules/enet/register_types.cpp51
-rw-r--r--modules/enet/register_types.h30
-rw-r--r--modules/enet/unix.c616
-rw-r--r--modules/enet/win32.c422
-rw-r--r--modules/gdscript/gd_compiler.cpp6
-rw-r--r--modules/gdscript/gd_editor.cpp28
-rw-r--r--modules/gdscript/gd_function.cpp1
-rw-r--r--modules/gdscript/gd_function.h12
-rw-r--r--modules/gdscript/gd_parser.cpp99
-rw-r--r--modules/gdscript/gd_parser.h8
-rw-r--r--modules/gdscript/gd_script.cpp90
-rw-r--r--modules/gdscript/gd_script.h106
-rw-r--r--modules/gdscript/gd_tokenizer.cpp10
-rw-r--r--modules/gdscript/gd_tokenizer.h4
-rw-r--r--modules/visual_script/register_types.cpp18
-rw-r--r--modules/visual_script/visual_script.cpp138
-rw-r--r--modules/visual_script/visual_script.h11
-rw-r--r--modules/visual_script/visual_script_editor.cpp565
-rw-r--r--modules/visual_script/visual_script_editor.h29
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp209
-rw-r--r--modules/visual_script/visual_script_flow_control.h50
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp1653
-rw-r--r--modules/visual_script/visual_script_func_nodes.h131
-rw-r--r--modules/visual_script/visual_script_nodes.cpp1028
-rw-r--r--modules/visual_script/visual_script_nodes.h277
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp17
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h1
-rw-r--r--platform/windows/detect.py5
-rw-r--r--scene/2d/physics_body_2d.cpp77
-rw-r--r--scene/2d/physics_body_2d.h13
-rw-r--r--scene/gui/control.cpp9
-rw-r--r--scene/gui/control.h6
-rw-r--r--scene/gui/graph_edit.cpp196
-rw-r--r--scene/gui/graph_edit.h9
-rw-r--r--scene/gui/graph_node.cpp77
-rw-r--r--scene/gui/graph_node.h14
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp40
-rw-r--r--scene/gui/tree.h6
-rw-r--r--scene/main/node.cpp717
-rw-r--r--scene/main/node.h60
-rw-r--r--scene/main/scene_main_loop.cpp517
-rw-r--r--scene/main/scene_main_loop.h64
-rw-r--r--scene/resources/default_theme/default_theme.cpp5
-rw-r--r--scene/resources/default_theme/graph_node.pngbin752 -> 762 bytes
-rw-r--r--scene/resources/default_theme/graph_node_comment.pngbin0 -> 506 bytes
-rw-r--r--scene/resources/default_theme/graph_node_selected.pngbin920 -> 933 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h14
-rw-r--r--scene/resources/default_theme/window_resizer.pngbin0 -> 181 bytes
-rw-r--r--tools/doc/doc_data.cpp18
-rw-r--r--tools/editor/create_dialog.cpp23
-rw-r--r--tools/editor/create_dialog.h5
-rw-r--r--tools/editor/editor_data.cpp2
-rw-r--r--tools/editor/editor_help.cpp158
-rw-r--r--tools/editor/editor_help.h17
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_plugin.cpp28
-rw-r--r--tools/editor/editor_plugin.h1
-rw-r--r--tools/editor/editor_settings.cpp21
-rw-r--r--tools/editor/editor_settings.h2
-rw-r--r--tools/editor/icons/2x/icon_capsule_shape_2d.pngbin603 -> 552 bytes
-rw-r--r--tools/editor/icons/2x/icon_circle_shape_2d.pngbin934 -> 838 bytes
-rw-r--r--tools/editor/icons/2x/icon_concave_polygon_shape_2d.pngbin466 -> 436 bytes
-rw-r--r--tools/editor/icons/2x/icon_convex_polygon_shape_2d.pngbin392 -> 373 bytes
-rw-r--r--tools/editor/icons/2x/icon_line_shape_2d.pngbin651 -> 597 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_aabb.pngbin0 -> 697 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_array.pngbin0 -> 326 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_boolean.pngbin0 -> 434 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_color.pngbin0 -> 411 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_color_array.pngbin0 -> 445 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_dictionary.pngbin0 -> 371 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_float.pngbin0 -> 355 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_float_array.pngbin0 -> 451 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_image.pngbin0 -> 450 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_input.pngbin0 -> 409 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_int_array.pngbin0 -> 384 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_integer.pngbin0 -> 367 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_matrix3.pngbin0 -> 391 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_matrix32.pngbin0 -> 573 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_object.pngbin0 -> 507 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_path.pngbin0 -> 435 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_plane.pngbin0 -> 424 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_quat.pngbin0 -> 509 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_raw_array.pngbin0 -> 382 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_rect2.pngbin0 -> 431 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_rid.pngbin0 -> 349 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_string.pngbin0 -> 437 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_string_array.pngbin0 -> 479 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_transform.pngbin0 -> 431 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_variant.pngbin0 -> 405 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_vector2.pngbin0 -> 541 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_vector2_array.pngbin0 -> 485 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_vector3.pngbin0 -> 509 bytes
-rw-r--r--tools/editor/icons/2x/icon_mini_vector3_array.pngbin0 -> 416 bytes
-rw-r--r--tools/editor/icons/2x/icon_ray_shape_2d.pngbin382 -> 330 bytes
-rw-r--r--tools/editor/icons/2x/icon_rectangle_shape_2d.pngbin232 -> 213 bytes
-rw-r--r--tools/editor/icons/2x/icon_segment_shape_2d.pngbin334 -> 320 bytes
-rw-r--r--tools/editor/icons/icon_capsule_shape_2d.pngbin324 -> 309 bytes
-rw-r--r--tools/editor/icons/icon_circle_shape_2d.pngbin466 -> 425 bytes
-rw-r--r--tools/editor/icons/icon_concave_polygon_shape_2d.pngbin347 -> 321 bytes
-rw-r--r--tools/editor/icons/icon_convex_polygon_shape_2d.pngbin319 -> 297 bytes
-rw-r--r--tools/editor/icons/icon_line_shape_2d.pngbin412 -> 379 bytes
-rw-r--r--tools/editor/icons/icon_loop_interpolation.pngbin0 -> 374 bytes
-rw-r--r--tools/editor/icons/icon_mini_aabb.pngbin205 -> 367 bytes
-rw-r--r--tools/editor/icons/icon_mini_array.pngbin193 -> 210 bytes
-rw-r--r--tools/editor/icons/icon_mini_boolean.pngbin203 -> 256 bytes
-rw-r--r--tools/editor/icons/icon_mini_color.pngbin202 -> 253 bytes
-rw-r--r--tools/editor/icons/icon_mini_color_array.pngbin201 -> 337 bytes
-rw-r--r--tools/editor/icons/icon_mini_dictionary.pngbin192 -> 230 bytes
-rw-r--r--tools/editor/icons/icon_mini_float.pngbin211 -> 233 bytes
-rw-r--r--tools/editor/icons/icon_mini_float_array.pngbin210 -> 275 bytes
-rw-r--r--tools/editor/icons/icon_mini_image.pngbin211 -> 257 bytes
-rw-r--r--tools/editor/icons/icon_mini_input.pngbin201 -> 236 bytes
-rw-r--r--tools/editor/icons/icon_mini_int_array.pngbin198 -> 262 bytes
-rw-r--r--tools/editor/icons/icon_mini_integer.pngbin196 -> 228 bytes
-rw-r--r--tools/editor/icons/icon_mini_matrix3.pngbin220 -> 236 bytes
-rw-r--r--tools/editor/icons/icon_mini_matrix32.pngbin216 -> 320 bytes
-rw-r--r--tools/editor/icons/icon_mini_object.pngbin210 -> 289 bytes
-rw-r--r--tools/editor/icons/icon_mini_path.pngbin211 -> 254 bytes
-rw-r--r--tools/editor/icons/icon_mini_plane.pngbin207 -> 249 bytes
-rw-r--r--tools/editor/icons/icon_mini_quat.pngbin205 -> 309 bytes
-rw-r--r--tools/editor/icons/icon_mini_raw_array.pngbin214 -> 248 bytes
-rw-r--r--tools/editor/icons/icon_mini_rect2.pngbin216 -> 267 bytes
-rw-r--r--tools/editor/icons/icon_mini_rid.pngbin205 -> 222 bytes
-rw-r--r--tools/editor/icons/icon_mini_string.pngbin198 -> 258 bytes
-rw-r--r--tools/editor/icons/icon_mini_string_array.pngbin216 -> 296 bytes
-rw-r--r--tools/editor/icons/icon_mini_transform.pngbin216 -> 264 bytes
-rw-r--r--tools/editor/icons/icon_mini_variant.pngbin254 -> 240 bytes
-rw-r--r--tools/editor/icons/icon_mini_vector2.pngbin217 -> 301 bytes
-rw-r--r--tools/editor/icons/icon_mini_vector2_array.pngbin216 -> 284 bytes
-rw-r--r--tools/editor/icons/icon_mini_vector3.pngbin219 -> 285 bytes
-rw-r--r--tools/editor/icons/icon_mini_vector3_array.pngbin212 -> 264 bytes
-rw-r--r--tools/editor/icons/icon_ray_shape_2d.pngbin250 -> 233 bytes
-rw-r--r--tools/editor/icons/icon_rectangle_shape_2d.pngbin160 -> 159 bytes
-rw-r--r--tools/editor/icons/icon_segment_shape_2d.pngbin252 -> 241 bytes
-rw-r--r--tools/editor/icons/source/icon_capsule_shape_2d.svg6
-rw-r--r--tools/editor/icons/source/icon_circle_shape_2d.svg95
-rw-r--r--tools/editor/icons/source/icon_concave_polygon_shape_2d.svg96
-rw-r--r--tools/editor/icons/source/icon_convex_polygon_shape_2d.svg96
-rw-r--r--tools/editor/icons/source/icon_line_shape_2d.svg110
-rw-r--r--tools/editor/icons/source/icon_mini_aabb.svg107
-rw-r--r--tools/editor/icons/source/icon_mini_array.svg130
-rw-r--r--tools/editor/icons/source/icon_mini_boolean.svg131
-rw-r--r--tools/editor/icons/source/icon_mini_color.svg126
-rw-r--r--tools/editor/icons/source/icon_mini_color_array.svg250
-rw-r--r--tools/editor/icons/source/icon_mini_dictionary.svg150
-rw-r--r--tools/editor/icons/source/icon_mini_float.svg147
-rw-r--r--tools/editor/icons/source/icon_mini_float_array.svg133
-rw-r--r--tools/editor/icons/source/icon_mini_image.svg156
-rw-r--r--tools/editor/icons/source/icon_mini_input.svg146
-rw-r--r--tools/editor/icons/source/icon_mini_int_array.svg94
-rw-r--r--tools/editor/icons/source/icon_mini_integer.svg143
-rw-r--r--tools/editor/icons/source/icon_mini_matrix3.svg140
-rw-r--r--tools/editor/icons/source/icon_mini_matrix32.svg145
-rw-r--r--tools/editor/icons/source/icon_mini_object.svg111
-rw-r--r--tools/editor/icons/source/icon_mini_path.svg142
-rw-r--r--tools/editor/icons/source/icon_mini_plane.svg124
-rw-r--r--tools/editor/icons/source/icon_mini_quat.svg123
-rw-r--r--tools/editor/icons/source/icon_mini_raw_array.svg103
-rw-r--r--tools/editor/icons/source/icon_mini_rect2.svg170
-rw-r--r--tools/editor/icons/source/icon_mini_rid.svg140
-rw-r--r--tools/editor/icons/source/icon_mini_string.svg236
-rw-r--r--tools/editor/icons/source/icon_mini_string_array.svg289
-rw-r--r--tools/editor/icons/source/icon_mini_transform.svg96
-rw-r--r--tools/editor/icons/source/icon_mini_variant.svg138
-rw-r--r--tools/editor/icons/source/icon_mini_vector2.svg149
-rw-r--r--tools/editor/icons/source/icon_mini_vector2_array.svg129
-rw-r--r--tools/editor/icons/source/icon_mini_vector3.svg142
-rw-r--r--tools/editor/icons/source/icon_mini_vector3_array.svg129
-rw-r--r--tools/editor/icons/source/icon_ray_shape_2d.svg103
-rw-r--r--tools/editor/icons/source/icon_rectangle_shape_2d.svg99
-rw-r--r--tools/editor/icons/source/icon_segment_shape_2d.svg95
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp114
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.h6
-rw-r--r--tools/editor/plugins/material_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/mesh_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp29
-rw-r--r--tools/editor/plugins/script_editor_plugin.h9
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp59
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h3
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp37
-rw-r--r--tools/editor/project_settings.cpp72
-rw-r--r--tools/editor/project_settings.h2
-rw-r--r--tools/editor/property_editor.cpp174
-rw-r--r--tools/editor/property_editor.h4
-rw-r--r--tools/editor/property_selector.cpp598
-rw-r--r--tools/editor/property_selector.h55
-rw-r--r--tools/editor/scene_tree_dock.cpp20
-rw-r--r--tools/editor/scene_tree_dock.h2
231 files changed, 19093 insertions, 1509 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index e760bc00d4..b822f52f15 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -1332,17 +1332,18 @@ Variant _GLOBAL_DEF( const String& p_var, const Variant& p_default) {
void Globals::add_singleton(const Singleton &p_singleton) {
singletons.push_back(p_singleton);
+ singleton_ptrs[p_singleton.name]=p_singleton.ptr;
}
Object* Globals::get_singleton_object(const String& p_name) const {
- for(const List<Singleton>::Element *E=singletons.front();E;E=E->next()) {
- if (E->get().name == p_name) {
- return E->get().ptr;
- };
- };
- return NULL;
+ const Map<StringName,Object*>::Element *E=singleton_ptrs.find(p_name);
+ if (!E)
+ return NULL;
+ else
+ return E->get();
+
};
bool Globals::has_singleton(const String& p_name) const {
@@ -1375,6 +1376,25 @@ Vector<String> Globals::get_optimizer_presets() const {
}
+void Globals::_add_property_info_bind(const Dictionary& p_info) {
+
+ ERR_FAIL_COND(!p_info.has("name"));
+ ERR_FAIL_COND(!p_info.has("type"));
+
+ PropertyInfo pinfo;
+ pinfo.name = p_info["name"];
+ ERR_FAIL_COND(!props.has(pinfo.name));
+ pinfo.type = Variant::Type(p_info["type"].operator int());
+ ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX);
+
+ if (p_info.has("hint"))
+ pinfo.hint = PropertyHint(p_info["hint"].operator int());
+ if (p_info.has("hint_string"))
+ pinfo.hint_string = p_info["hint_string"];
+
+ set_custom_property_info(pinfo.name, pinfo);
+}
+
void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) {
ERR_FAIL_COND(!props.has(p_prop));
@@ -1399,6 +1419,7 @@ void Globals::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order);
ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting);
ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting);
+ ObjectTypeDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind);
ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear);
ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path);
ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path);
diff --git a/core/globals.h b/core/globals.h
index 68bb859ace..5e0bdb0e54 100644
--- a/core/globals.h
+++ b/core/globals.h
@@ -91,11 +91,14 @@ protected:
Error _save_settings_binary(const String& p_file,const Map<String,List<String> > &props,const CustomMap& p_custom=CustomMap());
List<Singleton> singletons;
+ Map<StringName,Object*> singleton_ptrs;
Error _save_custom_bnd(const String& p_file);
bool _load_resource_pack(const String& p_pack);
+ void _add_property_info_bind(const Dictionary& p_info);
+
protected:
static void _bind_methods();
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index a17e358cbb..ca44d24911 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -60,6 +60,10 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,M
strm.avail_in=p_src_size;
int aout = deflateBound(&strm,p_src_size);;
+ /*if (aout>p_src_size) {
+ deflateEnd(&strm);
+ return -1;
+ }*/
strm.avail_out=aout;
strm.next_in=(Bytef*)p_src;
strm.next_out=p_dst;
@@ -107,19 +111,21 @@ int Compression::get_max_compressed_buffer_size(int p_src_size,Mode p_mode){
-void Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode){
+int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode){
switch(p_mode) {
case MODE_FASTLZ: {
+ int ret_size=0;
+
if (p_dst_max_size<16) {
uint8_t dst[16];
- fastlz_decompress(p_src,p_src_size,dst,16);
+ ret_size = fastlz_decompress(p_src,p_src_size,dst,16);
copymem(p_dst,dst,p_dst_max_size);
} else {
- fastlz_decompress(p_src,p_src_size,p_dst,p_dst_max_size);
+ ret_size = fastlz_decompress(p_src,p_src_size,p_dst,p_dst_max_size);
}
- return;
+ return ret_size;
} break;
case MODE_DEFLATE: {
@@ -130,7 +136,7 @@ void Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *
strm.avail_in= 0;
strm.next_in=Z_NULL;
int err = inflateInit(&strm);
- ERR_FAIL_COND(err!=Z_OK);
+ ERR_FAIL_COND_V(err!=Z_OK,-1);
strm.avail_in=p_src_size;
strm.avail_out=p_dst_max_size;
@@ -138,11 +144,12 @@ void Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *
strm.next_out=p_dst;
err = inflate(&strm,Z_FINISH);
+ int total = strm.total_out;
inflateEnd(&strm);
- ERR_FAIL_COND(err!=Z_STREAM_END);
- return;
+ ERR_FAIL_COND_V(err!=Z_STREAM_END,-1);
+ return total;
} break;
}
- ERR_FAIL();
+ ERR_FAIL_V(-1);
}
diff --git a/core/io/compression.h b/core/io/compression.h
index 07a293c940..e0a4d31a51 100644
--- a/core/io/compression.h
+++ b/core/io/compression.h
@@ -43,7 +43,7 @@ public:
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);
+ static int 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();
};
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index 79f3e129e1..47e5f3729c 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -5,22 +5,34 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_transfer_mode","mode"), &NetworkedMultiplayerPeer::set_transfer_mode );
ObjectTypeDB::bind_method(_MD("set_target_peer","id"), &NetworkedMultiplayerPeer::set_target_peer );
- ObjectTypeDB::bind_method(_MD("set_channel","id"), &NetworkedMultiplayerPeer::set_channel );
ObjectTypeDB::bind_method(_MD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer );
- ObjectTypeDB::bind_method(_MD("get_packet_channel"), &NetworkedMultiplayerPeer::get_packet_channel );
ObjectTypeDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll );
+ ObjectTypeDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status );
+ ObjectTypeDB::bind_method(_MD("get_unique_id"), &NetworkedMultiplayerPeer::get_unique_id );
- BIND_CONSTANT( TARGET_ALL_PEERS );
+ ObjectTypeDB::bind_method(_MD("set_refuse_new_connections","enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections );
+ ObjectTypeDB::bind_method(_MD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections );
BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE );
+ BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE_ORDERED );
BIND_CONSTANT( TRANSFER_MODE_RELIABLE );
- BIND_CONSTANT( TRANSFER_MODE_ORDERED );
+
+ BIND_CONSTANT( CONNECTION_DISCONNECTED );
+ BIND_CONSTANT( CONNECTION_CONNECTING );
+ BIND_CONSTANT( CONNECTION_CONNECTED );
+
+ BIND_CONSTANT( TARGET_PEER_BROADCAST );
+ BIND_CONSTANT( TARGET_PEER_SERVER );
+
ADD_SIGNAL( MethodInfo("peer_connected",PropertyInfo(Variant::INT,"id")));
ADD_SIGNAL( MethodInfo("peer_disconnected",PropertyInfo(Variant::INT,"id")));
+ ADD_SIGNAL( MethodInfo("server_disconnected"));
+ ADD_SIGNAL( MethodInfo("connection_succeeded") );
+ ADD_SIGNAL( MethodInfo("connection_failed") );
}
NetworkedMultiplayerPeer::NetworkedMultiplayerPeer() {
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index f140b57b8b..485200a9a9 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -12,29 +12,43 @@ protected:
public:
enum {
- TARGET_ALL_PEERS=0xFFFFFF // send to this for all peers
+ TARGET_PEER_BROADCAST=0,
+ TARGET_PEER_SERVER=1
};
-
enum TransferMode {
TRANSFER_MODE_UNRELIABLE,
+ TRANSFER_MODE_UNRELIABLE_ORDERED,
TRANSFER_MODE_RELIABLE,
- TRANSFER_MODE_ORDERED
};
- virtual void set_transfer_mode(TransferMode p_mode)=0;
- virtual void set_target_peer(int p_peer)=0;
- virtual void set_channel(int p_channel)=0;
+ enum ConnectionStatus {
+ CONNECTION_DISCONNECTED,
+ CONNECTION_CONNECTING,
+ CONNECTION_CONNECTED,
+ };
+ virtual void set_transfer_mode(TransferMode p_mode)=0;
+ virtual void set_target_peer(int p_peer_id)=0;
+
virtual int get_packet_peer() const=0;
- virtual int get_packet_channel() const=0;
+ virtual bool is_server() const=0;
virtual void poll()=0;
+ virtual int get_unique_id() const=0;
+
+ virtual void set_refuse_new_connections(bool p_enable)=0;
+ virtual bool is_refusing_new_connections() const=0;
+
+
+ virtual ConnectionStatus get_connection_status() const=0;
+
NetworkedMultiplayerPeer();
};
VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::TransferMode )
+VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::ConnectionStatus )
#endif // NetworkedMultiplayerPeer_H
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 306e7d8c9d..baaeacaf18 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -222,6 +222,7 @@ void StreamPeer::put_double(double p_val){
void StreamPeer::put_utf8_string(const String& p_string) {
CharString cs=p_string.utf8();
+ put_u32(p_string.length());
put_data((const uint8_t*)cs.get_data(),cs.length());
}
@@ -348,8 +349,10 @@ String StreamPeer::get_string(int p_bytes){
ERR_FAIL_COND_V(p_bytes<0,String());
Vector<char> buf;
- buf.resize(p_bytes+1);
- get_data((uint8_t*)&buf[0],p_bytes);
+ Error err = buf.resize(p_bytes+1);
+ ERR_FAIL_COND_V(err!=OK,String());
+ err = get_data((uint8_t*)&buf[0],p_bytes);
+ ERR_FAIL_COND_V(err!=OK,String());
buf[p_bytes]=0;
return buf.ptr();
@@ -359,8 +362,10 @@ String StreamPeer::get_utf8_string(int p_bytes){
ERR_FAIL_COND_V(p_bytes<0,String());
Vector<uint8_t> buf;
- buf.resize(p_bytes);
- get_data(buf.ptr(),p_bytes);
+ Error err = buf.resize(p_bytes);
+ ERR_FAIL_COND_V(err!=OK,String());
+ err = get_data(buf.ptr(),p_bytes);
+ ERR_FAIL_COND_V(err!=OK,String());
String ret;
ret.parse_utf8((const char*)buf.ptr(),buf.size());
@@ -371,8 +376,10 @@ Variant StreamPeer::get_var(){
int len = get_32();
Vector<uint8_t> var;
- var.resize(len);
- get_data(var.ptr(),len);
+ Error err = var.resize(len);
+ ERR_FAIL_COND_V(err!=OK,Variant());
+ err = get_data(var.ptr(),len);
+ ERR_FAIL_COND_V(err!=OK,Variant());
Variant ret;
decode_variant(ret,var.ptr(),len);
@@ -420,3 +427,128 @@ void StreamPeer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_utf8_string","bytes"),&StreamPeer::get_utf8_string);
ObjectTypeDB::bind_method(_MD("get_var:Variant"),&StreamPeer::get_var);
}
+////////////////////////////////
+
+
+void StreamPeerBuffer::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("seek","pos"),&StreamPeerBuffer::seek);
+ ObjectTypeDB::bind_method(_MD("get_size"),&StreamPeerBuffer::get_size);
+ ObjectTypeDB::bind_method(_MD("get_pos"),&StreamPeerBuffer::get_pos);
+ ObjectTypeDB::bind_method(_MD("resize","size"),&StreamPeerBuffer::resize);
+ ObjectTypeDB::bind_method(_MD("set_data_array","data"),&StreamPeerBuffer::set_data_array);
+ ObjectTypeDB::bind_method(_MD("get_data_array"),&StreamPeerBuffer::get_data_array);
+ ObjectTypeDB::bind_method(_MD("clear"),&StreamPeerBuffer::clear);
+ ObjectTypeDB::bind_method(_MD("duplicate:StreamPeerBuffer"),&StreamPeerBuffer::duplicate);
+
+}
+
+
+Error StreamPeerBuffer::put_data(const uint8_t* p_data,int p_bytes) {
+
+ if (p_bytes<=0)
+ return OK;
+
+ if (pointer+p_bytes > data.size()) {
+ data.resize(pointer+p_bytes);
+
+ }
+
+ DVector<uint8_t>::Write w = data.write();
+ copymem(&w[pointer],p_data,p_bytes);
+
+ pointer+=p_bytes;
+ return OK;
+}
+
+Error StreamPeerBuffer::put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent){
+
+ r_sent=p_bytes;
+ return put_data(p_data,p_bytes);
+}
+
+Error StreamPeerBuffer::get_data(uint8_t* p_buffer, int p_bytes){
+
+ int recv;
+ get_partial_data(p_buffer,p_bytes,recv);
+ if (recv!=p_bytes)
+ return ERR_INVALID_PARAMETER;
+
+ return OK;
+
+}
+Error StreamPeerBuffer::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received){
+
+
+ if (pointer+p_bytes > data.size()) {
+ r_received=data.size()-pointer;
+ if (r_received<=0) {
+ r_received=0;
+ return OK; //you got 0
+ }
+ } else {
+ r_received=p_bytes;
+ }
+
+ DVector<uint8_t>::Read r = data.read();
+ copymem(p_buffer,r.ptr(),r_received);
+}
+
+int StreamPeerBuffer::get_available_bytes() const {
+
+ return data.size()-pointer;
+}
+
+void StreamPeerBuffer::seek(int p_pos){
+
+ ERR_FAIL_COND(p_pos < 0);
+ ERR_FAIL_COND(p_pos > data.size());
+ pointer=p_pos;
+}
+int StreamPeerBuffer::get_size() const{
+
+ return data.size();
+}
+
+int StreamPeerBuffer::get_pos() const {
+
+ return pointer;
+}
+
+void StreamPeerBuffer::resize(int p_size){
+
+ data.resize(p_size);
+}
+
+void StreamPeerBuffer::set_data_array(const DVector<uint8_t> & p_data){
+
+ data=p_data;
+ pointer=0;
+}
+
+DVector<uint8_t> StreamPeerBuffer::get_data_array() const{
+
+ return data;
+}
+
+
+void StreamPeerBuffer::clear() {
+
+ data.resize(0);
+ pointer=0;
+}
+
+
+Ref<StreamPeerBuffer> StreamPeerBuffer::duplicate() const {
+
+ Ref<StreamPeerBuffer> spb;
+ spb.instance();
+ spb->data=data;
+ return spb;
+}
+
+
+StreamPeerBuffer::StreamPeerBuffer() {
+
+ pointer=0;
+}
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 970e6695a5..f28e6f594d 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -91,4 +91,40 @@ public:
StreamPeer() { big_endian=false; }
};
+
+class StreamPeerBuffer : public StreamPeer {
+
+ OBJ_TYPE(StreamPeerBuffer,StreamPeer);
+
+ DVector<uint8_t> data;
+ int pointer;
+protected:
+
+ static void _bind_methods();
+public:
+ Error put_data(const uint8_t* p_data,int p_bytes);
+ Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent);
+
+ Error get_data(uint8_t* p_buffer, int p_bytes);
+ Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received);
+
+ virtual int get_available_bytes() const;
+
+ void seek(int p_pos);
+ int get_size() const;
+ int get_pos() const;
+ void resize(int p_size);
+
+
+ void set_data_array(const DVector<uint8_t> & p_data);
+ DVector<uint8_t> get_data_array() const;
+
+ void clear();
+
+ Ref<StreamPeerBuffer> duplicate() const;
+
+ StreamPeerBuffer();
+};
+
+
#endif // STREAM_PEER_H
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index fbf700fb9c..90aae9fe50 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -618,6 +618,15 @@ struct Matrix32 {
operator String() const;
+ Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) {
+
+ elements[0][0] = xx;
+ elements[0][1] = xy;
+ elements[1][0] = yx;
+ elements[1][1] = yy;
+ elements[2][0] = ox;
+ elements[2][1] = oy;
+ }
Matrix32(real_t p_rot, const Vector2& p_pos);
Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; }
diff --git a/core/object.cpp b/core/object.cpp
index 26319d42dd..b036efa501 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -59,30 +59,112 @@ struct _ObjectDebugLock {
#endif
+
+PropertyInfo::operator Dictionary() const {
+
+ Dictionary d;
+ d["name"]=name;
+ d["type"]=type;
+ d["hint"]=hint;
+ d["hint_string"]=hint_string;
+ d["usage"]=usage;
+ return d;
+
+}
+
+PropertyInfo PropertyInfo::from_dict(const Dictionary& p_dict) {
+
+ PropertyInfo pi;
+
+ if (p_dict.has("type"))
+ pi.type=Variant::Type(int(p_dict["type"]));
+
+ if (p_dict.has("name"))
+ pi.name=p_dict["name"];
+
+ if (p_dict.has("hint"))
+ pi.hint=PropertyHint(int(p_dict["hint"]));
+
+ if (p_dict.has("hint_string"))
+
+ pi.hint_string=p_dict["hint_string"];
+
+ if (p_dict.has("usage"))
+ pi.usage=p_dict["usage"];
+
+ return pi;
+}
+
+
Array convert_property_list(const List<PropertyInfo> * p_list) {
Array va;
for (const List<PropertyInfo>::Element *E=p_list->front();E;E=E->next()) {
- const PropertyInfo &pi = E->get();
- Dictionary d;
- d["name"]=pi.name;
- d["type"]=pi.type;
- d["hint"]=pi.hint;
- d["hint_string"]=pi.hint_string;
- d["usage"]=pi.usage;
- va.push_back(d);
+
+ va.push_back(Dictionary(E->get()));
}
return va;
}
+MethodInfo::operator Dictionary() const {
+
+
+ Dictionary d;
+ d["name"]=name;
+ d["args"]=convert_property_list(&arguments);
+ Array da;
+ for(int i=0;i<default_arguments.size();i++)
+ da.push_back(default_arguments[i]);
+ d["default_args"]=da;
+ d["flags"]=flags;
+ d["id"]=id;
+ Dictionary r = return_val;
+ d["return"]=r;
+ return d;
+
+}
+
MethodInfo::MethodInfo() {
id=0;
flags=METHOD_FLAG_NORMAL;
}
+MethodInfo MethodInfo::from_dict(const Dictionary& p_dict) {
+
+ MethodInfo mi;
+
+ if (p_dict.has("name"))
+ mi.name=p_dict["name"];
+ Array args;
+ if (p_dict.has("args")) {
+ args=p_dict["args"];
+ }
+
+ for(int i=0;i<args.size();i++) {
+ Dictionary d = args[i];
+ mi.arguments.push_back(PropertyInfo::from_dict(d));
+ }
+ Array defargs;
+ if (p_dict.has("default_args")) {
+ defargs=p_dict["default_args"];
+ }
+ for(int i=0;i<defargs.size();i++) {
+ mi.default_arguments.push_back(defargs[i]);
+ }
+
+ if (p_dict.has("return")) {
+ mi.return_val=PropertyInfo::from_dict(p_dict["return"]);
+ }
+
+ if (p_dict.has("flags"))
+ mi.flags=p_dict["flags"];
+
+ return mi;
+}
+
MethodInfo::MethodInfo(const String& p_name) {
id=0;
@@ -1012,25 +1094,6 @@ Array Object::_get_property_list_bind() const {
}
-static Dictionary _get_dict_from_method(const MethodInfo &mi) {
-
- Dictionary d;
- d["name"]=mi.name;
- d["args"]=convert_property_list(&mi.arguments);
- Array da;
- for(int i=0;i<mi.default_arguments.size();i++)
- da.push_back(mi.default_arguments[i]);
- d["default_args"]=da;
- d["flags"]=mi.flags;
- d["id"]=mi.id;
- Dictionary r;
- r["type"]=mi.return_val.type;
- r["hint"]=mi.return_val.hint;
- r["hint_string"]=mi.return_val.hint_string;
- d["return_type"]=r;
- return d;
-
-}
Array Object::_get_method_list_bind() const {
@@ -1040,7 +1103,7 @@ Array Object::_get_method_list_bind() const {
for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
- Dictionary d = _get_dict_from_method(E->get());
+ Dictionary d = E->get();
//va.push_back(d);
ret.push_back(d);
}
@@ -1305,7 +1368,7 @@ Array Object::_get_signal_list() const{
Array ret;
for (List<MethodInfo>::Element *E=signal_list.front();E;E=E->next()) {
- ret.push_back(_get_dict_from_method(E->get()));
+ ret.push_back(Dictionary(E->get()));
}
return ret;
diff --git a/core/object.h b/core/object.h
index 400ab3070e..ac3fc51b3e 100644
--- a/core/object.h
+++ b/core/object.h
@@ -70,6 +70,14 @@ enum PropertyHint {
PROPERTY_HINT_OBJECT_ID,
PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose
PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts)
+ PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type
+ PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type
+ PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance
+ PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base
+ PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
+ PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
+ PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
+ PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
PROPERTY_HINT_MAX,
};
@@ -118,6 +126,11 @@ struct PropertyInfo {
_FORCE_INLINE_ PropertyInfo added_usage(int p_fl) const { PropertyInfo pi=*this; pi.usage|=p_fl; return pi; }
+
+ operator Dictionary() const;
+
+ static PropertyInfo from_dict(const Dictionary& p_dict);
+
PropertyInfo() { type=Variant::NIL; hint=PROPERTY_HINT_NONE; usage = PROPERTY_USAGE_DEFAULT; }
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;
@@ -142,6 +155,9 @@ struct MethodInfo {
inline bool operator<(const MethodInfo& p_method) const { return id==p_method.id?(name < p_method.name):(id<p_method.id); }
+ operator Dictionary() const;
+
+ static MethodInfo from_dict(const Dictionary& p_dict);
MethodInfo();
MethodInfo(const String& p_name);
MethodInfo(const String& p_name, const PropertyInfo& p_param1);
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp
index ba98797a89..b6a69e3bd4 100644
--- a/core/object_type_db.cpp
+++ b/core/object_type_db.cpp
@@ -642,7 +642,7 @@ void ObjectTypeDB::get_property_list(StringName p_type, List<PropertyInfo> *p_li
TypeInfo *check=type;
while(check) {
- for(List<PropertyInfo>::Element *E=type->property_list.front();E;E=E->next()) {
+ for(List<PropertyInfo>::Element *E=check->property_list.front();E;E=E->next()) {
if (p_validator) {
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 8c79657c64..f4a6de0e96 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -34,8 +34,52 @@
*/
bool InputEvent::operator==(const InputEvent &p_event) const {
+ if (type != p_event.type){
+ return false;
+ }
- return true;
+ switch(type) {
+ case KEY:
+ return key.unicode == p_event.key.unicode
+ && key.scancode == p_event.key.scancode
+ && key.echo == p_event.key.echo
+ && key.pressed == p_event.key.pressed
+ && key.mod == p_event.key.mod;
+ case MOUSE_MOTION:
+ return mouse_motion.x == p_event.mouse_motion.x
+ && mouse_motion.y == p_event.mouse_motion.y
+ && mouse_motion.relative_x == p_event.mouse_motion.relative_y
+ && mouse_motion.button_mask == p_event.mouse_motion.button_mask
+ && key.mod == p_event.key.mod;
+ case MOUSE_BUTTON:
+ return mouse_button.pressed == p_event.mouse_button.pressed
+ && mouse_button.x == p_event.mouse_button.x
+ && mouse_button.y == p_event.mouse_button.y
+ && mouse_button.button_index == p_event.mouse_button.button_index
+ && mouse_button.button_mask == p_event.mouse_button.button_mask
+ && key.mod == p_event.key.mod;
+ case JOYSTICK_MOTION:
+ return joy_motion.axis == p_event.joy_motion.axis
+ && joy_motion.axis_value == p_event.joy_motion.axis_value;
+ case JOYSTICK_BUTTON:
+ return joy_button.pressed == p_event.joy_button.pressed
+ && joy_button.button_index == p_event.joy_button.button_index
+ && joy_button.pressure == p_event.joy_button.pressure;
+ case SCREEN_TOUCH:
+ return screen_touch.pressed == p_event.screen_touch.pressed
+ && screen_touch.index == p_event.screen_touch.index
+ && screen_touch.x == p_event.screen_touch.x
+ && screen_touch.y == p_event.screen_touch.y;
+ case SCREEN_DRAG:
+ return screen_drag.index == p_event.screen_drag.index
+ && screen_drag.x == p_event.screen_drag.x
+ && screen_drag.y == p_event.screen_drag.y;
+ case ACTION:
+ return action.action == p_event.action.action
+ && action.pressed == p_event.action.pressed;
+ }
+
+ return false;
}
InputEvent::operator String() const {
diff --git a/core/path_db.cpp b/core/path_db.cpp
index d0feda5c82..132cc83a35 100644
--- a/core/path_db.cpp
+++ b/core/path_db.cpp
@@ -363,6 +363,7 @@ NodePath::NodePath(const String& p_path) {
from=i+1;
}
+
}
path=path.substr(0,subpath_pos);
@@ -380,6 +381,8 @@ NodePath::NodePath(const String& p_path) {
last_is_slash=false;
}
+
+
}
if (slices==0 && !absolute && !property)
@@ -413,6 +416,7 @@ NodePath::NodePath(const String& p_path) {
} else {
last_is_slash=false;
}
+
}
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 97bd5f2a32..3de26573f4 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -118,6 +118,7 @@ void register_core_types() {
ObjectTypeDB::register_type<Resource>();
ObjectTypeDB::register_type<FuncRef>();
ObjectTypeDB::register_virtual_type<StreamPeer>();
+ ObjectTypeDB::register_type<StreamPeerBuffer>();
ObjectTypeDB::register_create_type<StreamPeerTCP>();
ObjectTypeDB::register_create_type<TCP_Server>();
ObjectTypeDB::register_create_type<PacketPeerUDP>();
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 75d8b6d285..fa1d01d3eb 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -33,6 +33,7 @@ int ScriptServer::_language_count=0;
bool ScriptServer::scripting_enabled=true;
bool ScriptServer::reload_scripts_on_save=false;
+ScriptEditRequestFunction ScriptServer::edit_request_func=NULL;
void Script::_notification( int p_what) {
diff --git a/core/script_language.h b/core/script_language.h
index 0e3f298790..1b037e908c 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -38,6 +38,8 @@
class ScriptLanguage;
+typedef void (*ScriptEditRequestFunction)(const String& p_path);
+
class ScriptServer {
enum {
@@ -50,6 +52,8 @@ class ScriptServer {
static bool reload_scripts_on_save;
public:
+ static ScriptEditRequestFunction edit_request_func;
+
static void set_scripting_enabled(bool p_enabled);
static bool is_scripting_enabled();
static int get_language_count();
@@ -88,6 +92,8 @@ public:
virtual bool can_instance() const=0;
+ virtual Ref<Script> get_base_script() const=0; //for script inheritance
+
virtual StringName get_instance_base_type() const=0; // this may not work in all scripts, will return empty if so
virtual ScriptInstance* instance_create(Object *p_this)=0;
virtual bool instance_has(const Object *p_this) const=0;
@@ -113,7 +119,8 @@ public:
virtual bool get_property_default_value(const StringName& p_property,Variant& r_value) const=0;
virtual void update_exports() {} //editor tool
- virtual void get_method_list(List<MethodInfo> *p_list) const=0;
+ virtual void get_script_method_list(List<MethodInfo> *p_list) const=0;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const=0;
Script() {}
@@ -121,6 +128,8 @@ public:
class ScriptInstance {
public:
+
+
virtual bool set(const StringName& p_name, const Variant& p_value)=0;
virtual bool get(const StringName& p_name, Variant &r_ret) const=0;
virtual void get_property_list(List<PropertyInfo> *p_properties) const=0;
@@ -148,6 +157,17 @@ public:
virtual bool is_placeholder() const { return false; }
+ enum RPCMode {
+ RPC_MODE_DISABLED,
+ RPC_MODE_REMOTE,
+ RPC_MODE_SYNC,
+ RPC_MODE_MASTER,
+ RPC_MODE_SLAVE,
+ };
+
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const=0;
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const=0;
+
virtual ScriptLanguage *get_language()=0;
virtual ~ScriptInstance();
};
@@ -279,6 +299,9 @@ public:
virtual bool is_placeholder() const { return true; }
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const { return RPC_MODE_DISABLED; }
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const { return RPC_MODE_DISABLED; }
+
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script,Object *p_owner);
~PlaceHolderScriptInstance();
diff --git a/core/string_db.cpp b/core/string_db.cpp
index 9a693f88e9..bf92c4eac4 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -183,7 +183,8 @@ StringName::StringName(const char *p_name) {
ERR_FAIL_COND(!configured);
- ERR_FAIL_COND( !p_name || !p_name[0]);
+ if (!p_name || p_name[0]==0)
+ return; //empty, ignore
_global_lock();
@@ -288,6 +289,9 @@ StringName::StringName(const String& p_name) {
ERR_FAIL_COND(!configured);
+ if (p_name==String())
+ return;
+
_global_lock();
uint32_t hash = p_name.hash();
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index c537ed230f..fd64b58bd5 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -3046,7 +3046,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
const String *str=reinterpret_cast<const String*>(_data._mem);
int idx = r_iter;
idx++;
- if (idx >= str->size())
+ if (idx >= str->length())
return false;
r_iter = idx;
return true;
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 56a24d77ee..9c6b9742b3 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -11505,6 +11505,13 @@
Get the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
</description>
</method>
+ <method name="get_window_layout" qualifiers="virtual">
+ <argument index="0" name="layout" type="ConfigFile">
+ </argument>
+ <description>
+ Get the GUI layout of the plugin. This is used to save the project's editor layout when the [method EditorPlugin.queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock).
+ </description>
+ </method>
<method name="handles" qualifiers="virtual">
<return type="bool">
</return>
@@ -11529,6 +11536,11 @@
Remember that you have to manage the visibility of all your editor controls manually.
</description>
</method>
+ <method name="queue_save_layout" qualifiers="const">
+ <description>
+ Queue save the project's editor layout.
+ </description>
+ </method>
<method name="remove_control_from_bottom_panel">
<argument index="0" name="control" type="Control">
</argument>
@@ -11564,6 +11576,11 @@
Remove the import plugin, don't forget to call this on exit.
</description>
</method>
+ <method name="save_external_data" qualifiers="virtual">
+ <description>
+ This method is called after the editor save the project or when the it's closed. It asks the plugin to save edited external scenes/resources.
+ </description>
+ </method>
<method name="set_state" qualifiers="virtual">
<argument index="0" name="state" type="Dictionary">
</argument>
@@ -11571,6 +11588,13 @@
Restore the state saved by [method EditorPlugin.get_state].
</description>
</method>
+ <method name="set_window_layout" qualifiers="virtual">
+ <argument index="0" name="layout" type="ConfigFile">
+ </argument>
+ <description>
+ Restore the plugin GUI layout saved by [method EditorPlugin.get_window_layout].
+ </description>
+ </method>
</methods>
<constants>
<constant name="CONTAINER_TOOLBAR" value="0">
@@ -11714,6 +11738,24 @@
[/codeblock]
</description>
<methods>
+ <method name="add_property_info">
+ <argument index="0" name="info" type="Dictionary">
+ </argument>
+ <description>
+ Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@Global Scope]), and optionally hint:[int](see PROPERTY_HINT_* in [@Global Scope]), hint_string:[String].
+ Example:[codeblock]
+ editor_settings.set("category/property_name", 0)
+
+ var property_info = {
+ "name": "category/property_name",
+ "type": TYPE_INT,
+ "hint": PROPERTY_HINT_ENUM,
+ "hint_string": "one,two,three"
+ }
+
+ editor_settings.add_property_info(property_info)[/codeblock]
+ </description>
+ </method>
<method name="erase">
<argument index="0" name="property" type="String">
</argument>
@@ -13730,6 +13772,26 @@
Contains global variables accessible from everywhere. Use the normal [Object] API, such as "Globals.get(variable)", "Globals.set(variable,value)" or "Globals.has(variable)" to access them. Variables stored in engine.cfg are also loaded into globals, making this object very useful for reading custom game configuration options.
</description>
<methods>
+ <method name="add_property_info">
+ <argument index="0" name="hint" type="Dictionary">
+ </argument>
+ <description>
+ Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@Global Scope]), and optionally hint:[int](see PROPERTY_HINT_* in [@Global Scope]), hint_string:[String].
+ Example:
+ [codeblock]
+ Globals.set("category/property_name", 0)
+
+ var property_info = {
+ "name": "category/property_name",
+ "type": TYPE_INT,
+ "hint": PROPERTY_HINT_ENUM,
+ "hint_string": "one,two,three"
+ }
+
+ Globals.add_property_info(property_info)
+ [/codeblock]
+ </description>
+ </method>
<method name="clear">
<argument index="0" name="name" type="String">
</argument>
@@ -17646,8 +17708,13 @@
</class>
<class name="ItemList" inherits="Control" category="Core">
<brief_description>
+ Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.
</brief_description>
<description>
+ This control provides a selectable list of items that may be in a single (or multiple columns) with option of text, icons,
+ or both text and icon. Tooltips are supported and may be different for every item in the list. Selectable items in the list
+ may be selected or deselected and multiple selection may be enabled. Selection with right mouse button may also be enabled
+ to allow use of popup context menus. Items may also be 'activated' with a double click (or Enter key).
</description>
<methods>
<method name="add_icon_item">
@@ -17656,6 +17723,7 @@
<argument index="1" name="selectable" type="bool" default="true">
</argument>
<description>
+ Adds an item to the item list with no text, only an icon.
</description>
</method>
<method name="add_item">
@@ -17666,26 +17734,32 @@
<argument index="2" name="selectable" type="bool" default="true">
</argument>
<description>
+ Adds an item to the item list with specified text. Specify an icon of null for a list item with no icon.
+ If selectable is true the list item will be selectable.
</description>
</method>
<method name="clear">
<description>
+ Remove all items from the list.
</description>
</method>
<method name="ensure_current_is_visible">
<description>
+ Ensure selection is visible, adjusting the scroll position as necessary.
</description>
</method>
<method name="get_allow_rmb_select" qualifiers="const">
<return type="bool">
</return>
<description>
+ Return whether or not items may be selected via right mouse clicking.
</description>
</method>
<method name="get_fixed_column_width" qualifiers="const">
<return type="int">
</return>
<description>
+ If column size has been fixed to a value, return that value.
</description>
</method>
<method name="get_fixed_icon_size" qualifiers="const">
@@ -17714,12 +17788,14 @@
<argument index="1" name="exact" type="bool" default="false">
</argument>
<description>
+ Given a position within the control return the item (if any) at that point.
</description>
</method>
<method name="get_item_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Return count of items currently in the item list.
</description>
</method>
<method name="get_item_custom_bg_color" qualifiers="const">
@@ -17758,6 +17834,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the text for specified item index.
</description>
</method>
<method name="get_item_tooltip" qualifiers="const">
@@ -17766,18 +17843,21 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return tooltip hint for specified item index.
</description>
</method>
<method name="get_max_columns" qualifiers="const">
<return type="int">
</return>
<description>
+ Return total number of columns in use by the list.
</description>
</method>
<method name="get_max_text_lines" qualifiers="const">
<return type="int">
</return>
<description>
+ Return total number of lines currently in use by the list.
</description>
</method>
<method name="get_select_mode" qualifiers="const">
@@ -17790,7 +17870,7 @@
<return type="IntArray">
</return>
<description>
- Returns a list of selected indexes.
+ Returns the list of selected indexes.
</description>
</method>
<method name="is_item_disabled" qualifiers="const">
@@ -17799,6 +17879,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns whether or not the item at the specified index is disabled
</description>
</method>
<method name="is_item_selectable" qualifiers="const">
@@ -17807,12 +17888,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns whether or not the item at the specified index is selectable.
</description>
</method>
<method name="is_same_column_width" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns whether or not all columns of the list are of the same size.
</description>
</method>
<method name="is_selected" qualifiers="const">
@@ -17821,12 +17904,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns whether or not item at the specified index is currently selected.
</description>
</method>
<method name="remove_item">
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Remove item at specified index from the list.
</description>
</method>
<method name="select">
@@ -17835,18 +17920,22 @@
<argument index="1" name="single" type="bool" default="true">
</argument>
<description>
+ Select the item at the specified index.
+ Note: This method does not trigger the item selection signal.
</description>
</method>
<method name="set_allow_rmb_select">
<argument index="0" name="allow" type="bool">
</argument>
<description>
+ Allow (or disallow) selection of (selectable) items in the list using right mouse button.
</description>
</method>
<method name="set_fixed_column_width">
<argument index="0" name="width" type="int">
</argument>
<description>
+ Set the size (width) all columns in the list are to use.
</description>
</method>
<method name="set_fixed_icon_size">
@@ -17881,6 +17970,8 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
+ Disable (or enable) item at specified index.
+ Disabled items are not be selectable and do not fire activation (Enter or double-click) signals.
</description>
</method>
<method name="set_item_icon">
@@ -17889,6 +17980,7 @@
<argument index="1" name="icon" type="Texture">
</argument>
<description>
+ Set (or replace) icon of the item at the specified index.
</description>
</method>
<method name="set_item_icon_region">
@@ -17905,6 +17997,7 @@
<argument index="1" name="metadata" type="Variant">
</argument>
<description>
+ Sets a value (of any type) to be stored with the item at the specified index.
</description>
</method>
<method name="set_item_selectable">
@@ -17913,6 +18006,7 @@
<argument index="1" name="selectable" type="bool">
</argument>
<description>
+ Allow or disallow selection of the item at the specified index.
</description>
</method>
<method name="set_item_text">
@@ -17921,6 +18015,7 @@
<argument index="1" name="text" type="String">
</argument>
<description>
+ Sets text of item at specified index.
</description>
</method>
<method name="set_item_tooltip">
@@ -17929,24 +18024,28 @@
<argument index="1" name="tooltip" type="String">
</argument>
<description>
+ Sets tooltip hint for item at specified index.
</description>
</method>
<method name="set_max_columns">
<argument index="0" name="amount" type="int">
</argument>
<description>
+ Set maximum number of columns to use for the list.
</description>
</method>
<method name="set_max_text_lines">
<argument index="0" name="lines" type="int">
</argument>
<description>
+ Set maximum number of lines to use for the list.
</description>
</method>
<method name="set_same_column_width">
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ Sets a fixed size (width) to use for all columns of the list.
</description>
</method>
<method name="set_select_mode">
@@ -17957,12 +18056,14 @@
</method>
<method name="sort_items_by_text">
<description>
+ Sorts items in the list by their text.
</description>
</method>
<method name="unselect">
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Ensure item at specified index is not selected.
</description>
</method>
</methods>
@@ -17971,6 +18072,7 @@
<argument index="0" name="index" type="int">
</argument>
<description>
+ Fired when specified list item is activated via double click or Enter.
</description>
</signal>
<signal name="item_rmb_selected">
@@ -17979,12 +18081,16 @@
<argument index="1" name="atpos" type="Vector2">
</argument>
<description>
+ Fired when specified list item has been selected via right mouse clicking.
+ The click position is also provided to allow appropriate popup of context menus
+ at the correct location.
</description>
</signal>
<signal name="item_selected">
<argument index="0" name="index" type="int">
</argument>
<description>
+ Fired when specified item has been selected.
</description>
</signal>
<signal name="multi_selected">
@@ -17993,6 +18099,7 @@
<argument index="1" name="selected" type="bool">
</argument>
<description>
+ Fired when a multiple selection is altered on a list allowing mutliple selection.
</description>
</signal>
</signals>
diff --git a/main/input_default.cpp b/main/input_default.cpp
index c655b409ff..f93a142c54 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -1055,6 +1055,7 @@ bool InputDefault::is_joy_mapped(int p_device) {
}
String InputDefault::get_joy_guid_remapped(int p_device) const {
+ ERR_FAIL_COND_V(!joy_names.has(p_device), "");
return joy_names[p_device].uid;
}
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
new file mode 100644
index 0000000000..d2bc8801e4
--- /dev/null
+++ b/modules/enet/SCsub
@@ -0,0 +1,8 @@
+Import('env')
+
+env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources,"*.c")
+#TODO: Make it possible to build against system enet
+env.Append(CPPPATH = ["#modules/enet"])
+
+Export('env')
diff --git a/modules/enet/callbacks.c b/modules/enet/callbacks.c
new file mode 100644
index 0000000000..b3990af1fb
--- /dev/null
+++ b/modules/enet/callbacks.c
@@ -0,0 +1,53 @@
+/**
+ @file callbacks.c
+ @brief ENet callback functions
+*/
+#define ENET_BUILDING_LIB 1
+#include "enet/enet.h"
+
+static ENetCallbacks callbacks = { malloc, free, abort };
+
+int
+enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits)
+{
+ if (version < ENET_VERSION_CREATE (1, 3, 0))
+ return -1;
+
+ if (inits -> malloc != NULL || inits -> free != NULL)
+ {
+ if (inits -> malloc == NULL || inits -> free == NULL)
+ return -1;
+
+ callbacks.malloc = inits -> malloc;
+ callbacks.free = inits -> free;
+ }
+
+ if (inits -> no_memory != NULL)
+ callbacks.no_memory = inits -> no_memory;
+
+ return enet_initialize ();
+}
+
+ENetVersion
+enet_linked_version (void)
+{
+ return ENET_VERSION;
+}
+
+void *
+enet_malloc (size_t size)
+{
+ void * memory = callbacks.malloc (size);
+
+ if (memory == NULL)
+ callbacks.no_memory ();
+
+ return memory;
+}
+
+void
+enet_free (void * memory)
+{
+ callbacks.free (memory);
+}
+
diff --git a/modules/enet/compress.c b/modules/enet/compress.c
new file mode 100644
index 0000000000..784489a787
--- /dev/null
+++ b/modules/enet/compress.c
@@ -0,0 +1,654 @@
+/**
+ @file compress.c
+ @brief An adaptive order-2 PPM range coder
+*/
+#define ENET_BUILDING_LIB 1
+#include <string.h>
+#include "enet/enet.h"
+
+typedef struct _ENetSymbol
+{
+ /* binary indexed tree of symbols */
+ enet_uint8 value;
+ enet_uint8 count;
+ enet_uint16 under;
+ enet_uint16 left, right;
+
+ /* context defined by this symbol */
+ enet_uint16 symbols;
+ enet_uint16 escapes;
+ enet_uint16 total;
+ enet_uint16 parent;
+} ENetSymbol;
+
+/* adaptation constants tuned aggressively for small packet sizes rather than large file compression */
+enum
+{
+ ENET_RANGE_CODER_TOP = 1<<24,
+ ENET_RANGE_CODER_BOTTOM = 1<<16,
+
+ ENET_CONTEXT_SYMBOL_DELTA = 3,
+ ENET_CONTEXT_SYMBOL_MINIMUM = 1,
+ ENET_CONTEXT_ESCAPE_MINIMUM = 1,
+
+ ENET_SUBCONTEXT_ORDER = 2,
+ ENET_SUBCONTEXT_SYMBOL_DELTA = 2,
+ ENET_SUBCONTEXT_ESCAPE_DELTA = 5
+};
+
+/* context exclusion roughly halves compression speed, so disable for now */
+#undef ENET_CONTEXT_EXCLUSION
+
+typedef struct _ENetRangeCoder
+{
+ /* only allocate enough symbols for reasonable MTUs, would need to be larger for large file compression */
+ ENetSymbol symbols[4096];
+} ENetRangeCoder;
+
+void *
+enet_range_coder_create (void)
+{
+ ENetRangeCoder * rangeCoder = (ENetRangeCoder *) enet_malloc (sizeof (ENetRangeCoder));
+ if (rangeCoder == NULL)
+ return NULL;
+
+ return rangeCoder;
+}
+
+void
+enet_range_coder_destroy (void * context)
+{
+ ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context;
+ if (rangeCoder == NULL)
+ return;
+
+ enet_free (rangeCoder);
+}
+
+#define ENET_SYMBOL_CREATE(symbol, value_, count_) \
+{ \
+ symbol = & rangeCoder -> symbols [nextSymbol ++]; \
+ symbol -> value = value_; \
+ symbol -> count = count_; \
+ symbol -> under = count_; \
+ symbol -> left = 0; \
+ symbol -> right = 0; \
+ symbol -> symbols = 0; \
+ symbol -> escapes = 0; \
+ symbol -> total = 0; \
+ symbol -> parent = 0; \
+}
+
+#define ENET_CONTEXT_CREATE(context, escapes_, minimum) \
+{ \
+ ENET_SYMBOL_CREATE (context, 0, 0); \
+ (context) -> escapes = escapes_; \
+ (context) -> total = escapes_ + 256*minimum; \
+ (context) -> symbols = 0; \
+}
+
+static enet_uint16
+enet_symbol_rescale (ENetSymbol * symbol)
+{
+ enet_uint16 total = 0;
+ for (;;)
+ {
+ symbol -> count -= symbol->count >> 1;
+ symbol -> under = symbol -> count;
+ if (symbol -> left)
+ symbol -> under += enet_symbol_rescale (symbol + symbol -> left);
+ total += symbol -> under;
+ if (! symbol -> right) break;
+ symbol += symbol -> right;
+ }
+ return total;
+}
+
+#define ENET_CONTEXT_RESCALE(context, minimum) \
+{ \
+ (context) -> total = (context) -> symbols ? enet_symbol_rescale ((context) + (context) -> symbols) : 0; \
+ (context) -> escapes -= (context) -> escapes >> 1; \
+ (context) -> total += (context) -> escapes + 256*minimum; \
+}
+
+#define ENET_RANGE_CODER_OUTPUT(value) \
+{ \
+ if (outData >= outEnd) \
+ return 0; \
+ * outData ++ = value; \
+}
+
+#define ENET_RANGE_CODER_ENCODE(under, count, total) \
+{ \
+ encodeRange /= (total); \
+ encodeLow += (under) * encodeRange; \
+ encodeRange *= (count); \
+ for (;;) \
+ { \
+ if((encodeLow ^ (encodeLow + encodeRange)) >= ENET_RANGE_CODER_TOP) \
+ { \
+ if(encodeRange >= ENET_RANGE_CODER_BOTTOM) break; \
+ encodeRange = -encodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
+ } \
+ ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \
+ encodeRange <<= 8; \
+ encodeLow <<= 8; \
+ } \
+}
+
+#define ENET_RANGE_CODER_FLUSH \
+{ \
+ while (encodeLow) \
+ { \
+ ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \
+ encodeLow <<= 8; \
+ } \
+}
+
+#define ENET_RANGE_CODER_FREE_SYMBOLS \
+{ \
+ if (nextSymbol >= sizeof (rangeCoder -> symbols) / sizeof (ENetSymbol) - ENET_SUBCONTEXT_ORDER ) \
+ { \
+ nextSymbol = 0; \
+ ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); \
+ predicted = 0; \
+ order = 0; \
+ } \
+}
+
+#define ENET_CONTEXT_ENCODE(context, symbol_, value_, under_, count_, update, minimum) \
+{ \
+ under_ = value*minimum; \
+ count_ = minimum; \
+ if (! (context) -> symbols) \
+ { \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ (context) -> symbols = symbol_ - (context); \
+ } \
+ else \
+ { \
+ ENetSymbol * node = (context) + (context) -> symbols; \
+ for (;;) \
+ { \
+ if (value_ < node -> value) \
+ { \
+ node -> under += update; \
+ if (node -> left) { node += node -> left; continue; } \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ node -> left = symbol_ - node; \
+ } \
+ else \
+ if (value_ > node -> value) \
+ { \
+ under_ += node -> under; \
+ if (node -> right) { node += node -> right; continue; } \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ node -> right = symbol_ - node; \
+ } \
+ else \
+ { \
+ count_ += node -> count; \
+ under_ += node -> under - node -> count; \
+ node -> under += update; \
+ node -> count += update; \
+ symbol_ = node; \
+ } \
+ break; \
+ } \
+ } \
+}
+
+#ifdef ENET_CONTEXT_EXCLUSION
+static const ENetSymbol emptyContext = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+#define ENET_CONTEXT_WALK(context, body) \
+{ \
+ const ENetSymbol * node = (context) + (context) -> symbols; \
+ const ENetSymbol * stack [256]; \
+ size_t stackSize = 0; \
+ while (node -> left) \
+ { \
+ stack [stackSize ++] = node; \
+ node += node -> left; \
+ } \
+ for (;;) \
+ { \
+ body; \
+ if (node -> right) \
+ { \
+ node += node -> right; \
+ while (node -> left) \
+ { \
+ stack [stackSize ++] = node; \
+ node += node -> left; \
+ } \
+ } \
+ else \
+ if (stackSize <= 0) \
+ break; \
+ else \
+ node = stack [-- stackSize]; \
+ } \
+}
+
+#define ENET_CONTEXT_ENCODE_EXCLUDE(context, value_, under, total, minimum) \
+ENET_CONTEXT_WALK(context, { \
+ if (node -> value != value_) \
+ { \
+ enet_uint16 parentCount = rangeCoder -> symbols [node -> parent].count + minimum; \
+ if (node -> value < value_) \
+ under -= parentCount; \
+ total -= parentCount; \
+ } \
+})
+#endif
+
+size_t
+enet_range_coder_compress (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit)
+{
+ ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context;
+ enet_uint8 * outStart = outData, * outEnd = & outData [outLimit];
+ const enet_uint8 * inData, * inEnd;
+ enet_uint32 encodeLow = 0, encodeRange = ~0;
+ ENetSymbol * root;
+ enet_uint16 predicted = 0;
+ size_t order = 0, nextSymbol = 0;
+
+ if (rangeCoder == NULL || inBufferCount <= 0 || inLimit <= 0)
+ return 0;
+
+ inData = (const enet_uint8 *) inBuffers -> data;
+ inEnd = & inData [inBuffers -> dataLength];
+ inBuffers ++;
+ inBufferCount --;
+
+ ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM);
+
+ for (;;)
+ {
+ ENetSymbol * subcontext, * symbol;
+#ifdef ENET_CONTEXT_EXCLUSION
+ const ENetSymbol * childContext = & emptyContext;
+#endif
+ enet_uint8 value;
+ enet_uint16 count, under, * parent = & predicted, total;
+ if (inData >= inEnd)
+ {
+ if (inBufferCount <= 0)
+ break;
+ inData = (const enet_uint8 *) inBuffers -> data;
+ inEnd = & inData [inBuffers -> dataLength];
+ inBuffers ++;
+ inBufferCount --;
+ }
+ value = * inData ++;
+
+ for (subcontext = & rangeCoder -> symbols [predicted];
+ subcontext != root;
+#ifdef ENET_CONTEXT_EXCLUSION
+ childContext = subcontext,
+#endif
+ subcontext = & rangeCoder -> symbols [subcontext -> parent])
+ {
+ ENET_CONTEXT_ENCODE (subcontext, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0);
+ * parent = symbol - rangeCoder -> symbols;
+ parent = & symbol -> parent;
+ total = subcontext -> total;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA)
+ ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, 0);
+#endif
+ if (count > 0)
+ {
+ ENET_RANGE_CODER_ENCODE (subcontext -> escapes + under, count, total);
+ }
+ else
+ {
+ if (subcontext -> escapes > 0 && subcontext -> escapes < total)
+ ENET_RANGE_CODER_ENCODE (0, subcontext -> escapes, total);
+ subcontext -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA;
+ subcontext -> total += ENET_SUBCONTEXT_ESCAPE_DELTA;
+ }
+ subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA;
+ if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100)
+ ENET_CONTEXT_RESCALE (subcontext, 0);
+ if (count > 0) goto nextInput;
+ }
+
+ ENET_CONTEXT_ENCODE (root, symbol, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM);
+ * parent = symbol - rangeCoder -> symbols;
+ parent = & symbol -> parent;
+ total = root -> total;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA)
+ ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, ENET_CONTEXT_SYMBOL_MINIMUM);
+#endif
+ ENET_RANGE_CODER_ENCODE (root -> escapes + under, count, total);
+ root -> total += ENET_CONTEXT_SYMBOL_DELTA;
+ if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100)
+ ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM);
+
+ nextInput:
+ if (order >= ENET_SUBCONTEXT_ORDER)
+ predicted = rangeCoder -> symbols [predicted].parent;
+ else
+ order ++;
+ ENET_RANGE_CODER_FREE_SYMBOLS;
+ }
+
+ ENET_RANGE_CODER_FLUSH;
+
+ return (size_t) (outData - outStart);
+}
+
+#define ENET_RANGE_CODER_SEED \
+{ \
+ if (inData < inEnd) decodeCode |= * inData ++ << 24; \
+ if (inData < inEnd) decodeCode |= * inData ++ << 16; \
+ if (inData < inEnd) decodeCode |= * inData ++ << 8; \
+ if (inData < inEnd) decodeCode |= * inData ++; \
+}
+
+#define ENET_RANGE_CODER_READ(total) ((decodeCode - decodeLow) / (decodeRange /= (total)))
+
+#define ENET_RANGE_CODER_DECODE(under, count, total) \
+{ \
+ decodeLow += (under) * decodeRange; \
+ decodeRange *= (count); \
+ for (;;) \
+ { \
+ if((decodeLow ^ (decodeLow + decodeRange)) >= ENET_RANGE_CODER_TOP) \
+ { \
+ if(decodeRange >= ENET_RANGE_CODER_BOTTOM) break; \
+ decodeRange = -decodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
+ } \
+ decodeCode <<= 8; \
+ if (inData < inEnd) \
+ decodeCode |= * inData ++; \
+ decodeRange <<= 8; \
+ decodeLow <<= 8; \
+ } \
+}
+
+#define ENET_CONTEXT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, createRoot, visitNode, createRight, createLeft) \
+{ \
+ under_ = 0; \
+ count_ = minimum; \
+ if (! (context) -> symbols) \
+ { \
+ createRoot; \
+ } \
+ else \
+ { \
+ ENetSymbol * node = (context) + (context) -> symbols; \
+ for (;;) \
+ { \
+ enet_uint16 after = under_ + node -> under + (node -> value + 1)*minimum, before = node -> count + minimum; \
+ visitNode; \
+ if (code >= after) \
+ { \
+ under_ += node -> under; \
+ if (node -> right) { node += node -> right; continue; } \
+ createRight; \
+ } \
+ else \
+ if (code < after - before) \
+ { \
+ node -> under += update; \
+ if (node -> left) { node += node -> left; continue; } \
+ createLeft; \
+ } \
+ else \
+ { \
+ value_ = node -> value; \
+ count_ += node -> count; \
+ under_ = after - before; \
+ node -> under += update; \
+ node -> count += update; \
+ symbol_ = node; \
+ } \
+ break; \
+ } \
+ } \
+}
+
+#define ENET_CONTEXT_TRY_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \
+ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, return 0, exclude (node -> value, after, before), return 0, return 0)
+
+#define ENET_CONTEXT_ROOT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \
+ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, \
+ { \
+ value_ = code / minimum; \
+ under_ = code - code%minimum; \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ (context) -> symbols = symbol_ - (context); \
+ }, \
+ exclude (node -> value, after, before), \
+ { \
+ value_ = node->value + 1 + (code - after)/minimum; \
+ under_ = code - (code - after)%minimum; \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ node -> right = symbol_ - node; \
+ }, \
+ { \
+ value_ = node->value - 1 - (after - before - code - 1)/minimum; \
+ under_ = code - (after - before - code - 1)%minimum; \
+ ENET_SYMBOL_CREATE (symbol_, value_, update); \
+ node -> left = symbol_ - node; \
+ }) \
+
+#ifdef ENET_CONTEXT_EXCLUSION
+typedef struct _ENetExclude
+{
+ enet_uint8 value;
+ enet_uint16 under;
+} ENetExclude;
+
+#define ENET_CONTEXT_DECODE_EXCLUDE(context, total, minimum) \
+{ \
+ enet_uint16 under = 0; \
+ nextExclude = excludes; \
+ ENET_CONTEXT_WALK (context, { \
+ under += rangeCoder -> symbols [node -> parent].count + minimum; \
+ nextExclude -> value = node -> value; \
+ nextExclude -> under = under; \
+ nextExclude ++; \
+ }); \
+ total -= under; \
+}
+
+#define ENET_CONTEXT_EXCLUDED(value_, after, before) \
+{ \
+ size_t low = 0, high = nextExclude - excludes; \
+ for(;;) \
+ { \
+ size_t mid = (low + high) >> 1; \
+ const ENetExclude * exclude = & excludes [mid]; \
+ if (value_ < exclude -> value) \
+ { \
+ if (low + 1 < high) \
+ { \
+ high = mid; \
+ continue; \
+ } \
+ if (exclude > excludes) \
+ after -= exclude [-1].under; \
+ } \
+ else \
+ { \
+ if (value_ > exclude -> value) \
+ { \
+ if (low + 1 < high) \
+ { \
+ low = mid; \
+ continue; \
+ } \
+ } \
+ else \
+ before = 0; \
+ after -= exclude -> under; \
+ } \
+ break; \
+ } \
+}
+#endif
+
+#define ENET_CONTEXT_NOT_EXCLUDED(value_, after, before)
+
+size_t
+enet_range_coder_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit)
+{
+ ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context;
+ enet_uint8 * outStart = outData, * outEnd = & outData [outLimit];
+ const enet_uint8 * inEnd = & inData [inLimit];
+ enet_uint32 decodeLow = 0, decodeCode = 0, decodeRange = ~0;
+ ENetSymbol * root;
+ enet_uint16 predicted = 0;
+ size_t order = 0, nextSymbol = 0;
+#ifdef ENET_CONTEXT_EXCLUSION
+ ENetExclude excludes [256];
+ ENetExclude * nextExclude = excludes;
+#endif
+
+ if (rangeCoder == NULL || inLimit <= 0)
+ return 0;
+
+ ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM);
+
+ ENET_RANGE_CODER_SEED;
+
+ for (;;)
+ {
+ ENetSymbol * subcontext, * symbol, * patch;
+#ifdef ENET_CONTEXT_EXCLUSION
+ const ENetSymbol * childContext = & emptyContext;
+#endif
+ enet_uint8 value = 0;
+ enet_uint16 code, under, count, bottom, * parent = & predicted, total;
+
+ for (subcontext = & rangeCoder -> symbols [predicted];
+ subcontext != root;
+#ifdef ENET_CONTEXT_EXCLUSION
+ childContext = subcontext,
+#endif
+ subcontext = & rangeCoder -> symbols [subcontext -> parent])
+ {
+ if (subcontext -> escapes <= 0)
+ continue;
+ total = subcontext -> total;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > 0)
+ ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, 0);
+#endif
+ if (subcontext -> escapes >= total)
+ continue;
+ code = ENET_RANGE_CODER_READ (total);
+ if (code < subcontext -> escapes)
+ {
+ ENET_RANGE_CODER_DECODE (0, subcontext -> escapes, total);
+ continue;
+ }
+ code -= subcontext -> escapes;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > 0)
+ {
+ ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_EXCLUDED);
+ }
+ else
+#endif
+ {
+ ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_NOT_EXCLUDED);
+ }
+ bottom = symbol - rangeCoder -> symbols;
+ ENET_RANGE_CODER_DECODE (subcontext -> escapes + under, count, total);
+ subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA;
+ if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100)
+ ENET_CONTEXT_RESCALE (subcontext, 0);
+ goto patchContexts;
+ }
+
+ total = root -> total;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > 0)
+ ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, ENET_CONTEXT_SYMBOL_MINIMUM);
+#endif
+ code = ENET_RANGE_CODER_READ (total);
+ if (code < root -> escapes)
+ {
+ ENET_RANGE_CODER_DECODE (0, root -> escapes, total);
+ break;
+ }
+ code -= root -> escapes;
+#ifdef ENET_CONTEXT_EXCLUSION
+ if (childContext -> total > 0)
+ {
+ ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_EXCLUDED);
+ }
+ else
+#endif
+ {
+ ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_NOT_EXCLUDED);
+ }
+ bottom = symbol - rangeCoder -> symbols;
+ ENET_RANGE_CODER_DECODE (root -> escapes + under, count, total);
+ root -> total += ENET_CONTEXT_SYMBOL_DELTA;
+ if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100)
+ ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM);
+
+ patchContexts:
+ for (patch = & rangeCoder -> symbols [predicted];
+ patch != subcontext;
+ patch = & rangeCoder -> symbols [patch -> parent])
+ {
+ ENET_CONTEXT_ENCODE (patch, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0);
+ * parent = symbol - rangeCoder -> symbols;
+ parent = & symbol -> parent;
+ if (count <= 0)
+ {
+ patch -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA;
+ patch -> total += ENET_SUBCONTEXT_ESCAPE_DELTA;
+ }
+ patch -> total += ENET_SUBCONTEXT_SYMBOL_DELTA;
+ if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || patch -> total > ENET_RANGE_CODER_BOTTOM - 0x100)
+ ENET_CONTEXT_RESCALE (patch, 0);
+ }
+ * parent = bottom;
+
+ ENET_RANGE_CODER_OUTPUT (value);
+
+ if (order >= ENET_SUBCONTEXT_ORDER)
+ predicted = rangeCoder -> symbols [predicted].parent;
+ else
+ order ++;
+ ENET_RANGE_CODER_FREE_SYMBOLS;
+ }
+
+ return (size_t) (outData - outStart);
+}
+
+/** @defgroup host ENet host functions
+ @{
+*/
+
+/** Sets the packet compressor the host should use to the default range coder.
+ @param host host to enable the range coder for
+ @returns 0 on success, < 0 on failure
+*/
+int
+enet_host_compress_with_range_coder (ENetHost * host)
+{
+ ENetCompressor compressor;
+ memset (& compressor, 0, sizeof (compressor));
+ compressor.context = enet_range_coder_create();
+ if (compressor.context == NULL)
+ return -1;
+ compressor.compress = enet_range_coder_compress;
+ compressor.decompress = enet_range_coder_decompress;
+ compressor.destroy = enet_range_coder_destroy;
+ enet_host_compress (host, & compressor);
+ return 0;
+}
+
+/** @} */
+
+
diff --git a/modules/enet/config.py b/modules/enet/config.py
new file mode 100644
index 0000000000..ea7e83378a
--- /dev/null
+++ b/modules/enet/config.py
@@ -0,0 +1,11 @@
+
+
+def can_build(platform):
+ return True
+
+
+def configure(env):
+ pass
+
+
+
diff --git a/modules/enet/enet/callbacks.h b/modules/enet/enet/callbacks.h
new file mode 100644
index 0000000000..340a4a9896
--- /dev/null
+++ b/modules/enet/enet/callbacks.h
@@ -0,0 +1,27 @@
+/**
+ @file callbacks.h
+ @brief ENet callbacks
+*/
+#ifndef __ENET_CALLBACKS_H__
+#define __ENET_CALLBACKS_H__
+
+#include <stdlib.h>
+
+typedef struct _ENetCallbacks
+{
+ void * (ENET_CALLBACK * malloc) (size_t size);
+ void (ENET_CALLBACK * free) (void * memory);
+ void (ENET_CALLBACK * no_memory) (void);
+} ENetCallbacks;
+
+/** @defgroup callbacks ENet internal callbacks
+ @{
+ @ingroup private
+*/
+extern void * enet_malloc (size_t);
+extern void enet_free (void *);
+
+/** @} */
+
+#endif /* __ENET_CALLBACKS_H__ */
+
diff --git a/modules/enet/enet/enet.h b/modules/enet/enet/enet.h
new file mode 100644
index 0000000000..650b199ee5
--- /dev/null
+++ b/modules/enet/enet/enet.h
@@ -0,0 +1,596 @@
+/**
+ @file enet.h
+ @brief ENet public header file
+*/
+#ifndef __ENET_ENET_H__
+#define __ENET_ENET_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+
+#ifdef _WIN32
+#include "enet/win32.h"
+#else
+#include "enet/unix.h"
+#endif
+
+#include "enet/types.h"
+#include "enet/protocol.h"
+#include "enet/list.h"
+#include "enet/callbacks.h"
+
+#define ENET_VERSION_MAJOR 1
+#define ENET_VERSION_MINOR 3
+#define ENET_VERSION_PATCH 13
+#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
+#define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF)
+#define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF)
+#define ENET_VERSION_GET_PATCH(version) ((version)&0xFF)
+#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
+
+typedef enet_uint32 ENetVersion;
+
+struct _ENetHost;
+struct _ENetEvent;
+struct _ENetPacket;
+
+typedef enum _ENetSocketType
+{
+ ENET_SOCKET_TYPE_STREAM = 1,
+ ENET_SOCKET_TYPE_DATAGRAM = 2
+} ENetSocketType;
+
+typedef enum _ENetSocketWait
+{
+ ENET_SOCKET_WAIT_NONE = 0,
+ ENET_SOCKET_WAIT_SEND = (1 << 0),
+ ENET_SOCKET_WAIT_RECEIVE = (1 << 1),
+ ENET_SOCKET_WAIT_INTERRUPT = (1 << 2)
+} ENetSocketWait;
+
+typedef enum _ENetSocketOption
+{
+ ENET_SOCKOPT_NONBLOCK = 1,
+ ENET_SOCKOPT_BROADCAST = 2,
+ ENET_SOCKOPT_RCVBUF = 3,
+ ENET_SOCKOPT_SNDBUF = 4,
+ ENET_SOCKOPT_REUSEADDR = 5,
+ ENET_SOCKOPT_RCVTIMEO = 6,
+ ENET_SOCKOPT_SNDTIMEO = 7,
+ ENET_SOCKOPT_ERROR = 8,
+ ENET_SOCKOPT_NODELAY = 9
+} ENetSocketOption;
+
+typedef enum _ENetSocketShutdown
+{
+ ENET_SOCKET_SHUTDOWN_READ = 0,
+ ENET_SOCKET_SHUTDOWN_WRITE = 1,
+ ENET_SOCKET_SHUTDOWN_READ_WRITE = 2
+} ENetSocketShutdown;
+
+#define ENET_HOST_ANY 0
+#define ENET_HOST_BROADCAST 0xFFFFFFFFU
+#define ENET_PORT_ANY 0
+
+/**
+ * Portable internet address structure.
+ *
+ * The host must be specified in network byte-order, and the port must be in host
+ * byte-order. The constant ENET_HOST_ANY may be used to specify the default
+ * server host. The constant ENET_HOST_BROADCAST may be used to specify the
+ * broadcast address (255.255.255.255). This makes sense for enet_host_connect,
+ * but not for enet_host_create. Once a server responds to a broadcast, the
+ * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
+ */
+typedef struct _ENetAddress
+{
+ enet_uint32 host;
+ enet_uint16 port;
+} ENetAddress;
+
+/**
+ * Packet flag bit constants.
+ *
+ * The host must be specified in network byte-order, and the port must be in
+ * host byte-order. The constant ENET_HOST_ANY may be used to specify the
+ * default server host.
+
+ @sa ENetPacket
+*/
+typedef enum _ENetPacketFlag
+{
+ /** packet must be received by the target peer and resend attempts should be
+ * made until the packet is delivered */
+ ENET_PACKET_FLAG_RELIABLE = (1 << 0),
+ /** packet will not be sequenced with other packets
+ * not supported for reliable packets
+ */
+ ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1),
+ /** packet will not allocate data, and user must supply it instead */
+ ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2),
+ /** packet will be fragmented using unreliable (instead of reliable) sends
+ * if it exceeds the MTU */
+ ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT = (1 << 3),
+
+ /** whether the packet has been sent from all queues it has been entered into */
+ ENET_PACKET_FLAG_SENT = (1<<8)
+} ENetPacketFlag;
+
+typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *);
+
+/**
+ * ENet packet structure.
+ *
+ * An ENet data packet that may be sent to or received from a peer. The shown
+ * fields should only be read and never modified. The data field contains the
+ * allocated data for the packet. The dataLength fields specifies the length
+ * of the allocated data. The flags field is either 0 (specifying no flags),
+ * or a bitwise-or of any combination of the following flags:
+ *
+ * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
+ * and resend attempts should be made until the packet is delivered
+ *
+ * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets
+ * (not supported for reliable packets)
+ *
+ * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead
+ *
+ * ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT - packet will be fragmented using unreliable
+ * (instead of reliable) sends if it exceeds the MTU
+ *
+ * ENET_PACKET_FLAG_SENT - whether the packet has been sent from all queues it has been entered into
+ @sa ENetPacketFlag
+ */
+typedef struct _ENetPacket
+{
+ size_t referenceCount; /**< internal use only */
+ enet_uint32 flags; /**< bitwise-or of ENetPacketFlag constants */
+ enet_uint8 * data; /**< allocated data for packet */
+ size_t dataLength; /**< length of data */
+ ENetPacketFreeCallback freeCallback; /**< function to be called when the packet is no longer in use */
+ void * userData; /**< application private data, may be freely modified */
+} ENetPacket;
+
+typedef struct _ENetAcknowledgement
+{
+ ENetListNode acknowledgementList;
+ enet_uint32 sentTime;
+ ENetProtocol command;
+} ENetAcknowledgement;
+
+typedef struct _ENetOutgoingCommand
+{
+ ENetListNode outgoingCommandList;
+ enet_uint16 reliableSequenceNumber;
+ enet_uint16 unreliableSequenceNumber;
+ enet_uint32 sentTime;
+ enet_uint32 roundTripTimeout;
+ enet_uint32 roundTripTimeoutLimit;
+ enet_uint32 fragmentOffset;
+ enet_uint16 fragmentLength;
+ enet_uint16 sendAttempts;
+ ENetProtocol command;
+ ENetPacket * packet;
+} ENetOutgoingCommand;
+
+typedef struct _ENetIncomingCommand
+{
+ ENetListNode incomingCommandList;
+ enet_uint16 reliableSequenceNumber;
+ enet_uint16 unreliableSequenceNumber;
+ ENetProtocol command;
+ enet_uint32 fragmentCount;
+ enet_uint32 fragmentsRemaining;
+ enet_uint32 * fragments;
+ ENetPacket * packet;
+} ENetIncomingCommand;
+
+typedef enum _ENetPeerState
+{
+ ENET_PEER_STATE_DISCONNECTED = 0,
+ ENET_PEER_STATE_CONNECTING = 1,
+ ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
+ ENET_PEER_STATE_CONNECTION_PENDING = 3,
+ ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4,
+ ENET_PEER_STATE_CONNECTED = 5,
+ ENET_PEER_STATE_DISCONNECT_LATER = 6,
+ ENET_PEER_STATE_DISCONNECTING = 7,
+ ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8,
+ ENET_PEER_STATE_ZOMBIE = 9
+} ENetPeerState;
+
+#ifndef ENET_BUFFER_MAXIMUM
+#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
+#endif
+
+enum
+{
+ ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024,
+ ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024,
+ ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000,
+ ENET_HOST_DEFAULT_MTU = 1400,
+ ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE = 32 * 1024 * 1024,
+ ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA = 32 * 1024 * 1024,
+
+ ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500,
+ ENET_PEER_DEFAULT_PACKET_THROTTLE = 32,
+ ENET_PEER_PACKET_THROTTLE_SCALE = 32,
+ ENET_PEER_PACKET_THROTTLE_COUNTER = 7,
+ ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
+ ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
+ ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000,
+ ENET_PEER_PACKET_LOSS_SCALE = (1 << 16),
+ ENET_PEER_PACKET_LOSS_INTERVAL = 10000,
+ ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024,
+ ENET_PEER_TIMEOUT_LIMIT = 32,
+ ENET_PEER_TIMEOUT_MINIMUM = 5000,
+ ENET_PEER_TIMEOUT_MAXIMUM = 30000,
+ ENET_PEER_PING_INTERVAL = 500,
+ ENET_PEER_UNSEQUENCED_WINDOWS = 64,
+ ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024,
+ ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32,
+ ENET_PEER_RELIABLE_WINDOWS = 16,
+ ENET_PEER_RELIABLE_WINDOW_SIZE = 0x1000,
+ ENET_PEER_FREE_RELIABLE_WINDOWS = 8
+};
+
+typedef struct _ENetChannel
+{
+ enet_uint16 outgoingReliableSequenceNumber;
+ enet_uint16 outgoingUnreliableSequenceNumber;
+ enet_uint16 usedReliableWindows;
+ enet_uint16 reliableWindows [ENET_PEER_RELIABLE_WINDOWS];
+ enet_uint16 incomingReliableSequenceNumber;
+ enet_uint16 incomingUnreliableSequenceNumber;
+ ENetList incomingReliableCommands;
+ ENetList incomingUnreliableCommands;
+} ENetChannel;
+
+/**
+ * An ENet peer which data packets may be sent or received from.
+ *
+ * No fields should be modified unless otherwise specified.
+ */
+typedef struct _ENetPeer
+{
+ ENetListNode dispatchList;
+ struct _ENetHost * host;
+ enet_uint16 outgoingPeerID;
+ enet_uint16 incomingPeerID;
+ enet_uint32 connectID;
+ enet_uint8 outgoingSessionID;
+ enet_uint8 incomingSessionID;
+ ENetAddress address; /**< Internet address of the peer */
+ void * data; /**< Application private data, may be freely modified */
+ ENetPeerState state;
+ ENetChannel * channels;
+ size_t channelCount; /**< Number of channels allocated for communication with peer */
+ enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */
+ enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */
+ enet_uint32 incomingBandwidthThrottleEpoch;
+ enet_uint32 outgoingBandwidthThrottleEpoch;
+ enet_uint32 incomingDataTotal;
+ enet_uint32 outgoingDataTotal;
+ enet_uint32 lastSendTime;
+ enet_uint32 lastReceiveTime;
+ enet_uint32 nextTimeout;
+ enet_uint32 earliestTimeout;
+ enet_uint32 packetLossEpoch;
+ enet_uint32 packetsSent;
+ enet_uint32 packetsLost;
+ enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
+ enet_uint32 packetLossVariance;
+ enet_uint32 packetThrottle;
+ enet_uint32 packetThrottleLimit;
+ enet_uint32 packetThrottleCounter;
+ enet_uint32 packetThrottleEpoch;
+ enet_uint32 packetThrottleAcceleration;
+ enet_uint32 packetThrottleDeceleration;
+ enet_uint32 packetThrottleInterval;
+ enet_uint32 pingInterval;
+ enet_uint32 timeoutLimit;
+ enet_uint32 timeoutMinimum;
+ enet_uint32 timeoutMaximum;
+ enet_uint32 lastRoundTripTime;
+ enet_uint32 lowestRoundTripTime;
+ enet_uint32 lastRoundTripTimeVariance;
+ enet_uint32 highestRoundTripTimeVariance;
+ enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
+ enet_uint32 roundTripTimeVariance;
+ enet_uint32 mtu;
+ enet_uint32 windowSize;
+ enet_uint32 reliableDataInTransit;
+ enet_uint16 outgoingReliableSequenceNumber;
+ ENetList acknowledgements;
+ ENetList sentReliableCommands;
+ ENetList sentUnreliableCommands;
+ ENetList outgoingReliableCommands;
+ ENetList outgoingUnreliableCommands;
+ ENetList dispatchedCommands;
+ int needsDispatch;
+ enet_uint16 incomingUnsequencedGroup;
+ enet_uint16 outgoingUnsequencedGroup;
+ enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32];
+ enet_uint32 eventData;
+ size_t totalWaitingData;
+} ENetPeer;
+
+/** An ENet packet compressor for compressing UDP packets before socket sends or receives.
+ */
+typedef struct _ENetCompressor
+{
+ /** Context data for the compressor. Must be non-NULL. */
+ void * context;
+ /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
+ size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit);
+ /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
+ size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit);
+ /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */
+ void (ENET_CALLBACK * destroy) (void * context);
+} ENetCompressor;
+
+/** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */
+typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount);
+
+/** Callback for intercepting received raw UDP packets. Should return 1 to intercept, 0 to ignore, or -1 to propagate an error. */
+typedef int (ENET_CALLBACK * ENetInterceptCallback) (struct _ENetHost * host, struct _ENetEvent * event);
+
+/** An ENet host for communicating with peers.
+ *
+ * No fields should be modified unless otherwise stated.
+
+ @sa enet_host_create()
+ @sa enet_host_destroy()
+ @sa enet_host_connect()
+ @sa enet_host_service()
+ @sa enet_host_flush()
+ @sa enet_host_broadcast()
+ @sa enet_host_compress()
+ @sa enet_host_compress_with_range_coder()
+ @sa enet_host_channel_limit()
+ @sa enet_host_bandwidth_limit()
+ @sa enet_host_bandwidth_throttle()
+ */
+typedef struct _ENetHost
+{
+ ENetSocket socket;
+ ENetAddress address; /**< Internet address of the host */
+ enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */
+ enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */
+ enet_uint32 bandwidthThrottleEpoch;
+ enet_uint32 mtu;
+ enet_uint32 randomSeed;
+ int recalculateBandwidthLimits;
+ ENetPeer * peers; /**< array of peers allocated for this host */
+ size_t peerCount; /**< number of peers allocated for this host */
+ size_t channelLimit; /**< maximum number of channels allowed for connected peers */
+ enet_uint32 serviceTime;
+ ENetList dispatchQueue;
+ int continueSending;
+ size_t packetSize;
+ enet_uint16 headerFlags;
+ ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
+ size_t commandCount;
+ ENetBuffer buffers [ENET_BUFFER_MAXIMUM];
+ size_t bufferCount;
+ ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */
+ ENetCompressor compressor;
+ enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU];
+ ENetAddress receivedAddress;
+ enet_uint8 * receivedData;
+ size_t receivedDataLength;
+ enet_uint32 totalSentData; /**< total data sent, user should reset to 0 as needed to prevent overflow */
+ enet_uint32 totalSentPackets; /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */
+ enet_uint32 totalReceivedData; /**< total data received, user should reset to 0 as needed to prevent overflow */
+ enet_uint32 totalReceivedPackets; /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */
+ ENetInterceptCallback intercept; /**< callback the user can set to intercept received raw UDP packets */
+ size_t connectedPeers;
+ size_t bandwidthLimitedPeers;
+ size_t duplicatePeers; /**< optional number of allowed peers from duplicate IPs, defaults to ENET_PROTOCOL_MAXIMUM_PEER_ID */
+ size_t maximumPacketSize; /**< the maximum allowable packet size that may be sent or received on a peer */
+ size_t maximumWaitingData; /**< the maximum aggregate amount of buffer space a peer may use waiting for packets to be delivered */
+} ENetHost;
+
+/**
+ * An ENet event type, as specified in @ref ENetEvent.
+ */
+typedef enum _ENetEventType
+{
+ /** no event occurred within the specified time limit */
+ ENET_EVENT_TYPE_NONE = 0,
+
+ /** a connection request initiated by enet_host_connect has completed.
+ * The peer field contains the peer which successfully connected.
+ */
+ ENET_EVENT_TYPE_CONNECT = 1,
+
+ /** a peer has disconnected. This event is generated on a successful
+ * completion of a disconnect initiated by enet_peer_disconnect, if
+ * a peer has timed out, or if a connection request intialized by
+ * enet_host_connect has timed out. The peer field contains the peer
+ * which disconnected. The data field contains user supplied data
+ * describing the disconnection, or 0, if none is available.
+ */
+ ENET_EVENT_TYPE_DISCONNECT = 2,
+
+ /** a packet has been received from a peer. The peer field specifies the
+ * peer which sent the packet. The channelID field specifies the channel
+ * number upon which the packet was received. The packet field contains
+ * the packet that was received; this packet must be destroyed with
+ * enet_packet_destroy after use.
+ */
+ ENET_EVENT_TYPE_RECEIVE = 3
+} ENetEventType;
+
+/**
+ * An ENet event as returned by enet_host_service().
+
+ @sa enet_host_service
+ */
+typedef struct _ENetEvent
+{
+ ENetEventType type; /**< type of the event */
+ ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */
+ enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */
+ enet_uint32 data; /**< data associated with the event, if appropriate */
+ ENetPacket * packet; /**< packet associated with the event, if appropriate */
+} ENetEvent;
+
+/** @defgroup global ENet global functions
+ @{
+*/
+
+/**
+ Initializes ENet globally. Must be called prior to using any functions in
+ ENet.
+ @returns 0 on success, < 0 on failure
+*/
+ENET_API int enet_initialize (void);
+
+/**
+ Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored.
+
+ @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
+ @param inits user-overridden callbacks where any NULL callbacks will use ENet's defaults
+ @returns 0 on success, < 0 on failure
+*/
+ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits);
+
+/**
+ Shuts down ENet globally. Should be called when a program that has
+ initialized ENet exits.
+*/
+ENET_API void enet_deinitialize (void);
+
+/**
+ Gives the linked version of the ENet library.
+ @returns the version number
+*/
+ENET_API ENetVersion enet_linked_version (void);
+
+/** @} */
+
+/** @defgroup private ENet private implementation functions */
+
+/**
+ Returns the wall-time in milliseconds. Its initial value is unspecified
+ unless otherwise set.
+ */
+ENET_API enet_uint32 enet_time_get (void);
+/**
+ Sets the current wall-time in milliseconds.
+ */
+ENET_API void enet_time_set (enet_uint32);
+
+/** @defgroup socket ENet socket functions
+ @{
+*/
+ENET_API ENetSocket enet_socket_create (ENetSocketType);
+ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *);
+ENET_API int enet_socket_get_address (ENetSocket, ENetAddress *);
+ENET_API int enet_socket_listen (ENetSocket, int);
+ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
+ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *);
+ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
+ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
+ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
+ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int);
+ENET_API int enet_socket_get_option (ENetSocket, ENetSocketOption, int *);
+ENET_API int enet_socket_shutdown (ENetSocket, ENetSocketShutdown);
+ENET_API void enet_socket_destroy (ENetSocket);
+ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
+
+/** @} */
+
+/** @defgroup Address ENet address functions
+ @{
+*/
+/** Attempts to resolve the host named by the parameter hostName and sets
+ the host field in the address parameter if successful.
+ @param address destination to store resolved address
+ @param hostName host name to lookup
+ @retval 0 on success
+ @retval < 0 on failure
+ @returns the address of the given hostName in address on success
+*/
+ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName);
+
+/** Gives the printable form of the IP address specified in the address parameter.
+ @param address address printed
+ @param hostName destination for name, must not be NULL
+ @param nameLength maximum length of hostName.
+ @returns the null-terminated name of the host in hostName on success
+ @retval 0 on success
+ @retval < 0 on failure
+*/
+ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength);
+
+/** Attempts to do a reverse lookup of the host field in the address parameter.
+ @param address address used for reverse lookup
+ @param hostName destination for name, must not be NULL
+ @param nameLength maximum length of hostName.
+ @returns the null-terminated name of the host in hostName on success
+ @retval 0 on success
+ @retval < 0 on failure
+*/
+ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength);
+
+/** @} */
+
+ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32);
+ENET_API void enet_packet_destroy (ENetPacket *);
+ENET_API int enet_packet_resize (ENetPacket *, size_t);
+ENET_API enet_uint32 enet_crc32 (const ENetBuffer *, size_t);
+
+ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32);
+ENET_API void enet_host_destroy (ENetHost *);
+ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32);
+ENET_API int enet_host_check_events (ENetHost *, ENetEvent *);
+ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
+ENET_API void enet_host_flush (ENetHost *);
+ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
+ENET_API void enet_host_compress (ENetHost *, const ENetCompressor *);
+ENET_API int enet_host_compress_with_range_coder (ENetHost * host);
+ENET_API void enet_host_channel_limit (ENetHost *, size_t);
+ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
+extern void enet_host_bandwidth_throttle (ENetHost *);
+extern enet_uint32 enet_host_random_seed (void);
+
+ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
+ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * channelID);
+ENET_API void enet_peer_ping (ENetPeer *);
+ENET_API void enet_peer_ping_interval (ENetPeer *, enet_uint32);
+ENET_API void enet_peer_timeout (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
+ENET_API void enet_peer_reset (ENetPeer *);
+ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32);
+ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32);
+ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_uint32);
+ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
+extern int enet_peer_throttle (ENetPeer *, enet_uint32);
+extern void enet_peer_reset_queues (ENetPeer *);
+extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *);
+extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
+extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, const void *, size_t, enet_uint32, enet_uint32);
+extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16);
+extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *);
+extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *);
+extern void enet_peer_on_connect (ENetPeer *);
+extern void enet_peer_on_disconnect (ENetPeer *);
+
+ENET_API void * enet_range_coder_create (void);
+ENET_API void enet_range_coder_destroy (void *);
+ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t);
+ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t);
+
+extern size_t enet_protocol_command_size (enet_uint8);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ENET_ENET_H__ */
+
diff --git a/modules/enet/enet/list.h b/modules/enet/enet/list.h
new file mode 100644
index 0000000000..d7b2600848
--- /dev/null
+++ b/modules/enet/enet/list.h
@@ -0,0 +1,43 @@
+/**
+ @file list.h
+ @brief ENet list management
+*/
+#ifndef __ENET_LIST_H__
+#define __ENET_LIST_H__
+
+#include <stdlib.h>
+
+typedef struct _ENetListNode
+{
+ struct _ENetListNode * next;
+ struct _ENetListNode * previous;
+} ENetListNode;
+
+typedef ENetListNode * ENetListIterator;
+
+typedef struct _ENetList
+{
+ ENetListNode sentinel;
+} ENetList;
+
+extern void enet_list_clear (ENetList *);
+
+extern ENetListIterator enet_list_insert (ENetListIterator, void *);
+extern void * enet_list_remove (ENetListIterator);
+extern ENetListIterator enet_list_move (ENetListIterator, void *, void *);
+
+extern size_t enet_list_size (ENetList *);
+
+#define enet_list_begin(list) ((list) -> sentinel.next)
+#define enet_list_end(list) (& (list) -> sentinel)
+
+#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
+
+#define enet_list_next(iterator) ((iterator) -> next)
+#define enet_list_previous(iterator) ((iterator) -> previous)
+
+#define enet_list_front(list) ((void *) (list) -> sentinel.next)
+#define enet_list_back(list) ((void *) (list) -> sentinel.previous)
+
+#endif /* __ENET_LIST_H__ */
+
diff --git a/modules/enet/enet/protocol.h b/modules/enet/enet/protocol.h
new file mode 100644
index 0000000000..f8c73d8a66
--- /dev/null
+++ b/modules/enet/enet/protocol.h
@@ -0,0 +1,198 @@
+/**
+ @file protocol.h
+ @brief ENet protocol
+*/
+#ifndef __ENET_PROTOCOL_H__
+#define __ENET_PROTOCOL_H__
+
+#include "enet/types.h"
+
+enum
+{
+ ENET_PROTOCOL_MINIMUM_MTU = 576,
+ ENET_PROTOCOL_MAXIMUM_MTU = 4096,
+ ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
+ ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
+ ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 65536,
+ ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
+ ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255,
+ ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xFFF,
+ ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT = 1024 * 1024
+};
+
+typedef enum _ENetProtocolCommand
+{
+ ENET_PROTOCOL_COMMAND_NONE = 0,
+ ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
+ ENET_PROTOCOL_COMMAND_CONNECT = 2,
+ ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
+ ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
+ ENET_PROTOCOL_COMMAND_PING = 5,
+ ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
+ ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
+ ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
+ ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9,
+ ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10,
+ ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
+ ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12,
+ ENET_PROTOCOL_COMMAND_COUNT = 13,
+
+ ENET_PROTOCOL_COMMAND_MASK = 0x0F
+} ENetProtocolCommand;
+
+typedef enum _ENetProtocolFlag
+{
+ ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
+ ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
+
+ ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14),
+ ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
+ ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME,
+
+ ENET_PROTOCOL_HEADER_SESSION_MASK = (3 << 12),
+ ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12
+} ENetProtocolFlag;
+
+#ifdef _MSC_VER
+#pragma pack(push, 1)
+#define ENET_PACKED
+#elif defined(__GNUC__) || defined(__clang__)
+#define ENET_PACKED __attribute__ ((packed))
+#else
+#define ENET_PACKED
+#endif
+
+typedef struct _ENetProtocolHeader
+{
+ enet_uint16 peerID;
+ enet_uint16 sentTime;
+} ENET_PACKED ENetProtocolHeader;
+
+typedef struct _ENetProtocolCommandHeader
+{
+ enet_uint8 command;
+ enet_uint8 channelID;
+ enet_uint16 reliableSequenceNumber;
+} ENET_PACKED ENetProtocolCommandHeader;
+
+typedef struct _ENetProtocolAcknowledge
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 receivedReliableSequenceNumber;
+ enet_uint16 receivedSentTime;
+} ENET_PACKED ENetProtocolAcknowledge;
+
+typedef struct _ENetProtocolConnect
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 outgoingPeerID;
+ enet_uint8 incomingSessionID;
+ enet_uint8 outgoingSessionID;
+ enet_uint32 mtu;
+ enet_uint32 windowSize;
+ enet_uint32 channelCount;
+ enet_uint32 incomingBandwidth;
+ enet_uint32 outgoingBandwidth;
+ enet_uint32 packetThrottleInterval;
+ enet_uint32 packetThrottleAcceleration;
+ enet_uint32 packetThrottleDeceleration;
+ enet_uint32 connectID;
+ enet_uint32 data;
+} ENET_PACKED ENetProtocolConnect;
+
+typedef struct _ENetProtocolVerifyConnect
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 outgoingPeerID;
+ enet_uint8 incomingSessionID;
+ enet_uint8 outgoingSessionID;
+ enet_uint32 mtu;
+ enet_uint32 windowSize;
+ enet_uint32 channelCount;
+ enet_uint32 incomingBandwidth;
+ enet_uint32 outgoingBandwidth;
+ enet_uint32 packetThrottleInterval;
+ enet_uint32 packetThrottleAcceleration;
+ enet_uint32 packetThrottleDeceleration;
+ enet_uint32 connectID;
+} ENET_PACKED ENetProtocolVerifyConnect;
+
+typedef struct _ENetProtocolBandwidthLimit
+{
+ ENetProtocolCommandHeader header;
+ enet_uint32 incomingBandwidth;
+ enet_uint32 outgoingBandwidth;
+} ENET_PACKED ENetProtocolBandwidthLimit;
+
+typedef struct _ENetProtocolThrottleConfigure
+{
+ ENetProtocolCommandHeader header;
+ enet_uint32 packetThrottleInterval;
+ enet_uint32 packetThrottleAcceleration;
+ enet_uint32 packetThrottleDeceleration;
+} ENET_PACKED ENetProtocolThrottleConfigure;
+
+typedef struct _ENetProtocolDisconnect
+{
+ ENetProtocolCommandHeader header;
+ enet_uint32 data;
+} ENET_PACKED ENetProtocolDisconnect;
+
+typedef struct _ENetProtocolPing
+{
+ ENetProtocolCommandHeader header;
+} ENET_PACKED ENetProtocolPing;
+
+typedef struct _ENetProtocolSendReliable
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 dataLength;
+} ENET_PACKED ENetProtocolSendReliable;
+
+typedef struct _ENetProtocolSendUnreliable
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 unreliableSequenceNumber;
+ enet_uint16 dataLength;
+} ENET_PACKED ENetProtocolSendUnreliable;
+
+typedef struct _ENetProtocolSendUnsequenced
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 unsequencedGroup;
+ enet_uint16 dataLength;
+} ENET_PACKED ENetProtocolSendUnsequenced;
+
+typedef struct _ENetProtocolSendFragment
+{
+ ENetProtocolCommandHeader header;
+ enet_uint16 startSequenceNumber;
+ enet_uint16 dataLength;
+ enet_uint32 fragmentCount;
+ enet_uint32 fragmentNumber;
+ enet_uint32 totalLength;
+ enet_uint32 fragmentOffset;
+} ENET_PACKED ENetProtocolSendFragment;
+
+typedef union _ENetProtocol
+{
+ ENetProtocolCommandHeader header;
+ ENetProtocolAcknowledge acknowledge;
+ ENetProtocolConnect connect;
+ ENetProtocolVerifyConnect verifyConnect;
+ ENetProtocolDisconnect disconnect;
+ ENetProtocolPing ping;
+ ENetProtocolSendReliable sendReliable;
+ ENetProtocolSendUnreliable sendUnreliable;
+ ENetProtocolSendUnsequenced sendUnsequenced;
+ ENetProtocolSendFragment sendFragment;
+ ENetProtocolBandwidthLimit bandwidthLimit;
+ ENetProtocolThrottleConfigure throttleConfigure;
+} ENET_PACKED ENetProtocol;
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
+
+#endif /* __ENET_PROTOCOL_H__ */
+
diff --git a/modules/enet/enet/time.h b/modules/enet/enet/time.h
new file mode 100644
index 0000000000..c82a546035
--- /dev/null
+++ b/modules/enet/enet/time.h
@@ -0,0 +1,18 @@
+/**
+ @file time.h
+ @brief ENet time constants and macros
+*/
+#ifndef __ENET_TIME_H__
+#define __ENET_TIME_H__
+
+#define ENET_TIME_OVERFLOW 86400000
+
+#define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW)
+#define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW)
+#define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b))
+#define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b))
+
+#define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b))
+
+#endif /* __ENET_TIME_H__ */
+
diff --git a/modules/enet/enet/types.h b/modules/enet/enet/types.h
new file mode 100644
index 0000000000..ab010a4b13
--- /dev/null
+++ b/modules/enet/enet/types.h
@@ -0,0 +1,13 @@
+/**
+ @file types.h
+ @brief type definitions for ENet
+*/
+#ifndef __ENET_TYPES_H__
+#define __ENET_TYPES_H__
+
+typedef unsigned char enet_uint8; /**< unsigned 8-bit type */
+typedef unsigned short enet_uint16; /**< unsigned 16-bit type */
+typedef unsigned int enet_uint32; /**< unsigned 32-bit type */
+
+#endif /* __ENET_TYPES_H__ */
+
diff --git a/modules/enet/enet/unix.h b/modules/enet/enet/unix.h
new file mode 100644
index 0000000000..a59e340606
--- /dev/null
+++ b/modules/enet/enet/unix.h
@@ -0,0 +1,47 @@
+/**
+ @file unix.h
+ @brief ENet Unix header
+*/
+#ifndef __ENET_UNIX_H__
+#define __ENET_UNIX_H__
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
+
+#ifdef MSG_MAXIOVLEN
+#define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN
+#endif
+
+typedef int ENetSocket;
+
+#define ENET_SOCKET_NULL -1
+
+#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
+#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
+
+#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
+#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
+
+typedef struct
+{
+ void * data;
+ size_t dataLength;
+} ENetBuffer;
+
+#define ENET_CALLBACK
+
+#define ENET_API extern
+
+typedef fd_set ENetSocketSet;
+
+#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset))
+#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset))
+#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset))
+#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset))
+
+#endif /* __ENET_UNIX_H__ */
+
diff --git a/modules/enet/enet/utility.h b/modules/enet/enet/utility.h
new file mode 100644
index 0000000000..e48a476be3
--- /dev/null
+++ b/modules/enet/enet/utility.h
@@ -0,0 +1,12 @@
+/**
+ @file utility.h
+ @brief ENet utility header
+*/
+#ifndef __ENET_UTILITY_H__
+#define __ENET_UTILITY_H__
+
+#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y))
+#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
+
+#endif /* __ENET_UTILITY_H__ */
+
diff --git a/modules/enet/enet/win32.h b/modules/enet/enet/win32.h
new file mode 100644
index 0000000000..e73ca9d052
--- /dev/null
+++ b/modules/enet/enet/win32.h
@@ -0,0 +1,57 @@
+/**
+ @file win32.h
+ @brief ENet Win32 header
+*/
+#ifndef __ENET_WIN32_H__
+#define __ENET_WIN32_H__
+
+#ifdef _MSC_VER
+#ifdef ENET_BUILDING_LIB
+#pragma warning (disable: 4267) // size_t to int conversion
+#pragma warning (disable: 4244) // 64bit to 32bit int
+#pragma warning (disable: 4018) // signed/unsigned mismatch
+#pragma warning (disable: 4146) // unary minus operator applied to unsigned type
+#endif
+#endif
+
+#include <stdlib.h>
+#include <winsock2.h>
+
+typedef SOCKET ENetSocket;
+
+#define ENET_SOCKET_NULL INVALID_SOCKET
+
+#define ENET_HOST_TO_NET_16(value) (htons (value))
+#define ENET_HOST_TO_NET_32(value) (htonl (value))
+
+#define ENET_NET_TO_HOST_16(value) (ntohs (value))
+#define ENET_NET_TO_HOST_32(value) (ntohl (value))
+
+typedef struct
+{
+ size_t dataLength;
+ void * data;
+} ENetBuffer;
+
+#define ENET_CALLBACK __cdecl
+
+#ifdef ENET_DLL
+#ifdef ENET_BUILDING_LIB
+#define ENET_API __declspec( dllexport )
+#else
+#define ENET_API __declspec( dllimport )
+#endif /* ENET_BUILDING_LIB */
+#else /* !ENET_DLL */
+#define ENET_API extern
+#endif /* ENET_DLL */
+
+typedef fd_set ENetSocketSet;
+
+#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset))
+#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset))
+#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset))
+#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset))
+
+#endif /* __ENET_WIN32_H__ */
+
+
diff --git a/modules/enet/host.c b/modules/enet/host.c
new file mode 100644
index 0000000000..3be6c0922c
--- /dev/null
+++ b/modules/enet/host.c
@@ -0,0 +1,492 @@
+/**
+ @file host.c
+ @brief ENet host management functions
+*/
+#define ENET_BUILDING_LIB 1
+#include <string.h>
+#include "enet/enet.h"
+
+/** @defgroup host ENet host functions
+ @{
+*/
+
+/** Creates a host for communicating to peers.
+
+ @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host.
+ @param peerCount the maximum number of peers that should be allocated for the host.
+ @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT
+ @param incomingBandwidth downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
+ @param outgoingBandwidth upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
+
+ @returns the host on success and NULL on failure
+
+ @remarks ENet will strategically drop packets on specific sides of a connection between hosts
+ to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine
+ the window size of a connection which limits the amount of reliable packets that may be in transit
+ at any given time.
+*/
+ENetHost *
+enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelLimit, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)
+{
+ ENetHost * host;
+ ENetPeer * currentPeer;
+
+ if (peerCount > ENET_PROTOCOL_MAXIMUM_PEER_ID)
+ return NULL;
+
+ host = (ENetHost *) enet_malloc (sizeof (ENetHost));
+ if (host == NULL)
+ return NULL;
+ memset (host, 0, sizeof (ENetHost));
+
+ host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer));
+ if (host -> peers == NULL)
+ {
+ enet_free (host);
+
+ return NULL;
+ }
+ memset (host -> peers, 0, peerCount * sizeof (ENetPeer));
+
+ host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM);
+ if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0))
+ {
+ if (host -> socket != ENET_SOCKET_NULL)
+ enet_socket_destroy (host -> socket);
+
+ enet_free (host -> peers);
+ enet_free (host);
+
+ return NULL;
+ }
+
+ enet_socket_set_option (host -> socket, ENET_SOCKOPT_NONBLOCK, 1);
+ enet_socket_set_option (host -> socket, ENET_SOCKOPT_BROADCAST, 1);
+ enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE);
+ enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE);
+
+ if (address != NULL && enet_socket_get_address (host -> socket, & host -> address) < 0)
+ host -> address = * address;
+
+ if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
+ channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT;
+ else
+ if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT)
+ channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT;
+
+ host -> randomSeed = (enet_uint32) (size_t) host;
+ host -> randomSeed += enet_host_random_seed ();
+ host -> randomSeed = (host -> randomSeed << 16) | (host -> randomSeed >> 16);
+ host -> channelLimit = channelLimit;
+ host -> incomingBandwidth = incomingBandwidth;
+ host -> outgoingBandwidth = outgoingBandwidth;
+ host -> bandwidthThrottleEpoch = 0;
+ host -> recalculateBandwidthLimits = 0;
+ host -> mtu = ENET_HOST_DEFAULT_MTU;
+ host -> peerCount = peerCount;
+ host -> commandCount = 0;
+ host -> bufferCount = 0;
+ host -> checksum = NULL;
+ host -> receivedAddress.host = ENET_HOST_ANY;
+ host -> receivedAddress.port = 0;
+ host -> receivedData = NULL;
+ host -> receivedDataLength = 0;
+
+ host -> totalSentData = 0;
+ host -> totalSentPackets = 0;
+ host -> totalReceivedData = 0;
+ host -> totalReceivedPackets = 0;
+
+ host -> connectedPeers = 0;
+ host -> bandwidthLimitedPeers = 0;
+ host -> duplicatePeers = ENET_PROTOCOL_MAXIMUM_PEER_ID;
+ host -> maximumPacketSize = ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE;
+ host -> maximumWaitingData = ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA;
+
+ host -> compressor.context = NULL;
+ host -> compressor.compress = NULL;
+ host -> compressor.decompress = NULL;
+ host -> compressor.destroy = NULL;
+
+ host -> intercept = NULL;
+
+ enet_list_clear (& host -> dispatchQueue);
+
+ for (currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ currentPeer -> host = host;
+ currentPeer -> incomingPeerID = currentPeer - host -> peers;
+ currentPeer -> outgoingSessionID = currentPeer -> incomingSessionID = 0xFF;
+ currentPeer -> data = NULL;
+
+ enet_list_clear (& currentPeer -> acknowledgements);
+ enet_list_clear (& currentPeer -> sentReliableCommands);
+ enet_list_clear (& currentPeer -> sentUnreliableCommands);
+ enet_list_clear (& currentPeer -> outgoingReliableCommands);
+ enet_list_clear (& currentPeer -> outgoingUnreliableCommands);
+ enet_list_clear (& currentPeer -> dispatchedCommands);
+
+ enet_peer_reset (currentPeer);
+ }
+
+ return host;
+}
+
+/** Destroys the host and all resources associated with it.
+ @param host pointer to the host to destroy
+*/
+void
+enet_host_destroy (ENetHost * host)
+{
+ ENetPeer * currentPeer;
+
+ if (host == NULL)
+ return;
+
+ enet_socket_destroy (host -> socket);
+
+ for (currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ enet_peer_reset (currentPeer);
+ }
+
+ if (host -> compressor.context != NULL && host -> compressor.destroy)
+ (* host -> compressor.destroy) (host -> compressor.context);
+
+ enet_free (host -> peers);
+ enet_free (host);
+}
+
+/** Initiates a connection to a foreign host.
+ @param host host seeking the connection
+ @param address destination for the connection
+ @param channelCount number of channels to allocate
+ @param data user data supplied to the receiving host
+ @returns a peer representing the foreign host on success, NULL on failure
+ @remarks The peer returned will have not completed the connection until enet_host_service()
+ notifies of an ENET_EVENT_TYPE_CONNECT event for the peer.
+*/
+ENetPeer *
+enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelCount, enet_uint32 data)
+{
+ ENetPeer * currentPeer;
+ ENetChannel * channel;
+ ENetProtocol command;
+
+ if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT)
+ channelCount = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT;
+ else
+ if (channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
+ channelCount = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT;
+
+ for (currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED)
+ break;
+ }
+
+ if (currentPeer >= & host -> peers [host -> peerCount])
+ return NULL;
+
+ currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel));
+ if (currentPeer -> channels == NULL)
+ return NULL;
+ currentPeer -> channelCount = channelCount;
+ currentPeer -> state = ENET_PEER_STATE_CONNECTING;
+ currentPeer -> address = * address;
+ currentPeer -> connectID = ++ host -> randomSeed;
+
+ if (host -> outgoingBandwidth == 0)
+ currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+ else
+ currentPeer -> windowSize = (host -> outgoingBandwidth /
+ ENET_PEER_WINDOW_SIZE_SCALE) *
+ ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+
+ if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
+ currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
+ currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+
+ for (channel = currentPeer -> channels;
+ channel < & currentPeer -> channels [channelCount];
+ ++ channel)
+ {
+ channel -> outgoingReliableSequenceNumber = 0;
+ channel -> outgoingUnreliableSequenceNumber = 0;
+ channel -> incomingReliableSequenceNumber = 0;
+ channel -> incomingUnreliableSequenceNumber = 0;
+
+ enet_list_clear (& channel -> incomingReliableCommands);
+ enet_list_clear (& channel -> incomingUnreliableCommands);
+
+ channel -> usedReliableWindows = 0;
+ memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows));
+ }
+
+ command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ command.header.channelID = 0xFF;
+ command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID);
+ command.connect.incomingSessionID = currentPeer -> incomingSessionID;
+ command.connect.outgoingSessionID = currentPeer -> outgoingSessionID;
+ command.connect.mtu = ENET_HOST_TO_NET_32 (currentPeer -> mtu);
+ command.connect.windowSize = ENET_HOST_TO_NET_32 (currentPeer -> windowSize);
+ command.connect.channelCount = ENET_HOST_TO_NET_32 (channelCount);
+ command.connect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth);
+ command.connect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
+ command.connect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval);
+ command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration);
+ command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration);
+ command.connect.connectID = currentPeer -> connectID;
+ command.connect.data = ENET_HOST_TO_NET_32 (data);
+
+ enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0);
+
+ return currentPeer;
+}
+
+/** Queues a packet to be sent to all peers associated with the host.
+ @param host host on which to broadcast the packet
+ @param channelID channel on which to broadcast
+ @param packet packet to broadcast
+*/
+void
+enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet)
+{
+ ENetPeer * currentPeer;
+
+ for (currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
+ continue;
+
+ enet_peer_send (currentPeer, channelID, packet);
+ }
+
+ if (packet -> referenceCount == 0)
+ enet_packet_destroy (packet);
+}
+
+/** Sets the packet compressor the host should use to compress and decompress packets.
+ @param host host to enable or disable compression for
+ @param compressor callbacks for for the packet compressor; if NULL, then compression is disabled
+*/
+void
+enet_host_compress (ENetHost * host, const ENetCompressor * compressor)
+{
+ if (host -> compressor.context != NULL && host -> compressor.destroy)
+ (* host -> compressor.destroy) (host -> compressor.context);
+
+ if (compressor)
+ host -> compressor = * compressor;
+ else
+ host -> compressor.context = NULL;
+}
+
+/** Limits the maximum allowed channels of future incoming connections.
+ @param host host to limit
+ @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT
+*/
+void
+enet_host_channel_limit (ENetHost * host, size_t channelLimit)
+{
+ if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
+ channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT;
+ else
+ if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT)
+ channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT;
+
+ host -> channelLimit = channelLimit;
+}
+
+
+/** Adjusts the bandwidth limits of a host.
+ @param host host to adjust
+ @param incomingBandwidth new incoming bandwidth
+ @param outgoingBandwidth new outgoing bandwidth
+ @remarks the incoming and outgoing bandwidth parameters are identical in function to those
+ specified in enet_host_create().
+*/
+void
+enet_host_bandwidth_limit (ENetHost * host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)
+{
+ host -> incomingBandwidth = incomingBandwidth;
+ host -> outgoingBandwidth = outgoingBandwidth;
+ host -> recalculateBandwidthLimits = 1;
+}
+
+void
+enet_host_bandwidth_throttle (ENetHost * host)
+{
+ enet_uint32 timeCurrent = enet_time_get (),
+ elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch,
+ peersRemaining = (enet_uint32) host -> connectedPeers,
+ dataTotal = ~0,
+ bandwidth = ~0,
+ throttle = 0,
+ bandwidthLimit = 0;
+ int needsAdjustment = host -> bandwidthLimitedPeers > 0 ? 1 : 0;
+ ENetPeer * peer;
+ ENetProtocol command;
+
+ if (elapsedTime < ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL)
+ return;
+
+ host -> bandwidthThrottleEpoch = timeCurrent;
+
+ if (peersRemaining == 0)
+ return;
+
+ if (host -> outgoingBandwidth != 0)
+ {
+ dataTotal = 0;
+ bandwidth = (host -> outgoingBandwidth * elapsedTime) / 1000;
+
+ for (peer = host -> peers;
+ peer < & host -> peers [host -> peerCount];
+ ++ peer)
+ {
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ continue;
+
+ dataTotal += peer -> outgoingDataTotal;
+ }
+ }
+
+ while (peersRemaining > 0 && needsAdjustment != 0)
+ {
+ needsAdjustment = 0;
+
+ if (dataTotal <= bandwidth)
+ throttle = ENET_PEER_PACKET_THROTTLE_SCALE;
+ else
+ throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal;
+
+ for (peer = host -> peers;
+ peer < & host -> peers [host -> peerCount];
+ ++ peer)
+ {
+ enet_uint32 peerBandwidth;
+
+ if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) ||
+ peer -> incomingBandwidth == 0 ||
+ peer -> outgoingBandwidthThrottleEpoch == timeCurrent)
+ continue;
+
+ peerBandwidth = (peer -> incomingBandwidth * elapsedTime) / 1000;
+ if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth)
+ continue;
+
+ peer -> packetThrottleLimit = (peerBandwidth *
+ ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal;
+
+ if (peer -> packetThrottleLimit == 0)
+ peer -> packetThrottleLimit = 1;
+
+ if (peer -> packetThrottle > peer -> packetThrottleLimit)
+ peer -> packetThrottle = peer -> packetThrottleLimit;
+
+ peer -> outgoingBandwidthThrottleEpoch = timeCurrent;
+
+ peer -> incomingDataTotal = 0;
+ peer -> outgoingDataTotal = 0;
+
+ needsAdjustment = 1;
+ -- peersRemaining;
+ bandwidth -= peerBandwidth;
+ dataTotal -= peerBandwidth;
+ }
+ }
+
+ if (peersRemaining > 0)
+ {
+ if (dataTotal <= bandwidth)
+ throttle = ENET_PEER_PACKET_THROTTLE_SCALE;
+ else
+ throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal;
+
+ for (peer = host -> peers;
+ peer < & host -> peers [host -> peerCount];
+ ++ peer)
+ {
+ if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) ||
+ peer -> outgoingBandwidthThrottleEpoch == timeCurrent)
+ continue;
+
+ peer -> packetThrottleLimit = throttle;
+
+ if (peer -> packetThrottle > peer -> packetThrottleLimit)
+ peer -> packetThrottle = peer -> packetThrottleLimit;
+
+ peer -> incomingDataTotal = 0;
+ peer -> outgoingDataTotal = 0;
+ }
+ }
+
+ if (host -> recalculateBandwidthLimits)
+ {
+ host -> recalculateBandwidthLimits = 0;
+
+ peersRemaining = (enet_uint32) host -> connectedPeers;
+ bandwidth = host -> incomingBandwidth;
+ needsAdjustment = 1;
+
+ if (bandwidth == 0)
+ bandwidthLimit = 0;
+ else
+ while (peersRemaining > 0 && needsAdjustment != 0)
+ {
+ needsAdjustment = 0;
+ bandwidthLimit = bandwidth / peersRemaining;
+
+ for (peer = host -> peers;
+ peer < & host -> peers [host -> peerCount];
+ ++ peer)
+ {
+ if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) ||
+ peer -> incomingBandwidthThrottleEpoch == timeCurrent)
+ continue;
+
+ if (peer -> outgoingBandwidth > 0 &&
+ peer -> outgoingBandwidth >= bandwidthLimit)
+ continue;
+
+ peer -> incomingBandwidthThrottleEpoch = timeCurrent;
+
+ needsAdjustment = 1;
+ -- peersRemaining;
+ bandwidth -= peer -> outgoingBandwidth;
+ }
+ }
+
+ for (peer = host -> peers;
+ peer < & host -> peers [host -> peerCount];
+ ++ peer)
+ {
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ continue;
+
+ command.header.command = ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ command.header.channelID = 0xFF;
+ command.bandwidthLimit.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
+
+ if (peer -> incomingBandwidthThrottleEpoch == timeCurrent)
+ command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (peer -> outgoingBandwidth);
+ else
+ command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit);
+
+ enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
+ }
+ }
+}
+
+/** @} */
diff --git a/modules/enet/list.c b/modules/enet/list.c
new file mode 100644
index 0000000000..1c1a8dfaaf
--- /dev/null
+++ b/modules/enet/list.c
@@ -0,0 +1,75 @@
+/**
+ @file list.c
+ @brief ENet linked list functions
+*/
+#define ENET_BUILDING_LIB 1
+#include "enet/enet.h"
+
+/**
+ @defgroup list ENet linked list utility functions
+ @ingroup private
+ @{
+*/
+void
+enet_list_clear (ENetList * list)
+{
+ list -> sentinel.next = & list -> sentinel;
+ list -> sentinel.previous = & list -> sentinel;
+}
+
+ENetListIterator
+enet_list_insert (ENetListIterator position, void * data)
+{
+ ENetListIterator result = (ENetListIterator) data;
+
+ result -> previous = position -> previous;
+ result -> next = position;
+
+ result -> previous -> next = result;
+ position -> previous = result;
+
+ return result;
+}
+
+void *
+enet_list_remove (ENetListIterator position)
+{
+ position -> previous -> next = position -> next;
+ position -> next -> previous = position -> previous;
+
+ return position;
+}
+
+ENetListIterator
+enet_list_move (ENetListIterator position, void * dataFirst, void * dataLast)
+{
+ ENetListIterator first = (ENetListIterator) dataFirst,
+ last = (ENetListIterator) dataLast;
+
+ first -> previous -> next = last -> next;
+ last -> next -> previous = first -> previous;
+
+ first -> previous = position -> previous;
+ last -> next = position;
+
+ first -> previous -> next = first;
+ position -> previous = last;
+
+ return first;
+}
+
+size_t
+enet_list_size (ENetList * list)
+{
+ size_t size = 0;
+ ENetListIterator position;
+
+ for (position = enet_list_begin (list);
+ position != enet_list_end (list);
+ position = enet_list_next (position))
+ ++ size;
+
+ return size;
+}
+
+/** @} */
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
new file mode 100644
index 0000000000..5ddbb83534
--- /dev/null
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -0,0 +1,643 @@
+#include "os/os.h"
+#include "io/marshalls.h"
+#include "networked_multiplayer_enet.h"
+
+void NetworkedMultiplayerENet::set_transfer_mode(TransferMode p_mode) {
+
+ transfer_mode=p_mode;
+}
+
+void NetworkedMultiplayerENet::set_target_peer(int p_peer){
+
+ target_peer=p_peer;
+}
+
+int NetworkedMultiplayerENet::get_packet_peer() const{
+
+ ERR_FAIL_COND_V(!active,1);
+ ERR_FAIL_COND_V(incoming_packets.size()==0,1);
+
+ return incoming_packets.front()->get().from;
+
+}
+
+Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int p_in_bandwidth, int p_out_bandwidth){
+
+ ERR_FAIL_COND_V(active,ERR_ALREADY_IN_USE);
+
+ ENetAddress address;
+ address.host = ENET_HOST_ANY;
+
+ address.port = p_port;
+
+ host = enet_host_create (& address /* the address to bind the server host to */,
+ p_max_clients /* allow up to 32 clients and/or outgoing connections */,
+ 2 /* allow up to 2 channels to be used, 0 and 1 */,
+ p_in_bandwidth /* assume any amount of incoming bandwidth */,
+ p_out_bandwidth /* assume any amount of outgoing bandwidth */);
+
+ ERR_FAIL_COND_V(!host,ERR_CANT_CREATE);
+
+ _setup_compressor();
+ active=true;
+ server=true;
+ refuse_connections=false;
+ unique_id=1;
+ connection_status=CONNECTION_CONNECTED;
+ return OK;
+}
+Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port, int p_in_bandwidth, int p_out_bandwidth){
+
+ ERR_FAIL_COND_V(active,ERR_ALREADY_IN_USE);
+
+ host = enet_host_create (NULL /* create a client host */,
+ 1 /* only allow 1 outgoing connection */,
+ 2 /* allow up 2 channels to be used, 0 and 1 */,
+ p_in_bandwidth /* 56K modem with 56 Kbps downstream bandwidth */,
+ p_out_bandwidth /* 56K modem with 14 Kbps upstream bandwidth */);
+
+ ERR_FAIL_COND_V(!host,ERR_CANT_CREATE);
+
+
+ _setup_compressor();
+
+ ENetAddress address;
+ address.host=p_ip.host;
+ address.port=p_port;
+
+ //enet_address_set_host (& address, "localhost");
+ //address.port = p_port;
+
+ unique_id=_gen_unique_id();
+
+ /* Initiate the connection, allocating the two channels 0 and 1. */
+ ENetPeer *peer = enet_host_connect (host, & address, 2, unique_id);
+
+ if (peer == NULL) {
+ enet_host_destroy(host);
+ ERR_FAIL_COND_V(!peer,ERR_CANT_CREATE);
+ }
+
+ //technically safe to ignore the peer or anything else.
+
+ connection_status=CONNECTION_CONNECTING;
+ active=true;
+ server=false;
+ refuse_connections=false;
+
+ return OK;
+}
+
+void NetworkedMultiplayerENet::poll(){
+
+ ERR_FAIL_COND(!active);
+
+ _pop_current_packet();
+
+ ENetEvent event;
+ /* Wait up to 1000 milliseconds for an event. */
+ while (true) {
+
+ if (!host || !active) //might have been disconnected while emitting a notification
+ return;
+
+ int ret = enet_host_service (host, & event, 1);
+
+ if (ret<0) {
+ //error, do something?
+ break;
+ } else if (ret==0) {
+ break;
+ }
+
+ switch (event.type)
+ {
+ case ENET_EVENT_TYPE_CONNECT: {
+ /* Store any relevant client information here. */
+
+ if (server && refuse_connections) {
+ enet_peer_reset(event.peer);
+ break;
+ }
+
+ IP_Address ip;
+ ip.host=event.peer -> address.host;
+
+ int *new_id = memnew( int );
+ *new_id = event.data;
+
+ if (*new_id==0) { //data zero is sent by server (enet won't let you configure this). Server is always 1
+ *new_id=1;
+ }
+
+ event.peer->data=new_id;
+
+ peer_map[*new_id]=event.peer;
+
+ connection_status=CONNECTION_CONNECTED; //if connecting, this means it connected t something!
+
+ emit_signal("peer_connected",*new_id);
+
+ if (server) {
+ //someone connected, let it know of all the peers available
+ for (Map<int,ENetPeer*>::Element *E=peer_map.front();E;E=E->next()) {
+
+ if (E->key()==*new_id)
+ continue;
+ //send existing peers to new peer
+ ENetPacket * packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
+ encode_uint32(SYSMSG_ADD_PEER,&packet->data[0]);
+ encode_uint32(E->key(),&packet->data[4]);
+ enet_peer_send(event.peer,1,packet);
+ //send the new peer to existing peers
+ packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
+ encode_uint32(SYSMSG_ADD_PEER,&packet->data[0]);
+ encode_uint32(*new_id,&packet->data[4]);
+ enet_peer_send(E->get(),1,packet);
+ }
+ } else {
+
+ emit_signal("connection_succeeded");
+ }
+
+ } break;
+ case ENET_EVENT_TYPE_DISCONNECT: {
+
+ /* Reset the peer's client information. */
+
+ int *id = (int*)event.peer -> data;
+
+
+
+ if (!id) {
+ if (!server) {
+ emit_signal("connection_failed");
+ }
+ } else {
+
+ if (server) {
+ //someone disconnected, let it know to everyone else
+ for (Map<int,ENetPeer*>::Element *E=peer_map.front();E;E=E->next()) {
+
+ if (E->key()==*id)
+ continue;
+ //send the new peer to existing peers
+ ENetPacket* packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
+ encode_uint32(SYSMSG_REMOVE_PEER,&packet->data[0]);
+ encode_uint32(*id,&packet->data[4]);
+ enet_peer_send(E->get(),1,packet);
+ }
+ } else if (!server) {
+ emit_signal("server_disconnected");
+ close_connection();
+ return;
+ }
+
+ emit_signal("peer_disconnected",*id);
+ peer_map.erase(*id);
+ memdelete( id );
+
+ }
+
+
+ } break;
+ case ENET_EVENT_TYPE_RECEIVE: {
+
+
+ if (event.channelID==1) {
+ //some config message
+ ERR_CONTINUE( event.packet->dataLength < 8);
+
+ int msg = decode_uint32(&event.packet->data[0]);
+ int id = decode_uint32(&event.packet->data[4]);
+
+ switch(msg) {
+ case SYSMSG_ADD_PEER: {
+
+ peer_map[id]=NULL;
+ emit_signal("peer_connected",id);
+
+ } break;
+ case SYSMSG_REMOVE_PEER: {
+
+ peer_map.erase(id);
+ emit_signal("peer_disconnected",id);
+ } break;
+ }
+
+ enet_packet_destroy(event.packet);
+ } else if (event.channelID==0){
+
+ Packet packet;
+ packet.packet = event.packet;
+
+ int *id = (int*)event.peer -> data;
+
+ ERR_CONTINUE(event.packet->dataLength<12)
+
+
+ uint32_t source = decode_uint32(&event.packet->data[0]);
+ int target = decode_uint32(&event.packet->data[4]);
+ uint32_t flags = decode_uint32(&event.packet->data[8]);
+
+ packet.from=source;
+
+ if (server) {
+
+ packet.from=*id;
+
+ if (target==0) {
+ //re-send the everyone but sender :|
+
+ incoming_packets.push_back(packet);
+ //and make copies for sending
+ for (Map<int,ENetPeer*>::Element *E=peer_map.front();E;E=E->next()) {
+
+ if (uint32_t(E->key())==source) //do not resend to self
+ continue;
+
+ ENetPacket* packet2 = enet_packet_create (packet.packet->data,packet.packet->dataLength,flags);
+
+ enet_peer_send(E->get(),0,packet2);
+ }
+
+ } else if (target<0) {
+ //to all but one
+
+ //and make copies for sending
+ for (Map<int,ENetPeer*>::Element *E=peer_map.front();E;E=E->next()) {
+
+ if (uint32_t(E->key())==source || E->key()==-target) //do not resend to self, also do not send to excluded
+ continue;
+
+ ENetPacket* packet2 = enet_packet_create (packet.packet->data,packet.packet->dataLength,flags);
+
+ enet_peer_send(E->get(),0,packet2);
+ }
+
+ if (-target != 1) {
+ //server is not excluded
+ incoming_packets.push_back(packet);
+ } else {
+ //server is excluded, erase packet
+ enet_packet_destroy(packet.packet);
+ }
+
+ } else if (target==1) {
+ //to myself and only myself
+ incoming_packets.push_back(packet);
+ } else {
+ //to someone else, specifically
+ ERR_CONTINUE(!peer_map.has(target));
+ enet_peer_send(peer_map[target],0,packet.packet);
+ }
+ } else {
+
+ incoming_packets.push_back(packet);
+ }
+
+
+ //destroy packet later..
+ } else {
+ ERR_CONTINUE(true);
+ }
+
+
+ }break;
+ case ENET_EVENT_TYPE_NONE: {
+ //do nothing
+ } break;
+ }
+ }
+}
+
+bool NetworkedMultiplayerENet::is_server() const {
+ ERR_FAIL_COND_V(!active,false);
+
+ return server;
+}
+
+void NetworkedMultiplayerENet::close_connection() {
+
+ if (!active)
+ return;
+
+ _pop_current_packet();
+
+ bool peers_disconnected=false;
+ for (Map<int,ENetPeer*>::Element *E=peer_map.front();E;E=E->next()) {
+ if (E->get()) {
+ enet_peer_disconnect_now(E->get(),unique_id);
+ peers_disconnected=true;
+ }
+ }
+
+ if (peers_disconnected) {
+ enet_host_flush(host);
+ OS::get_singleton()->delay_usec(100); //wait 100ms for disconnection packets to send
+
+ }
+
+ enet_host_destroy(host);
+ active=false;
+ incoming_packets.clear();
+ unique_id=1; //server is 1
+ connection_status=CONNECTION_DISCONNECTED;
+}
+
+int NetworkedMultiplayerENet::get_available_packet_count() const {
+
+ return incoming_packets.size();
+}
+Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer,int &r_buffer_size) const{
+
+ ERR_FAIL_COND_V(incoming_packets.size()==0,ERR_UNAVAILABLE);
+
+ _pop_current_packet();
+
+ current_packet = incoming_packets.front()->get();
+ incoming_packets.pop_front();
+
+ *r_buffer=(const uint8_t*)(&current_packet.packet->data[12]);
+ r_buffer_size=current_packet.packet->dataLength;
+
+ return OK;
+}
+Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer,int p_buffer_size){
+
+ ERR_FAIL_COND_V(!active,ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(connection_status!=CONNECTION_CONNECTED,ERR_UNCONFIGURED);
+
+ int packet_flags=0;
+
+ switch(transfer_mode) {
+ case TRANSFER_MODE_UNRELIABLE: {
+ packet_flags=ENET_PACKET_FLAG_UNSEQUENCED;
+ } break;
+ case TRANSFER_MODE_UNRELIABLE_ORDERED: {
+ packet_flags=0;
+ } break;
+ case TRANSFER_MODE_RELIABLE: {
+ packet_flags=ENET_PACKET_FLAG_RELIABLE;
+ } break;
+ }
+
+ Map<int,ENetPeer*>::Element *E=NULL;
+
+ if (target_peer!=0) {
+
+ E = peer_map.find(ABS(target_peer));
+ if (!E) {
+ ERR_EXPLAIN("Invalid Target Peer: "+itos(target_peer));
+ ERR_FAIL_V(ERR_INVALID_PARAMETER);
+ }
+ }
+
+ ENetPacket * packet = enet_packet_create (NULL,p_buffer_size+12,packet_flags);
+ encode_uint32(unique_id,&packet->data[0]); //source ID
+ encode_uint32(target_peer,&packet->data[4]); //dest ID
+ encode_uint32(packet_flags,&packet->data[8]); //dest ID
+ copymem(&packet->data[12],p_buffer,p_buffer_size);
+
+ if (server) {
+
+ if (target_peer==0) {
+ enet_host_broadcast(host,0,packet);
+ } else if (target_peer<0) {
+ //send to all but one
+ //and make copies for sending
+
+ int exclude=-target_peer;
+
+ for (Map<int,ENetPeer*>::Element *F=peer_map.front();F;F=F->next()) {
+
+ if (F->key()==exclude) // exclude packet
+ continue;
+
+ ENetPacket* packet2 = enet_packet_create (packet->data,packet->dataLength,packet_flags);
+
+ enet_peer_send(F->get(),0,packet2);
+ }
+
+ enet_packet_destroy(packet); //original packet no longer needed
+ } else {
+ enet_peer_send (E->get(), 0, packet);
+
+ }
+ } else {
+
+ ERR_FAIL_COND_V(!peer_map.has(1),ERR_BUG);
+ enet_peer_send (peer_map[1], 0, packet); //send to server for broadcast..
+
+ }
+
+ enet_host_flush(host);
+
+ return OK;
+}
+
+int NetworkedMultiplayerENet::get_max_packet_size() const {
+
+ return 1<<24; //anything is good
+}
+
+void NetworkedMultiplayerENet::_pop_current_packet() const {
+
+ if (current_packet.packet) {
+ enet_packet_destroy(current_packet.packet);
+ current_packet.packet=NULL;
+ current_packet.from=0;
+ }
+
+}
+
+NetworkedMultiplayerPeer::ConnectionStatus NetworkedMultiplayerENet::get_connection_status() const {
+
+ return connection_status;
+}
+
+uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
+
+ uint32_t hash = 0;
+
+ while (hash==0 || hash==1) {
+
+ hash = hash_djb2_one_32(
+ (uint32_t)OS::get_singleton()->get_ticks_usec() );
+ hash = hash_djb2_one_32(
+ (uint32_t)OS::get_singleton()->get_unix_time(), hash );
+ hash = hash_djb2_one_32(
+ (uint32_t)OS::get_singleton()->get_data_dir().hash64(), hash );
+ //hash = hash_djb2_one_32(
+ // (uint32_t)OS::get_singleton()->get_unique_ID().hash64(), hash );
+ hash = hash_djb2_one_32(
+ (uint32_t)((uint64_t)this), hash ); //rely on aslr heap
+ hash = hash_djb2_one_32(
+ (uint32_t)((uint64_t)&hash), hash ); //rely on aslr stack
+
+ hash=hash&0x7FFFFFFF; // make it compatible with unsigned, since negatie id is used for exclusion
+ }
+
+ return hash;
+}
+
+int NetworkedMultiplayerENet::get_unique_id() const {
+
+ ERR_FAIL_COND_V(!active,0);
+ return unique_id;
+}
+
+void NetworkedMultiplayerENet::set_refuse_new_connections(bool p_enable) {
+
+ refuse_connections=p_enable;
+}
+
+bool NetworkedMultiplayerENet::is_refusing_new_connections() const {
+
+ return refuse_connections;
+}
+
+void NetworkedMultiplayerENet::set_compression_mode(CompressionMode p_mode) {
+
+ compression_mode=p_mode;
+}
+
+NetworkedMultiplayerENet::CompressionMode NetworkedMultiplayerENet::get_compression_mode() const{
+
+ return compression_mode;
+}
+
+size_t NetworkedMultiplayerENet::enet_compress(void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit) {
+
+ NetworkedMultiplayerENet *enet = (NetworkedMultiplayerENet*)(context);
+
+ if (size_t(enet->src_compressor_mem.size())<inLimit) {
+ enet->src_compressor_mem.resize( inLimit );
+ }
+
+ int total = inLimit;
+ int ofs=0;
+ while(total) {
+ for(size_t i=0;i<inBufferCount;i++) {
+ int to_copy = MIN(total,int(inBuffers[i].dataLength));
+ copymem(&enet->src_compressor_mem[ofs],inBuffers[i].data,to_copy);
+ ofs+=to_copy;
+ total-=to_copy;
+ }
+ }
+
+ Compression::Mode mode;
+
+ switch(enet->compression_mode) {
+ case COMPRESS_FASTLZ: {
+ mode=Compression::MODE_FASTLZ;
+ } break;
+ case COMPRESS_ZLIB: {
+ mode=Compression::MODE_DEFLATE;
+ } break;
+ default: { ERR_FAIL_V(0); }
+ }
+
+ int req_size = Compression::get_max_compressed_buffer_size(ofs,mode);
+ if (enet->dst_compressor_mem.size()<req_size) {
+ enet->dst_compressor_mem.resize(req_size);
+ }
+ int ret=Compression::compress(enet->dst_compressor_mem.ptr(),enet->src_compressor_mem.ptr(),ofs,mode);
+
+ if (ret<0)
+ return 0;
+
+
+ if (ret>int(outLimit))
+ return 0; //do not bother
+
+ copymem(outData,enet->dst_compressor_mem.ptr(),ret);
+
+ return ret;
+}
+
+size_t NetworkedMultiplayerENet::enet_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit){
+
+ NetworkedMultiplayerENet *enet = (NetworkedMultiplayerENet*)(context);
+ int ret = -1;
+ switch(enet->compression_mode) {
+ case COMPRESS_FASTLZ: {
+
+ ret=Compression::decompress(outData,outLimit,inData,inLimit,Compression::MODE_FASTLZ);
+ } break;
+ case COMPRESS_ZLIB: {
+
+ ret=Compression::decompress(outData,outLimit,inData,inLimit,Compression::MODE_DEFLATE);
+ } break;
+ default: {}
+ }
+ if (ret<0) {
+ return 0;
+ } else {
+ return ret;
+ }
+}
+
+void NetworkedMultiplayerENet::_setup_compressor() {
+
+ switch(compression_mode) {
+
+ case COMPRESS_NONE: {
+
+ enet_host_compress(host,NULL);
+ } break;
+ case COMPRESS_RANGE_CODER: {
+ enet_host_compress_with_range_coder(host);
+ } break;
+ case COMPRESS_FASTLZ:
+ case COMPRESS_ZLIB: {
+
+ enet_host_compress(host,&enet_compressor);
+ } break;
+ }
+}
+
+void NetworkedMultiplayerENet::enet_compressor_destroy(void * context){
+
+ //do none
+}
+
+
+void NetworkedMultiplayerENet::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("create_server","port","max_clients","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_server,DEFVAL(32),DEFVAL(0),DEFVAL(0));
+ ObjectTypeDB::bind_method(_MD("create_client","ip","port","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_client,DEFVAL(0),DEFVAL(0));
+ ObjectTypeDB::bind_method(_MD("close_connection"),&NetworkedMultiplayerENet::close_connection);
+ ObjectTypeDB::bind_method(_MD("set_compression_mode","mode"),&NetworkedMultiplayerENet::set_compression_mode);
+ ObjectTypeDB::bind_method(_MD("get_compression_mode"),&NetworkedMultiplayerENet::get_compression_mode);
+
+ BIND_CONSTANT( COMPRESS_NONE );
+ BIND_CONSTANT( COMPRESS_RANGE_CODER );
+ BIND_CONSTANT( COMPRESS_FASTLZ );
+ BIND_CONSTANT( COMPRESS_ZLIB );
+
+}
+
+
+NetworkedMultiplayerENet::NetworkedMultiplayerENet(){
+
+ active=false;
+ server=false;
+ refuse_connections=false;
+ unique_id=0;
+ target_peer=0;
+ current_packet.packet=NULL;
+ transfer_mode=TRANSFER_MODE_RELIABLE;
+ connection_status=CONNECTION_DISCONNECTED;
+ compression_mode=COMPRESS_NONE;
+ enet_compressor.context=this;
+ enet_compressor.compress=enet_compress;
+ enet_compressor.decompress=enet_decompress;
+ enet_compressor.destroy=enet_compressor_destroy;
+
+}
+
+NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
+
+ close_connection();
+}
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
new file mode 100644
index 0000000000..dc86058cbb
--- /dev/null
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -0,0 +1,111 @@
+#ifndef NETWORKED_MULTIPLAYER_ENET_H
+#define NETWORKED_MULTIPLAYER_ENET_H
+
+#include "io/networked_multiplayer_peer.h"
+#include "enet/enet.h"
+#include "io/compression.h"
+
+class NetworkedMultiplayerENet : public NetworkedMultiplayerPeer {
+
+ OBJ_TYPE(NetworkedMultiplayerENet,NetworkedMultiplayerPeer)
+public:
+ enum CompressionMode {
+ COMPRESS_NONE,
+ COMPRESS_RANGE_CODER,
+ COMPRESS_FASTLZ,
+ COMPRESS_ZLIB
+ };
+private:
+
+
+ enum {
+ SYSMSG_ADD_PEER,
+ SYSMSG_REMOVE_PEER
+ };
+
+ bool active;
+ bool server;
+
+ uint32_t unique_id;
+
+ int target_peer;
+ TransferMode transfer_mode;
+
+ ENetEvent event;
+ ENetPeer *peer;
+ ENetHost *host;
+
+ bool refuse_connections;
+
+ ConnectionStatus connection_status;
+
+ Map<int,ENetPeer*> peer_map;
+
+ struct Packet {
+
+ ENetPacket *packet;
+ int from;
+ };
+
+ CompressionMode compression_mode;
+
+ mutable List<Packet> incoming_packets;
+
+ mutable Packet current_packet;
+
+ uint32_t _gen_unique_id() const;
+ void _pop_current_packet() const;
+
+ Vector<uint8_t> src_compressor_mem;
+ Vector<uint8_t> dst_compressor_mem;
+
+ ENetCompressor enet_compressor;
+ static size_t enet_compress(void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit);
+ static size_t enet_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit);
+ static void enet_compressor_destroy(void * context);
+ void _setup_compressor();
+
+protected:
+ static void _bind_methods();
+public:
+
+ virtual void set_transfer_mode(TransferMode p_mode);
+ virtual void set_target_peer(int p_peer);
+
+
+ virtual int get_packet_peer() const;
+
+
+ Error create_server(int p_port, int p_max_peers=32, int p_in_bandwidth=0, int p_out_bandwidth=0);
+ Error create_client(const IP_Address& p_ip, int p_port, int p_in_bandwidth=0, int p_out_bandwidth=0);
+
+ void close_connection();
+
+ virtual void poll();
+
+ virtual bool is_server() const;
+
+ virtual int get_available_packet_count() const;
+ virtual Error get_packet(const uint8_t **r_buffer,int &r_buffer_size) const; ///< buffer is GONE after next get_packet
+ virtual Error put_packet(const uint8_t *p_buffer,int p_buffer_size);
+
+ virtual int get_max_packet_size() const;
+
+ virtual ConnectionStatus get_connection_status() const;
+
+ virtual void set_refuse_new_connections(bool p_enable);
+ virtual bool is_refusing_new_connections() const;
+
+ virtual int get_unique_id() const;
+
+ void set_compression_mode(CompressionMode p_mode);
+ CompressionMode get_compression_mode() const;
+
+ NetworkedMultiplayerENet();
+ ~NetworkedMultiplayerENet();
+};
+
+VARIANT_ENUM_CAST(NetworkedMultiplayerENet::CompressionMode);
+
+
+#endif // NETWORKED_MULTIPLAYER_ENET_H
diff --git a/modules/enet/packet.c b/modules/enet/packet.c
new file mode 100644
index 0000000000..5fa78b28ae
--- /dev/null
+++ b/modules/enet/packet.c
@@ -0,0 +1,165 @@
+/**
+ @file packet.c
+ @brief ENet packet management functions
+*/
+#include <string.h>
+#define ENET_BUILDING_LIB 1
+#include "enet/enet.h"
+
+/** @defgroup Packet ENet packet functions
+ @{
+*/
+
+/** Creates a packet that may be sent to a peer.
+ @param data initial contents of the packet's data; the packet's data will remain uninitialized if data is NULL.
+ @param dataLength size of the data allocated for this packet
+ @param flags flags for this packet as described for the ENetPacket structure.
+ @returns the packet on success, NULL on failure
+*/
+ENetPacket *
+enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags)
+{
+ ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket));
+ if (packet == NULL)
+ return NULL;
+
+ if (flags & ENET_PACKET_FLAG_NO_ALLOCATE)
+ packet -> data = (enet_uint8 *) data;
+ else
+ if (dataLength <= 0)
+ packet -> data = NULL;
+ else
+ {
+ packet -> data = (enet_uint8 *) enet_malloc (dataLength);
+ if (packet -> data == NULL)
+ {
+ enet_free (packet);
+ return NULL;
+ }
+
+ if (data != NULL)
+ memcpy (packet -> data, data, dataLength);
+ }
+
+ packet -> referenceCount = 0;
+ packet -> flags = flags;
+ packet -> dataLength = dataLength;
+ packet -> freeCallback = NULL;
+ packet -> userData = NULL;
+
+ return packet;
+}
+
+/** Destroys the packet and deallocates its data.
+ @param packet packet to be destroyed
+*/
+void
+enet_packet_destroy (ENetPacket * packet)
+{
+ if (packet == NULL)
+ return;
+
+ if (packet -> freeCallback != NULL)
+ (* packet -> freeCallback) (packet);
+ if (! (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE) &&
+ packet -> data != NULL)
+ enet_free (packet -> data);
+ enet_free (packet);
+}
+
+/** Attempts to resize the data in the packet to length specified in the
+ dataLength parameter
+ @param packet packet to resize
+ @param dataLength new size for the packet data
+ @returns 0 on success, < 0 on failure
+*/
+int
+enet_packet_resize (ENetPacket * packet, size_t dataLength)
+{
+ enet_uint8 * newData;
+
+ if (dataLength <= packet -> dataLength || (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE))
+ {
+ packet -> dataLength = dataLength;
+
+ return 0;
+ }
+
+ newData = (enet_uint8 *) enet_malloc (dataLength);
+ if (newData == NULL)
+ return -1;
+
+ memcpy (newData, packet -> data, packet -> dataLength);
+ enet_free (packet -> data);
+
+ packet -> data = newData;
+ packet -> dataLength = dataLength;
+
+ return 0;
+}
+
+static int initializedCRC32 = 0;
+static enet_uint32 crcTable [256];
+
+static enet_uint32
+reflect_crc (int val, int bits)
+{
+ int result = 0, bit;
+
+ for (bit = 0; bit < bits; bit ++)
+ {
+ if(val & 1) result |= 1 << (bits - 1 - bit);
+ val >>= 1;
+ }
+
+ return result;
+}
+
+static void
+initialize_crc32 (void)
+{
+ int byte;
+
+ for (byte = 0; byte < 256; ++ byte)
+ {
+ enet_uint32 crc = reflect_crc (byte, 8) << 24;
+ int offset;
+
+ for(offset = 0; offset < 8; ++ offset)
+ {
+ if (crc & 0x80000000)
+ crc = (crc << 1) ^ 0x04c11db7;
+ else
+ crc <<= 1;
+ }
+
+ crcTable [byte] = reflect_crc (crc, 32);
+ }
+
+ initializedCRC32 = 1;
+}
+
+enet_uint32
+enet_crc32 (const ENetBuffer * buffers, size_t bufferCount)
+{
+ enet_uint32 crc = 0xFFFFFFFF;
+
+ if (! initializedCRC32) initialize_crc32 ();
+
+ while (bufferCount -- > 0)
+ {
+ const enet_uint8 * data = (const enet_uint8 *) buffers -> data,
+ * dataEnd = & data [buffers -> dataLength];
+
+ while (data < dataEnd)
+ {
+ crc = (crc >> 8) ^ crcTable [(crc & 0xFF) ^ *data++];
+ }
+
+ ++ buffers;
+ }
+
+ return ENET_HOST_TO_NET_32 (~ crc);
+}
+
+/** @} */
diff --git a/modules/enet/peer.c b/modules/enet/peer.c
new file mode 100644
index 0000000000..e2d0872bd3
--- /dev/null
+++ b/modules/enet/peer.c
@@ -0,0 +1,1004 @@
+/**
+ @file peer.c
+ @brief ENet peer management functions
+*/
+#include <string.h>
+#define ENET_BUILDING_LIB 1
+#include "enet/enet.h"
+
+/** @defgroup peer ENet peer functions
+ @{
+*/
+
+/** Configures throttle parameter for a peer.
+
+ Unreliable packets are dropped by ENet in response to the varying conditions
+ of the Internet connection to the peer. The throttle represents a probability
+ that an unreliable packet should not be dropped and thus sent by ENet to the peer.
+ The lowest mean round trip time from the sending of a reliable packet to the
+ receipt of its acknowledgement is measured over an amount of time specified by
+ the interval parameter in milliseconds. If a measured round trip time happens to
+ be significantly less than the mean round trip time measured over the interval,
+ then the throttle probability is increased to allow more traffic by an amount
+ specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE
+ constant. If a measured round trip time happens to be significantly greater than
+ the mean round trip time measured over the interval, then the throttle probability
+ is decreased to limit traffic by an amount specified in the deceleration parameter, which
+ is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has
+ a value of ENET_PEER_PACKET_THROTTLE_SCALE, no unreliable packets are dropped by
+ ENet, and so 100% of all unreliable packets will be sent. When the throttle has a
+ value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable
+ packets will be sent. Intermediate values for the throttle represent intermediate
+ probabilities between 0% and 100% of unreliable packets being sent. The bandwidth
+ limits of the local and foreign hosts are taken into account to determine a
+ sensible limit for the throttle probability above which it should not raise even in
+ the best of conditions.
+
+ @param peer peer to configure
+ @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL.
+ @param acceleration rate at which to increase the throttle probability as mean RTT declines
+ @param deceleration rate at which to decrease the throttle probability as mean RTT increases
+*/
+void
+enet_peer_throttle_configure (ENetPeer * peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration)
+{
+ ENetProtocol command;
+
+ peer -> packetThrottleInterval = interval;
+ peer -> packetThrottleAcceleration = acceleration;
+ peer -> packetThrottleDeceleration = deceleration;
+
+ command.header.command = ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ command.header.channelID = 0xFF;
+
+ command.throttleConfigure.packetThrottleInterval = ENET_HOST_TO_NET_32 (interval);
+ command.throttleConfigure.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (acceleration);
+ command.throttleConfigure.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (deceleration);
+
+ enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
+}
+
+int
+enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt)
+{
+ if (peer -> lastRoundTripTime <= peer -> lastRoundTripTimeVariance)
+ {
+ peer -> packetThrottle = peer -> packetThrottleLimit;
+ }
+ else
+ if (rtt < peer -> lastRoundTripTime)
+ {
+ peer -> packetThrottle += peer -> packetThrottleAcceleration;
+
+ if (peer -> packetThrottle > peer -> packetThrottleLimit)
+ peer -> packetThrottle = peer -> packetThrottleLimit;
+
+ return 1;
+ }
+ else
+ if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance)
+ {
+ if (peer -> packetThrottle > peer -> packetThrottleDeceleration)
+ peer -> packetThrottle -= peer -> packetThrottleDeceleration;
+ else
+ peer -> packetThrottle = 0;
+
+ return -1;
+ }
+
+ return 0;
+}
+
+/** Queues a packet to be sent.
+ @param peer destination for the packet
+ @param channelID channel on which to send
+ @param packet packet to send
+ @retval 0 on success
+ @retval < 0 on failure
+*/
+int
+enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet)
+{
+ ENetChannel * channel = & peer -> channels [channelID];
+ ENetProtocol command;
+ size_t fragmentLength;
+
+ if (peer -> state != ENET_PEER_STATE_CONNECTED ||
+ channelID >= peer -> channelCount ||
+ packet -> dataLength > peer -> host -> maximumPacketSize)
+ return -1;
+
+ fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment);
+ if (peer -> host -> checksum != NULL)
+ fragmentLength -= sizeof(enet_uint32);
+
+ if (packet -> dataLength > fragmentLength)
+ {
+ enet_uint32 fragmentCount = (packet -> dataLength + fragmentLength - 1) / fragmentLength,
+ fragmentNumber,
+ fragmentOffset;
+ enet_uint8 commandNumber;
+ enet_uint16 startSequenceNumber;
+ ENetList fragments;
+ ENetOutgoingCommand * fragment;
+
+ if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT)
+ return -1;
+
+ if ((packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT)) == ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT &&
+ channel -> outgoingUnreliableSequenceNumber < 0xFFFF)
+ {
+ commandNumber = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT;
+ startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingUnreliableSequenceNumber + 1);
+ }
+ else
+ {
+ commandNumber = ENET_PROTOCOL_COMMAND_SEND_FRAGMENT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingReliableSequenceNumber + 1);
+ }
+
+ enet_list_clear (& fragments);
+
+ for (fragmentNumber = 0,
+ fragmentOffset = 0;
+ fragmentOffset < packet -> dataLength;
+ ++ fragmentNumber,
+ fragmentOffset += fragmentLength)
+ {
+ if (packet -> dataLength - fragmentOffset < fragmentLength)
+ fragmentLength = packet -> dataLength - fragmentOffset;
+
+ fragment = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand));
+ if (fragment == NULL)
+ {
+ while (! enet_list_empty (& fragments))
+ {
+ fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments));
+
+ enet_free (fragment);
+ }
+
+ return -1;
+ }
+
+ fragment -> fragmentOffset = fragmentOffset;
+ fragment -> fragmentLength = fragmentLength;
+ fragment -> packet = packet;
+ fragment -> command.header.command = commandNumber;
+ fragment -> command.header.channelID = channelID;
+ fragment -> command.sendFragment.startSequenceNumber = startSequenceNumber;
+ fragment -> command.sendFragment.dataLength = ENET_HOST_TO_NET_16 (fragmentLength);
+ fragment -> command.sendFragment.fragmentCount = ENET_HOST_TO_NET_32 (fragmentCount);
+ fragment -> command.sendFragment.fragmentNumber = ENET_HOST_TO_NET_32 (fragmentNumber);
+ fragment -> command.sendFragment.totalLength = ENET_HOST_TO_NET_32 (packet -> dataLength);
+ fragment -> command.sendFragment.fragmentOffset = ENET_NET_TO_HOST_32 (fragmentOffset);
+
+ enet_list_insert (enet_list_end (& fragments), fragment);
+ }
+
+ packet -> referenceCount += fragmentNumber;
+
+ while (! enet_list_empty (& fragments))
+ {
+ fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments));
+
+ enet_peer_setup_outgoing_command (peer, fragment);
+ }
+
+ return 0;
+ }
+
+ command.header.channelID = channelID;
+
+ if ((packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNSEQUENCED)) == ENET_PACKET_FLAG_UNSEQUENCED)
+ {
+ command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED;
+ command.sendUnsequenced.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength);
+ }
+ else
+ if (packet -> flags & ENET_PACKET_FLAG_RELIABLE || channel -> outgoingUnreliableSequenceNumber >= 0xFFFF)
+ {
+ command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ command.sendReliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength);
+ }
+ else
+ {
+ command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE;
+ command.sendUnreliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength);
+ }
+
+ if (enet_peer_queue_outgoing_command (peer, & command, packet, 0, packet -> dataLength) == NULL)
+ return -1;
+
+ return 0;
+}
+
+/** Attempts to dequeue any incoming queued packet.
+ @param peer peer to dequeue packets from
+ @param channelID holds the channel ID of the channel the packet was received on success
+ @returns a pointer to the packet, or NULL if there are no available incoming queued packets
+*/
+ENetPacket *
+enet_peer_receive (ENetPeer * peer, enet_uint8 * channelID)
+{
+ ENetIncomingCommand * incomingCommand;
+ ENetPacket * packet;
+
+ if (enet_list_empty (& peer -> dispatchedCommands))
+ return NULL;
+
+ incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (& peer -> dispatchedCommands));
+
+ if (channelID != NULL)
+ * channelID = incomingCommand -> command.header.channelID;
+
+ packet = incomingCommand -> packet;
+
+ -- packet -> referenceCount;
+
+ if (incomingCommand -> fragments != NULL)
+ enet_free (incomingCommand -> fragments);
+
+ enet_free (incomingCommand);
+
+ peer -> totalWaitingData -= packet -> dataLength;
+
+ return packet;
+}
+
+static void
+enet_peer_reset_outgoing_commands (ENetList * queue)
+{
+ ENetOutgoingCommand * outgoingCommand;
+
+ while (! enet_list_empty (queue))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (queue));
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ -- outgoingCommand -> packet -> referenceCount;
+
+ if (outgoingCommand -> packet -> referenceCount == 0)
+ enet_packet_destroy (outgoingCommand -> packet);
+ }
+
+ enet_free (outgoingCommand);
+ }
+}
+
+static void
+enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand)
+{
+ ENetListIterator currentCommand;
+
+ for (currentCommand = startCommand; currentCommand != endCommand; )
+ {
+ ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ currentCommand = enet_list_next (currentCommand);
+
+ enet_list_remove (& incomingCommand -> incomingCommandList);
+
+ if (incomingCommand -> packet != NULL)
+ {
+ -- incomingCommand -> packet -> referenceCount;
+
+ if (incomingCommand -> packet -> referenceCount == 0)
+ enet_packet_destroy (incomingCommand -> packet);
+ }
+
+ if (incomingCommand -> fragments != NULL)
+ enet_free (incomingCommand -> fragments);
+
+ enet_free (incomingCommand);
+ }
+}
+
+static void
+enet_peer_reset_incoming_commands (ENetList * queue)
+{
+ enet_peer_remove_incoming_commands(queue, enet_list_begin (queue), enet_list_end (queue));
+}
+
+void
+enet_peer_reset_queues (ENetPeer * peer)
+{
+ ENetChannel * channel;
+
+ if (peer -> needsDispatch)
+ {
+ enet_list_remove (& peer -> dispatchList);
+
+ peer -> needsDispatch = 0;
+ }
+
+ while (! enet_list_empty (& peer -> acknowledgements))
+ enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements)));
+
+ enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands);
+ enet_peer_reset_outgoing_commands (& peer -> sentUnreliableCommands);
+ enet_peer_reset_outgoing_commands (& peer -> outgoingReliableCommands);
+ enet_peer_reset_outgoing_commands (& peer -> outgoingUnreliableCommands);
+ enet_peer_reset_incoming_commands (& peer -> dispatchedCommands);
+
+ if (peer -> channels != NULL && peer -> channelCount > 0)
+ {
+ for (channel = peer -> channels;
+ channel < & peer -> channels [peer -> channelCount];
+ ++ channel)
+ {
+ enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands);
+ enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands);
+ }
+
+ enet_free (peer -> channels);
+ }
+
+ peer -> channels = NULL;
+ peer -> channelCount = 0;
+}
+
+void
+enet_peer_on_connect (ENetPeer * peer)
+{
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ {
+ if (peer -> incomingBandwidth != 0)
+ ++ peer -> host -> bandwidthLimitedPeers;
+
+ ++ peer -> host -> connectedPeers;
+ }
+}
+
+void
+enet_peer_on_disconnect (ENetPeer * peer)
+{
+ if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER)
+ {
+ if (peer -> incomingBandwidth != 0)
+ -- peer -> host -> bandwidthLimitedPeers;
+
+ -- peer -> host -> connectedPeers;
+ }
+}
+
+/** Forcefully disconnects a peer.
+ @param peer peer to forcefully disconnect
+ @remarks The foreign host represented by the peer is not notified of the disconnection and will timeout
+ on its connection to the local host.
+*/
+void
+enet_peer_reset (ENetPeer * peer)
+{
+ enet_peer_on_disconnect (peer);
+
+ peer -> outgoingPeerID = ENET_PROTOCOL_MAXIMUM_PEER_ID;
+ peer -> connectID = 0;
+
+ peer -> state = ENET_PEER_STATE_DISCONNECTED;
+
+ peer -> incomingBandwidth = 0;
+ peer -> outgoingBandwidth = 0;
+ peer -> incomingBandwidthThrottleEpoch = 0;
+ peer -> outgoingBandwidthThrottleEpoch = 0;
+ peer -> incomingDataTotal = 0;
+ peer -> outgoingDataTotal = 0;
+ peer -> lastSendTime = 0;
+ peer -> lastReceiveTime = 0;
+ peer -> nextTimeout = 0;
+ peer -> earliestTimeout = 0;
+ peer -> packetLossEpoch = 0;
+ peer -> packetsSent = 0;
+ peer -> packetsLost = 0;
+ peer -> packetLoss = 0;
+ peer -> packetLossVariance = 0;
+ peer -> packetThrottle = ENET_PEER_DEFAULT_PACKET_THROTTLE;
+ peer -> packetThrottleLimit = ENET_PEER_PACKET_THROTTLE_SCALE;
+ peer -> packetThrottleCounter = 0;
+ peer -> packetThrottleEpoch = 0;
+ peer -> packetThrottleAcceleration = ENET_PEER_PACKET_THROTTLE_ACCELERATION;
+ peer -> packetThrottleDeceleration = ENET_PEER_PACKET_THROTTLE_DECELERATION;
+ peer -> packetThrottleInterval = ENET_PEER_PACKET_THROTTLE_INTERVAL;
+ peer -> pingInterval = ENET_PEER_PING_INTERVAL;
+ peer -> timeoutLimit = ENET_PEER_TIMEOUT_LIMIT;
+ peer -> timeoutMinimum = ENET_PEER_TIMEOUT_MINIMUM;
+ peer -> timeoutMaximum = ENET_PEER_TIMEOUT_MAXIMUM;
+ peer -> lastRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
+ peer -> lowestRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
+ peer -> lastRoundTripTimeVariance = 0;
+ peer -> highestRoundTripTimeVariance = 0;
+ peer -> roundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
+ peer -> roundTripTimeVariance = 0;
+ peer -> mtu = peer -> host -> mtu;
+ peer -> reliableDataInTransit = 0;
+ peer -> outgoingReliableSequenceNumber = 0;
+ peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+ peer -> incomingUnsequencedGroup = 0;
+ peer -> outgoingUnsequencedGroup = 0;
+ peer -> eventData = 0;
+ peer -> totalWaitingData = 0;
+
+ memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow));
+
+ enet_peer_reset_queues (peer);
+}
+
+/** Sends a ping request to a peer.
+ @param peer destination for the ping request
+ @remarks ping requests factor into the mean round trip time as designated by the
+ roundTripTime field in the ENetPeer structure. ENet automatically pings all connected
+ peers at regular intervals, however, this function may be called to ensure more
+ frequent ping requests.
+*/
+void
+enet_peer_ping (ENetPeer * peer)
+{
+ ENetProtocol command;
+
+ if (peer -> state != ENET_PEER_STATE_CONNECTED)
+ return;
+
+ command.header.command = ENET_PROTOCOL_COMMAND_PING | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ command.header.channelID = 0xFF;
+
+ enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
+}
+
+/** Sets the interval at which pings will be sent to a peer.
+
+ Pings are used both to monitor the liveness of the connection and also to dynamically
+ adjust the throttle during periods of low traffic so that the throttle has reasonable
+ responsiveness during traffic spikes.
+
+ @param peer the peer to adjust
+ @param pingInterval the interval at which to send pings; defaults to ENET_PEER_PING_INTERVAL if 0
+*/
+void
+enet_peer_ping_interval (ENetPeer * peer, enet_uint32 pingInterval)
+{
+ peer -> pingInterval = pingInterval ? pingInterval : ENET_PEER_PING_INTERVAL;
+}
+
+/** Sets the timeout parameters for a peer.
+
+ The timeout parameter control how and when a peer will timeout from a failure to acknowledge
+ reliable traffic. Timeout values use an exponential backoff mechanism, where if a reliable
+ packet is not acknowledge within some multiple of the average RTT plus a variance tolerance,
+ the timeout will be doubled until it reaches a set limit. If the timeout is thus at this
+ limit and reliable packets have been sent but not acknowledged within a certain minimum time
+ period, the peer will be disconnected. Alternatively, if reliable packets have been sent
+ but not acknowledged for a certain maximum time period, the peer will be disconnected regardless
+ of the current timeout limit value.
+
+ @param peer the peer to adjust
+ @param timeoutLimit the timeout limit; defaults to ENET_PEER_TIMEOUT_LIMIT if 0
+ @param timeoutMinimum the timeout minimum; defaults to ENET_PEER_TIMEOUT_MINIMUM if 0
+ @param timeoutMaximum the timeout maximum; defaults to ENET_PEER_TIMEOUT_MAXIMUM if 0
+*/
+
+void
+enet_peer_timeout (ENetPeer * peer, enet_uint32 timeoutLimit, enet_uint32 timeoutMinimum, enet_uint32 timeoutMaximum)
+{
+ peer -> timeoutLimit = timeoutLimit ? timeoutLimit : ENET_PEER_TIMEOUT_LIMIT;
+ peer -> timeoutMinimum = timeoutMinimum ? timeoutMinimum : ENET_PEER_TIMEOUT_MINIMUM;
+ peer -> timeoutMaximum = timeoutMaximum ? timeoutMaximum : ENET_PEER_TIMEOUT_MAXIMUM;
+}
+
+/** Force an immediate disconnection from a peer.
+ @param peer peer to disconnect
+ @param data data describing the disconnection
+ @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not
+ guaranteed to receive the disconnect notification, and is reset immediately upon
+ return from this function.
+*/
+void
+enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data)
+{
+ ENetProtocol command;
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECTED)
+ return;
+
+ if (peer -> state != ENET_PEER_STATE_ZOMBIE &&
+ peer -> state != ENET_PEER_STATE_DISCONNECTING)
+ {
+ enet_peer_reset_queues (peer);
+
+ command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED;
+ command.header.channelID = 0xFF;
+ command.disconnect.data = ENET_HOST_TO_NET_32 (data);
+
+ enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
+
+ enet_host_flush (peer -> host);
+ }
+
+ enet_peer_reset (peer);
+}
+
+/** Request a disconnection from a peer.
+ @param peer peer to request a disconnection
+ @param data data describing the disconnection
+ @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service()
+ once the disconnection is complete.
+*/
+void
+enet_peer_disconnect (ENetPeer * peer, enet_uint32 data)
+{
+ ENetProtocol command;
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECTING ||
+ peer -> state == ENET_PEER_STATE_DISCONNECTED ||
+ peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT ||
+ peer -> state == ENET_PEER_STATE_ZOMBIE)
+ return;
+
+ enet_peer_reset_queues (peer);
+
+ command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT;
+ command.header.channelID = 0xFF;
+ command.disconnect.data = ENET_HOST_TO_NET_32 (data);
+
+ if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER)
+ command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ else
+ command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED;
+
+ enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
+
+ if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER)
+ {
+ enet_peer_on_disconnect (peer);
+
+ peer -> state = ENET_PEER_STATE_DISCONNECTING;
+ }
+ else
+ {
+ enet_host_flush (peer -> host);
+ enet_peer_reset (peer);
+ }
+}
+
+/** Request a disconnection from a peer, but only after all queued outgoing packets are sent.
+ @param peer peer to request a disconnection
+ @param data data describing the disconnection
+ @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service()
+ once the disconnection is complete.
+*/
+void
+enet_peer_disconnect_later (ENetPeer * peer, enet_uint32 data)
+{
+ if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) &&
+ ! (enet_list_empty (& peer -> outgoingReliableCommands) &&
+ enet_list_empty (& peer -> outgoingUnreliableCommands) &&
+ enet_list_empty (& peer -> sentReliableCommands)))
+ {
+ peer -> state = ENET_PEER_STATE_DISCONNECT_LATER;
+ peer -> eventData = data;
+ }
+ else
+ enet_peer_disconnect (peer, data);
+}
+
+ENetAcknowledgement *
+enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, enet_uint16 sentTime)
+{
+ ENetAcknowledgement * acknowledgement;
+
+ if (command -> header.channelID < peer -> channelCount)
+ {
+ ENetChannel * channel = & peer -> channels [command -> header.channelID];
+ enet_uint16 reliableWindow = command -> header.reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE,
+ currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+
+ if (command -> header.reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ reliableWindow += ENET_PEER_RELIABLE_WINDOWS;
+
+ if (reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1 && reliableWindow <= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS)
+ return NULL;
+ }
+
+ acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement));
+ if (acknowledgement == NULL)
+ return NULL;
+
+ peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge);
+
+ acknowledgement -> sentTime = sentTime;
+ acknowledgement -> command = * command;
+
+ enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement);
+
+ return acknowledgement;
+}
+
+void
+enet_peer_setup_outgoing_command (ENetPeer * peer, ENetOutgoingCommand * outgoingCommand)
+{
+ ENetChannel * channel = & peer -> channels [outgoingCommand -> command.header.channelID];
+
+ peer -> outgoingDataTotal += enet_protocol_command_size (outgoingCommand -> command.header.command) + outgoingCommand -> fragmentLength;
+
+ if (outgoingCommand -> command.header.channelID == 0xFF)
+ {
+ ++ peer -> outgoingReliableSequenceNumber;
+
+ outgoingCommand -> reliableSequenceNumber = peer -> outgoingReliableSequenceNumber;
+ outgoingCommand -> unreliableSequenceNumber = 0;
+ }
+ else
+ if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE)
+ {
+ ++ channel -> outgoingReliableSequenceNumber;
+ channel -> outgoingUnreliableSequenceNumber = 0;
+
+ outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber;
+ outgoingCommand -> unreliableSequenceNumber = 0;
+ }
+ else
+ if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED)
+ {
+ ++ peer -> outgoingUnsequencedGroup;
+
+ outgoingCommand -> reliableSequenceNumber = 0;
+ outgoingCommand -> unreliableSequenceNumber = 0;
+ }
+ else
+ {
+ if (outgoingCommand -> fragmentOffset == 0)
+ ++ channel -> outgoingUnreliableSequenceNumber;
+
+ outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber;
+ outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber;
+ }
+
+ outgoingCommand -> sendAttempts = 0;
+ outgoingCommand -> sentTime = 0;
+ outgoingCommand -> roundTripTimeout = 0;
+ outgoingCommand -> roundTripTimeoutLimit = 0;
+ outgoingCommand -> command.header.reliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> reliableSequenceNumber);
+
+ switch (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK)
+ {
+ case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
+ outgoingCommand -> command.sendUnreliable.unreliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> unreliableSequenceNumber);
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED:
+ outgoingCommand -> command.sendUnsequenced.unsequencedGroup = ENET_HOST_TO_NET_16 (peer -> outgoingUnsequencedGroup);
+ break;
+
+ default:
+ break;
+ }
+
+ if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE)
+ enet_list_insert (enet_list_end (& peer -> outgoingReliableCommands), outgoingCommand);
+ else
+ enet_list_insert (enet_list_end (& peer -> outgoingUnreliableCommands), outgoingCommand);
+}
+
+ENetOutgoingCommand *
+enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 offset, enet_uint16 length)
+{
+ ENetOutgoingCommand * outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand));
+ if (outgoingCommand == NULL)
+ return NULL;
+
+ outgoingCommand -> command = * command;
+ outgoingCommand -> fragmentOffset = offset;
+ outgoingCommand -> fragmentLength = length;
+ outgoingCommand -> packet = packet;
+ if (packet != NULL)
+ ++ packet -> referenceCount;
+
+ enet_peer_setup_outgoing_command (peer, outgoingCommand);
+
+ return outgoingCommand;
+}
+
+void
+enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * channel)
+{
+ ENetListIterator droppedCommand, startCommand, currentCommand;
+
+ for (droppedCommand = startCommand = currentCommand = enet_list_begin (& channel -> incomingUnreliableCommands);
+ currentCommand != enet_list_end (& channel -> incomingUnreliableCommands);
+ currentCommand = enet_list_next (currentCommand))
+ {
+ ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED)
+ continue;
+
+ if (incomingCommand -> reliableSequenceNumber == channel -> incomingReliableSequenceNumber)
+ {
+ if (incomingCommand -> fragmentsRemaining <= 0)
+ {
+ channel -> incomingUnreliableSequenceNumber = incomingCommand -> unreliableSequenceNumber;
+ continue;
+ }
+
+ if (startCommand != currentCommand)
+ {
+ enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
+
+ if (! peer -> needsDispatch)
+ {
+ enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
+
+ peer -> needsDispatch = 1;
+ }
+
+ droppedCommand = currentCommand;
+ }
+ else
+ if (droppedCommand != currentCommand)
+ droppedCommand = enet_list_previous (currentCommand);
+ }
+ else
+ {
+ enet_uint16 reliableWindow = incomingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE,
+ currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ reliableWindow += ENET_PEER_RELIABLE_WINDOWS;
+ if (reliableWindow >= currentWindow && reliableWindow < currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1)
+ break;
+
+ droppedCommand = enet_list_next (currentCommand);
+
+ if (startCommand != currentCommand)
+ {
+ enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
+
+ if (! peer -> needsDispatch)
+ {
+ enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
+
+ peer -> needsDispatch = 1;
+ }
+ }
+ }
+
+ startCommand = enet_list_next (currentCommand);
+ }
+
+ if (startCommand != currentCommand)
+ {
+ enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
+
+ if (! peer -> needsDispatch)
+ {
+ enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
+
+ peer -> needsDispatch = 1;
+ }
+
+ droppedCommand = currentCommand;
+ }
+
+ enet_peer_remove_incoming_commands (& channel -> incomingUnreliableCommands, enet_list_begin (& channel -> incomingUnreliableCommands), droppedCommand);
+}
+
+void
+enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * channel)
+{
+ ENetListIterator currentCommand;
+
+ for (currentCommand = enet_list_begin (& channel -> incomingReliableCommands);
+ currentCommand != enet_list_end (& channel -> incomingReliableCommands);
+ currentCommand = enet_list_next (currentCommand))
+ {
+ ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if (incomingCommand -> fragmentsRemaining > 0 ||
+ incomingCommand -> reliableSequenceNumber != (enet_uint16) (channel -> incomingReliableSequenceNumber + 1))
+ break;
+
+ channel -> incomingReliableSequenceNumber = incomingCommand -> reliableSequenceNumber;
+
+ if (incomingCommand -> fragmentCount > 0)
+ channel -> incomingReliableSequenceNumber += incomingCommand -> fragmentCount - 1;
+ }
+
+ if (currentCommand == enet_list_begin (& channel -> incomingReliableCommands))
+ return;
+
+ channel -> incomingUnreliableSequenceNumber = 0;
+
+ enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingReliableCommands), enet_list_previous (currentCommand));
+
+ if (! peer -> needsDispatch)
+ {
+ enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
+
+ peer -> needsDispatch = 1;
+ }
+
+ if (! enet_list_empty (& channel -> incomingUnreliableCommands))
+ enet_peer_dispatch_incoming_unreliable_commands (peer, channel);
+}
+
+ENetIncomingCommand *
+enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, const void * data, size_t dataLength, enet_uint32 flags, enet_uint32 fragmentCount)
+{
+ static ENetIncomingCommand dummyCommand;
+
+ ENetChannel * channel = & peer -> channels [command -> header.channelID];
+ enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber = 0;
+ enet_uint16 reliableWindow, currentWindow;
+ ENetIncomingCommand * incomingCommand;
+ ENetListIterator currentCommand;
+ ENetPacket * packet = NULL;
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER)
+ goto discardCommand;
+
+ if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED)
+ {
+ reliableSequenceNumber = command -> header.reliableSequenceNumber;
+ reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+
+ if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ reliableWindow += ENET_PEER_RELIABLE_WINDOWS;
+
+ if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1)
+ goto discardCommand;
+ }
+
+ switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK)
+ {
+ case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
+ case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
+ if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber)
+ goto discardCommand;
+
+ for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands));
+ currentCommand != enet_list_end (& channel -> incomingReliableCommands);
+ currentCommand = enet_list_previous (currentCommand))
+ {
+ incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ continue;
+ }
+ else
+ if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber <= reliableSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber)
+ break;
+
+ goto discardCommand;
+ }
+ }
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
+ case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT:
+ unreliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendUnreliable.unreliableSequenceNumber);
+
+ if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber &&
+ unreliableSequenceNumber <= channel -> incomingUnreliableSequenceNumber)
+ goto discardCommand;
+
+ for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands));
+ currentCommand != enet_list_end (& channel -> incomingUnreliableCommands);
+ currentCommand = enet_list_previous (currentCommand))
+ {
+ incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED)
+ continue;
+
+ if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ continue;
+ }
+ else
+ if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber)
+ continue;
+
+ if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber)
+ {
+ if (incomingCommand -> unreliableSequenceNumber < unreliableSequenceNumber)
+ break;
+
+ goto discardCommand;
+ }
+ }
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED:
+ currentCommand = enet_list_end (& channel -> incomingUnreliableCommands);
+ break;
+
+ default:
+ goto discardCommand;
+ }
+
+ if (peer -> totalWaitingData >= peer -> host -> maximumWaitingData)
+ goto notifyError;
+
+ packet = enet_packet_create (data, dataLength, flags);
+ if (packet == NULL)
+ goto notifyError;
+
+ incomingCommand = (ENetIncomingCommand *) enet_malloc (sizeof (ENetIncomingCommand));
+ if (incomingCommand == NULL)
+ goto notifyError;
+
+ incomingCommand -> reliableSequenceNumber = command -> header.reliableSequenceNumber;
+ incomingCommand -> unreliableSequenceNumber = unreliableSequenceNumber & 0xFFFF;
+ incomingCommand -> command = * command;
+ incomingCommand -> fragmentCount = fragmentCount;
+ incomingCommand -> fragmentsRemaining = fragmentCount;
+ incomingCommand -> packet = packet;
+ incomingCommand -> fragments = NULL;
+
+ if (fragmentCount > 0)
+ {
+ if (fragmentCount <= ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT)
+ incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32));
+ if (incomingCommand -> fragments == NULL)
+ {
+ enet_free (incomingCommand);
+
+ goto notifyError;
+ }
+ memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32));
+ }
+
+ if (packet != NULL)
+ {
+ ++ packet -> referenceCount;
+
+ peer -> totalWaitingData += packet -> dataLength;
+ }
+
+ enet_list_insert (enet_list_next (currentCommand), incomingCommand);
+
+ switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK)
+ {
+ case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
+ case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
+ enet_peer_dispatch_incoming_reliable_commands (peer, channel);
+ break;
+
+ default:
+ enet_peer_dispatch_incoming_unreliable_commands (peer, channel);
+ break;
+ }
+
+ return incomingCommand;
+
+discardCommand:
+ if (fragmentCount > 0)
+ goto notifyError;
+
+ if (packet != NULL && packet -> referenceCount == 0)
+ enet_packet_destroy (packet);
+
+ return & dummyCommand;
+
+notifyError:
+ if (packet != NULL && packet -> referenceCount == 0)
+ enet_packet_destroy (packet);
+
+ return NULL;
+}
+
+/** @} */
diff --git a/modules/enet/protocol.c b/modules/enet/protocol.c
new file mode 100644
index 0000000000..4a2a4ed185
--- /dev/null
+++ b/modules/enet/protocol.c
@@ -0,0 +1,1914 @@
+/**
+ @file protocol.c
+ @brief ENet protocol functions
+*/
+#include <stdio.h>
+#include <string.h>
+#define ENET_BUILDING_LIB 1
+#include "enet/utility.h"
+#include "enet/time.h"
+#include "enet/enet.h"
+
+
+static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
+{
+ 0,
+ sizeof (ENetProtocolAcknowledge),
+ sizeof (ENetProtocolConnect),
+ sizeof (ENetProtocolVerifyConnect),
+ sizeof (ENetProtocolDisconnect),
+ sizeof (ENetProtocolPing),
+ sizeof (ENetProtocolSendReliable),
+ sizeof (ENetProtocolSendUnreliable),
+ sizeof (ENetProtocolSendFragment),
+ sizeof (ENetProtocolSendUnsequenced),
+ sizeof (ENetProtocolBandwidthLimit),
+ sizeof (ENetProtocolThrottleConfigure),
+ sizeof (ENetProtocolSendFragment)
+};
+
+size_t
+enet_protocol_command_size (enet_uint8 commandNumber)
+{
+ return commandSizes [commandNumber & ENET_PROTOCOL_COMMAND_MASK];
+}
+
+static void
+enet_protocol_change_state (ENetHost * host, ENetPeer * peer, ENetPeerState state)
+{
+ if (state == ENET_PEER_STATE_CONNECTED || state == ENET_PEER_STATE_DISCONNECT_LATER)
+ enet_peer_on_connect (peer);
+ else
+ enet_peer_on_disconnect (peer);
+
+ peer -> state = state;
+}
+
+static void
+enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState state)
+{
+ enet_protocol_change_state (host, peer, state);
+
+ if (! peer -> needsDispatch)
+ {
+ enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList);
+
+ peer -> needsDispatch = 1;
+ }
+}
+
+static int
+enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
+{
+ while (! enet_list_empty (& host -> dispatchQueue))
+ {
+ ENetPeer * peer = (ENetPeer *) enet_list_remove (enet_list_begin (& host -> dispatchQueue));
+
+ peer -> needsDispatch = 0;
+
+ switch (peer -> state)
+ {
+ case ENET_PEER_STATE_CONNECTION_PENDING:
+ case ENET_PEER_STATE_CONNECTION_SUCCEEDED:
+ enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED);
+
+ event -> type = ENET_EVENT_TYPE_CONNECT;
+ event -> peer = peer;
+ event -> data = peer -> eventData;
+
+ return 1;
+
+ case ENET_PEER_STATE_ZOMBIE:
+ host -> recalculateBandwidthLimits = 1;
+
+ event -> type = ENET_EVENT_TYPE_DISCONNECT;
+ event -> peer = peer;
+ event -> data = peer -> eventData;
+
+ enet_peer_reset (peer);
+
+ return 1;
+
+ case ENET_PEER_STATE_CONNECTED:
+ if (enet_list_empty (& peer -> dispatchedCommands))
+ continue;
+
+ event -> packet = enet_peer_receive (peer, & event -> channelID);
+ if (event -> packet == NULL)
+ continue;
+
+ event -> type = ENET_EVENT_TYPE_RECEIVE;
+ event -> peer = peer;
+
+ if (! enet_list_empty (& peer -> dispatchedCommands))
+ {
+ peer -> needsDispatch = 1;
+
+ enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList);
+ }
+
+ return 1;
+
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static void
+enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event)
+{
+ host -> recalculateBandwidthLimits = 1;
+
+ if (event != NULL)
+ {
+ enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED);
+
+ event -> type = ENET_EVENT_TYPE_CONNECT;
+ event -> peer = peer;
+ event -> data = peer -> eventData;
+ }
+ else
+ enet_protocol_dispatch_state (host, peer, peer -> state == ENET_PEER_STATE_CONNECTING ? ENET_PEER_STATE_CONNECTION_SUCCEEDED : ENET_PEER_STATE_CONNECTION_PENDING);
+}
+
+static void
+enet_protocol_notify_disconnect (ENetHost * host, ENetPeer * peer, ENetEvent * event)
+{
+ if (peer -> state >= ENET_PEER_STATE_CONNECTION_PENDING)
+ host -> recalculateBandwidthLimits = 1;
+
+ if (peer -> state != ENET_PEER_STATE_CONNECTING && peer -> state < ENET_PEER_STATE_CONNECTION_SUCCEEDED)
+ enet_peer_reset (peer);
+ else
+ if (event != NULL)
+ {
+ event -> type = ENET_EVENT_TYPE_DISCONNECT;
+ event -> peer = peer;
+ event -> data = 0;
+
+ enet_peer_reset (peer);
+ }
+ else
+ {
+ peer -> eventData = 0;
+
+ enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE);
+ }
+}
+
+static void
+enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer)
+{
+ ENetOutgoingCommand * outgoingCommand;
+
+ while (! enet_list_empty (& peer -> sentUnreliableCommands))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands);
+
+ enet_list_remove (& outgoingCommand -> outgoingCommandList);
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ -- outgoingCommand -> packet -> referenceCount;
+
+ if (outgoingCommand -> packet -> referenceCount == 0)
+ {
+ outgoingCommand -> packet -> flags |= ENET_PACKET_FLAG_SENT;
+
+ enet_packet_destroy (outgoingCommand -> packet);
+ }
+ }
+
+ enet_free (outgoingCommand);
+ }
+}
+
+static ENetProtocolCommand
+enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliableSequenceNumber, enet_uint8 channelID)
+{
+ ENetOutgoingCommand * outgoingCommand = NULL;
+ ENetListIterator currentCommand;
+ ENetProtocolCommand commandNumber;
+ int wasSent = 1;
+
+ for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
+ currentCommand != enet_list_end (& peer -> sentReliableCommands);
+ currentCommand = enet_list_next (currentCommand))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+
+ if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber &&
+ outgoingCommand -> command.header.channelID == channelID)
+ break;
+ }
+
+ if (currentCommand == enet_list_end (& peer -> sentReliableCommands))
+ {
+ for (currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
+ currentCommand != enet_list_end (& peer -> outgoingReliableCommands);
+ currentCommand = enet_list_next (currentCommand))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+
+ if (outgoingCommand -> sendAttempts < 1) return ENET_PROTOCOL_COMMAND_NONE;
+
+ if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber &&
+ outgoingCommand -> command.header.channelID == channelID)
+ break;
+ }
+
+ if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands))
+ return ENET_PROTOCOL_COMMAND_NONE;
+
+ wasSent = 0;
+ }
+
+ if (outgoingCommand == NULL)
+ return ENET_PROTOCOL_COMMAND_NONE;
+
+ if (channelID < peer -> channelCount)
+ {
+ ENetChannel * channel = & peer -> channels [channelID];
+ enet_uint16 reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ if (channel -> reliableWindows [reliableWindow] > 0)
+ {
+ -- channel -> reliableWindows [reliableWindow];
+ if (! channel -> reliableWindows [reliableWindow])
+ channel -> usedReliableWindows &= ~ (1 << reliableWindow);
+ }
+ }
+
+ commandNumber = (ENetProtocolCommand) (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK);
+
+ enet_list_remove (& outgoingCommand -> outgoingCommandList);
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ if (wasSent)
+ peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
+
+ -- outgoingCommand -> packet -> referenceCount;
+
+ if (outgoingCommand -> packet -> referenceCount == 0)
+ {
+ outgoingCommand -> packet -> flags |= ENET_PACKET_FLAG_SENT;
+
+ enet_packet_destroy (outgoingCommand -> packet);
+ }
+ }
+
+ enet_free (outgoingCommand);
+
+ if (enet_list_empty (& peer -> sentReliableCommands))
+ return commandNumber;
+
+ outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands);
+
+ peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout;
+
+ return commandNumber;
+}
+
+static ENetPeer *
+enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command)
+{
+ enet_uint8 incomingSessionID, outgoingSessionID;
+ enet_uint32 mtu, windowSize;
+ ENetChannel * channel;
+ size_t channelCount, duplicatePeers = 0;
+ ENetPeer * currentPeer, * peer = NULL;
+ ENetProtocol verifyCommand;
+
+ channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount);
+
+ if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT ||
+ channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
+ return NULL;
+
+ for (currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED)
+ {
+ if (peer == NULL)
+ peer = currentPeer;
+ }
+ else
+ if (currentPeer -> state != ENET_PEER_STATE_CONNECTING &&
+ currentPeer -> address.host == host -> receivedAddress.host)
+ {
+ if (currentPeer -> address.port == host -> receivedAddress.port &&
+ currentPeer -> connectID == command -> connect.connectID)
+ return NULL;
+
+ ++ duplicatePeers;
+ }
+ }
+
+ if (peer == NULL || duplicatePeers >= host -> duplicatePeers)
+ return NULL;
+
+ if (channelCount > host -> channelLimit)
+ channelCount = host -> channelLimit;
+ peer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel));
+ if (peer -> channels == NULL)
+ return NULL;
+ peer -> channelCount = channelCount;
+ peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_CONNECT;
+ peer -> connectID = command -> connect.connectID;
+ peer -> address = host -> receivedAddress;
+ peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> connect.outgoingPeerID);
+ peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.incomingBandwidth);
+ peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.outgoingBandwidth);
+ peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleInterval);
+ peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleAcceleration);
+ peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleDeceleration);
+ peer -> eventData = ENET_NET_TO_HOST_32 (command -> connect.data);
+
+ incomingSessionID = command -> connect.incomingSessionID == 0xFF ? peer -> outgoingSessionID : command -> connect.incomingSessionID;
+ incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT);
+ if (incomingSessionID == peer -> outgoingSessionID)
+ incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT);
+ peer -> outgoingSessionID = incomingSessionID;
+
+ outgoingSessionID = command -> connect.outgoingSessionID == 0xFF ? peer -> incomingSessionID : command -> connect.outgoingSessionID;
+ outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT);
+ if (outgoingSessionID == peer -> incomingSessionID)
+ outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT);
+ peer -> incomingSessionID = outgoingSessionID;
+
+ for (channel = peer -> channels;
+ channel < & peer -> channels [channelCount];
+ ++ channel)
+ {
+ channel -> outgoingReliableSequenceNumber = 0;
+ channel -> outgoingUnreliableSequenceNumber = 0;
+ channel -> incomingReliableSequenceNumber = 0;
+ channel -> incomingUnreliableSequenceNumber = 0;
+
+ enet_list_clear (& channel -> incomingReliableCommands);
+ enet_list_clear (& channel -> incomingUnreliableCommands);
+
+ channel -> usedReliableWindows = 0;
+ memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows));
+ }
+
+ mtu = ENET_NET_TO_HOST_32 (command -> connect.mtu);
+
+ if (mtu < ENET_PROTOCOL_MINIMUM_MTU)
+ mtu = ENET_PROTOCOL_MINIMUM_MTU;
+ else
+ if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
+ mtu = ENET_PROTOCOL_MAXIMUM_MTU;
+
+ peer -> mtu = mtu;
+
+ if (host -> outgoingBandwidth == 0 &&
+ peer -> incomingBandwidth == 0)
+ peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+ else
+ if (host -> outgoingBandwidth == 0 ||
+ peer -> incomingBandwidth == 0)
+ peer -> windowSize = (ENET_MAX (host -> outgoingBandwidth, peer -> incomingBandwidth) /
+ ENET_PEER_WINDOW_SIZE_SCALE) *
+ ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ peer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, peer -> incomingBandwidth) /
+ ENET_PEER_WINDOW_SIZE_SCALE) *
+ ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+
+ if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
+ peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
+ peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+
+ if (host -> incomingBandwidth == 0)
+ windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+ else
+ windowSize = (host -> incomingBandwidth / ENET_PEER_WINDOW_SIZE_SCALE) *
+ ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+
+ if (windowSize > ENET_NET_TO_HOST_32 (command -> connect.windowSize))
+ windowSize = ENET_NET_TO_HOST_32 (command -> connect.windowSize);
+
+ if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
+ windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
+ windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+
+ verifyCommand.header.command = ENET_PROTOCOL_COMMAND_VERIFY_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+ verifyCommand.header.channelID = 0xFF;
+ verifyCommand.verifyConnect.outgoingPeerID = ENET_HOST_TO_NET_16 (peer -> incomingPeerID);
+ verifyCommand.verifyConnect.incomingSessionID = incomingSessionID;
+ verifyCommand.verifyConnect.outgoingSessionID = outgoingSessionID;
+ verifyCommand.verifyConnect.mtu = ENET_HOST_TO_NET_32 (peer -> mtu);
+ verifyCommand.verifyConnect.windowSize = ENET_HOST_TO_NET_32 (windowSize);
+ verifyCommand.verifyConnect.channelCount = ENET_HOST_TO_NET_32 (channelCount);
+ verifyCommand.verifyConnect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth);
+ verifyCommand.verifyConnect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
+ verifyCommand.verifyConnect.packetThrottleInterval = ENET_HOST_TO_NET_32 (peer -> packetThrottleInterval);
+ verifyCommand.verifyConnect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (peer -> packetThrottleAcceleration);
+ verifyCommand.verifyConnect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (peer -> packetThrottleDeceleration);
+ verifyCommand.verifyConnect.connectID = peer -> connectID;
+
+ enet_peer_queue_outgoing_command (peer, & verifyCommand, NULL, 0, 0);
+
+ return peer;
+}
+
+static int
+enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData)
+{
+ size_t dataLength;
+
+ if (command -> header.channelID >= peer -> channelCount ||
+ (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER))
+ return -1;
+
+ dataLength = ENET_NET_TO_HOST_16 (command -> sendReliable.dataLength);
+ * currentData += dataLength;
+ if (dataLength > host -> maximumPacketSize ||
+ * currentData < host -> receivedData ||
+ * currentData > & host -> receivedData [host -> receivedDataLength])
+ return -1;
+
+ if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendReliable), dataLength, ENET_PACKET_FLAG_RELIABLE, 0) == NULL)
+ return -1;
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData)
+{
+ enet_uint32 unsequencedGroup, index;
+ size_t dataLength;
+
+ if (command -> header.channelID >= peer -> channelCount ||
+ (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER))
+ return -1;
+
+ dataLength = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.dataLength);
+ * currentData += dataLength;
+ if (dataLength > host -> maximumPacketSize ||
+ * currentData < host -> receivedData ||
+ * currentData > & host -> receivedData [host -> receivedDataLength])
+ return -1;
+
+ unsequencedGroup = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.unsequencedGroup);
+ index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE;
+
+ if (unsequencedGroup < peer -> incomingUnsequencedGroup)
+ unsequencedGroup += 0x10000;
+
+ if (unsequencedGroup >= (enet_uint32) peer -> incomingUnsequencedGroup + ENET_PEER_FREE_UNSEQUENCED_WINDOWS * ENET_PEER_UNSEQUENCED_WINDOW_SIZE)
+ return 0;
+
+ unsequencedGroup &= 0xFFFF;
+
+ if (unsequencedGroup - index != peer -> incomingUnsequencedGroup)
+ {
+ peer -> incomingUnsequencedGroup = unsequencedGroup - index;
+
+ memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow));
+ }
+ else
+ if (peer -> unsequencedWindow [index / 32] & (1 << (index % 32)))
+ return 0;
+
+ if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), dataLength, ENET_PACKET_FLAG_UNSEQUENCED, 0) == NULL)
+ return -1;
+
+ peer -> unsequencedWindow [index / 32] |= 1 << (index % 32);
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData)
+{
+ size_t dataLength;
+
+ if (command -> header.channelID >= peer -> channelCount ||
+ (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER))
+ return -1;
+
+ dataLength = ENET_NET_TO_HOST_16 (command -> sendUnreliable.dataLength);
+ * currentData += dataLength;
+ if (dataLength > host -> maximumPacketSize ||
+ * currentData < host -> receivedData ||
+ * currentData > & host -> receivedData [host -> receivedDataLength])
+ return -1;
+
+ if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable), dataLength, 0, 0) == NULL)
+ return -1;
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData)
+{
+ enet_uint32 fragmentNumber,
+ fragmentCount,
+ fragmentOffset,
+ fragmentLength,
+ startSequenceNumber,
+ totalLength;
+ ENetChannel * channel;
+ enet_uint16 startWindow, currentWindow;
+ ENetListIterator currentCommand;
+ ENetIncomingCommand * startCommand = NULL;
+
+ if (command -> header.channelID >= peer -> channelCount ||
+ (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER))
+ return -1;
+
+ fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength);
+ * currentData += fragmentLength;
+ if (fragmentLength > host -> maximumPacketSize ||
+ * currentData < host -> receivedData ||
+ * currentData > & host -> receivedData [host -> receivedDataLength])
+ return -1;
+
+ channel = & peer -> channels [command -> header.channelID];
+ startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber);
+ startWindow = startSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+
+ if (startSequenceNumber < channel -> incomingReliableSequenceNumber)
+ startWindow += ENET_PEER_RELIABLE_WINDOWS;
+
+ if (startWindow < currentWindow || startWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1)
+ return 0;
+
+ fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber);
+ fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount);
+ fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset);
+ totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength);
+
+ if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT ||
+ fragmentNumber >= fragmentCount ||
+ totalLength > host -> maximumPacketSize ||
+ fragmentOffset >= totalLength ||
+ fragmentLength > totalLength - fragmentOffset)
+ return -1;
+
+ for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands));
+ currentCommand != enet_list_end (& channel -> incomingReliableCommands);
+ currentCommand = enet_list_previous (currentCommand))
+ {
+ ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if (startSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ continue;
+ }
+ else
+ if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber <= startSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < startSequenceNumber)
+ break;
+
+ if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_FRAGMENT ||
+ totalLength != incomingCommand -> packet -> dataLength ||
+ fragmentCount != incomingCommand -> fragmentCount)
+ return -1;
+
+ startCommand = incomingCommand;
+ break;
+ }
+ }
+
+ if (startCommand == NULL)
+ {
+ ENetProtocol hostCommand = * command;
+
+ hostCommand.header.reliableSequenceNumber = startSequenceNumber;
+
+ startCommand = enet_peer_queue_incoming_command (peer, & hostCommand, NULL, totalLength, ENET_PACKET_FLAG_RELIABLE, fragmentCount);
+ if (startCommand == NULL)
+ return -1;
+ }
+
+ if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0)
+ {
+ -- startCommand -> fragmentsRemaining;
+
+ startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32));
+
+ if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
+ fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
+
+ memcpy (startCommand -> packet -> data + fragmentOffset,
+ (enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
+ fragmentLength);
+
+ if (startCommand -> fragmentsRemaining <= 0)
+ enet_peer_dispatch_incoming_reliable_commands (peer, channel);
+ }
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData)
+{
+ enet_uint32 fragmentNumber,
+ fragmentCount,
+ fragmentOffset,
+ fragmentLength,
+ reliableSequenceNumber,
+ startSequenceNumber,
+ totalLength;
+ enet_uint16 reliableWindow, currentWindow;
+ ENetChannel * channel;
+ ENetListIterator currentCommand;
+ ENetIncomingCommand * startCommand = NULL;
+
+ if (command -> header.channelID >= peer -> channelCount ||
+ (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER))
+ return -1;
+
+ fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength);
+ * currentData += fragmentLength;
+ if (fragmentLength > host -> maximumPacketSize ||
+ * currentData < host -> receivedData ||
+ * currentData > & host -> receivedData [host -> receivedDataLength])
+ return -1;
+
+ channel = & peer -> channels [command -> header.channelID];
+ reliableSequenceNumber = command -> header.reliableSequenceNumber;
+ startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber);
+
+ reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+
+ if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ reliableWindow += ENET_PEER_RELIABLE_WINDOWS;
+
+ if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1)
+ return 0;
+
+ if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber &&
+ startSequenceNumber <= channel -> incomingUnreliableSequenceNumber)
+ return 0;
+
+ fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber);
+ fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount);
+ fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset);
+ totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength);
+
+ if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT ||
+ fragmentNumber >= fragmentCount ||
+ totalLength > host -> maximumPacketSize ||
+ fragmentOffset >= totalLength ||
+ fragmentLength > totalLength - fragmentOffset)
+ return -1;
+
+ for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands));
+ currentCommand != enet_list_end (& channel -> incomingUnreliableCommands);
+ currentCommand = enet_list_previous (currentCommand))
+ {
+ ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand;
+
+ if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ {
+ if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
+ continue;
+ }
+ else
+ if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber)
+ break;
+
+ if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber)
+ continue;
+
+ if (incomingCommand -> unreliableSequenceNumber <= startSequenceNumber)
+ {
+ if (incomingCommand -> unreliableSequenceNumber < startSequenceNumber)
+ break;
+
+ if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT ||
+ totalLength != incomingCommand -> packet -> dataLength ||
+ fragmentCount != incomingCommand -> fragmentCount)
+ return -1;
+
+ startCommand = incomingCommand;
+ break;
+ }
+ }
+
+ if (startCommand == NULL)
+ {
+ startCommand = enet_peer_queue_incoming_command (peer, command, NULL, totalLength, ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT, fragmentCount);
+ if (startCommand == NULL)
+ return -1;
+ }
+
+ if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0)
+ {
+ -- startCommand -> fragmentsRemaining;
+
+ startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32));
+
+ if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
+ fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
+
+ memcpy (startCommand -> packet -> data + fragmentOffset,
+ (enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
+ fragmentLength);
+
+ if (startCommand -> fragmentsRemaining <= 0)
+ enet_peer_dispatch_incoming_unreliable_commands (peer, channel);
+ }
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
+{
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ return -1;
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
+{
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ return -1;
+
+ if (peer -> incomingBandwidth != 0)
+ -- host -> bandwidthLimitedPeers;
+
+ peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth);
+ peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth);
+
+ if (peer -> incomingBandwidth != 0)
+ ++ host -> bandwidthLimitedPeers;
+
+ if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0)
+ peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+ else
+ if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0)
+ peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) /
+ ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) /
+ ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+
+ if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
+ peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+ else
+ if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
+ peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
+{
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ return -1;
+
+ peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval);
+ peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration);
+ peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration);
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
+{
+ if (peer -> state == ENET_PEER_STATE_DISCONNECTED || peer -> state == ENET_PEER_STATE_ZOMBIE || peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT)
+ return 0;
+
+ enet_peer_reset_queues (peer);
+
+ if (peer -> state == ENET_PEER_STATE_CONNECTION_SUCCEEDED || peer -> state == ENET_PEER_STATE_DISCONNECTING || peer -> state == ENET_PEER_STATE_CONNECTING)
+ enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE);
+ else
+ if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)
+ {
+ if (peer -> state == ENET_PEER_STATE_CONNECTION_PENDING) host -> recalculateBandwidthLimits = 1;
+
+ enet_peer_reset (peer);
+ }
+ else
+ if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE)
+ enet_protocol_change_state (host, peer, ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT);
+ else
+ enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE);
+
+ if (peer -> state != ENET_PEER_STATE_DISCONNECTED)
+ peer -> eventData = ENET_NET_TO_HOST_32 (command -> disconnect.data);
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command)
+{
+ enet_uint32 roundTripTime,
+ receivedSentTime,
+ receivedReliableSequenceNumber;
+ ENetProtocolCommand commandNumber;
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECTED || peer -> state == ENET_PEER_STATE_ZOMBIE)
+ return 0;
+
+ receivedSentTime = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedSentTime);
+ receivedSentTime |= host -> serviceTime & 0xFFFF0000;
+ if ((receivedSentTime & 0x8000) > (host -> serviceTime & 0x8000))
+ receivedSentTime -= 0x10000;
+
+ if (ENET_TIME_LESS (host -> serviceTime, receivedSentTime))
+ return 0;
+
+ peer -> lastReceiveTime = host -> serviceTime;
+ peer -> earliestTimeout = 0;
+
+ roundTripTime = ENET_TIME_DIFFERENCE (host -> serviceTime, receivedSentTime);
+
+ enet_peer_throttle (peer, roundTripTime);
+
+ peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4;
+
+ if (roundTripTime >= peer -> roundTripTime)
+ {
+ peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8;
+ peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4;
+ }
+ else
+ {
+ peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8;
+ peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4;
+ }
+
+ if (peer -> roundTripTime < peer -> lowestRoundTripTime)
+ peer -> lowestRoundTripTime = peer -> roundTripTime;
+
+ if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance)
+ peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance;
+
+ if (peer -> packetThrottleEpoch == 0 ||
+ ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval)
+ {
+ peer -> lastRoundTripTime = peer -> lowestRoundTripTime;
+ peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance;
+ peer -> lowestRoundTripTime = peer -> roundTripTime;
+ peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance;
+ peer -> packetThrottleEpoch = host -> serviceTime;
+ }
+
+ receivedReliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedReliableSequenceNumber);
+
+ commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID);
+
+ switch (peer -> state)
+ {
+ case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT:
+ if (commandNumber != ENET_PROTOCOL_COMMAND_VERIFY_CONNECT)
+ return -1;
+
+ enet_protocol_notify_connect (host, peer, event);
+ break;
+
+ case ENET_PEER_STATE_DISCONNECTING:
+ if (commandNumber != ENET_PROTOCOL_COMMAND_DISCONNECT)
+ return -1;
+
+ enet_protocol_notify_disconnect (host, peer, event);
+ break;
+
+ case ENET_PEER_STATE_DISCONNECT_LATER:
+ if (enet_list_empty (& peer -> outgoingReliableCommands) &&
+ enet_list_empty (& peer -> outgoingUnreliableCommands) &&
+ enet_list_empty (& peer -> sentReliableCommands))
+ enet_peer_disconnect (peer, peer -> eventData);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static int
+enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command)
+{
+ enet_uint32 mtu, windowSize;
+ size_t channelCount;
+
+ if (peer -> state != ENET_PEER_STATE_CONNECTING)
+ return 0;
+
+ channelCount = ENET_NET_TO_HOST_32 (command -> verifyConnect.channelCount);
+
+ if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT ||
+ ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleInterval) != peer -> packetThrottleInterval ||
+ ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleAcceleration) != peer -> packetThrottleAcceleration ||
+ ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleDeceleration) != peer -> packetThrottleDeceleration ||
+ command -> verifyConnect.connectID != peer -> connectID)
+ {
+ peer -> eventData = 0;
+
+ enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE);
+
+ return -1;
+ }
+
+ enet_protocol_remove_sent_reliable_command (peer, 1, 0xFF);
+
+ if (channelCount < peer -> channelCount)
+ peer -> channelCount = channelCount;
+
+ peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID);
+ peer -> incomingSessionID = command -> verifyConnect.incomingSessionID;
+ peer -> outgoingSessionID = command -> verifyConnect.outgoingSessionID;
+
+ mtu = ENET_NET_TO_HOST_32 (command -> verifyConnect.mtu);
+
+ if (mtu < ENET_PROTOCOL_MINIMUM_MTU)
+ mtu = ENET_PROTOCOL_MINIMUM_MTU;
+ else
+ if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
+ mtu = ENET_PROTOCOL_MAXIMUM_MTU;
+
+ if (mtu < peer -> mtu)
+ peer -> mtu = mtu;
+
+ windowSize = ENET_NET_TO_HOST_32 (command -> verifyConnect.windowSize);
+
+ if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
+ windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
+
+ if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
+ windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
+
+ if (windowSize < peer -> windowSize)
+ peer -> windowSize = windowSize;
+
+ peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.incomingBandwidth);
+ peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.outgoingBandwidth);
+
+ enet_protocol_notify_connect (host, peer, event);
+ return 0;
+}
+
+static int
+enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
+{
+ ENetProtocolHeader * header;
+ ENetProtocol * command;
+ ENetPeer * peer;
+ enet_uint8 * currentData;
+ size_t headerSize;
+ enet_uint16 peerID, flags;
+ enet_uint8 sessionID;
+
+ if (host -> receivedDataLength < (size_t) & ((ENetProtocolHeader *) 0) -> sentTime)
+ return 0;
+
+ header = (ENetProtocolHeader *) host -> receivedData;
+
+ peerID = ENET_NET_TO_HOST_16 (header -> peerID);
+ sessionID = (peerID & ENET_PROTOCOL_HEADER_SESSION_MASK) >> ENET_PROTOCOL_HEADER_SESSION_SHIFT;
+ flags = peerID & ENET_PROTOCOL_HEADER_FLAG_MASK;
+ peerID &= ~ (ENET_PROTOCOL_HEADER_FLAG_MASK | ENET_PROTOCOL_HEADER_SESSION_MASK);
+
+ headerSize = (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME ? sizeof (ENetProtocolHeader) : (size_t) & ((ENetProtocolHeader *) 0) -> sentTime);
+ if (host -> checksum != NULL)
+ headerSize += sizeof (enet_uint32);
+
+ if (peerID == ENET_PROTOCOL_MAXIMUM_PEER_ID)
+ peer = NULL;
+ else
+ if (peerID >= host -> peerCount)
+ return 0;
+ else
+ {
+ peer = & host -> peers [peerID];
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
+ peer -> state == ENET_PEER_STATE_ZOMBIE ||
+ ((host -> receivedAddress.host != peer -> address.host ||
+ host -> receivedAddress.port != peer -> address.port) &&
+ peer -> address.host != ENET_HOST_BROADCAST) ||
+ (peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID &&
+ sessionID != peer -> incomingSessionID))
+ return 0;
+ }
+
+ if (flags & ENET_PROTOCOL_HEADER_FLAG_COMPRESSED)
+ {
+ size_t originalSize;
+ if (host -> compressor.context == NULL || host -> compressor.decompress == NULL)
+ return 0;
+
+ originalSize = host -> compressor.decompress (host -> compressor.context,
+ host -> receivedData + headerSize,
+ host -> receivedDataLength - headerSize,
+ host -> packetData [1] + headerSize,
+ sizeof (host -> packetData [1]) - headerSize);
+ if (originalSize <= 0 || originalSize > sizeof (host -> packetData [1]) - headerSize)
+ return 0;
+
+ memcpy (host -> packetData [1], header, headerSize);
+ host -> receivedData = host -> packetData [1];
+ host -> receivedDataLength = headerSize + originalSize;
+ }
+
+ if (host -> checksum != NULL)
+ {
+ enet_uint32 * checksum = (enet_uint32 *) & host -> receivedData [headerSize - sizeof (enet_uint32)],
+ desiredChecksum = * checksum;
+ ENetBuffer buffer;
+
+ * checksum = peer != NULL ? peer -> connectID : 0;
+
+ buffer.data = host -> receivedData;
+ buffer.dataLength = host -> receivedDataLength;
+
+ if (host -> checksum (& buffer, 1) != desiredChecksum)
+ return 0;
+ }
+
+ if (peer != NULL)
+ {
+ peer -> address.host = host -> receivedAddress.host;
+ peer -> address.port = host -> receivedAddress.port;
+ peer -> incomingDataTotal += host -> receivedDataLength;
+ }
+
+ currentData = host -> receivedData + headerSize;
+
+ while (currentData < & host -> receivedData [host -> receivedDataLength])
+ {
+ enet_uint8 commandNumber;
+ size_t commandSize;
+
+ command = (ENetProtocol *) currentData;
+
+ if (currentData + sizeof (ENetProtocolCommandHeader) > & host -> receivedData [host -> receivedDataLength])
+ break;
+
+ commandNumber = command -> header.command & ENET_PROTOCOL_COMMAND_MASK;
+ if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT)
+ break;
+
+ commandSize = commandSizes [commandNumber];
+ if (commandSize == 0 || currentData + commandSize > & host -> receivedData [host -> receivedDataLength])
+ break;
+
+ currentData += commandSize;
+
+ if (peer == NULL && commandNumber != ENET_PROTOCOL_COMMAND_CONNECT)
+ break;
+
+ command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber);
+
+ switch (commandNumber)
+ {
+ case ENET_PROTOCOL_COMMAND_ACKNOWLEDGE:
+ if (enet_protocol_handle_acknowledge (host, event, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_CONNECT:
+ if (peer != NULL)
+ goto commandError;
+ peer = enet_protocol_handle_connect (host, header, command);
+ if (peer == NULL)
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_VERIFY_CONNECT:
+ if (enet_protocol_handle_verify_connect (host, event, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_DISCONNECT:
+ if (enet_protocol_handle_disconnect (host, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_PING:
+ if (enet_protocol_handle_ping (host, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
+ if (enet_protocol_handle_send_reliable (host, peer, command, & currentData))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
+ if (enet_protocol_handle_send_unreliable (host, peer, command, & currentData))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED:
+ if (enet_protocol_handle_send_unsequenced (host, peer, command, & currentData))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
+ if (enet_protocol_handle_send_fragment (host, peer, command, & currentData))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT:
+ if (enet_protocol_handle_bandwidth_limit (host, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE:
+ if (enet_protocol_handle_throttle_configure (host, peer, command))
+ goto commandError;
+ break;
+
+ case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT:
+ if (enet_protocol_handle_send_unreliable_fragment (host, peer, command, & currentData))
+ goto commandError;
+ break;
+
+ default:
+ goto commandError;
+ }
+
+ if (peer != NULL &&
+ (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) != 0)
+ {
+ enet_uint16 sentTime;
+
+ if (! (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME))
+ break;
+
+ sentTime = ENET_NET_TO_HOST_16 (header -> sentTime);
+
+ switch (peer -> state)
+ {
+ case ENET_PEER_STATE_DISCONNECTING:
+ case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT:
+ case ENET_PEER_STATE_DISCONNECTED:
+ case ENET_PEER_STATE_ZOMBIE:
+ break;
+
+ case ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT:
+ if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT)
+ enet_peer_queue_acknowledgement (peer, command, sentTime);
+ break;
+
+ default:
+ enet_peer_queue_acknowledgement (peer, command, sentTime);
+ break;
+ }
+ }
+ }
+
+commandError:
+ if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE)
+ return 1;
+
+ return 0;
+}
+
+static int
+enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
+{
+ int packets;
+
+ for (packets = 0; packets < 256; ++ packets)
+ {
+ int receivedLength;
+ ENetBuffer buffer;
+
+ buffer.data = host -> packetData [0];
+ buffer.dataLength = sizeof (host -> packetData [0]);
+
+ receivedLength = enet_socket_receive (host -> socket,
+ & host -> receivedAddress,
+ & buffer,
+ 1);
+
+ if (receivedLength < 0)
+ return -1;
+
+ if (receivedLength == 0)
+ return 0;
+
+ host -> receivedData = host -> packetData [0];
+ host -> receivedDataLength = receivedLength;
+
+ host -> totalReceivedData += receivedLength;
+ host -> totalReceivedPackets ++;
+
+ if (host -> intercept != NULL)
+ {
+ switch (host -> intercept (host, event))
+ {
+ case 1:
+ if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE)
+ return 1;
+
+ continue;
+
+ case -1:
+ return -1;
+
+ default:
+ break;
+ }
+ }
+
+ switch (enet_protocol_handle_incoming_commands (host, event))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+ return -1;
+
+ default:
+ break;
+ }
+ }
+
+ return -1;
+}
+
+static void
+enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer)
+{
+ ENetProtocol * command = & host -> commands [host -> commandCount];
+ ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
+ ENetAcknowledgement * acknowledgement;
+ ENetListIterator currentAcknowledgement;
+ enet_uint16 reliableSequenceNumber;
+
+ currentAcknowledgement = enet_list_begin (& peer -> acknowledgements);
+
+ while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements))
+ {
+ if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
+ buffer >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
+ peer -> mtu - host -> packetSize < sizeof (ENetProtocolAcknowledge))
+ {
+ host -> continueSending = 1;
+
+ break;
+ }
+
+ acknowledgement = (ENetAcknowledgement *) currentAcknowledgement;
+
+ currentAcknowledgement = enet_list_next (currentAcknowledgement);
+
+ buffer -> data = command;
+ buffer -> dataLength = sizeof (ENetProtocolAcknowledge);
+
+ host -> packetSize += buffer -> dataLength;
+
+ reliableSequenceNumber = ENET_HOST_TO_NET_16 (acknowledgement -> command.header.reliableSequenceNumber);
+
+ command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE;
+ command -> header.channelID = acknowledgement -> command.header.channelID;
+ command -> header.reliableSequenceNumber = reliableSequenceNumber;
+ command -> acknowledge.receivedReliableSequenceNumber = reliableSequenceNumber;
+ command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_16 (acknowledgement -> sentTime);
+
+ if ((acknowledgement -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT)
+ enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE);
+
+ enet_list_remove (& acknowledgement -> acknowledgementList);
+ enet_free (acknowledgement);
+
+ ++ command;
+ ++ buffer;
+ }
+
+ host -> commandCount = command - host -> commands;
+ host -> bufferCount = buffer - host -> buffers;
+}
+
+static void
+enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
+{
+ ENetProtocol * command = & host -> commands [host -> commandCount];
+ ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
+ ENetOutgoingCommand * outgoingCommand;
+ ENetListIterator currentCommand;
+
+ currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands);
+
+ while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands))
+ {
+ size_t commandSize;
+
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+ commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
+
+ if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
+ buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
+ peer -> mtu - host -> packetSize < commandSize ||
+ (outgoingCommand -> packet != NULL &&
+ peer -> mtu - host -> packetSize < commandSize + outgoingCommand -> fragmentLength))
+ {
+ host -> continueSending = 1;
+
+ break;
+ }
+
+ currentCommand = enet_list_next (currentCommand);
+
+ if (outgoingCommand -> packet != NULL && outgoingCommand -> fragmentOffset == 0)
+ {
+ peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER;
+ peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE;
+
+ if (peer -> packetThrottleCounter > peer -> packetThrottle)
+ {
+ enet_uint16 reliableSequenceNumber = outgoingCommand -> reliableSequenceNumber,
+ unreliableSequenceNumber = outgoingCommand -> unreliableSequenceNumber;
+ for (;;)
+ {
+ -- outgoingCommand -> packet -> referenceCount;
+
+ if (outgoingCommand -> packet -> referenceCount == 0)
+ enet_packet_destroy (outgoingCommand -> packet);
+
+ enet_list_remove (& outgoingCommand -> outgoingCommandList);
+ enet_free (outgoingCommand);
+
+ if (currentCommand == enet_list_end (& peer -> outgoingUnreliableCommands))
+ break;
+
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+ if (outgoingCommand -> reliableSequenceNumber != reliableSequenceNumber ||
+ outgoingCommand -> unreliableSequenceNumber != unreliableSequenceNumber)
+ break;
+
+ currentCommand = enet_list_next (currentCommand);
+ }
+
+ continue;
+ }
+ }
+
+ buffer -> data = command;
+ buffer -> dataLength = commandSize;
+
+ host -> packetSize += buffer -> dataLength;
+
+ * command = outgoingCommand -> command;
+
+ enet_list_remove (& outgoingCommand -> outgoingCommandList);
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ ++ buffer;
+
+ buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset;
+ buffer -> dataLength = outgoingCommand -> fragmentLength;
+
+ host -> packetSize += buffer -> dataLength;
+
+ enet_list_insert (enet_list_end (& peer -> sentUnreliableCommands), outgoingCommand);
+ }
+ else
+ enet_free (outgoingCommand);
+
+ ++ command;
+ ++ buffer;
+ }
+
+ host -> commandCount = command - host -> commands;
+ host -> bufferCount = buffer - host -> buffers;
+
+ if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER &&
+ enet_list_empty (& peer -> outgoingReliableCommands) &&
+ enet_list_empty (& peer -> outgoingUnreliableCommands) &&
+ enet_list_empty (& peer -> sentReliableCommands))
+ enet_peer_disconnect (peer, peer -> eventData);
+}
+
+static int
+enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * event)
+{
+ ENetOutgoingCommand * outgoingCommand;
+ ENetListIterator currentCommand, insertPosition;
+
+ currentCommand = enet_list_begin (& peer -> sentReliableCommands);
+ insertPosition = enet_list_begin (& peer -> outgoingReliableCommands);
+
+ while (currentCommand != enet_list_end (& peer -> sentReliableCommands))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+
+ currentCommand = enet_list_next (currentCommand);
+
+ if (ENET_TIME_DIFFERENCE (host -> serviceTime, outgoingCommand -> sentTime) < outgoingCommand -> roundTripTimeout)
+ continue;
+
+ if (peer -> earliestTimeout == 0 ||
+ ENET_TIME_LESS (outgoingCommand -> sentTime, peer -> earliestTimeout))
+ peer -> earliestTimeout = outgoingCommand -> sentTime;
+
+ if (peer -> earliestTimeout != 0 &&
+ (ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMaximum ||
+ (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit &&
+ ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMinimum)))
+ {
+ enet_protocol_notify_disconnect (host, peer, event);
+
+ return 1;
+ }
+
+ if (outgoingCommand -> packet != NULL)
+ peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
+
+ ++ peer -> packetsLost;
+
+ outgoingCommand -> roundTripTimeout *= 2;
+
+ enet_list_insert (insertPosition, enet_list_remove (& outgoingCommand -> outgoingCommandList));
+
+ if (currentCommand == enet_list_begin (& peer -> sentReliableCommands) &&
+ ! enet_list_empty (& peer -> sentReliableCommands))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+
+ peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout;
+ }
+ }
+
+ return 0;
+}
+
+static int
+enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
+{
+ ENetProtocol * command = & host -> commands [host -> commandCount];
+ ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
+ ENetOutgoingCommand * outgoingCommand;
+ ENetListIterator currentCommand;
+ ENetChannel *channel;
+ enet_uint16 reliableWindow;
+ size_t commandSize;
+ int windowExceeded = 0, windowWrap = 0, canPing = 1;
+
+ currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
+
+ while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands))
+ {
+ outgoingCommand = (ENetOutgoingCommand *) currentCommand;
+
+ channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
+ reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ if (channel != NULL)
+ {
+ if (! windowWrap &&
+ outgoingCommand -> sendAttempts < 1 &&
+ ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
+ (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
+ channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
+ (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOWS - reliableWindow)))))
+ windowWrap = 1;
+ if (windowWrap)
+ {
+ currentCommand = enet_list_next (currentCommand);
+
+ continue;
+ }
+ }
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ if (! windowExceeded)
+ {
+ enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
+
+ if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
+ windowExceeded = 1;
+ }
+ if (windowExceeded)
+ {
+ currentCommand = enet_list_next (currentCommand);
+
+ continue;
+ }
+ }
+
+ canPing = 0;
+
+ commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
+ if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
+ buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
+ peer -> mtu - host -> packetSize < commandSize ||
+ (outgoingCommand -> packet != NULL &&
+ (enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
+ {
+ host -> continueSending = 1;
+
+ break;
+ }
+
+ currentCommand = enet_list_next (currentCommand);
+
+ if (channel != NULL && outgoingCommand -> sendAttempts < 1)
+ {
+ channel -> usedReliableWindows |= 1 << reliableWindow;
+ ++ channel -> reliableWindows [reliableWindow];
+ }
+
+ ++ outgoingCommand -> sendAttempts;
+
+ if (outgoingCommand -> roundTripTimeout == 0)
+ {
+ outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance;
+ outgoingCommand -> roundTripTimeoutLimit = peer -> timeoutLimit * outgoingCommand -> roundTripTimeout;
+ }
+
+ if (enet_list_empty (& peer -> sentReliableCommands))
+ peer -> nextTimeout = host -> serviceTime + outgoingCommand -> roundTripTimeout;
+
+ enet_list_insert (enet_list_end (& peer -> sentReliableCommands),
+ enet_list_remove (& outgoingCommand -> outgoingCommandList));
+
+ outgoingCommand -> sentTime = host -> serviceTime;
+
+ buffer -> data = command;
+ buffer -> dataLength = commandSize;
+
+ host -> packetSize += buffer -> dataLength;
+ host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_SENT_TIME;
+
+ * command = outgoingCommand -> command;
+
+ if (outgoingCommand -> packet != NULL)
+ {
+ ++ buffer;
+
+ buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset;
+ buffer -> dataLength = outgoingCommand -> fragmentLength;
+
+ host -> packetSize += outgoingCommand -> fragmentLength;
+
+ peer -> reliableDataInTransit += outgoingCommand -> fragmentLength;
+ }
+
+ ++ peer -> packetsSent;
+
+ ++ command;
+ ++ buffer;
+ }
+
+ host -> commandCount = command - host -> commands;
+ host -> bufferCount = buffer - host -> buffers;
+
+ return canPing;
+}
+
+static int
+enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int checkForTimeouts)
+{
+ enet_uint8 headerData [sizeof (ENetProtocolHeader) + sizeof (enet_uint32)];
+ ENetProtocolHeader * header = (ENetProtocolHeader *) headerData;
+ ENetPeer * currentPeer;
+ int sentLength;
+ size_t shouldCompress = 0;
+
+ host -> continueSending = 1;
+
+ while (host -> continueSending)
+ for (host -> continueSending = 0,
+ currentPeer = host -> peers;
+ currentPeer < & host -> peers [host -> peerCount];
+ ++ currentPeer)
+ {
+ if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED ||
+ currentPeer -> state == ENET_PEER_STATE_ZOMBIE)
+ continue;
+
+ host -> headerFlags = 0;
+ host -> commandCount = 0;
+ host -> bufferCount = 1;
+ host -> packetSize = sizeof (ENetProtocolHeader);
+
+ if (! enet_list_empty (& currentPeer -> acknowledgements))
+ enet_protocol_send_acknowledgements (host, currentPeer);
+
+ if (checkForTimeouts != 0 &&
+ ! enet_list_empty (& currentPeer -> sentReliableCommands) &&
+ ENET_TIME_GREATER_EQUAL (host -> serviceTime, currentPeer -> nextTimeout) &&
+ enet_protocol_check_timeouts (host, currentPeer, event) == 1)
+ {
+ if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE)
+ return 1;
+ else
+ continue;
+ }
+
+ if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
+ enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
+ enet_list_empty (& currentPeer -> sentReliableCommands) &&
+ ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= currentPeer -> pingInterval &&
+ currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
+ {
+ enet_peer_ping (currentPeer);
+ enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
+ }
+
+ if (! enet_list_empty (& currentPeer -> outgoingUnreliableCommands))
+ enet_protocol_send_unreliable_outgoing_commands (host, currentPeer);
+
+ if (host -> commandCount == 0)
+ continue;
+
+ if (currentPeer -> packetLossEpoch == 0)
+ currentPeer -> packetLossEpoch = host -> serviceTime;
+ else
+ if (ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> packetLossEpoch) >= ENET_PEER_PACKET_LOSS_INTERVAL &&
+ currentPeer -> packetsSent > 0)
+ {
+ enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent;
+
+#ifdef ENET_DEBUG
+ printf ("peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0);
+#endif
+
+ currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4;
+
+ if (packetLoss >= currentPeer -> packetLoss)
+ {
+ currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8;
+ currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4;
+ }
+ else
+ {
+ currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8;
+ currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4;
+ }
+
+ currentPeer -> packetLossEpoch = host -> serviceTime;
+ currentPeer -> packetsSent = 0;
+ currentPeer -> packetsLost = 0;
+ }
+
+ host -> buffers -> data = headerData;
+ if (host -> headerFlags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME)
+ {
+ header -> sentTime = ENET_HOST_TO_NET_16 (host -> serviceTime & 0xFFFF);
+
+ host -> buffers -> dataLength = sizeof (ENetProtocolHeader);
+ }
+ else
+ host -> buffers -> dataLength = (size_t) & ((ENetProtocolHeader *) 0) -> sentTime;
+
+ shouldCompress = 0;
+ if (host -> compressor.context != NULL && host -> compressor.compress != NULL)
+ {
+ size_t originalSize = host -> packetSize - sizeof(ENetProtocolHeader),
+ compressedSize = host -> compressor.compress (host -> compressor.context,
+ & host -> buffers [1], host -> bufferCount - 1,
+ originalSize,
+ host -> packetData [1],
+ originalSize);
+ if (compressedSize > 0 && compressedSize < originalSize)
+ {
+ host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED;
+ shouldCompress = compressedSize;
+#ifdef ENET_DEBUG_COMPRESS
+ printf ("peer %u: compressed %u -> %u (%u%%)\n", currentPeer -> incomingPeerID, originalSize, compressedSize, (compressedSize * 100) / originalSize);
+#endif
+ }
+ }
+
+ if (currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID)
+ host -> headerFlags |= currentPeer -> outgoingSessionID << ENET_PROTOCOL_HEADER_SESSION_SHIFT;
+ header -> peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID | host -> headerFlags);
+ if (host -> checksum != NULL)
+ {
+ enet_uint32 * checksum = (enet_uint32 *) & headerData [host -> buffers -> dataLength];
+ * checksum = currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID ? currentPeer -> connectID : 0;
+ host -> buffers -> dataLength += sizeof (enet_uint32);
+ * checksum = host -> checksum (host -> buffers, host -> bufferCount);
+ }
+
+ if (shouldCompress > 0)
+ {
+ host -> buffers [1].data = host -> packetData [1];
+ host -> buffers [1].dataLength = shouldCompress;
+ host -> bufferCount = 2;
+ }
+
+ currentPeer -> lastSendTime = host -> serviceTime;
+
+ sentLength = enet_socket_send (host -> socket, & currentPeer -> address, host -> buffers, host -> bufferCount);
+
+ enet_protocol_remove_sent_unreliable_commands (currentPeer);
+
+ if (sentLength < 0)
+ return -1;
+
+ host -> totalSentData += sentLength;
+ host -> totalSentPackets ++;
+ }
+
+ return 0;
+}
+
+/** Sends any queued packets on the host specified to its designated peers.
+
+ @param host host to flush
+ @remarks this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to enet_host_service().
+ @ingroup host
+*/
+void
+enet_host_flush (ENetHost * host)
+{
+ host -> serviceTime = enet_time_get ();
+
+ enet_protocol_send_outgoing_commands (host, NULL, 0);
+}
+
+/** Checks for any queued events on the host and dispatches one if available.
+
+ @param host host to check for events
+ @param event an event structure where event details will be placed if available
+ @retval > 0 if an event was dispatched
+ @retval 0 if no events are available
+ @retval < 0 on failure
+ @ingroup host
+*/
+int
+enet_host_check_events (ENetHost * host, ENetEvent * event)
+{
+ if (event == NULL) return -1;
+
+ event -> type = ENET_EVENT_TYPE_NONE;
+ event -> peer = NULL;
+ event -> packet = NULL;
+
+ return enet_protocol_dispatch_incoming_commands (host, event);
+}
+
+/** Waits for events on the host specified and shuttles packets between
+ the host and its peers.
+
+ @param host host to service
+ @param event an event structure where event details will be placed if one occurs
+ if event == NULL then no events will be delivered
+ @param timeout number of milliseconds that ENet should wait for events
+ @retval > 0 if an event occurred within the specified time limit
+ @retval 0 if no event occurred
+ @retval < 0 on failure
+ @remarks enet_host_service should be called fairly regularly for adequate performance
+ @ingroup host
+*/
+int
+enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
+{
+ enet_uint32 waitCondition;
+
+ if (event != NULL)
+ {
+ event -> type = ENET_EVENT_TYPE_NONE;
+ event -> peer = NULL;
+ event -> packet = NULL;
+
+ switch (enet_protocol_dispatch_incoming_commands (host, event))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+#ifdef ENET_DEBUG
+ perror ("Error dispatching incoming packets");
+#endif
+
+ return -1;
+
+ default:
+ break;
+ }
+ }
+
+ host -> serviceTime = enet_time_get ();
+
+ timeout += host -> serviceTime;
+
+ do
+ {
+ if (ENET_TIME_DIFFERENCE (host -> serviceTime, host -> bandwidthThrottleEpoch) >= ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL)
+ enet_host_bandwidth_throttle (host);
+
+ switch (enet_protocol_send_outgoing_commands (host, event, 1))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+#ifdef ENET_DEBUG
+ perror ("Error sending outgoing packets");
+#endif
+
+ return -1;
+
+ default:
+ break;
+ }
+
+ switch (enet_protocol_receive_incoming_commands (host, event))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+#ifdef ENET_DEBUG
+ perror ("Error receiving incoming packets");
+#endif
+
+ return -1;
+
+ default:
+ break;
+ }
+
+ switch (enet_protocol_send_outgoing_commands (host, event, 1))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+#ifdef ENET_DEBUG
+ perror ("Error sending outgoing packets");
+#endif
+
+ return -1;
+
+ default:
+ break;
+ }
+
+ if (event != NULL)
+ {
+ switch (enet_protocol_dispatch_incoming_commands (host, event))
+ {
+ case 1:
+ return 1;
+
+ case -1:
+#ifdef ENET_DEBUG
+ perror ("Error dispatching incoming packets");
+#endif
+
+ return -1;
+
+ default:
+ break;
+ }
+ }
+
+ if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout))
+ return 0;
+
+ do
+ {
+ host -> serviceTime = enet_time_get ();
+
+ if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout))
+ return 0;
+
+ waitCondition = ENET_SOCKET_WAIT_RECEIVE | ENET_SOCKET_WAIT_INTERRUPT;
+
+ if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, host -> serviceTime)) != 0)
+ return -1;
+ }
+ while (waitCondition & ENET_SOCKET_WAIT_INTERRUPT);
+
+ host -> serviceTime = enet_time_get ();
+ } while (waitCondition & ENET_SOCKET_WAIT_RECEIVE);
+
+ return 0;
+}
+
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
new file mode 100644
index 0000000000..630b76ced8
--- /dev/null
+++ b/modules/enet/register_types.cpp
@@ -0,0 +1,51 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+#include "error_macros.h"
+#include "networked_multiplayer_enet.h"
+
+static bool enet_ok=false;
+
+void register_enet_types() {
+
+ if (enet_initialize() !=0 ) {
+ ERR_PRINT("ENet initialization failure");
+ } else {
+ enet_ok=true;
+ }
+
+ ObjectTypeDB::register_type<NetworkedMultiplayerENet>();
+}
+
+void unregister_enet_types() {
+
+ if (enet_ok)
+ enet_deinitialize();
+
+}
diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h
new file mode 100644
index 0000000000..50f34dc67f
--- /dev/null
+++ b/modules/enet/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_enet_types();
+void unregister_enet_types();
diff --git a/modules/enet/unix.c b/modules/enet/unix.c
new file mode 100644
index 0000000000..3138cc04b6
--- /dev/null
+++ b/modules/enet/unix.c
@@ -0,0 +1,616 @@
+/**
+ @file unix.c
+ @brief ENet Unix system specific functions
+*/
+#ifndef _WIN32
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
+#define ENET_BUILDING_LIB 1
+#include "enet/enet.h"
+
+//@godot: added this since enet takes them fromt he build system
+#define HAS_POLL
+#define HAS_FCNTL
+#define HAS_SOCKLEN_T
+
+
+#ifdef __APPLE__
+#ifdef HAS_POLL
+#undef HAS_POLL
+#endif
+#ifndef HAS_FCNTL
+#define HAS_FCNTL 1
+#endif
+#ifndef HAS_INET_PTON
+#define HAS_INET_PTON 1
+#endif
+#ifndef HAS_INET_NTOP
+#define HAS_INET_NTOP 1
+#endif
+#ifndef HAS_MSGHDR_FLAGS
+#define HAS_MSGHDR_FLAGS 1
+#endif
+#ifndef HAS_SOCKLEN_T
+#define HAS_SOCKLEN_T 1
+#endif
+#ifndef HAS_GETADDRINFO
+#define HAS_GETADDRINFO 1
+#endif
+#ifndef HAS_GETNAMEINFO
+#define HAS_GETNAMEINFO 1
+#endif
+#endif
+
+#ifdef HAS_FCNTL
+#include <fcntl.h>
+#endif
+
+#ifdef HAS_POLL
+#include <sys/poll.h>
+#endif
+
+#ifndef HAS_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
+static enet_uint32 timeBase = 0;
+
+int
+enet_initialize (void)
+{
+ return 0;
+}
+
+void
+enet_deinitialize (void)
+{
+}
+
+enet_uint32
+enet_host_random_seed (void)
+{
+ return (enet_uint32) time (NULL);
+}
+
+enet_uint32
+enet_time_get (void)
+{
+ struct timeval timeVal;
+
+ gettimeofday (& timeVal, NULL);
+
+ return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase;
+}
+
+void
+enet_time_set (enet_uint32 newTimeBase)
+{
+ struct timeval timeVal;
+
+ gettimeofday (& timeVal, NULL);
+
+ timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase;
+}
+
+int
+enet_address_set_host (ENetAddress * address, const char * name)
+{
+#ifdef HAS_GETADDRINFO
+ struct addrinfo hints, * resultList = NULL, * result = NULL;
+
+ memset (& hints, 0, sizeof (hints));
+ hints.ai_family = AF_INET;
+
+ if (getaddrinfo (name, NULL, NULL, & resultList) != 0)
+ return -1;
+
+ for (result = resultList; result != NULL; result = result -> ai_next)
+ {
+ if (result -> ai_family == AF_INET && result -> ai_addr != NULL && result -> ai_addrlen >= sizeof (struct sockaddr_in))
+ {
+ struct sockaddr_in * sin = (struct sockaddr_in *) result -> ai_addr;
+
+ address -> host = sin -> sin_addr.s_addr;
+
+ freeaddrinfo (resultList);
+
+ return 0;
+ }
+ }
+
+ if (resultList != NULL)
+ freeaddrinfo (resultList);
+#else
+ struct hostent * hostEntry = NULL;
+#ifdef HAS_GETHOSTBYNAME_R
+ struct hostent hostData;
+ char buffer [2048];
+ int errnum;
+
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
+#else
+ hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum);
+#endif
+#else
+ hostEntry = gethostbyname (name);
+#endif
+
+ if (hostEntry != NULL && hostEntry -> h_addrtype == AF_INET)
+ {
+ address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0];
+
+ return 0;
+ }
+#endif
+
+#ifdef HAS_INET_PTON
+ if (! inet_pton (AF_INET, name, & address -> host))
+#else
+ if (! inet_aton (name, (struct in_addr *) & address -> host))
+#endif
+ return -1;
+
+ return 0;
+}
+
+int
+enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
+{
+#ifdef HAS_INET_NTOP
+ if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL)
+#else
+ char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
+ if (addr != NULL)
+ {
+ size_t addrLen = strlen(addr);
+ if (addrLen >= nameLength)
+ return -1;
+ memcpy (name, addr, addrLen + 1);
+ }
+ else
+#endif
+ return -1;
+ return 0;
+}
+
+int
+enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
+{
+#ifdef HAS_GETNAMEINFO
+ struct sockaddr_in sin;
+ int err;
+
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+
+ err = getnameinfo ((struct sockaddr *) & sin, sizeof (sin), name, nameLength, NULL, 0, NI_NAMEREQD);
+ if (! err)
+ {
+ if (name != NULL && nameLength > 0 && ! memchr (name, '\0', nameLength))
+ return -1;
+ return 0;
+ }
+ if (err != EAI_NONAME)
+ return -1;
+#else
+ struct in_addr in;
+ struct hostent * hostEntry = NULL;
+#ifdef HAS_GETHOSTBYADDR_R
+ struct hostent hostData;
+ char buffer [2048];
+ int errnum;
+
+ in.s_addr = address -> host;
+
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
+#else
+ hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum);
+#endif
+#else
+ in.s_addr = address -> host;
+
+ hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
+#endif
+
+ if (hostEntry != NULL)
+ {
+ size_t hostLen = strlen (hostEntry -> h_name);
+ if (hostLen >= nameLength)
+ return -1;
+ memcpy (name, hostEntry -> h_name, hostLen + 1);
+ return 0;
+ }
+#endif
+
+ return enet_address_get_host_ip (address, name, nameLength);
+}
+
+int
+enet_socket_bind (ENetSocket socket, const ENetAddress * address)
+{
+ struct sockaddr_in sin;
+
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+
+ if (address != NULL)
+ {
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+ }
+ else
+ {
+ sin.sin_port = 0;
+ sin.sin_addr.s_addr = INADDR_ANY;
+ }
+
+ return bind (socket,
+ (struct sockaddr *) & sin,
+ sizeof (struct sockaddr_in));
+}
+
+int
+enet_socket_get_address (ENetSocket socket, ENetAddress * address)
+{
+ struct sockaddr_in sin;
+ socklen_t sinLength = sizeof (struct sockaddr_in);
+
+ if (getsockname (socket, (struct sockaddr *) & sin, & sinLength) == -1)
+ return -1;
+
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+
+ return 0;
+}
+
+int
+enet_socket_listen (ENetSocket socket, int backlog)
+{
+ return listen (socket, backlog < 0 ? SOMAXCONN : backlog);
+}
+
+ENetSocket
+enet_socket_create (ENetSocketType type)
+{
+ return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0);
+}
+
+int
+enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
+{
+ int result = -1;
+ switch (option)
+ {
+ case ENET_SOCKOPT_NONBLOCK:
+#ifdef HAS_FCNTL
+ result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
+#else
+ result = ioctl (socket, FIONBIO, & value);
+#endif
+ break;
+
+ case ENET_SOCKOPT_BROADCAST:
+ result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_REUSEADDR:
+ result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_RCVBUF:
+ result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_SNDBUF:
+ result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_RCVTIMEO:
+ {
+ struct timeval timeVal;
+ timeVal.tv_sec = value / 1000;
+ timeVal.tv_usec = (value % 1000) * 1000;
+ result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & timeVal, sizeof (struct timeval));
+ break;
+ }
+
+ case ENET_SOCKOPT_SNDTIMEO:
+ {
+ struct timeval timeVal;
+ timeVal.tv_sec = value / 1000;
+ timeVal.tv_usec = (value % 1000) * 1000;
+ result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & timeVal, sizeof (struct timeval));
+ break;
+ }
+
+ case ENET_SOCKOPT_NODELAY:
+ result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int));
+ break;
+
+ default:
+ break;
+ }
+ return result == -1 ? -1 : 0;
+}
+
+int
+enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
+{
+ int result = -1;
+ socklen_t len;
+ switch (option)
+ {
+ case ENET_SOCKOPT_ERROR:
+ len = sizeof (int);
+ result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len);
+ break;
+
+ default:
+ break;
+ }
+ return result == -1 ? -1 : 0;
+}
+
+int
+enet_socket_connect (ENetSocket socket, const ENetAddress * address)
+{
+ struct sockaddr_in sin;
+ int result;
+
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+
+ result = connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in));
+ if (result == -1 && errno == EINPROGRESS)
+ return 0;
+
+ return result;
+}
+
+ENetSocket
+enet_socket_accept (ENetSocket socket, ENetAddress * address)
+{
+ int result;
+ struct sockaddr_in sin;
+ socklen_t sinLength = sizeof (struct sockaddr_in);
+
+ result = accept (socket,
+ address != NULL ? (struct sockaddr *) & sin : NULL,
+ address != NULL ? & sinLength : NULL);
+
+ if (result == -1)
+ return ENET_SOCKET_NULL;
+
+ if (address != NULL)
+ {
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+ }
+
+ return result;
+}
+
+int
+enet_socket_shutdown (ENetSocket socket, ENetSocketShutdown how)
+{
+ return shutdown (socket, (int) how);
+}
+
+void
+enet_socket_destroy (ENetSocket socket)
+{
+ if (socket != -1)
+ close (socket);
+}
+
+int
+enet_socket_send (ENetSocket socket,
+ const ENetAddress * address,
+ const ENetBuffer * buffers,
+ size_t bufferCount)
+{
+ struct msghdr msgHdr;
+ struct sockaddr_in sin;
+ int sentLength;
+
+ memset (& msgHdr, 0, sizeof (struct msghdr));
+
+ if (address != NULL)
+ {
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+
+ msgHdr.msg_name = & sin;
+ msgHdr.msg_namelen = sizeof (struct sockaddr_in);
+ }
+
+ msgHdr.msg_iov = (struct iovec *) buffers;
+ msgHdr.msg_iovlen = bufferCount;
+
+ sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL);
+
+ if (sentLength == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+
+ return sentLength;
+}
+
+int
+enet_socket_receive (ENetSocket socket,
+ ENetAddress * address,
+ ENetBuffer * buffers,
+ size_t bufferCount)
+{
+ struct msghdr msgHdr;
+ struct sockaddr_in sin;
+ int recvLength;
+
+ memset (& msgHdr, 0, sizeof (struct msghdr));
+
+ if (address != NULL)
+ {
+ msgHdr.msg_name = & sin;
+ msgHdr.msg_namelen = sizeof (struct sockaddr_in);
+ }
+
+ msgHdr.msg_iov = (struct iovec *) buffers;
+ msgHdr.msg_iovlen = bufferCount;
+
+ recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL);
+
+ if (recvLength == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+
+#ifdef HAS_MSGHDR_FLAGS
+ if (msgHdr.msg_flags & MSG_TRUNC)
+ return -1;
+#endif
+
+ if (address != NULL)
+ {
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+ }
+
+ return recvLength;
+}
+
+int
+enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout)
+{
+ struct timeval timeVal;
+
+ timeVal.tv_sec = timeout / 1000;
+ timeVal.tv_usec = (timeout % 1000) * 1000;
+
+ return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal);
+}
+
+int
+enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout)
+{
+#ifdef HAS_POLL
+ struct pollfd pollSocket;
+ int pollCount;
+
+ pollSocket.fd = socket;
+ pollSocket.events = 0;
+
+ if (* condition & ENET_SOCKET_WAIT_SEND)
+ pollSocket.events |= POLLOUT;
+
+ if (* condition & ENET_SOCKET_WAIT_RECEIVE)
+ pollSocket.events |= POLLIN;
+
+ pollCount = poll (& pollSocket, 1, timeout);
+
+ if (pollCount < 0)
+ {
+ if (errno == EINTR && * condition & ENET_SOCKET_WAIT_INTERRUPT)
+ {
+ * condition = ENET_SOCKET_WAIT_INTERRUPT;
+
+ return 0;
+ }
+
+ return -1;
+ }
+
+ * condition = ENET_SOCKET_WAIT_NONE;
+
+ if (pollCount == 0)
+ return 0;
+
+ if (pollSocket.revents & POLLOUT)
+ * condition |= ENET_SOCKET_WAIT_SEND;
+
+ if (pollSocket.revents & POLLIN)
+ * condition |= ENET_SOCKET_WAIT_RECEIVE;
+
+ return 0;
+#else
+ fd_set readSet, writeSet;
+ struct timeval timeVal;
+ int selectCount;
+
+ timeVal.tv_sec = timeout / 1000;
+ timeVal.tv_usec = (timeout % 1000) * 1000;
+
+ FD_ZERO (& readSet);
+ FD_ZERO (& writeSet);
+
+ if (* condition & ENET_SOCKET_WAIT_SEND)
+ FD_SET (socket, & writeSet);
+
+ if (* condition & ENET_SOCKET_WAIT_RECEIVE)
+ FD_SET (socket, & readSet);
+
+ selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal);
+
+ if (selectCount < 0)
+ {
+ if (errno == EINTR && * condition & ENET_SOCKET_WAIT_INTERRUPT)
+ {
+ * condition = ENET_SOCKET_WAIT_INTERRUPT;
+
+ return 0;
+ }
+
+ return -1;
+ }
+
+ * condition = ENET_SOCKET_WAIT_NONE;
+
+ if (selectCount == 0)
+ return 0;
+
+ if (FD_ISSET (socket, & writeSet))
+ * condition |= ENET_SOCKET_WAIT_SEND;
+
+ if (FD_ISSET (socket, & readSet))
+ * condition |= ENET_SOCKET_WAIT_RECEIVE;
+
+ return 0;
+#endif
+}
+
+#endif
+
diff --git a/modules/enet/win32.c b/modules/enet/win32.c
new file mode 100644
index 0000000000..d77fa9a49a
--- /dev/null
+++ b/modules/enet/win32.c
@@ -0,0 +1,422 @@
+/**
+ @file win32.c
+ @brief ENet Win32 system specific functions
+*/
+#ifdef _WIN32
+
+#define ENET_BUILDING_LIB 0
+#include "enet/enet.h"
+#include <windows.h>
+#include <mmsystem.h>
+
+static enet_uint32 timeBase = 0;
+
+int
+enet_initialize (void)
+{
+ WORD versionRequested = MAKEWORD (1, 1);
+ WSADATA wsaData;
+
+ if (WSAStartup (versionRequested, & wsaData))
+ return -1;
+
+ if (LOBYTE (wsaData.wVersion) != 1||
+ HIBYTE (wsaData.wVersion) != 1)
+ {
+ WSACleanup ();
+
+ return -1;
+ }
+
+ timeBeginPeriod (1);
+
+ return 0;
+}
+
+void
+enet_deinitialize (void)
+{
+ timeEndPeriod (1);
+
+ WSACleanup ();
+}
+
+enet_uint32
+enet_host_random_seed (void)
+{
+ return (enet_uint32) timeGetTime ();
+}
+
+enet_uint32
+enet_time_get (void)
+{
+ return (enet_uint32) timeGetTime () - timeBase;
+}
+
+void
+enet_time_set (enet_uint32 newTimeBase)
+{
+ timeBase = (enet_uint32) timeGetTime () - newTimeBase;
+}
+
+int
+enet_address_set_host (ENetAddress * address, const char * name)
+{
+ struct hostent * hostEntry;
+
+ hostEntry = gethostbyname (name);
+ if (hostEntry == NULL ||
+ hostEntry -> h_addrtype != AF_INET)
+ {
+ unsigned long host = inet_addr (name);
+ if (host == INADDR_NONE)
+ return -1;
+ address -> host = host;
+ return 0;
+ }
+
+ address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0];
+
+ return 0;
+}
+
+int
+enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
+{
+ char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
+ if (addr == NULL)
+ return -1;
+ else
+ {
+ size_t addrLen = strlen(addr);
+ if (addrLen >= nameLength)
+ return -1;
+ memcpy (name, addr, addrLen + 1);
+ }
+ return 0;
+}
+
+int
+enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
+{
+ struct in_addr in;
+ struct hostent * hostEntry;
+
+ in.s_addr = address -> host;
+
+ hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
+ if (hostEntry == NULL)
+ return enet_address_get_host_ip (address, name, nameLength);
+ else
+ {
+ size_t hostLen = strlen (hostEntry -> h_name);
+ if (hostLen >= nameLength)
+ return -1;
+ memcpy (name, hostEntry -> h_name, hostLen + 1);
+ }
+
+ return 0;
+}
+
+int
+enet_socket_bind (ENetSocket socket, const ENetAddress * address)
+{
+ struct sockaddr_in sin;
+
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+
+ if (address != NULL)
+ {
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+ }
+ else
+ {
+ sin.sin_port = 0;
+ sin.sin_addr.s_addr = INADDR_ANY;
+ }
+
+ return bind (socket,
+ (struct sockaddr *) & sin,
+ sizeof (struct sockaddr_in)) == SOCKET_ERROR ? -1 : 0;
+}
+
+int
+enet_socket_get_address (ENetSocket socket, ENetAddress * address)
+{
+ struct sockaddr_in sin;
+ int sinLength = sizeof (struct sockaddr_in);
+
+ if (getsockname (socket, (struct sockaddr *) & sin, & sinLength) == -1)
+ return -1;
+
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+
+ return 0;
+}
+
+int
+enet_socket_listen (ENetSocket socket, int backlog)
+{
+ return listen (socket, backlog < 0 ? SOMAXCONN : backlog) == SOCKET_ERROR ? -1 : 0;
+}
+
+ENetSocket
+enet_socket_create (ENetSocketType type)
+{
+ return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0);
+}
+
+int
+enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
+{
+ int result = SOCKET_ERROR;
+ switch (option)
+ {
+ case ENET_SOCKOPT_NONBLOCK:
+ {
+ u_long nonBlocking = (u_long) value;
+ result = ioctlsocket (socket, FIONBIO, & nonBlocking);
+ break;
+ }
+
+ case ENET_SOCKOPT_BROADCAST:
+ result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_REUSEADDR:
+ result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_RCVBUF:
+ result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_SNDBUF:
+ result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_RCVTIMEO:
+ result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_SNDTIMEO:
+ result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & value, sizeof (int));
+ break;
+
+ case ENET_SOCKOPT_NODELAY:
+ result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int));
+ break;
+
+ default:
+ break;
+ }
+ return result == SOCKET_ERROR ? -1 : 0;
+}
+
+int
+enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
+{
+ int result = SOCKET_ERROR, len;
+ switch (option)
+ {
+ case ENET_SOCKOPT_ERROR:
+ len = sizeof(int);
+ result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, & len);
+ break;
+
+ default:
+ break;
+ }
+ return result == SOCKET_ERROR ? -1 : 0;
+}
+
+int
+enet_socket_connect (ENetSocket socket, const ENetAddress * address)
+{
+ struct sockaddr_in sin;
+ int result;
+
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+
+ result = connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in));
+ if (result == SOCKET_ERROR && WSAGetLastError () != WSAEWOULDBLOCK)
+ return -1;
+
+ return 0;
+}
+
+ENetSocket
+enet_socket_accept (ENetSocket socket, ENetAddress * address)
+{
+ SOCKET result;
+ struct sockaddr_in sin;
+ int sinLength = sizeof (struct sockaddr_in);
+
+ result = accept (socket,
+ address != NULL ? (struct sockaddr *) & sin : NULL,
+ address != NULL ? & sinLength : NULL);
+
+ if (result == INVALID_SOCKET)
+ return ENET_SOCKET_NULL;
+
+ if (address != NULL)
+ {
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+ }
+
+ return result;
+}
+
+int
+enet_socket_shutdown (ENetSocket socket, ENetSocketShutdown how)
+{
+ return shutdown (socket, (int) how) == SOCKET_ERROR ? -1 : 0;
+}
+
+void
+enet_socket_destroy (ENetSocket socket)
+{
+ if (socket != INVALID_SOCKET)
+ closesocket (socket);
+}
+
+int
+enet_socket_send (ENetSocket socket,
+ const ENetAddress * address,
+ const ENetBuffer * buffers,
+ size_t bufferCount)
+{
+ struct sockaddr_in sin;
+ DWORD sentLength;
+
+ if (address != NULL)
+ {
+ memset (& sin, 0, sizeof (struct sockaddr_in));
+
+ sin.sin_family = AF_INET;
+ sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
+ sin.sin_addr.s_addr = address -> host;
+ }
+
+ if (WSASendTo (socket,
+ (LPWSABUF) buffers,
+ (DWORD) bufferCount,
+ & sentLength,
+ 0,
+ address != NULL ? (struct sockaddr *) & sin : NULL,
+ address != NULL ? sizeof (struct sockaddr_in) : 0,
+ NULL,
+ NULL) == SOCKET_ERROR)
+ {
+ if (WSAGetLastError () == WSAEWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+
+ return (int) sentLength;
+}
+
+int
+enet_socket_receive (ENetSocket socket,
+ ENetAddress * address,
+ ENetBuffer * buffers,
+ size_t bufferCount)
+{
+ INT sinLength = sizeof (struct sockaddr_in);
+ DWORD flags = 0,
+ recvLength;
+ struct sockaddr_in sin;
+
+ if (WSARecvFrom (socket,
+ (LPWSABUF) buffers,
+ (DWORD) bufferCount,
+ & recvLength,
+ & flags,
+ address != NULL ? (struct sockaddr *) & sin : NULL,
+ address != NULL ? & sinLength : NULL,
+ NULL,
+ NULL) == SOCKET_ERROR)
+ {
+ switch (WSAGetLastError ())
+ {
+ case WSAEWOULDBLOCK:
+ case WSAECONNRESET:
+ return 0;
+ }
+
+ return -1;
+ }
+
+ if (flags & MSG_PARTIAL)
+ return -1;
+
+ if (address != NULL)
+ {
+ address -> host = (enet_uint32) sin.sin_addr.s_addr;
+ address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
+ }
+
+ return (int) recvLength;
+}
+
+int
+enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout)
+{
+ struct timeval timeVal;
+
+ timeVal.tv_sec = timeout / 1000;
+ timeVal.tv_usec = (timeout % 1000) * 1000;
+
+ return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal);
+}
+
+int
+enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout)
+{
+ fd_set readSet, writeSet;
+ struct timeval timeVal;
+ int selectCount;
+
+ timeVal.tv_sec = timeout / 1000;
+ timeVal.tv_usec = (timeout % 1000) * 1000;
+
+ FD_ZERO (& readSet);
+ FD_ZERO (& writeSet);
+
+ if (* condition & ENET_SOCKET_WAIT_SEND)
+ FD_SET (socket, & writeSet);
+
+ if (* condition & ENET_SOCKET_WAIT_RECEIVE)
+ FD_SET (socket, & readSet);
+
+ selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal);
+
+ if (selectCount < 0)
+ return -1;
+
+ * condition = ENET_SOCKET_WAIT_NONE;
+
+ if (selectCount == 0)
+ return 0;
+
+ if (FD_ISSET (socket, & writeSet))
+ * condition |= ENET_SOCKET_WAIT_SEND;
+
+ if (FD_ISSET (socket, & readSet))
+ * condition |= ENET_SOCKET_WAIT_RECEIVE;
+
+ return 0;
+}
+
+#endif
+
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 68c3dc98d3..ce8b6a6ea4 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1297,8 +1297,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
gdfunc = p_script->member_functions[func_name];
//}
- if (p_func)
+ if (p_func) {
gdfunc->_static=p_func->_static;
+ gdfunc->rpc_mode=p_func->rpc_mode;
+ }
#ifdef TOOLS_ENABLED
gdfunc->arg_names=argnames;
@@ -1625,6 +1627,8 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
minfo.index = p_script->member_indices.size();
minfo.setter = p_class->variables[i].setter;
minfo.getter = p_class->variables[i].getter;
+ minfo.rpc_mode=p_class->variables[i].rpc_mode;
+
p_script->member_indices[name]=minfo;
p_script->members.insert(name);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index 2e5fb82f37..5b74dab889 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -1463,7 +1463,7 @@ static void _make_function_hint(const GDParser::FunctionNode* p_func,int p_argid
}
-static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const StringName& p_method,const GDCompletionIdentifier& id, int p_argidx, Set<String>& result, String& arghint) {
+static void _find_type_arguments(GDCompletionContext& context,const GDParser::Node*p_node,int p_line,const StringName& p_method,const GDCompletionIdentifier& id, int p_argidx, Set<String>& result, String& arghint) {
//print_line("find type arguments?");
@@ -1700,9 +1700,31 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
if (p_argidx==0) {
List<MethodInfo> sigs;
ObjectTypeDB::get_signal_list(id.obj_type,&sigs);
+
+ if (id.script.is_valid()) {
+ id.script->get_script_signal_list(&sigs);
+ } else if (id.value.get_type()==Variant::OBJECT) {
+ Object *obj = id.value;
+ if (obj && !obj->get_script().is_null()) {
+ Ref<Script> scr=obj->get_script();
+ if (scr.is_valid()) {
+ scr->get_script_signal_list(&sigs);
+ }
+ }
+ }
+
for (List<MethodInfo>::Element *E=sigs.front();E;E=E->next()) {
result.insert("\""+E->get().name+"\"");
}
+
+ } else if (p_argidx==2){
+
+
+ if (context._class) {
+ for(int i=0;i<context._class->functions.size();i++) {
+ result.insert("\""+context._class->functions[i]->name+"\"");
+ }
+ }
}
/*if (p_argidx==2) {
@@ -1944,7 +1966,7 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
if (!context._class->owner)
ci.value=context.base;
- _find_type_arguments(p_node,p_line,id->name,ci,p_argidx,result,arghint);
+ _find_type_arguments(context,p_node,p_line,id->name,ci,p_argidx,result,arghint);
//guess type..
/*
List<MethodInfo> methods;
@@ -1967,7 +1989,7 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
GDCompletionIdentifier ci;
if (_guess_expression_type(context,op->arguments[0],p_line,ci)) {
- _find_type_arguments(p_node,p_line,id->name,ci,p_argidx,result,arghint);
+ _find_type_arguments(context,p_node,p_line,id->name,ci,p_argidx,result,arghint);
return;
}
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index 47d8f0b40f..b2cc6341c1 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -1309,6 +1309,7 @@ GDFunction::GDFunction() : function_list(this) {
_stack_size=0;
_call_size=0;
+ rpc_mode=ScriptInstance::RPC_MODE_DISABLED;
name="<anonymous>";
#ifdef DEBUG_ENABLED
_func_cname=NULL;
diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h
index e09c6509dd..f1c5b13ca1 100644
--- a/modules/gdscript/gd_function.h
+++ b/modules/gdscript/gd_function.h
@@ -7,6 +7,7 @@
#include "variant.h"
#include "string_db.h"
#include "reference.h"
+#include "script_language.h"
class GDInstance;
class GDScript;
@@ -64,6 +65,14 @@ public:
ADDR_TYPE_NIL=8
};
+ enum RPCMode {
+ RPC_DISABLED,
+ RPC_ENABLED,
+ RPC_SYNC,
+ RPC_SYNC_MASTER,
+ RPC_SYNC_SLAVE
+ };
+
struct StackDebug {
int line;
@@ -91,6 +100,8 @@ friend class GDCompiler;
int _call_size;
int _initial_line;
bool _static;
+ ScriptInstance::RPCMode rpc_mode;
+
GDScript *_script;
StringName name;
@@ -185,6 +196,7 @@ public:
Variant call(GDInstance *p_instance,const Variant **p_args, int p_argcount,Variant::CallError& r_err,CallState *p_state=NULL);
+ _FORCE_INLINE_ ScriptInstance::RPCMode get_rpc_mode() const { return rpc_mode; }
GDFunction();
~GDFunction();
};
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index a6794564db..e5a8dc0152 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -2075,6 +2075,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
if (error_set)
return;
+
if (indent_level>tab_level.back()->get()) {
p_class->end_line=tokenizer->get_token_line();
return; //go back a level
@@ -2371,6 +2372,9 @@ void GDParser::_parse_class(ClassNode *p_class) {
function->_static=_static;
function->line=fnline;
+ function->rpc_mode=rpc_mode;
+ rpc_mode=ScriptInstance::RPC_MODE_DISABLED;
+
if (_static)
p_class->static_functions.push_back(function);
@@ -2842,25 +2846,101 @@ void GDParser::_parse_class(ClassNode *p_class) {
}
- if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR && tokenizer->get_token()!=GDTokenizer::TK_PR_ONREADY && tokenizer->get_token()!=GDTokenizer::TK_PR_REMOTE && tokenizer->get_token()!=GDTokenizer::TK_PR_MASTER && tokenizer->get_token()!=GDTokenizer::TK_PR_SLAVE && tokenizer->get_token()!=GDTokenizer::TK_PR_SYNC) {
current_export=PropertyInfo();
- _set_error("Expected 'var'.");
+ _set_error("Expected 'var', 'onready', 'remote', 'master', 'slave' or 'sync'.");
return;
}
- }; //fallthrough to var
+ continue;
+ } break;
case GDTokenizer::TK_PR_ONREADY: {
- if (token==GDTokenizer::TK_PR_ONREADY) {
- //may be fallthrough from export, ignore if so
- tokenizer->advance();
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) {
+ _set_error("Expected 'var'.");
+ return;
+ }
+
+ continue;
+ } break;
+ case GDTokenizer::TK_PR_REMOTE: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (current_export.type) {
if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) {
_set_error("Expected 'var'.");
return;
}
+
+ } else {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR && tokenizer->get_token()!=GDTokenizer::TK_PR_FUNCTION) {
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
}
- }; //fallthrough to var
+ rpc_mode=ScriptInstance::RPC_MODE_REMOTE;
+
+ continue;
+ } break;
+ case GDTokenizer::TK_PR_MASTER: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (current_export.type) {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) {
+ _set_error("Expected 'var'.");
+ return;
+ }
+
+ } else {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR && tokenizer->get_token()!=GDTokenizer::TK_PR_FUNCTION) {
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
+ }
+
+ rpc_mode=ScriptInstance::RPC_MODE_MASTER;
+ continue;
+ } break;
+ case GDTokenizer::TK_PR_SLAVE: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (current_export.type) {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) {
+ _set_error("Expected 'var'.");
+ return;
+ }
+
+ } else {
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR && tokenizer->get_token()!=GDTokenizer::TK_PR_FUNCTION) {
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
+ }
+
+ rpc_mode=ScriptInstance::RPC_MODE_SLAVE;
+ continue;
+ } break;
+ case GDTokenizer::TK_PR_SYNC: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR && tokenizer->get_token()!=GDTokenizer::TK_PR_FUNCTION) {
+ if (current_export.type)
+ _set_error("Expected 'var'.");
+ else
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
+
+ rpc_mode=ScriptInstance::RPC_MODE_SYNC;
+ continue;
+ } break;
case GDTokenizer::TK_PR_VAR: {
//variale declaration and (eventual) initialization
@@ -2884,8 +2964,12 @@ void GDParser::_parse_class(ClassNode *p_class) {
member.expression=NULL;
member._export.name=member.identifier;
member.line=tokenizer->get_token_line();
+ member.rpc_mode=rpc_mode;
+
tokenizer->advance();
+ rpc_mode=ScriptInstance::RPC_MODE_DISABLED;
+
if (tokenizer->get_token()==GDTokenizer::TK_OP_ASSIGN) {
#ifdef DEBUG_ENABLED
@@ -3228,6 +3312,7 @@ void GDParser::clear() {
current_class=NULL;
completion_found=false;
+ rpc_mode=ScriptInstance::RPC_MODE_DISABLED;
current_function=NULL;
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 2d6b52c473..9e6f6e6765 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -33,6 +33,7 @@
#include "gd_functions.h"
#include "map.h"
#include "object.h"
+#include "script_language.h"
class GDParser {
public:
@@ -88,6 +89,7 @@ public:
StringName getter;
int line;
Node *expression;
+ ScriptInstance::RPCMode rpc_mode;
};
struct Constant {
StringName identifier;
@@ -119,12 +121,13 @@ public:
struct FunctionNode : public Node {
bool _static;
+ ScriptInstance::RPCMode rpc_mode;
StringName name;
Vector<StringName> arguments;
Vector<Node*> default_values;
BlockNode *body;
- FunctionNode() { type=TYPE_FUNCTION; _static=false; }
+ FunctionNode() { type=TYPE_FUNCTION; _static=false; rpc_mode=ScriptInstance::RPC_MODE_DISABLED; }
};
@@ -429,6 +432,9 @@ private:
PropertyInfo current_export;
+ ScriptInstance::RPCMode rpc_mode;
+
+
void _set_error(const String& p_error, int p_line=-1, int p_column=-1);
bool _recover_from_completion();
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 2b8d6e86e2..b97a0fcbb6 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -179,6 +179,15 @@ bool GDScript::can_instance() const {
}
+Ref<Script> GDScript::get_base_script() const {
+
+ if (_base) {
+ return Ref<GDScript>( _base );
+ } else {
+ return Ref<Script>();
+ }
+}
+
StringName GDScript::get_instance_base_type() const {
if (native.is_valid())
@@ -250,7 +259,7 @@ void GDScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) {
#endif
-void GDScript::get_method_list(List<MethodInfo> *p_list) const {
+void GDScript::get_script_method_list(List<MethodInfo> *p_list) const {
for (const Map<StringName,GDFunction*>::Element *E=member_functions.front();E;E=E->next()) {
MethodInfo mi;
@@ -267,6 +276,41 @@ void GDScript::get_method_list(List<MethodInfo> *p_list) const {
}
}
+void GDScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+ const GDScript *sptr=this;
+ List<PropertyInfo> props;
+
+ while(sptr) {
+
+ Vector<_GDScriptMemberSort> msort;
+ for(Map<StringName,PropertyInfo>::Element *E=sptr->member_info.front();E;E=E->next()) {
+
+ _GDScriptMemberSort ms;
+ ERR_CONTINUE(!sptr->member_indices.has(E->key()));
+ ms.index=sptr->member_indices[E->key()].index;
+ ms.name=E->key();
+ msort.push_back(ms);
+
+ }
+
+ msort.sort();
+ msort.invert();
+ for(int i=0;i<msort.size();i++) {
+
+ props.push_front(sptr->member_info[msort[i].name]);
+
+ }
+
+ sptr = sptr->_base;
+ }
+
+ for (List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
+ p_list->push_back(E->get());
+ }
+
+}
+
bool GDScript::has_method(const StringName& p_method) const {
return member_functions.has(p_method);
@@ -1300,6 +1344,46 @@ ScriptLanguage *GDInstance::get_language() {
return GDScriptLanguage::get_singleton();
}
+GDInstance::RPCMode GDInstance::get_rpc_mode(const StringName& p_method) const {
+
+ const GDScript *cscript = script.ptr();
+
+ while(cscript) {
+ const Map<StringName,GDFunction*>::Element *E=cscript->member_functions.find(p_method);
+ if (E) {
+
+ if (E->get()->get_rpc_mode()!=RPC_MODE_DISABLED) {
+ return E->get()->get_rpc_mode();
+ }
+
+ }
+ cscript=cscript->_base;
+ }
+
+ return RPC_MODE_DISABLED;
+}
+
+GDInstance::RPCMode GDInstance::get_rset_mode(const StringName& p_variable) const {
+
+ const GDScript *cscript = script.ptr();
+
+ while(cscript) {
+ const Map<StringName,GDScript::MemberInfo>::Element *E=cscript->member_indices.find(p_variable);
+ if (E) {
+
+ if (E->get().rpc_mode) {
+ return E->get().rpc_mode;
+ }
+
+ }
+ cscript=cscript->_base;
+ }
+
+ return RPC_MODE_DISABLED;
+}
+
+
+
void GDInstance::reload_members() {
#ifdef DEBUG_ENABLED
@@ -1811,6 +1895,10 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"pass",
"return",
"while",
+ "remote",
+ "sync",
+ "master",
+ "slave",
0};
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 28a0df1efd..0c3e1eb614 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -64,6 +64,7 @@ class GDScript : public Script {
int index;
StringName setter;
StringName getter;
+ ScriptInstance::RPCMode rpc_mode;
};
friend class GDInstance;
@@ -161,6 +162,8 @@ public:
Variant _new(const Variant** p_args,int p_argcount,Variant::CallError& r_error);
virtual bool can_instance() const;
+ virtual Ref<Script> get_base_script() const;
+
virtual StringName get_instance_base_type() const; // this may not work in all scripts, will return empty if so
virtual ScriptInstance* instance_create(Object *p_this);
virtual bool instance_has(const Object *p_this) const;
@@ -181,10 +184,13 @@ public:
bool get_property_default_value(const StringName& p_property,Variant& r_value) const;
- virtual void get_method_list(List<MethodInfo> *p_list) const;
+ virtual void get_script_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName& p_method) const;
virtual MethodInfo get_method_info(const StringName& p_method) const;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+
+
virtual ScriptLanguage *get_language() const;
GDScript();
@@ -236,6 +242,10 @@ public:
void reload_members();
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const;
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const;
+
+
GDInstance();
~GDInstance();
@@ -250,23 +260,23 @@ class GDScriptLanguage : public ScriptLanguage {
Map<StringName,int> globals;
- struct CallLevel {
+ struct CallLevel {
- Variant *stack;
- GDFunction *function;
- GDInstance *instance;
- int *ip;
- int *line;
+ Variant *stack;
+ GDFunction *function;
+ GDInstance *instance;
+ int *ip;
+ int *line;
- };
+ };
- int _debug_parse_err_line;
- String _debug_parse_err_file;
- String _debug_error;
- int _debug_call_stack_pos;
- int _debug_max_call_stack;
- CallLevel *_call_stack;
+ int _debug_parse_err_line;
+ String _debug_parse_err_file;
+ String _debug_error;
+ int _debug_call_stack_pos;
+ int _debug_max_call_stack;
+ CallLevel *_call_stack;
void _add_global(const StringName& p_name,const Variant& p_value);
@@ -288,54 +298,54 @@ public:
int calls;
- bool debug_break(const String& p_error,bool p_allow_continue=true);
- bool debug_break_parse(const String& p_file, int p_line,const String& p_error);
+ bool debug_break(const String& p_error,bool p_allow_continue=true);
+ bool debug_break_parse(const String& p_file, int p_line,const String& p_error);
- _FORCE_INLINE_ void enter_function(GDInstance *p_instance,GDFunction *p_function, Variant *p_stack, int *p_ip, int *p_line) {
+ _FORCE_INLINE_ void enter_function(GDInstance *p_instance,GDFunction *p_function, Variant *p_stack, int *p_ip, int *p_line) {
- if (Thread::get_main_ID()!=Thread::get_caller_ID())
- return; //no support for other threads than main for now
+ if (Thread::get_main_ID()!=Thread::get_caller_ID())
+ return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left()>0 && ScriptDebugger::get_singleton()->get_depth()>=0)
- ScriptDebugger::get_singleton()->set_depth( ScriptDebugger::get_singleton()->get_depth() +1 );
+ if (ScriptDebugger::get_singleton()->get_lines_left()>0 && ScriptDebugger::get_singleton()->get_depth()>=0)
+ ScriptDebugger::get_singleton()->set_depth( ScriptDebugger::get_singleton()->get_depth() +1 );
- if (_debug_call_stack_pos >= _debug_max_call_stack) {
- //stack overflow
- _debug_error="Stack Overflow (Stack Size: "+itos(_debug_max_call_stack)+")";
- ScriptDebugger::get_singleton()->debug(this);
- return;
- }
+ if (_debug_call_stack_pos >= _debug_max_call_stack) {
+ //stack overflow
+ _debug_error="Stack Overflow (Stack Size: "+itos(_debug_max_call_stack)+")";
+ ScriptDebugger::get_singleton()->debug(this);
+ return;
+ }
- _call_stack[_debug_call_stack_pos].stack=p_stack;
- _call_stack[_debug_call_stack_pos].instance=p_instance;
- _call_stack[_debug_call_stack_pos].function=p_function;
- _call_stack[_debug_call_stack_pos].ip=p_ip;
- _call_stack[_debug_call_stack_pos].line=p_line;
- _debug_call_stack_pos++;
- }
+ _call_stack[_debug_call_stack_pos].stack=p_stack;
+ _call_stack[_debug_call_stack_pos].instance=p_instance;
+ _call_stack[_debug_call_stack_pos].function=p_function;
+ _call_stack[_debug_call_stack_pos].ip=p_ip;
+ _call_stack[_debug_call_stack_pos].line=p_line;
+ _debug_call_stack_pos++;
+ }
- _FORCE_INLINE_ void exit_function() {
+ _FORCE_INLINE_ void exit_function() {
- if (Thread::get_main_ID()!=Thread::get_caller_ID())
- return; //no support for other threads than main for now
+ if (Thread::get_main_ID()!=Thread::get_caller_ID())
+ return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left()>0 && ScriptDebugger::get_singleton()->get_depth()>=0)
- ScriptDebugger::get_singleton()->set_depth( ScriptDebugger::get_singleton()->get_depth() -1 );
+ if (ScriptDebugger::get_singleton()->get_lines_left()>0 && ScriptDebugger::get_singleton()->get_depth()>=0)
+ ScriptDebugger::get_singleton()->set_depth( ScriptDebugger::get_singleton()->get_depth() -1 );
- if (_debug_call_stack_pos==0) {
+ if (_debug_call_stack_pos==0) {
- _debug_error="Stack Underflow (Engine Bug)";
- ScriptDebugger::get_singleton()->debug(this);
- return;
- }
+ _debug_error="Stack Underflow (Engine Bug)";
+ ScriptDebugger::get_singleton()->debug(this);
+ return;
+ }
- _debug_call_stack_pos--;
- }
+ _debug_call_stack_pos--;
+ }
virtual Vector<StackInfo> debug_get_current_stack_info() {
- if (Thread::get_main_ID()!=Thread::get_caller_ID())
- return Vector<StackInfo>();
+ if (Thread::get_main_ID()!=Thread::get_caller_ID())
+ return Vector<StackInfo>();
Vector<StackInfo> csi;
csi.resize(_debug_call_stack_pos);
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 93863c4eb2..47e740b227 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -100,6 +100,10 @@ const char* GDTokenizer::token_names[TK_MAX]={
"yield",
"signal",
"breakpoint",
+"rpc",
+"sync",
+"master",
+"slave",
"'['",
"']'",
"'{'",
@@ -865,6 +869,10 @@ void GDTokenizerText::_advance() {
{TK_PR_YIELD,"yield"},
{TK_PR_SIGNAL,"signal"},
{TK_PR_BREAKPOINT,"breakpoint"},
+ {TK_PR_REMOTE,"remote"},
+ {TK_PR_MASTER,"master"},
+ {TK_PR_SLAVE,"slave"},
+ {TK_PR_SYNC,"sync"},
{TK_PR_CONST,"const"},
//controlflow
{TK_CF_IF,"if"},
@@ -1047,7 +1055,7 @@ void GDTokenizerText::advance(int p_amount) {
//////////////////////////////////////////////////////////////////////////////////////////////////////
-#define BYTECODE_VERSION 10
+#define BYTECODE_VERSION 11
Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) {
diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h
index aaff573090..1815f82894 100644
--- a/modules/gdscript/gd_tokenizer.h
+++ b/modules/gdscript/gd_tokenizer.h
@@ -107,6 +107,10 @@ public:
TK_PR_YIELD,
TK_PR_SIGNAL,
TK_PR_BREAKPOINT,
+ TK_PR_REMOTE,
+ TK_PR_SYNC,
+ TK_PR_MASTER,
+ TK_PR_SLAVE,
TK_BRACKET_OPEN,
TK_BRACKET_CLOSE,
TK_CURLY_BRACKET_OPEN,
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index 1360e546f3..50c3a4075f 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -43,6 +43,10 @@ VisualScriptLanguage *visual_script_language=NULL;
void register_visual_script_types() {
+ visual_script_language=memnew( VisualScriptLanguage );
+ //script_language_gd->init();
+ ScriptServer::register_language(visual_script_language);
+
ObjectTypeDB::register_type<VisualScript>();
ObjectTypeDB::register_virtual_type<VisualScriptNode>();
ObjectTypeDB::register_virtual_type<VisualScriptFunctionState>();
@@ -62,11 +66,18 @@ void register_visual_script_types() {
ObjectTypeDB::register_type<VisualScriptSelf>();
ObjectTypeDB::register_type<VisualScriptCustomNode>();
ObjectTypeDB::register_type<VisualScriptSubCall>();
+ ObjectTypeDB::register_type<VisualScriptComment>();
+ ObjectTypeDB::register_type<VisualScriptConstructor>();
+ ObjectTypeDB::register_type<VisualScriptLocalVar>();
+ ObjectTypeDB::register_type<VisualScriptInputAction>();
+ ObjectTypeDB::register_type<VisualScriptDeconstruct>();
+ ObjectTypeDB::register_type<VisualScriptPreload>();
+
ObjectTypeDB::register_type<VisualScriptFunctionCall>();
ObjectTypeDB::register_type<VisualScriptPropertySet>();
ObjectTypeDB::register_type<VisualScriptPropertyGet>();
- ObjectTypeDB::register_type<VisualScriptScriptCall>();
+// ObjectTypeDB::register_type<VisualScriptScriptCall>();
ObjectTypeDB::register_type<VisualScriptEmitSignal>();
ObjectTypeDB::register_type<VisualScriptReturn>();
@@ -82,9 +93,6 @@ void register_visual_script_types() {
ObjectTypeDB::register_type<VisualScriptBuiltinFunc>();
- visual_script_language=memnew( VisualScriptLanguage );
- //script_language_gd->init();
- ScriptServer::register_language(visual_script_language);
register_visual_script_nodes();
register_visual_script_func_nodes();
@@ -102,6 +110,8 @@ void register_visual_script_types() {
void unregister_visual_script_types() {
+ unregister_visual_script_nodes();
+
ScriptServer::unregister_language(visual_script_language);
if (visual_script_language)
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 425436d907..f2fb371d6b 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1,7 +1,7 @@
#include "visual_script.h"
#include "visual_script_nodes.h"
#include "scene/main/node.h"
-
+#include "os/os.h"
#include "globals.h"
#define SCRIPT_VARIABLES_PREFIX "script_variables/"
@@ -31,11 +31,13 @@ void VisualScriptNode::_notification(int p_what) {
void VisualScriptNode::ports_changed_notify(){
+
default_input_values.resize( MAX(default_input_values.size(),get_input_value_port_count()) ); //let it grow as big as possible, we don't want to lose values on resize
+
emit_signal("ports_changed");
}
-void VisualScriptNode::set_default_input_value(int p_port,const Variant& p_value) {
+void VisualScriptNode::set_default_input_value(int p_port,const Variant& p_value) {
ERR_FAIL_INDEX(p_port,default_input_values.size());
@@ -54,35 +56,40 @@ void VisualScriptNode::_set_default_input_values(Array p_values) {
default_input_values=p_values;
}
-Array VisualScriptNode::_get_default_input_values() const {
- //validate on save, since on load there is little info about this
+void VisualScriptNode::validate_input_default_values() {
+
- Array saved_values;
+
+ default_input_values.resize(get_input_value_port_count());
//actually validate on save
for(int i=0;i<get_input_value_port_count();i++) {
Variant::Type expected = get_input_value_port_info(i).type;
- if (i>=default_input_values.size()) {
+ if (expected==Variant::NIL || expected==default_input_values[i].get_type()) {
+ continue;
+ } else {
+ //not the same, reconvert
Variant::CallError ce;
- saved_values.push_back(Variant::construct(expected,NULL,0,ce,false));
- } else {
-
- if (expected==Variant::NIL || expected==default_input_values[i].get_type()) {
- saved_values.push_back(default_input_values[i]);
- } else {
- //not the same, reconvert
- Variant::CallError ce;
- Variant existing = default_input_values[i];
- const Variant *existingp=&existing;
- saved_values.push_back( Variant::construct(expected,&existingp,1,ce,false) );
+ Variant existing = default_input_values[i];
+ const Variant *existingp=&existing;
+ default_input_values[i] = Variant::construct(expected,&existingp,1,ce,false);
+ if (ce.error!=Variant::CallError::CALL_OK) {
+ //could not convert? force..
+ default_input_values[i] = Variant::construct(expected,NULL,0,ce,false);
}
}
}
- return saved_values;
+}
+
+Array VisualScriptNode::_get_default_input_values() const {
+
+ //validate on save, since on load there is little info about this
+
+ return default_input_values;
}
@@ -224,6 +231,7 @@ int VisualScript::get_function_node_id(const StringName& p_name) const {
void VisualScript::_node_ports_changed(int p_id) {
+
StringName function;
for (Map<StringName,Function>::Element *E=functions.front();E;E=E->next()) {
@@ -239,6 +247,10 @@ void VisualScript::_node_ports_changed(int p_id) {
Function &func = functions[function];
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
+ if (OS::get_singleton()->get_main_loop() && OS::get_singleton()->get_main_loop()->cast_to<SceneTree>() && OS::get_singleton()->get_main_loop()->cast_to<SceneTree>()->is_editor_hint()) {
+ vsn->validate_input_default_values(); //force validate default values when editing on editor
+ }
+
//must revalidate all the functions
{
@@ -281,9 +293,10 @@ void VisualScript::_node_ports_changed(int p_id) {
}
}
+#ifdef TOOLS_ENABLED
set_edited(true); //something changed, let's set as edited
emit_signal("node_ports_changed",function,p_id);
-
+#endif
}
void VisualScript::add_node(const StringName& p_func,int p_id, const Ref<VisualScriptNode>& p_node, const Point2 &p_pos) {
@@ -655,7 +668,7 @@ Dictionary VisualScript::_get_variable_info(const StringName& p_name) const{
return d;
}
-void VisualScript::get_variable_list(List<StringName> *r_variables){
+void VisualScript::get_variable_list(List<StringName> *r_variables) const{
for (Map<StringName,Variable>::Element *E=variables.front();E;E=E->next()) {
@@ -835,6 +848,10 @@ StringName VisualScript::get_instance_base_type() const {
return base_type;
}
+Ref<Script> VisualScript::get_base_script() const {
+ return Ref<Script>(); // no inheritance in visual script
+}
+
#ifdef TOOLS_ENABLED
void VisualScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
@@ -991,7 +1008,7 @@ bool VisualScript::get_property_default_value(const StringName& p_property,Varia
r_value=variables[ script_variable_remap[p_property] ].default_value;
return true;
}
-void VisualScript::get_method_list(List<MethodInfo> *p_list) const {
+void VisualScript::get_script_method_list(List<MethodInfo> *p_list) const {
for (Map<StringName,Function>::Element *E=functions.front();E;E=E->next()) {
@@ -1044,6 +1061,17 @@ MethodInfo VisualScript::get_method_info(const StringName& p_method) const{
return mi;
}
+void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+ List<StringName> vars;
+ get_variable_list(&vars);
+
+ for (List<StringName>::Element *E=vars.front();E;E=E->next()) {
+
+ p_list->push_back(variables[E->get()].info);
+ }
+}
+
void VisualScript::_set_data(const Dictionary& p_data) {
@@ -1454,7 +1482,10 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
//from a node that requires read
Function::UnsequencedGet *ug = &f->unsequenced_gets[index];
- bool ok = ug->from->get_output_port_unsequenced(i,&variant_stack[ug->to_stack],working_mem,error_str);
+ Variant* ug_working_mem=ug->from->working_mem_idx>=0 ? &variant_stack[ug->from->working_mem_idx] : (Variant*)NULL;
+
+
+ bool ok = ug->from->get_output_port_unsequenced(i,&variant_stack[ug->to_stack],ug_working_mem,error_str);
if (!ok) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
current_node_id=ug->from->get_id();
@@ -1491,13 +1522,13 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
{
if (p_resuming_yield)
start_mode=VisualScriptNodeInstance::START_MODE_RESUME_YIELD;
- else if (flow_stack && !(flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) //if there is a push bit, it means we are continuing a sequence
+ else if (!flow_stack || !(flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) //if there is a push bit, it means we are continuing a sequence
start_mode=VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
else
start_mode=VisualScriptNodeInstance::START_MODE_CONTINUE_SEQUENCE;
}
- VSDEBUG("STEP - STARTSEQ: "+itos(start_sequence));
+ VSDEBUG("STEP - STARTSEQ: "+itos(start_mode));
int ret = node->step(input_args,output_args,start_mode,working_mem,r_error,error_str);
@@ -1706,6 +1737,7 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
node = instances[ flow_stack[i] & VisualScriptNodeInstance::FLOW_STACK_MASK ];
flow_stack_pos=i;
found=true;
+ break;
}
}
@@ -1734,6 +1766,22 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
String err_func = p_method;
int err_line=current_node_id; //not a line but it works as one
+ if (node && (r_error.error!=Variant::CallError::CALL_ERROR_INVALID_METHOD || error_str==String())) {
+
+ if (r_error.error==Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
+ int errorarg=r_error.argument;
+ error_str="Cannot convert argument "+itos(errorarg+1)+" to "+Variant::get_type_name(r_error.expected)+".";
+ } else if (r_error.error==Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
+ error_str="Expected "+itos(r_error.argument)+" arguments.";
+ } else if (r_error.error==Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
+ error_str="Expected "+itos(r_error.argument)+" arguments.";
+ } else if (r_error.error==Variant::CallError::CALL_ERROR_INVALID_METHOD) {
+ error_str="Invalid Call.";
+ } else if (r_error.error==Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
+ error_str="Instance is null";
+ }
+ }
+
//if (!GDScriptLanguage::get_singleton()->debug_break(err_text,false)) {
// debugger break did not happen
@@ -1766,7 +1814,7 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
}
-Variant VisualScriptInstance::call(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error){
+Variant VisualScriptInstance::call(const StringName& p_method, const Variant** p_args, int p_argcount, Variant::CallError &r_error){
r_error.error=Variant::CallError::CALL_OK; //ok by default
@@ -1870,6 +1918,30 @@ Ref<Script> VisualScriptInstance::get_script() const{
return script;
}
+ScriptInstance::RPCMode VisualScriptInstance::get_rpc_mode(const StringName& p_method) const {
+
+ const Map<StringName,VisualScript::Function>::Element *E = script->functions.find(p_method);
+ if (!E) {
+ return RPC_MODE_DISABLED;
+ }
+
+ if (E->get().function_id>=0 && E->get().nodes.has(E->get().function_id)) {
+
+ Ref<VisualScriptFunction> vsf = E->get().nodes[E->get().function_id].node;
+ if (vsf.is_valid()) {
+
+ return vsf->get_rpc_mode();
+ }
+ }
+
+ return RPC_MODE_DISABLED;
+}
+
+ScriptInstance::RPCMode VisualScriptInstance::get_rset_mode(const StringName& p_variable) const {
+
+ return RPC_MODE_DISABLED;
+}
+
void VisualScriptInstance::create(const Ref<VisualScript>& p_script,Object *p_owner) {
@@ -1907,6 +1979,7 @@ void VisualScriptInstance::create(const Ref<VisualScript>& p_script,Object *p_ow
function.max_stack=0;
function.flow_stack_size=0;
function.node_count=0;
+ Map<StringName,int> local_var_indices;
if (function.node<0) {
VisualScriptLanguage::singleton->debug_break_parse(get_script()->get_path(),0,"No start node in function: "+String(E->key()));
@@ -1970,7 +2043,20 @@ void VisualScriptInstance::create(const Ref<VisualScript>& p_script,Object *p_ow
}
}
- if (instance->get_working_memory_size()) {
+ if (node->cast_to<VisualScriptLocalVar>()) {
+ //working memory is shared only for this node, for the same variables
+ Ref<VisualScriptLocalVar> vslv = node;
+
+ StringName var_name = String(vslv->get_var_name()).strip_edges();
+
+ if (!local_var_indices.has(var_name)) {
+ local_var_indices[var_name]=function.max_stack;
+ function.max_stack++;
+ }
+
+ instance->working_mem_idx=local_var_indices[var_name];
+
+ } else if (instance->get_working_memory_size()) {
instance->working_mem_idx = function.max_stack;
function.max_stack+=instance->get_working_memory_size();
} else {
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 786b9b873e..c9734d1b11 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -20,6 +20,8 @@ friend class VisualScript;
void _set_default_input_values(Array p_values);
Array _get_default_input_values() const;
+
+ void validate_input_default_values();
protected:
virtual bool _use_builtin_script() const { return false; }
@@ -275,7 +277,7 @@ public:
Variant get_variable_default_value(const StringName& p_name) const;
void set_variable_info(const StringName& p_name,const PropertyInfo& p_info);
PropertyInfo get_variable_info(const StringName& p_name) const;
- void get_variable_list(List<StringName> *r_variables);
+ void get_variable_list(List<StringName> *r_variables) const;
void rename_variable(const StringName& p_name,const StringName& p_new_name);
@@ -300,6 +302,7 @@ public:
virtual bool can_instance() const;
+ virtual Ref<Script> get_base_script() const;
virtual StringName get_instance_base_type() const;
virtual ScriptInstance* instance_create(Object *p_this);
virtual bool instance_has(const Object *p_this) const;
@@ -320,11 +323,12 @@ public:
virtual void get_script_signal_list(List<MethodInfo> *r_signals) const;
virtual bool get_property_default_value(const StringName& p_property,Variant& r_value) const;
- virtual void get_method_list(List<MethodInfo> *p_list) const;
+ virtual void get_script_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName& p_method) const;
virtual MethodInfo get_method_info(const StringName& p_method) const;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
VisualScript();
@@ -413,6 +417,9 @@ public:
virtual ScriptLanguage *get_language();
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const;
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const;
+
VisualScriptInstance();
~VisualScriptInstance();
};
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 0d97126e0a..3f3b2f3220 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -4,8 +4,10 @@
#include "visual_script_flow_control.h"
#include "visual_script_func_nodes.h"
#include "os/input.h"
+#include "tools/editor/editor_resource_preview.h"
#include "os/keyboard.h"
+#ifdef TOOLS_ENABLED
class VisualScriptEditorSignalEdit : public Object {
OBJ_TYPE(VisualScriptEditorSignalEdit,Object)
@@ -300,9 +302,45 @@ public:
};
static Color _color_from_type(Variant::Type p_type) {
-
Color color;
- color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7);
+ switch(p_type) {
+ case Variant::NIL: color = Color::html("69ecbd"); break;
+
+ case Variant::BOOL: color = Color::html("8da6f0"); break;
+ case Variant::INT: color = Color::html("7dc6ef"); break;
+ case Variant::REAL: color = Color::html("61daf4"); break;
+ case Variant::STRING: color = Color::html("6ba7ec"); break;
+
+ case Variant::VECTOR2: color = Color::html("bd91f1"); break;
+ case Variant::RECT2: color = Color::html("f191a5"); break;
+ case Variant::VECTOR3: color = Color::html("d67dee"); break;
+ case Variant::MATRIX32: color = Color::html("c4ec69"); break;
+ case Variant::PLANE: color = Color::html("f77070"); break;
+ case Variant::QUAT: color = Color::html("ec69a3"); break;
+ case Variant::_AABB: color = Color::html("ee7991"); break;
+ case Variant::MATRIX3: color = Color::html("e3ec69"); break;
+ case Variant::TRANSFORM: color = Color::html("ecd669"); break;
+
+ case Variant::COLOR: color = Color::html("9dff70"); break;
+ case Variant::IMAGE: color = Color::html("93f1b9"); break;
+ case Variant::NODE_PATH: color = Color::html("6993ec"); break;
+ case Variant::_RID: color = Color::html("69ec9a"); break;
+ case Variant::OBJECT: color = Color::html("79f3e8"); break;
+ case Variant::INPUT_EVENT: color = Color::html("adf18f"); break;
+ case Variant::DICTIONARY: color = Color::html("77edb1"); break;
+
+ case Variant::ARRAY: color = Color::html("e0e0e0"); break;
+ case Variant::RAW_ARRAY: color = Color::html("aaf4c8"); break;
+ case Variant::INT_ARRAY: color = Color::html("afdcf5"); break;
+ case Variant::REAL_ARRAY: color = Color::html("97e7f8"); break;
+ case Variant::STRING_ARRAY: color = Color::html("9dc4f2"); break;
+ case Variant::VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
+ case Variant::VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
+ case Variant::COLOR_ARRAY: color = Color::html("e9ff97"); break;
+
+ default:
+ color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7);
+ }
return color;
}
@@ -346,6 +384,8 @@ void VisualScriptEditor::_update_graph_connections() {
void VisualScriptEditor::_update_graph(int p_only_id) {
+ if (updating_graph)
+ return;
updating_graph=true;
@@ -386,7 +426,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Control::get_icon("MiniVector2","EditorIcons"),
Control::get_icon("MiniRect2","EditorIcons"),
Control::get_icon("MiniVector3","EditorIcons"),
- Control::get_icon("MiniMatrix2","EditorIcons"),
+ Control::get_icon("MiniMatrix32","EditorIcons"),
Control::get_icon("MiniPlane","EditorIcons"),
Control::get_icon("MiniQuat","EditorIcons"),
Control::get_icon("MiniAabb","EditorIcons"),
@@ -437,6 +477,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_modulate(EditorSettings::get_singleton()->get("visual_script_editor/color_"+node->get_category()));
}
+
+
gnode->set_meta("__vnode",node);
gnode->set_name(itos(E->get()));
gnode->connect("dragged",this,"_node_moved",varray(E->get()));
@@ -448,10 +490,21 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_show_close_button(true);
}
+
Label *text = memnew( Label );
text->set_text(node->get_text());
gnode->add_child(text);
+ if (node->cast_to<VisualScriptComment>()) {
+ Ref<VisualScriptComment> vsc=node;
+ gnode->set_comment(true);
+ gnode->set_resizeable(true);
+ gnode->set_custom_minimum_size(vsc->get_size()*EDSCALE);
+ gnode->connect("resize_request",this,"_comment_node_resized",varray(E->get()));
+
+ }
+
+
int slot_idx=0;
bool single_seq_output = node->get_output_sequence_port_count()==1 && node->get_output_sequence_port_text(0)==String();
@@ -477,6 +530,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Variant::Type left_type=Variant::NIL;
String left_name;
+
+
if (i<node->get_input_value_port_count()) {
PropertyInfo pi = node->get_input_value_port_info(i);
left_ok=true;
@@ -513,6 +568,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
hbc->add_child(memnew(Label(left_name)));
if (left_type!=Variant::NIL && !script->is_input_value_port_connected(edited_func,E->get(),i)) {
+
+ PropertyInfo pi = node->get_input_value_port_info(i);
Button *button = memnew( Button );
Variant value = node->get_default_input_value(i);
if (value.get_type()!=left_type) {
@@ -523,7 +580,24 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
value = Variant::construct(left_type,&existingp,1,ce,false);
}
- button->set_text(value);
+ if (left_type==Variant::COLOR) {
+ button->set_custom_minimum_size(Size2(30,0)*EDSCALE);
+ button->connect("draw",this,"_draw_color_over_button",varray(button,value));
+ } else if (left_type==Variant::OBJECT && Ref<Resource>(value).is_valid()) {
+
+ Ref<Resource> res = value;
+ Array arr;
+ arr.push_back(button->get_instance_ID());
+ arr.push_back(String(value));
+ EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res,this,"_button_resource_previewed",arr);
+
+ } else if (pi.type==Variant::INT && pi.hint==PROPERTY_HINT_ENUM){
+
+ button->set_text(pi.hint_string.get_slice(",",value));
+ } else {
+
+ button->set_text(value);
+ }
button->connect("pressed",this,"_default_value_edited",varray(button,E->get(),i));
hbc->add_child(button);
}
@@ -560,6 +634,10 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
}
graph->add_child(gnode);
+
+ if (gnode->is_comment()) {
+ graph->move_child(gnode,0);
+ }
}
_update_graph_connections();
@@ -1384,6 +1462,8 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2& p_point,const Variant& p
String(d["type"])=="visual_script_variable_drag" ||
String(d["type"])=="visual_script_signal_drag" ||
String(d["type"])=="obj_property" ||
+ String(d["type"])=="resource" ||
+ String(d["type"])=="files" ||
String(d["type"])=="nodes"
) ) {
@@ -1391,18 +1471,27 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2& p_point,const Variant& p
if (String(d["type"])=="obj_property") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor*>(this)->_show_hint("Hold Meta to drop a Setter, Shift+Meta to drop a Setter and copy the value.");
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Meta to drop a Getter. Hold Shift to drop a generic signature."));
+#else
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."));
+#endif
+ }
+
+ if (String(d["type"])=="nodes") {
+
+#ifdef OSX_ENABLED
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Meta to drop a simple reference to the node."));
#else
- const_cast<VisualScriptEditor*>(this)->_show_hint("Hold Ctrl to drop a Setter, Shift+Ctrl to drop a Setter and copy the value.");
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Ctrl to drop a simple reference to the node."));
#endif
}
if (String(d["type"])=="visual_script_variable_drag") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor*>(this)->_show_hint("Hold Meta to drop a Variable Setter.");
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Meta to drop a Variable Setter."));
#else
- const_cast<VisualScriptEditor*>(this)->_show_hint("Hold Ctrl to drop a Variable Setter.");
+ const_cast<VisualScriptEditor*>(this)->_show_hint(TTR("Hold Ctrl to drop a Variable Setter."));
#endif
}
@@ -1441,6 +1530,8 @@ static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const R
#endif
+
+
void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){
if (p_from==graph) {
@@ -1530,15 +1621,17 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
ofs/=EDSCALE;
- Ref<VisualScriptScriptCall> vnode;
+ Ref<VisualScriptFunctionCall> vnode;
vnode.instance();
- vnode->set_call_mode(VisualScriptScriptCall::CALL_MODE_SELF);
- vnode->set_function(d["function"]);
+ vnode->set_call_mode(VisualScriptFunctionCall::CALL_MODE_SELF);
int new_id = script->get_available_id();
undo_redo->create_action(TTR("Add Node"));
undo_redo->add_do_method(script.ptr(),"add_node",edited_func,new_id,vnode,ofs);
+ undo_redo->add_do_method(vnode.ptr(),"set_base_type",script->get_instance_base_type());
+ undo_redo->add_do_method(vnode.ptr(),"set_function",d["function"]);
+
undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,new_id);
undo_redo->add_do_method(this,"_update_graph");
undo_redo->add_undo_method(this,"_update_graph");
@@ -1549,6 +1642,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
graph->set_selected(node);
_node_selected(node);
}
+
}
@@ -1579,8 +1673,90 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
if (node) {
graph->set_selected(node);
_node_selected(node);
+ }
+ }
+
+ if (d.has("type") && String(d["type"])=="resource") {
+
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap,snap));
+ }
+
+ ofs/=EDSCALE;
+
+ Ref<VisualScriptPreload> prnode;
+ prnode.instance();
+ prnode->set_preload(d["resource"]);
+
+ int new_id = script->get_available_id();
+
+ undo_redo->create_action(TTR("Add Preload Node"));
+ undo_redo->add_do_method(script.ptr(),"add_node",edited_func,new_id,prnode,ofs);
+ undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,new_id);
+ undo_redo->add_do_method(this,"_update_graph");
+ undo_redo->add_undo_method(this,"_update_graph");
+ undo_redo->commit_action();
+
+ Node* node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
+ }
+ }
+
+ if (d.has("type") && String(d["type"])=="files") {
+
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap,snap));
+ }
+
+ ofs/=EDSCALE;
+
+ Array files = d["files"];
+
+ List<int> new_ids;
+ int new_id = script->get_available_id();
+
+ if (files.size()) {
+ undo_redo->create_action(TTR("Add Preload Node"));
+
+ for(int i=0;i<files.size();i++) {
+
+ Ref<Resource> res = ResourceLoader::load(files[i]);
+ if (!res.is_valid())
+ continue;
+
+ Ref<VisualScriptPreload> prnode;
+ prnode.instance();
+ prnode->set_preload(res);
+
+ undo_redo->add_do_method(script.ptr(),"add_node",edited_func,new_id,prnode,ofs);
+ undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,new_id);
+ new_ids.push_back(new_id);
+ new_id++;
+ ofs+=Vector2(20,20)*EDSCALE;
+ }
+
+
+ undo_redo->add_do_method(this,"_update_graph");
+ undo_redo->add_undo_method(this,"_update_graph");
+ undo_redo->commit_action();
+ }
+
+ for(List<int>::Element *E=new_ids.front();E;E=E->next()) {
+
+ Node* node = graph->get_node(itos(E->get()));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
+ }
}
}
+
if (d.has("type") && String(d["type"])=="nodes") {
Node* sn = _find_script_node(get_tree()->get_edited_scene_root(),get_tree()->get_edited_scene_root(),script);
@@ -1591,6 +1767,14 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
return;
}
+
+#ifdef OSX_ENABLED
+ bool use_node = Input::get_singleton()->is_key_pressed(KEY_META);
+#else
+ bool use_node = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+#endif
+
+
Array nodes = d["nodes"];
Vector2 ofs = graph->get_scroll_ofs() + p_point;
@@ -1604,6 +1788,10 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
undo_redo->create_action(TTR("Add Node(s) From Tree"));
int base_id = script->get_available_id();
+ if (nodes.size()>1) {
+ use_node=true;
+ }
+
for(int i=0;i<nodes.size();i++) {
NodePath np = nodes[i];
@@ -1612,10 +1800,30 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
continue;
}
- Ref<VisualScriptSceneNode> scene_node;
- scene_node.instance();
- scene_node->set_node_path(sn->get_path_to(node));
- undo_redo->add_do_method(script.ptr(),"add_node",edited_func,base_id,scene_node,ofs);
+ Ref<VisualScriptNode> n;
+
+ if (use_node) {
+ Ref<VisualScriptSceneNode> scene_node;
+ scene_node.instance();
+ scene_node->set_node_path(sn->get_path_to(node));
+ n=scene_node;
+
+
+ } else {
+ Ref<VisualScriptFunctionCall> call;
+ call.instance();
+ call->set_call_mode(VisualScriptFunctionCall::CALL_MODE_NODE_PATH);
+ call->set_base_path(sn->get_path_to(node));;
+ call->set_base_type(node->get_type());
+ n=call;
+
+ method_select->select_method_from_instance(node);
+ selecting_method_id=base_id;
+
+ }
+
+
+ undo_redo->add_do_method(script.ptr(),"add_node",edited_func,base_id,n,ofs);
undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,base_id);
base_id++;
@@ -1633,9 +1841,9 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Node* sn = _find_script_node(get_tree()->get_edited_scene_root(),get_tree()->get_edited_scene_root(),script);
- if (!sn) {
- //EditorNode::get_singleton()->show_warning("Can't drop properties because script '"+get_name()+"' is not used in this scene.");
- //return;
+ if (!sn && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ EditorNode::get_singleton()->show_warning("Can't drop properties because script '"+get_name()+"' is not used in this scene.\nDrop holding 'Shift' to just copy the signature.");
+ return;
}
Object *obj=d["object"];
@@ -1653,36 +1861,33 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
ofs/=EDSCALE;
#ifdef OSX_ENABLED
- bool use_set = Input::get_singleton()->is_key_pressed(KEY_META);
+ bool use_get = Input::get_singleton()->is_key_pressed(KEY_META);
#else
- bool use_set = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+ bool use_get = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
#endif
- bool use_value = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
+ if (!node || Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
- if (!node) {
-
- if (use_set)
- undo_redo->create_action(TTR("Add Setter Property"));
- else
+ if (use_get)
undo_redo->create_action(TTR("Add Getter Property"));
+ else
+ undo_redo->create_action(TTR("Add Setter Property"));
int base_id = script->get_available_id();
Ref<VisualScriptNode> vnode;
- if (use_set) {
+ if (!use_get) {
Ref<VisualScriptPropertySet> pset;
pset.instance();
pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
pset->set_base_type(obj->get_type());
- pset->set_property(d["property"]);
- if (use_value) {
+ /*if (use_value) {
pset->set_use_builtin_value(true);
pset->set_builtin_value(d["value"]);
- }
+ }*/
vnode=pset;
} else {
@@ -1690,12 +1895,17 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
pget.instance();
pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
pget->set_base_type(obj->get_type());
- pget->set_property(d["property"]);
+
vnode=pget;
}
undo_redo->add_do_method(script.ptr(),"add_node",edited_func,base_id,vnode,ofs);
+ undo_redo->add_do_method(vnode.ptr(),"set_property",d["property"]);
+ if (!use_get) {
+ undo_redo->add_do_method(vnode.ptr(),"set_default_input_value",0,d["value"]);
+ }
+
undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,base_id);
undo_redo->add_do_method(this,"_update_graph");
@@ -1706,25 +1916,24 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
- if (use_set)
- undo_redo->create_action(TTR("Add Setter Property"));
- else
+ if (use_get)
undo_redo->create_action(TTR("Add Getter Property"));
+ else
+ undo_redo->create_action(TTR("Add Setter Property"));
int base_id = script->get_available_id();
Ref<VisualScriptNode> vnode;
- if (use_set) {
+ if (!use_get) {
Ref<VisualScriptPropertySet> pset;
pset.instance();
- pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_NODE_PATH);
- pset->set_base_path(sn->get_path_to(sn));
- pset->set_property(d["property"]);
- if (use_value) {
- pset->set_use_builtin_value(true);
- pset->set_builtin_value(d["value"]);
+ if (sn==node) {
+ pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_SELF);
+ } else {
+ pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_NODE_PATH);
+ pset->set_base_path(sn->get_path_to(node));
}
vnode=pset;
@@ -1732,13 +1941,20 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Ref<VisualScriptPropertyGet> pget;
pget.instance();
- pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_NODE_PATH);
- pget->set_base_path(sn->get_path_to(sn));
- pget->set_property(d["property"]);
+ if (sn==node) {
+ pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_SELF);
+ } else {
+ pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_NODE_PATH);
+ pget->set_base_path(sn->get_path_to(node));
+ }
vnode=pget;
}
undo_redo->add_do_method(script.ptr(),"add_node",edited_func,base_id,vnode,ofs);
+ undo_redo->add_do_method(vnode.ptr(),"set_property",d["property"]);
+ if (!use_get) {
+ undo_redo->add_do_method(vnode.ptr(),"set_default_input_value",0,d["value"]);
+ }
undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,base_id);
undo_redo->add_do_method(this,"_update_graph");
@@ -1756,6 +1972,50 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
}
+void VisualScriptEditor::_selected_method(const String& p_method) {
+
+ Ref<VisualScriptFunctionCall> vsfc = script->get_node(edited_func,selecting_method_id);
+ if (!vsfc.is_valid())
+ return;
+ vsfc->set_function(p_method);
+
+}
+
+void VisualScriptEditor::_draw_color_over_button(Object* obj,Color p_color) {
+
+ Button *button = obj->cast_to<Button>();
+ if (!button)
+ return;
+
+ Ref<StyleBox> normal = get_stylebox("normal","Button" );
+ button->draw_rect(Rect2(normal->get_offset(),button->get_size()-normal->get_minimum_size()),p_color);
+
+}
+
+void VisualScriptEditor::_button_resource_previewed(const String& p_path,const Ref<Texture>& p_preview,Variant p_ud) {
+
+
+ Array ud=p_ud;
+ ERR_FAIL_COND(ud.size()!=2);
+
+ ObjectID id = ud[0];
+ Object *obj = ObjectDB::get_instance(id);
+
+ if (!obj)
+ return;
+
+ Button *b = obj->cast_to<Button>();
+ ERR_FAIL_COND(!b);
+
+ if (p_preview.is_null()) {
+ b->set_text(ud[1]);
+ } else {
+
+ b->set_icon(p_preview);
+ }
+
+}
+
/////////////////////////
@@ -2250,6 +2510,11 @@ void VisualScriptEditor::_graph_disconnected(const String& p_from,int p_from_slo
}
+void VisualScriptEditor::_graph_connect_to_empty(const String& p_from,int p_from_slot,const Vector2& p_release_pos) {
+
+
+}
+
void VisualScriptEditor::_default_value_changed() {
@@ -2285,8 +2550,12 @@ void VisualScriptEditor::_default_value_edited(Node * p_button,int p_id,int p_in
default_value_edit->set_pos(p_button->cast_to<Control>()->get_global_pos()+Vector2(0,p_button->cast_to<Control>()->get_size().y));
default_value_edit->set_size(Size2(1,1));
- if (default_value_edit->edit(NULL,pinfo.name,pinfo.type,existing,pinfo.hint,pinfo.hint_string))
- default_value_edit->popup();
+ if (default_value_edit->edit(NULL,pinfo.name,pinfo.type,existing,pinfo.hint,pinfo.hint_string)) {
+ if (pinfo.hint==PROPERTY_HINT_MULTILINE_TEXT)
+ default_value_edit->popup_centered_ratio();
+ else
+ default_value_edit->popup();
+ }
editing_id = p_id;
editing_input=p_input_port;
@@ -2331,6 +2600,39 @@ void VisualScriptEditor::_graph_ofs_changed(const Vector2& p_ofs) {
updating_graph=false;
}
+void VisualScriptEditor::_comment_node_resized(const Vector2& p_new_size,int p_node) {
+
+ if (updating_graph)
+ return;
+
+ Ref<VisualScriptComment> vsc = script->get_node(edited_func,p_node);
+ if (vsc.is_null())
+ return;
+
+ Node *node = graph->get_node(itos(p_node));
+ if (!node)
+ return;
+ GraphNode *gn = node->cast_to<GraphNode>();
+ if (!gn)
+ return;
+
+ updating_graph=true;
+
+ graph->set_block_minimum_size_adjust(true); //faster resize
+
+ undo_redo->create_action("Resize Comment",true);
+ undo_redo->add_do_method(vsc.ptr(),"set_size",p_new_size/EDSCALE);
+ undo_redo->add_undo_method(vsc.ptr(),"set_size",vsc->get_size());
+ undo_redo->commit_action();
+
+ gn->set_custom_minimum_size(p_new_size); //for this time since graph update is blocked
+ gn->set_size(Size2(1,1));
+ graph->set_block_minimum_size_adjust(false);
+ updating_graph=false;
+
+
+}
+
void VisualScriptEditor::_menu_option(int p_what) {
switch(p_what) {
@@ -2366,8 +2668,151 @@ void VisualScriptEditor::_menu_option(int p_what) {
//popup disappearing grabs focus to owner, so use call deferred
node_filter->call_deferred("grab_focus");
node_filter->call_deferred("select_all");
+ } break;
+ case EDIT_COPY_NODES:
+ case EDIT_CUT_NODES: {
+
+ if (!script->has_function(edited_func))
+ break;
+
+ clipboard.nodes.clear();
+ clipboard.data_connections.clear();
+ clipboard.sequence_connections.clear();
+
+ for(int i=0;i<graph->get_child_count();i++) {
+ GraphNode *gn = graph->get_child(i)->cast_to<GraphNode>();
+ if (gn) {
+ if (gn->is_selected()) {
+
+ int id = String(gn->get_name()).to_int();
+ Ref<VisualScriptNode> node = script->get_node(edited_func,id);
+ if (node->cast_to<VisualScriptFunction>()) {
+ EditorNode::get_singleton()->show_warning("Can't copy the function node.");
+ return;
+ }
+ if (node.is_valid()) {
+ clipboard.nodes[id]=node->duplicate();
+ clipboard.nodes_positions[id]=script->get_node_pos(edited_func,id);
+ }
+
+ }
+ }
+ }
+
+ if (clipboard.nodes.empty())
+ break;
+
+ List<VisualScript::SequenceConnection> sequence_connections;
+
+ script->get_sequence_connection_list(edited_func,&sequence_connections);
+
+ for (List<VisualScript::SequenceConnection>::Element *E=sequence_connections.front();E;E=E->next()) {
+
+ if (clipboard.nodes.has(E->get().from_node) && clipboard.nodes.has(E->get().to_node)) {
+
+ clipboard.sequence_connections.insert(E->get());
+ }
+ }
+
+ List<VisualScript::DataConnection> data_connections;
+
+ script->get_data_connection_list(edited_func,&data_connections);
+
+ for (List<VisualScript::DataConnection>::Element *E=data_connections.front();E;E=E->next()) {
+
+ if (clipboard.nodes.has(E->get().from_node) && clipboard.nodes.has(E->get().to_node)) {
+
+ clipboard.data_connections.insert(E->get());
+ }
+ }
+
+ if (p_what==EDIT_CUT_NODES) {
+ _on_nodes_delete(); // oh yeah, also delete on cut
+ }
+
+
+ } break;
+ case EDIT_PASTE_NODES: {
+ if (!script->has_function(edited_func))
+ break;
+
+ if (clipboard.nodes.empty()) {
+ EditorNode::get_singleton()->show_warning("Clipboard is empty!");
+ break;
+ }
+
+ Map<int,int> remap;
+
+ undo_redo->create_action("Paste VisualScript Nodes");
+ int idc=script->get_available_id()+1;
+
+ Set<int> to_select;
+
+ Set<Vector2> existing_positions;
+
+ {
+ List<int> nodes;
+ script->get_node_list(edited_func,&nodes);
+ for (List<int>::Element *E=nodes.front();E;E=E->next()) {
+ Vector2 pos = script->get_node_pos(edited_func,E->get()).snapped(Vector2(2,2));
+ existing_positions.insert(pos);
+ }
+ }
+
+ for (Map<int,Ref<VisualScriptNode> >::Element *E=clipboard.nodes.front();E;E=E->next()) {
+
+
+ Ref<VisualScriptNode> node = E->get()->duplicate();
+
+ int new_id = idc++;
+ to_select.insert(new_id);
+
+ remap[E->key()]=new_id;
+
+ Vector2 paste_pos = clipboard.nodes_positions[E->key()];
+
+ while(existing_positions.has(paste_pos.snapped(Vector2(2,2)))) {
+ paste_pos+=Vector2(20,20)*EDSCALE;
+ }
+
+
+ undo_redo->add_do_method(script.ptr(),"add_node",edited_func,new_id,node,paste_pos);
+ undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,new_id);
+
+ }
+
+ for (Set<VisualScript::SequenceConnection>::Element *E=clipboard.sequence_connections.front();E;E=E->next()) {
+
+
+ undo_redo->add_do_method(script.ptr(),"sequence_connect",edited_func,remap[E->get().from_node],E->get().from_output,remap[E->get().to_node]);
+ undo_redo->add_undo_method(script.ptr(),"sequence_disconnect",edited_func,remap[E->get().from_node],E->get().from_output,remap[E->get().to_node]);
+
+ }
+
+ for (Set<VisualScript::DataConnection>::Element *E=clipboard.data_connections.front();E;E=E->next()) {
+
+
+ undo_redo->add_do_method(script.ptr(),"data_connect",edited_func,remap[E->get().from_node],E->get().from_port,remap[E->get().to_node],E->get().to_port);
+ undo_redo->add_undo_method(script.ptr(),"data_disconnect",edited_func,remap[E->get().from_node],E->get().from_port,remap[E->get().to_node],E->get().to_port);
+
+ }
+
+ undo_redo->add_do_method(this,"_update_graph");
+ undo_redo->add_undo_method(this,"_update_graph");
+
+ undo_redo->commit_action();
+
+ for(int i=0;i<graph->get_child_count();i++) {
+ GraphNode *gn = graph->get_child(i)->cast_to<GraphNode>();
+ if (gn) {
+ int id = gn->get_name().operator String().to_int();
+ gn->set_selected(to_select.has(id));
+
+ }
+ }
} break;
+
}
}
@@ -2394,6 +2839,9 @@ void VisualScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_menu_option",&VisualScriptEditor::_menu_option);
ObjectTypeDB::bind_method("_graph_ofs_changed",&VisualScriptEditor::_graph_ofs_changed);
ObjectTypeDB::bind_method("_center_on_node",&VisualScriptEditor::_center_on_node);
+ ObjectTypeDB::bind_method("_comment_node_resized",&VisualScriptEditor::_comment_node_resized);
+ ObjectTypeDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed);
+
@@ -2409,9 +2857,16 @@ void VisualScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_graph_connected",&VisualScriptEditor::_graph_connected);
ObjectTypeDB::bind_method("_graph_disconnected",&VisualScriptEditor::_graph_disconnected);
+ ObjectTypeDB::bind_method("_graph_connect_to_empty",&VisualScriptEditor::_graph_connect_to_empty);
+
ObjectTypeDB::bind_method("_update_graph_connections",&VisualScriptEditor::_update_graph_connections);
ObjectTypeDB::bind_method("_node_filter_changed",&VisualScriptEditor::_node_filter_changed);
+ ObjectTypeDB::bind_method("_selected_method",&VisualScriptEditor::_selected_method);
+ ObjectTypeDB::bind_method("_draw_color_over_button",&VisualScriptEditor::_draw_color_over_button);
+
+
+
}
@@ -2426,6 +2881,11 @@ VisualScriptEditor::VisualScriptEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/delete_selected"), EDIT_DELETE_NODES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/toggle_breakpoint"), EDIT_TOGGLE_BREAKPOINT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/find_node_type"), EDIT_FIND_NODE_TYPE);
+ edit_menu->get_popup()->add_separator();
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/copy_nodes"), EDIT_COPY_NODES);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/cut_nodes"), EDIT_CUT_NODES);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/paste_nodes"), EDIT_PASTE_NODES);
+
edit_menu->get_popup()->connect("item_pressed",this,"_menu_option");
main_hsplit = memnew( HSplitContainer );
@@ -2440,7 +2900,7 @@ VisualScriptEditor::VisualScriptEditor() {
left_vb->set_v_size_flags(SIZE_EXPAND_FILL);
left_vb->set_custom_minimum_size(Size2(180,1)*EDSCALE);
- base_type_select = memnew( Button );
+ base_type_select = memnew( Button );
left_vb->add_margin_child(TTR("Base Type:"),base_type_select);
base_type_select->connect("pressed",this,"_change_base_type");
@@ -2531,6 +2991,7 @@ VisualScriptEditor::VisualScriptEditor() {
graph->connect("connection_request",this,"_graph_connected");
graph->connect("disconnection_request",this,"_graph_disconnected");
+ graph->connect("connection_to_empty",this,"_graph_connect_to_empty");
edit_signal_dialog = memnew( AcceptDialog );
edit_signal_dialog->get_ok()->set_text(TTR("Close"));
@@ -2576,7 +3037,11 @@ VisualScriptEditor::VisualScriptEditor() {
add_child(default_value_edit);
default_value_edit->connect("variant_changed",this,"_default_value_changed");
+ method_select = memnew( PropertySelector );
+ add_child(method_select);
+ method_select->connect("selected",this,"_selected_method");
error_line=-1;
+
}
VisualScriptEditor::~VisualScriptEditor() {
@@ -2607,7 +3072,10 @@ static void register_editor_callback() {
ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"));
ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
- ED_SHORTCUT("visual_script_editor/find_node_type", TTR("Find Node Tyoe"), KEY_MASK_CMD+KEY_F);
+ ED_SHORTCUT("visual_script_editor/find_node_type", TTR("Find Node Type"), KEY_MASK_CMD+KEY_F);
+ ED_SHORTCUT("visual_script_editor/copy_nodes", TTR("Copy Nodes"), KEY_MASK_CMD+KEY_C);
+ ED_SHORTCUT("visual_script_editor/cut_nodes", TTR("Cut Nodes"), KEY_MASK_CMD+KEY_X);
+ ED_SHORTCUT("visual_script_editor/paste_nodes", TTR("Paste Nodes"), KEY_MASK_CMD+KEY_V);
}
@@ -2620,3 +3088,4 @@ void VisualScriptEditor::register_editor() {
}
+#endif
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index bd33f35739..735eaae446 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -6,11 +6,12 @@
#include "tools/editor/property_editor.h"
#include "scene/gui/graph_edit.h"
#include "tools/editor/create_dialog.h"
-
+#include "tools/editor/property_selector.h"
class VisualScriptEditorSignalEdit;
class VisualScriptEditorVariableEdit;
+#ifdef TOOLS_ENABLED
class VisualScriptEditor : public ScriptEditorBase {
OBJ_TYPE(VisualScriptEditor,ScriptEditorBase)
@@ -26,6 +27,9 @@ class VisualScriptEditor : public ScriptEditorBase {
EDIT_DELETE_NODES,
EDIT_TOGGLE_BREAKPOINT,
EDIT_FIND_NODE_TYPE,
+ EDIT_COPY_NODES,
+ EDIT_CUT_NODES,
+ EDIT_PASTE_NODES,
};
MenuButton *edit_menu;
@@ -47,6 +51,7 @@ class VisualScriptEditor : public ScriptEditorBase {
AcceptDialog *edit_signal_dialog;
PropertyEditor *edit_signal_edit;
+ PropertySelector *method_select;
VisualScriptEditorVariableEdit *variable_editor;
@@ -97,6 +102,15 @@ class VisualScriptEditor : public ScriptEditorBase {
String _validate_name(const String& p_name) const;
+ struct Clipboard {
+
+ Map<int,Ref<VisualScriptNode> > nodes;
+ Map<int,Vector2 > nodes_positions;
+
+ Set<VisualScript::SequenceConnection> sequence_connections;
+ Set<VisualScript::DataConnection> data_connections;
+ } clipboard;
+
int error_line;
@@ -118,6 +132,8 @@ class VisualScriptEditor : public ScriptEditorBase {
void _remove_node(int p_id);
void _graph_connected(const String& p_from,int p_from_slot,const String& p_to,int p_to_slot);
void _graph_disconnected(const String& p_from,int p_from_slot,const String& p_to,int p_to_slot);
+ void _graph_connect_to_empty(const String& p_from,int p_from_slot,const Vector2& p_release_pos);
+
void _node_ports_changed(const String& p_func,int p_id);
void _available_node_doubleclicked();
@@ -146,6 +162,15 @@ class VisualScriptEditor : public ScriptEditorBase {
void _menu_option(int p_what);
void _graph_ofs_changed(const Vector2& p_ofs);
+ void _comment_node_resized(const Vector2& p_new_size,int p_node);
+
+ int selecting_method_id;
+ void _selected_method(const String& p_method);
+
+ void _draw_color_over_button(Object* obj,Color p_color);
+ void _button_resource_previewed(const String& p_path,const Ref<Texture>& p_preview,Variant p_ud);
+
+
protected:
void _notification(int p_what);
@@ -174,11 +199,13 @@ public:
virtual void set_debugger_active(bool p_active);
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
virtual Control *get_edit_menu();
+ virtual bool can_lose_focus_on_node_selection() { return false; }
static void register_editor();
VisualScriptEditor();
~VisualScriptEditor();
};
+#endif
#endif // VisualSCRIPT_EDITOR_H
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index cb0ff4086c..700d5d57ff 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -2,6 +2,7 @@
#include "os/keyboard.h"
#include "globals.h"
+
//////////////////////////////////////////
////////////////RETURN////////////////////
//////////////////////////////////////////
@@ -85,7 +86,7 @@ void VisualScriptReturn::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_enable_return_value","enable"),&VisualScriptReturn::set_enable_return_value);
ObjectTypeDB::bind_method(_MD("is_return_value_enabled"),&VisualScriptReturn::is_return_value_enabled);
- String argt="Variant";
+ String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
argt+=","+Variant::get_type_name(Variant::Type(i));
}
@@ -152,7 +153,7 @@ static Ref<VisualScriptNode> create_return_node(const String& p_name) {
int VisualScriptCondition::get_output_sequence_port_count() const {
- return 2;
+ return 3;
}
bool VisualScriptCondition::has_input_sequence_port() const{
@@ -173,8 +174,10 @@ String VisualScriptCondition::get_output_sequence_port_text(int p_port) const {
if (p_port==0)
return "true";
- else
+ else if (p_port==1)
return "false";
+ else
+ return "done";
}
PropertyInfo VisualScriptCondition::get_input_value_port_info(int p_idx) const{
@@ -217,10 +220,12 @@ public:
virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
- if (p_inputs[0]->operator bool())
- return 0;
+ if (p_start_mode==START_MODE_CONTINUE_SEQUENCE)
+ return 2;
+ else if (p_inputs[0]->operator bool())
+ return 0 | STEP_FLAG_PUSH_STACK_BIT;
else
- return 1;
+ return 1 | STEP_FLAG_PUSH_STACK_BIT;
}
@@ -1660,6 +1665,197 @@ VisualScriptInputFilter::VisualScriptInputFilter() {
}
+//////////////////////////////////////////
+////////////////TYPE CAST///////////
+//////////////////////////////////////////
+
+
+int VisualScriptTypeCast::get_output_sequence_port_count() const {
+
+ return 2;
+}
+
+bool VisualScriptTypeCast::has_input_sequence_port() const{
+
+ return true;
+}
+
+int VisualScriptTypeCast::get_input_value_port_count() const{
+
+
+ return 1;
+}
+int VisualScriptTypeCast::get_output_value_port_count() const{
+
+ return 1;
+}
+
+String VisualScriptTypeCast::get_output_sequence_port_text(int p_port) const {
+
+ return p_port==0 ? "yes" : "no";
+}
+
+PropertyInfo VisualScriptTypeCast::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo(Variant::OBJECT,"instance");
+}
+
+PropertyInfo VisualScriptTypeCast::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(Variant::OBJECT,"");
+}
+
+
+String VisualScriptTypeCast::get_caption() const {
+
+ return "TypeCast";
+}
+
+String VisualScriptTypeCast::get_text() const {
+
+ if (script!=String())
+ return "Is "+script.get_file()+"?";
+ else
+ return "Is "+base_type+"?";
+}
+
+void VisualScriptTypeCast::set_base_type(const StringName& p_type) {
+
+ if (base_type==p_type)
+ return;
+
+ base_type=p_type;
+ _change_notify();
+ ports_changed_notify();
+}
+
+StringName VisualScriptTypeCast::get_base_type() const{
+
+ return base_type;
+}
+
+void VisualScriptTypeCast::set_base_script(const String& p_path){
+
+ if (script==p_path)
+ return;
+
+ script=p_path;
+ _change_notify();
+ ports_changed_notify();
+
+}
+String VisualScriptTypeCast::get_base_script() const{
+
+ return script;
+}
+
+
+class VisualScriptNodeInstanceTypeCast : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+ StringName base_type;
+ String script;
+
+ //virtual int get_working_memory_size() const { return 0; }
+ //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
+ //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ Object *obj = *p_inputs[0];
+
+ *p_outputs[0]=Variant();
+
+ if (!obj) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error_str="Instance is null";
+ return 0;
+ }
+
+ if (script!=String()) {
+
+ Ref<Script> obj_script = obj->get_script();
+ if (!obj_script.is_valid()) {
+ return 1; //well, definitely not the script because object we got has no script.
+ }
+
+ if (!ResourceCache::has(script)) {
+ //if the script is not in use by anyone, we can safely assume whathever we got is not casting to it.
+ return 1;
+ }
+ Ref<Script> cast_script = Ref<Resource>(ResourceCache::get(script));
+ if (!cast_script.is_valid()) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error_str="Script path is not a script: "+script;
+ return 1;
+ }
+
+ while(obj_script.is_valid()) {
+
+ if (cast_script==obj_script) {
+ *p_outputs[0]=*p_inputs[0]; //copy
+ return 0; // it is the script, yey
+ }
+
+ obj_script=obj_script->get_base_script();
+ }
+
+ return 1; //not found sorry
+ }
+
+ if (ObjectTypeDB::is_type(obj->get_type_name(),base_type)) {
+ *p_outputs[0]=*p_inputs[0]; //copy
+ return 0;
+ } else
+ return 1;
+
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptTypeCast::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceTypeCast * instance = memnew(VisualScriptNodeInstanceTypeCast );
+ instance->instance=p_instance;
+ instance->base_type=base_type;
+ instance->script=script;
+ return instance;
+}
+
+
+
+void VisualScriptTypeCast::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_base_type","type"),&VisualScriptTypeCast::set_base_type);
+ ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptTypeCast::get_base_type);
+
+ ObjectTypeDB::bind_method(_MD("set_base_script","path"),&VisualScriptTypeCast::set_base_script);
+ ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptTypeCast::get_base_script);
+
+
+ List<String> script_extensions;
+ for(int i=0;i>ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
+ }
+
+ String script_ext_hint;
+ for (List<String>::Element *E=script_extensions.front();E;E=E->next()) {
+ if (script_ext_hint!=String())
+ script_ext_hint+=",";
+ script_ext_hint+="*."+E->get();
+ }
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_script",PROPERTY_HINT_FILE,script_ext_hint),_SCS("set_base_script"),_SCS("get_base_script"));
+
+}
+
+VisualScriptTypeCast::VisualScriptTypeCast() {
+
+ base_type="Object";
+}
void register_visual_script_flow_control_nodes() {
@@ -1672,6 +1868,7 @@ void register_visual_script_flow_control_nodes() {
VisualScriptLanguage::singleton->add_register_func("flow_control/sequence",create_node_generic<VisualScriptSequence>);
VisualScriptLanguage::singleton->add_register_func("flow_control/input_select",create_node_generic<VisualScriptInputSelector>);
VisualScriptLanguage::singleton->add_register_func("flow_control/input_filter",create_node_generic<VisualScriptInputFilter>);
+ VisualScriptLanguage::singleton->add_register_func("flow_control/type_cast",create_node_generic<VisualScriptTypeCast>);
diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h
index ed0e328629..42fab2e44d 100644
--- a/modules/visual_script/visual_script_flow_control.h
+++ b/modules/visual_script/visual_script_flow_control.h
@@ -273,6 +273,56 @@ public:
VisualScriptInputFilter();
};
+
+
+
+
+class VisualScriptTypeCast : public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptTypeCast,VisualScriptNode)
+
+
+ StringName base_type;
+ String script;
+
+protected:
+
+ static void _bind_methods();
+public:
+
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const { return "flow_control"; }
+
+ void set_base_type(const StringName& p_type);
+ StringName get_base_type() const;
+
+ void set_base_script(const String& p_path);
+ String get_base_script() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+
+ VisualScriptTypeCast();
+};
+
+
+
+
void register_visual_script_flow_control_nodes();
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 4006dab4a5..7414447279 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -3,6 +3,8 @@
#include "os/os.h"
#include "scene/main/node.h"
#include "visual_script_nodes.h"
+#include "io/resource_loader.h"
+#include "globals.h"
//////////////////////////////////////////
////////////////CALL//////////////////////
@@ -91,20 +93,23 @@ StringName VisualScriptFunctionCall::_get_base_type() const {
return base_type;
}
+
int VisualScriptFunctionCall::get_input_value_port_count() const{
if (call_mode==CALL_MODE_BASIC_TYPE) {
Vector<StringName> names = Variant::get_method_argument_names(basic_type,function);
- return names.size()+1;
+ return names.size() + (rpc_call_mode>=RPC_RELIABLE_TO_ID?1:0) + 1;
} else {
+
MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
- if (!mb)
- return 0;
+ if (mb) {
+ return mb->get_argument_count() + (call_mode==CALL_MODE_INSTANCE?1:0) + (rpc_call_mode>=RPC_RELIABLE_TO_ID?1:0) - use_default_args;
+ }
- return mb->get_argument_count() + (call_mode==CALL_MODE_INSTANCE?1:0) - use_default_args;
+ return method_cache.arguments.size() + (call_mode==CALL_MODE_INSTANCE?1:0) + (rpc_call_mode>=RPC_RELIABLE_TO_ID?1:0) - use_default_args;
}
}
@@ -117,11 +122,18 @@ int VisualScriptFunctionCall::get_output_value_port_count() const{
return returns?1:0;
} else {
+ int ret;
MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
- if (!mb)
- return 0;
+ if (mb) {
+ ret = mb->has_return() ? 1 : 0;
+ } else
+ ret = 1; //it is assumed that script always returns something
+
+ if (call_mode==CALL_MODE_INSTANCE) {
+ ret++;
+ }
- return mb->has_return() ? 1 : 0;
+ return ret;
}
}
@@ -143,6 +155,16 @@ PropertyInfo VisualScriptFunctionCall::get_input_value_port_info(int p_idx) cons
}
}
+ if (rpc_call_mode>=RPC_RELIABLE_TO_ID) {
+
+ if (p_idx==0) {
+ return PropertyInfo(Variant::INT,"peer_id");
+ } else {
+ p_idx--;
+ }
+
+ }
+
#ifdef DEBUG_METHODS_ENABLED
if (call_mode==CALL_MODE_BASIC_TYPE) {
@@ -155,10 +177,15 @@ PropertyInfo VisualScriptFunctionCall::get_input_value_port_info(int p_idx) cons
} else {
MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
- if (!mb)
- return PropertyInfo();
+ if (mb) {
+ return mb->get_argument_info(p_idx);
+ }
+
+ if (p_idx>=0 && p_idx < method_cache.arguments.size()) {
+ return method_cache.arguments[p_idx];
+ }
- return mb->get_argument_info(p_idx);
+ return PropertyInfo();
}
#else
return PropertyInfo();
@@ -177,13 +204,34 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con
return PropertyInfo(Variant::get_method_return_type(basic_type,function),"");
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
- if (!mb)
- return PropertyInfo();
+ if (call_mode==CALL_MODE_INSTANCE) {
+ if (p_idx==0) {
+ return PropertyInfo(Variant::OBJECT,"pass");
+ } else {
+ p_idx--;
+ }
+ }
+
+ PropertyInfo ret;
+
+ /*MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ if (mb) {
+
+ ret = mb->get_argument_info(-1);
+ } else {*/
+
+ ret = method_cache.return_val;
+
+ //}
+
+ if (call_mode==CALL_MODE_INSTANCE) {
+ ret.name="return";
+ } else {
+ ret.name="";
+ }
+ return ret;
+
- PropertyInfo pi = mb->get_argument_info(-1);
- pi.name="";
- return pi;
}
#else
return PropertyInfo();
@@ -193,59 +241,38 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con
String VisualScriptFunctionCall::get_caption() const {
- static const char*cname[4]= {
+ static const char*cname[5]= {
"CallSelf",
"CallNode",
"CallInstance",
- "CallBasic"
+ "CallBasic",
+ "CallSingleton"
};
- return cname[call_mode];
+ String caption = cname[call_mode];
+
+ if (rpc_call_mode) {
+ caption+=" (RPC)";
+ }
+
+ return caption;
}
String VisualScriptFunctionCall::get_text() const {
if (call_mode==CALL_MODE_SELF)
return " "+String(function)+"()";
+ if (call_mode==CALL_MODE_SINGLETON)
+ return String(singleton)+":"+String(function)+"()";
else if (call_mode==CALL_MODE_BASIC_TYPE)
return Variant::get_type_name(basic_type)+"."+String(function)+"()";
+ else if (call_mode==CALL_MODE_NODE_PATH)
+ return " ["+String(base_path.simplified())+"]."+String(function)+"()";
else
return " "+base_type+"."+String(function)+"()";
}
-void VisualScriptFunctionCall::_update_defargs() {
-
- //save base type if accessible
-
- if (call_mode==CALL_MODE_NODE_PATH) {
-
- Node* node=_get_base_node();
- if (node) {
- base_type=node->get_type();
- }
- } else if (call_mode==CALL_MODE_SELF) {
-
- if (get_visual_script().is_valid()) {
- base_type=get_visual_script()->get_instance_base_type();
- }
- }
-
-
- if (call_mode==CALL_MODE_BASIC_TYPE) {
- use_default_args = Variant::get_method_default_arguments(basic_type,function).size();
- } else {
- if (!get_visual_script().is_valid())
- return; //do not change if not valid yet
-
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
- if (!mb)
- return;
-
- use_default_args=mb->get_default_argument_count();
- }
-
-}
void VisualScriptFunctionCall::set_basic_type(Variant::Type p_type) {
@@ -253,7 +280,7 @@ void VisualScriptFunctionCall::set_basic_type(Variant::Type p_type) {
return;
basic_type=p_type;
- _update_defargs();
+
_change_notify();
ports_changed_notify();
}
@@ -269,7 +296,6 @@ void VisualScriptFunctionCall::set_base_type(const StringName& p_type) {
return;
base_type=p_type;
- _update_defargs();
_change_notify();
ports_changed_notify();
}
@@ -279,13 +305,132 @@ StringName VisualScriptFunctionCall::get_base_type() const{
return base_type;
}
+void VisualScriptFunctionCall::set_base_script(const String& p_path) {
+
+ if (base_script==p_path)
+ return;
+
+ base_script=p_path;
+ _change_notify();
+ ports_changed_notify();
+}
+
+String VisualScriptFunctionCall::get_base_script() const {
+
+ return base_script;
+}
+
+void VisualScriptFunctionCall::set_singleton(const StringName& p_path) {
+
+ if (singleton==p_path)
+ return;
+
+ singleton=p_path;
+ Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ if (obj) {
+ base_type=obj->get_type();
+ }
+
+ _change_notify();
+ ports_changed_notify();
+}
+
+StringName VisualScriptFunctionCall::get_singleton() const {
+
+ return singleton;
+}
+
+
+
+void VisualScriptFunctionCall::_update_method_cache() {
+ StringName type;
+ Ref<Script> script;
+
+ if (call_mode==CALL_MODE_NODE_PATH) {
+
+ Node* node=_get_base_node();
+ if (node) {
+ type=node->get_type();
+ base_type=type; //cache, too
+ script = node->get_script();
+ }
+ } else if (call_mode==CALL_MODE_SELF) {
+
+ if (get_visual_script().is_valid()) {
+ type=get_visual_script()->get_instance_base_type();
+ base_type=type; //cache, too
+ script=get_visual_script();
+ }
+
+ } else if (call_mode==CALL_MODE_SINGLETON) {
+
+ Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ if (obj) {
+ type=obj->get_type();
+ script=obj->get_script();
+ }
+
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+
+ type=base_type;
+ if (base_script!=String()) {
+
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
+
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
+
+ if (ResourceCache::has(base_script)) {
+
+ script = Ref<Resource>( ResourceCache::get(base_script) );
+ } else {
+ return;
+ }
+ }
+ }
+
+
+// print_line("BASE: "+String(type)+" FUNC: "+String(function));
+ MethodBind *mb = ObjectTypeDB::get_method(type,function);
+ if (mb) {
+ use_default_args=mb->get_default_argument_count();
+ method_cache = MethodInfo();
+ for(int i=0;i<mb->get_argument_count();i++) {
+#ifdef DEBUG_METHODS_ENABLED
+ method_cache.arguments.push_back(mb->get_argument_info(i));
+#else
+ method_cache.arguments.push_back(PropertyInfo());
+#endif
+ }
+
+#ifdef DEBUG_METHODS_ENABLED
+
+ method_cache.return_val = mb->get_argument_info(-1);
+#endif
+ } else if (script.is_valid() && script->has_method(function)) {
+
+ method_cache = script->get_method_info(function);
+ use_default_args=method_cache.default_arguments.size();
+ }
+}
+
void VisualScriptFunctionCall::set_function(const StringName& p_type){
if (function==p_type)
return;
function=p_type;
- _update_defargs();
+
+ if (call_mode==CALL_MODE_BASIC_TYPE) {
+ use_default_args = Variant::get_method_default_arguments(basic_type,function).size();
+ } else {
+ //update all caches
+
+ _update_method_cache();
+
+ }
+
+
_change_notify();
ports_changed_notify();
}
@@ -301,7 +446,6 @@ void VisualScriptFunctionCall::set_base_path(const NodePath& p_type) {
return;
base_path=p_type;
- _update_defargs();
_change_notify();
ports_changed_notify();
}
@@ -318,7 +462,6 @@ void VisualScriptFunctionCall::set_call_mode(CallMode p_mode) {
return;
call_mode=p_mode;
- _update_defargs();
_change_notify();
ports_changed_notify();
@@ -339,10 +482,40 @@ void VisualScriptFunctionCall::set_use_default_args(int p_amount) {
}
+void VisualScriptFunctionCall::set_rpc_call_mode(VisualScriptFunctionCall::RPCCallMode p_mode) {
+
+ if (rpc_call_mode==p_mode)
+ return;
+ rpc_call_mode=p_mode;
+ ports_changed_notify();
+ _change_notify();
+}
+
+VisualScriptFunctionCall::RPCCallMode VisualScriptFunctionCall::get_rpc_call_mode() const{
+
+ return rpc_call_mode;
+}
+
+
int VisualScriptFunctionCall::get_use_default_args() const{
return use_default_args;
}
+
+
+
+
+void VisualScriptFunctionCall::_set_argument_cache(const Dictionary& p_cache) {
+ //so everything works in case all else fails
+ method_cache=MethodInfo::from_dict(p_cache);
+
+}
+
+Dictionary VisualScriptFunctionCall::_get_argument_cache() const {
+
+ return method_cache;
+}
+
void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const {
if (property.name=="function/base_type") {
@@ -351,12 +524,36 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
}
}
+ if (property.name=="function/base_script") {
+ if (call_mode!=CALL_MODE_INSTANCE) {
+ property.usage=0;
+ }
+ }
+
if (property.name=="function/basic_type") {
if (call_mode!=CALL_MODE_BASIC_TYPE) {
property.usage=0;
}
}
+ if (property.name=="function/singleton") {
+ if (call_mode!=CALL_MODE_SINGLETON) {
+ property.usage=0;
+ } else {
+ List<Globals::Singleton> names;
+ Globals::get_singleton()->get_singletons(&names);
+ property.hint=PROPERTY_HINT_ENUM;
+ String sl;
+ for (List<Globals::Singleton>::Element *E=names.front();E;E=E->next()) {
+ if (sl!=String())
+ sl+=",";
+ sl+=E->get().name;
+ }
+ property.hint_string=sl;
+
+ }
+ }
+
if (property.name=="function/node_path") {
if (call_mode!=CALL_MODE_NODE_PATH) {
property.usage=0;
@@ -372,48 +569,59 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
}
if (property.name=="function/function") {
- property.hint=PROPERTY_HINT_ENUM;
-
-
- List<MethodInfo> methods;
if (call_mode==CALL_MODE_BASIC_TYPE) {
- if (basic_type==Variant::NIL) {
- property.usage=0;
- return; //nothing for nil
- }
- Variant::CallError ce;
- Variant v = Variant::construct(basic_type,NULL,0,ce);
- v.get_method_list(&methods);
+ property.hint=PROPERTY_HINT_METHOD_OF_VARIANT_TYPE;
+ property.hint_string=Variant::get_type_name(basic_type);
+ } else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+ property.hint=PROPERTY_HINT_METHOD_OF_SCRIPT;
+ property.hint_string=itos(get_visual_script()->get_instance_ID());
+ } else if (call_mode==CALL_MODE_SINGLETON) {
- } else {
+ Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ if (obj) {
+ property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE;
+ property.hint_string=itos(obj->get_instance_ID());
+ } else {
- StringName base = _get_base_type();
- ObjectTypeDB::get_method_list(base,&methods);
+ property.hint=PROPERTY_HINT_METHOD_OF_BASE_TYPE;
+ property.hint_string=base_type;//should be cached
+ }
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+ property.hint=PROPERTY_HINT_METHOD_OF_BASE_TYPE;
+ property.hint_string=base_type;
+ if (base_script!=String()) {
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
- }
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
- List<String> mstring;
- for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- if (E->get().name.begins_with("_"))
- continue;
- mstring.push_back(E->get().name.get_slice(":",0));
- }
+ if (ResourceCache::has(base_script)) {
- mstring.sort();
+ Ref<Script> script = Ref<Resource>( ResourceCache::get(base_script) );
+ if (script.is_valid()) {
- String ml;
- for (List<String>::Element *E=mstring.front();E;E=E->next()) {
+ property.hint=PROPERTY_HINT_METHOD_OF_SCRIPT;
+ property.hint_string=itos(script->get_instance_ID());
+ }
+ }
+ }
+
+ } else if (call_mode==CALL_MODE_NODE_PATH) {
+ Node *node = _get_base_node();
+ if (node) {
+ property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE;
+ property.hint_string=itos(node->get_instance_ID());
+ } else {
+ property.hint=PROPERTY_HINT_METHOD_OF_BASE_TYPE;
+ property.hint_string=get_base_type();
+ }
- if (ml!=String())
- ml+=",";
- ml+=E->get();
}
- property.hint_string=ml;
}
if (property.name=="function/use_default_args") {
@@ -440,6 +648,13 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
property.hint_string="0,"+itos(mc)+",1";
}
}
+
+ if (property.name=="rpc/call_mode") {
+ if (call_mode==CALL_MODE_BASIC_TYPE) {
+ property.usage=0;
+ }
+ }
+
}
@@ -448,9 +663,15 @@ void VisualScriptFunctionCall::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptFunctionCall::set_base_type);
ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptFunctionCall::get_base_type);
+ ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptFunctionCall::set_base_script);
+ ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptFunctionCall::get_base_script);
+
ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptFunctionCall::set_basic_type);
ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptFunctionCall::get_basic_type);
+ ObjectTypeDB::bind_method(_MD("set_singleton","singleton"),&VisualScriptFunctionCall::set_singleton);
+ ObjectTypeDB::bind_method(_MD("get_singleton"),&VisualScriptFunctionCall::get_singleton);
+
ObjectTypeDB::bind_method(_MD("set_function","function"),&VisualScriptFunctionCall::set_function);
ObjectTypeDB::bind_method(_MD("get_function"),&VisualScriptFunctionCall::get_function);
@@ -463,6 +684,11 @@ void VisualScriptFunctionCall::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_use_default_args","amount"),&VisualScriptFunctionCall::set_use_default_args);
ObjectTypeDB::bind_method(_MD("get_use_default_args"),&VisualScriptFunctionCall::get_use_default_args);
+ ObjectTypeDB::bind_method(_MD("_set_argument_cache","argument_cache"),&VisualScriptFunctionCall::_set_argument_cache);
+ ObjectTypeDB::bind_method(_MD("_get_argument_cache"),&VisualScriptFunctionCall::_get_argument_cache);
+
+ ObjectTypeDB::bind_method(_MD("set_rpc_call_mode","mode"),&VisualScriptFunctionCall::set_rpc_call_mode);
+ ObjectTypeDB::bind_method(_MD("get_rpc_call_mode"),&VisualScriptFunctionCall::get_rpc_call_mode);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -472,12 +698,31 @@ void VisualScriptFunctionCall::_bind_methods() {
bt+=Variant::get_type_name(Variant::Type(i));
}
- ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+
+ List<String> script_extensions;
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
+ }
+
+ String script_ext_hint;
+ for (List<String>::Element *E=script_extensions.front();E;E=E->next()) {
+ if (script_ext_hint!=String())
+ script_ext_hint+=",";
+ script_ext_hint+="*."+E->get();
+ }
+
+
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type,Singleton"),_SCS("set_call_mode"),_SCS("get_call_mode"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/base_script",PROPERTY_HINT_FILE,script_ext_hint),_SCS("set_base_script"),_SCS("get_base_script"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/singleton"),_SCS("set_singleton"),_SCS("get_singleton"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"function/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"function/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
- ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/function"),_SCS("set_function"),_SCS("get_function"));
+ ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY,"function/argument_cache",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_argument_cache"),_SCS("_get_argument_cache"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/function"),_SCS("set_function"),_SCS("get_function")); //when set, if loaded properly, will override argument count.
ADD_PROPERTY(PropertyInfo(Variant::INT,"function/use_default_args"),_SCS("set_use_default_args"),_SCS("get_use_default_args"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"rpc/call_mode",PROPERTY_HINT_ENUM,"Disabled,Reliable,Unreliable,ReliableToID,UnreliableToID"),_SCS("set_rpc_call_mode"),_SCS("get_rpc_call_mode")); //when set, if loaded properly, will override argument count.
BIND_CONSTANT( CALL_MODE_SELF );
BIND_CONSTANT( CALL_MODE_NODE_PATH);
@@ -493,7 +738,9 @@ public:
NodePath node_path;
int input_args;
bool returns;
+ VisualScriptFunctionCall::RPCCallMode rpc_mode;
StringName function;
+ StringName singleton;
VisualScriptFunctionCall *node;
VisualScriptInstance *instance;
@@ -504,6 +751,35 @@ public:
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
+
+ _FORCE_INLINE_ bool call_rpc(Object* p_base,const Variant** p_args,int p_argcount) {
+
+ if (!p_base)
+ return false;
+
+ Node * node = p_base->cast_to<Node>();
+ if (!node)
+ return false;
+
+ int to_id=0;
+ bool reliable=true;
+
+ if (rpc_mode>=VisualScriptFunctionCall::RPC_RELIABLE_TO_ID) {
+ to_id = *p_args[0];
+ p_args+=1;
+ p_argcount-=1;
+ if (rpc_mode==VisualScriptFunctionCall::RPC_UNRELIABLE_TO_ID) {
+ reliable=false;
+ }
+ } else if (rpc_mode==VisualScriptFunctionCall::RPC_UNRELIABLE) {
+ reliable=false;
+ }
+
+ node->rpcp(to_id,!reliable,function,p_args,p_argcount);
+
+ return true;
+ }
+
virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
@@ -513,7 +789,9 @@ public:
Object *object=instance->get_owner_ptr();
- if (returns) {
+ if (rpc_mode) {
+ call_rpc(object,p_inputs,input_args);
+ } else if (returns) {
*p_outputs[0] = object->call(function,p_inputs,input_args,r_error);
} else {
object->call(function,p_inputs,input_args,r_error);
@@ -535,7 +813,9 @@ public:
return 0;
}
- if (returns) {
+ if (rpc_mode) {
+ call_rpc(node,p_inputs,input_args);
+ } else if (returns) {
*p_outputs[0] = another->call(function,p_inputs,input_args,r_error);
} else {
another->call(function,p_inputs,input_args,r_error);
@@ -547,14 +827,43 @@ public:
Variant v = *p_inputs[0];
- if (returns) {
- *p_outputs[0] = v.call(function,p_inputs+1,input_args,r_error);
+ if (rpc_mode) {
+ Object *obj = v;
+ if (obj) {
+ call_rpc(obj,p_inputs+1,input_args-1);
+ }
+ } else if (returns) {
+ if (call_mode==VisualScriptFunctionCall::CALL_MODE_INSTANCE) {
+ *p_outputs[1] = v.call(function,p_inputs+1,input_args,r_error);
+ } else {
+ *p_outputs[0] = v.call(function,p_inputs+1,input_args,r_error);
+ }
} else {
v.call(function,p_inputs+1,input_args,r_error);
}
+ if (call_mode==VisualScriptFunctionCall::CALL_MODE_INSTANCE) {
+ *p_outputs[0]=*p_inputs[0];
+ }
+
} break;
+ case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
+
+ Object *object=Globals::get_singleton()->get_singleton_object(singleton);
+ if (!object) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error_str="Invalid singleton name: '"+String(singleton)+"'";
+ return 0;
+ }
+ if (rpc_mode) {
+ call_rpc(object,p_inputs,input_args);
+ } else if (returns) {
+ *p_outputs[0] = object->call(function,p_inputs,input_args,r_error);
+ } else {
+ object->call(function,p_inputs,input_args,r_error);
+ }
+ } break;
}
return 0;
@@ -568,19 +877,23 @@ VisualScriptNodeInstance* VisualScriptFunctionCall::instance(VisualScriptInstanc
VisualScriptNodeInstanceFunctionCall * instance = memnew(VisualScriptNodeInstanceFunctionCall );
instance->node=this;
instance->instance=p_instance;
+ instance->singleton=singleton;
instance->function=function;
instance->call_mode=call_mode;
instance->returns=get_output_value_port_count();
instance->node_path=base_path;
instance->input_args = get_input_value_port_count() - ( (call_mode==CALL_MODE_BASIC_TYPE || call_mode==CALL_MODE_INSTANCE) ? 1: 0 );
+ instance->rpc_mode=rpc_call_mode;
return instance;
}
VisualScriptFunctionCall::VisualScriptFunctionCall() {
- call_mode=CALL_MODE_INSTANCE;
+ call_mode=CALL_MODE_SELF;
basic_type=Variant::NIL;
use_default_args=0;
base_type="Object";
+ rpc_call_mode=RPC_DISABLED;
+
}
@@ -675,16 +988,13 @@ StringName VisualScriptPropertySet::_get_base_type() const {
int VisualScriptPropertySet::get_input_value_port_count() const{
- int pc = (call_mode==CALL_MODE_BASIC_TYPE || call_mode==CALL_MODE_INSTANCE)?1:0;
-
- if (!use_builtin_value)
- pc++;
+ int pc = (call_mode==CALL_MODE_BASIC_TYPE || call_mode==CALL_MODE_INSTANCE)?2:1;
return pc;
}
int VisualScriptPropertySet::get_output_value_port_count() const{
- return call_mode==CALL_MODE_BASIC_TYPE? 1 : 0;
+ return (call_mode==CALL_MODE_BASIC_TYPE || call_mode==CALL_MODE_INSTANCE) ? 1 : 0;
}
String VisualScriptPropertySet::get_output_sequence_port_text(int p_port) const {
@@ -705,60 +1015,16 @@ PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const
}
}
-#ifdef DEBUG_METHODS_ENABLED
-
- //not very efficient but..
-
-
- List<PropertyInfo> pinfo;
-
- if (call_mode==CALL_MODE_BASIC_TYPE) {
-
-
- Variant v;
- if (basic_type==Variant::INPUT_EVENT) {
- InputEvent ev;
- ev.type=event_type;
- v=ev;
- } else {
- Variant::CallError ce;
- v = Variant::construct(basic_type,NULL,0,ce);
- }
- v.get_property_list(&pinfo);
-
- } else if (call_mode==CALL_MODE_NODE_PATH) {
-
- Node *n = _get_base_node();
- if (n) {
- n->get_property_list(&pinfo);
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
-
-
- for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
-
- if (E->get().name==property) {
-
- PropertyInfo info=E->get();
- info.name="value";
- return info;
- }
- }
-
-
-#endif
-
- return PropertyInfo(Variant::NIL,"value");
-
+ PropertyInfo pinfo=type_cache;
+ pinfo.name="value";
+ return pinfo;
}
PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) const{
if (call_mode==CALL_MODE_BASIC_TYPE) {
return PropertyInfo(basic_type,"out");
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+ return PropertyInfo(Variant::OBJECT,"pass");
} else {
return PropertyInfo();
}
@@ -784,18 +1050,12 @@ String VisualScriptPropertySet::get_text() const {
if (call_mode==CALL_MODE_BASIC_TYPE)
prop=Variant::get_type_name(basic_type)+"."+property;
- else
+ else if (call_mode==CALL_MODE_NODE_PATH)
+ prop=String(base_path)+":"+property;
+ else if (call_mode==CALL_MODE_SELF)
prop=property;
-
- if (use_builtin_value) {
- String bit = builtin_value.get_construct_string();
- if (bit.length()>40) {
- bit=bit.substr(0,40);
- bit+="...";
- }
-
- prop+="\n "+bit;
- }
+ else if (call_mode==CALL_MODE_INSTANCE)
+ prop=String(base_type)+":"+property;
return prop;
@@ -839,6 +1099,9 @@ void VisualScriptPropertySet::set_event_type(InputEvent::Type p_type) {
if (event_type==p_type)
return;
event_type=p_type;
+ if (call_mode==CALL_MODE_BASIC_TYPE) {
+ _update_cache();
+ }
_change_notify();
_update_base_type();
ports_changed_notify();
@@ -865,12 +1128,133 @@ StringName VisualScriptPropertySet::get_base_type() const{
return base_type;
}
+
+void VisualScriptPropertySet::set_base_script(const String& p_path) {
+
+ if (base_script==p_path)
+ return;
+
+ base_script=p_path;
+ _change_notify();
+ ports_changed_notify();
+}
+
+String VisualScriptPropertySet::get_base_script() const {
+
+ return base_script;
+}
+
+
+void VisualScriptPropertySet::_update_cache() {
+
+
+ if (!OS::get_singleton()->get_main_loop())
+ return;
+ if (!OS::get_singleton()->get_main_loop()->cast_to<SceneTree>())
+ return;
+
+ if (!OS::get_singleton()->get_main_loop()->cast_to<SceneTree>()->is_editor_hint()) //only update cache if editor exists, it's pointless otherwise
+ return;
+
+ if (call_mode==CALL_MODE_BASIC_TYPE) {
+
+ //not super efficient..
+
+ Variant v;
+ if (basic_type==Variant::INPUT_EVENT) {
+ InputEvent ev;
+ ev.type=event_type;
+ v=ev;
+ } else {
+ Variant::CallError ce;
+ v = Variant::construct(basic_type,NULL,0,ce);
+ }
+
+ List<PropertyInfo> pinfo;
+ v.get_property_list(&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ if (E->get().name==property) {
+
+ type_cache=E->get();
+ }
+ }
+
+ } else {
+
+
+ StringName type;
+ Ref<Script> script;
+ Node *node=NULL;
+
+ if (call_mode==CALL_MODE_NODE_PATH) {
+
+ node=_get_base_node();
+ if (node) {
+ type=node->get_type();
+ base_type=type; //cache, too
+ script = node->get_script();
+ }
+ } else if (call_mode==CALL_MODE_SELF) {
+
+ if (get_visual_script().is_valid()) {
+ type=get_visual_script()->get_instance_base_type();
+ base_type=type; //cache, too
+ script=get_visual_script();
+ }
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+
+ type=base_type;
+ if (base_script!=String()) {
+
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
+
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
+
+ if (ResourceCache::has(base_script)) {
+
+ script = Ref<Resource>( ResourceCache::get(base_script) );
+ } else {
+ return;
+ }
+ }
+ }
+
+ List<PropertyInfo> pinfo;
+
+
+ if (node) {
+
+ node->get_property_list(&pinfo);
+ } else {
+ ObjectTypeDB::get_property_list(type,&pinfo);
+ }
+
+ if (script.is_valid()) {
+
+ script->get_script_property_list(&pinfo);
+ }
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ if (E->get().name==property) {
+ type_cache=E->get();
+ return;
+ }
+ }
+
+ }
+}
+
void VisualScriptPropertySet::set_property(const StringName& p_type){
if (property==p_type)
return;
property=p_type;
+ _update_cache();
_change_notify();
ports_changed_notify();
}
@@ -914,34 +1298,17 @@ VisualScriptPropertySet::CallMode VisualScriptPropertySet::get_call_mode() const
}
-void VisualScriptPropertySet::set_use_builtin_value(bool p_use) {
-
- if (use_builtin_value==p_use)
- return;
-
- use_builtin_value=p_use;
- _change_notify();
- ports_changed_notify();
-
-}
-bool VisualScriptPropertySet::is_using_builtin_value() const{
- return use_builtin_value;
+void VisualScriptPropertySet::_set_type_cache(const Dictionary &p_type) {
+ type_cache=PropertyInfo::from_dict(p_type);
}
-void VisualScriptPropertySet::set_builtin_value(const Variant& p_value){
-
- if (builtin_value==p_value)
- return;
-
- builtin_value=p_value;
+Dictionary VisualScriptPropertySet::_get_type_cache() const {
+ return type_cache;
}
-Variant VisualScriptPropertySet::get_builtin_value() const{
- return builtin_value;
-}
void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
if (property.name=="property/base_type") {
@@ -950,6 +1317,11 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
}
}
+ if (property.name=="property/base_script") {
+ if (call_mode!=CALL_MODE_INSTANCE) {
+ property.usage=0;
+ }
+ }
if (property.name=="property/basic_type") {
if (call_mode!=CALL_MODE_BASIC_TYPE) {
@@ -978,99 +1350,50 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
}
if (property.name=="property/property") {
- property.hint=PROPERTY_HINT_ENUM;
-
-
- List<PropertyInfo> pinfo;
-
if (call_mode==CALL_MODE_BASIC_TYPE) {
- Variant::CallError ce;
- Variant v;
- if (basic_type==Variant::INPUT_EVENT) {
- InputEvent ev;
- ev.type=event_type;
- v=ev;
- } else {
- v = Variant::construct(basic_type,NULL,0,ce);
- }
- v.get_property_list(&pinfo);
-
- } else if (call_mode==CALL_MODE_NODE_PATH) {
- Node *n = _get_base_node();
- if (n) {
- n->get_property_list(&pinfo);
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
- } else {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE;
+ property.hint_string=Variant::get_type_name(basic_type);
+ } else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+ property.hint_string=itos(get_visual_script()->get_instance_ID());
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+ property.hint_string=base_type;
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
+ if (base_script!=String()) {
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
- }
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
- List<String> mstring;
+ if (ResourceCache::has(base_script)) {
- for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ Ref<Script> script = Ref<Resource>( ResourceCache::get(base_script) );
+ if (script.is_valid()) {
- if (E->get().usage&PROPERTY_USAGE_EDITOR) {
- mstring.push_back(E->get().name);
+ property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+ property.hint_string=itos(script->get_instance_ID());
+ }
+ }
}
- }
-
- String ml;
- for (List<String>::Element *E=mstring.front();E;E=E->next()) {
-
- if (ml!=String())
- ml+=",";
- ml+=E->get();
- }
-
- if (ml==String()) {
- property.usage=PROPERTY_USAGE_NOEDITOR; //do not show for editing if empty
- } else {
- property.hint_string=ml;
- }
- }
-
- if (property.name=="value/builtin") {
- if (!use_builtin_value) {
- property.usage=0;
- } else {
- List<PropertyInfo> pinfo;
-
- if (call_mode==CALL_MODE_BASIC_TYPE) {
- Variant::CallError ce;
- Variant v = Variant::construct(basic_type,NULL,0,ce);
- v.get_property_list(&pinfo);
-
- } else if (call_mode==CALL_MODE_NODE_PATH) {
-
- Node *n = _get_base_node();
- if (n) {
- n->get_property_list(&pinfo);
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
+ } else if (call_mode==CALL_MODE_NODE_PATH) {
+ Node *node = _get_base_node();
+ if (node) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_INSTANCE;
+ property.hint_string=itos(node->get_instance_ID());
} else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
+ property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+ property.hint_string=get_base_type();
}
- for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
-
- if (E->get().name==this->property) {
-
- property.hint=E->get().hint;
- property.type=E->get().type;
- property.hint_string=E->get().hint_string;
- }
- }
}
}
+
}
void VisualScriptPropertySet::_bind_methods() {
@@ -1078,10 +1401,15 @@ void VisualScriptPropertySet::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertySet::set_base_type);
ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptPropertySet::get_base_type);
+ ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertySet::set_base_script);
+ ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptPropertySet::get_base_script);
ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertySet::set_basic_type);
ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertySet::get_basic_type);
+ ObjectTypeDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertySet::_set_type_cache);
+ ObjectTypeDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertySet::_get_type_cache);
+
ObjectTypeDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertySet::set_event_type);
ObjectTypeDB::bind_method(_MD("get_event_type"),&VisualScriptPropertySet::get_event_type);
@@ -1094,11 +1422,7 @@ void VisualScriptPropertySet::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertySet::set_base_path);
ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptPropertySet::get_base_path);
- ObjectTypeDB::bind_method(_MD("set_builtin_value","value"),&VisualScriptPropertySet::set_builtin_value);
- ObjectTypeDB::bind_method(_MD("get_builtin_value"),&VisualScriptPropertySet::get_builtin_value);
- ObjectTypeDB::bind_method(_MD("set_use_builtin_value","enable"),&VisualScriptPropertySet::set_use_builtin_value);
- ObjectTypeDB::bind_method(_MD("is_using_builtin_value"),&VisualScriptPropertySet::is_using_builtin_value);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -1116,15 +1440,26 @@ void VisualScriptPropertySet::_bind_methods() {
et+=event_type_names[i];
}
+ List<String> script_extensions;
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
+ }
+
+ String script_ext_hint;
+ for (List<String>::Element *E=script_extensions.front();E;E=E->next()) {
+ if (script_ext_hint!=String())
+ script_ext_hint+=",";
+ script_ext_hint+="*."+E->get();
+ }
- ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type"),_SCS("set_call_mode"),_SCS("get_call_mode"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_script",PROPERTY_HINT_FILE,script_ext_hint),_SCS("set_base_script"),_SCS("get_base_script"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"property/type_cache",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_type_cache"),_SCS("_get_type_cache"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"property/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"property/event_type",PROPERTY_HINT_ENUM,et),_SCS("set_event_type"),_SCS("get_event_type"));
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"property/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/property"),_SCS("set_property"),_SCS("get_property"));
- ADD_PROPERTY(PropertyInfo(Variant::BOOL,"value/use_builtin"),_SCS("set_use_builtin_value"),_SCS("is_using_builtin_value"));
- ADD_PROPERTY(PropertyInfo(Variant::NIL,"value/builtin"),_SCS("set_builtin_value"),_SCS("get_builtin_value"));
BIND_CONSTANT( CALL_MODE_SELF );
BIND_CONSTANT( CALL_MODE_NODE_PATH);
@@ -1139,8 +1474,6 @@ public:
VisualScriptPropertySet::CallMode call_mode;
NodePath node_path;
StringName property;
- bool use_builtin;
- Variant builtin_val;
VisualScriptPropertySet *node;
VisualScriptInstance *instance;
@@ -1162,15 +1495,11 @@ public:
bool valid;
- if (use_builtin) {
- object->set(property,builtin_val,&valid);
- } else {
- object->set(property,*p_inputs[0],&valid);
- }
+ object->set(property,*p_inputs[0],&valid);
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid index property name.";
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+object->get_type();
}
} break;
case VisualScriptPropertySet::CALL_MODE_NODE_PATH: {
@@ -1191,15 +1520,11 @@ public:
bool valid;
- if (use_builtin) {
- another->set(property,builtin_val,&valid);
- } else {
- another->set(property,*p_inputs[0],&valid);
- }
+ another->set(property,*p_inputs[0],&valid);
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid index property name.";
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+another->get_type();
}
} break;
@@ -1210,20 +1535,14 @@ public:
bool valid;
- if (use_builtin) {
- v.set(property,builtin_val,&valid);
- } else {
- v.set(property,p_inputs[1],&valid);
- }
+ v.set(property,*p_inputs[1],&valid);
if (!valid) {
- r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid index property name.";
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error_str="Invalid set value '"+String(*p_inputs[1])+"' ("+Variant::get_type_name(p_inputs[1]->get_type())+") on property '"+String(property)+"' of type "+Variant::get_type_name(v.get_type());
}
- if (call_mode==VisualScriptPropertySet::CALL_MODE_BASIC_TYPE) {
- *p_outputs[0]=v;
- }
+ *p_outputs[0]=v;
} break;
@@ -1243,14 +1562,12 @@ VisualScriptNodeInstance* VisualScriptPropertySet::instance(VisualScriptInstance
instance->property=property;
instance->call_mode=call_mode;
instance->node_path=base_path;
- instance->use_builtin=use_builtin_value;
- instance->builtin_val=builtin_value;
return instance;
}
VisualScriptPropertySet::VisualScriptPropertySet() {
- call_mode=CALL_MODE_INSTANCE;
+ call_mode=CALL_MODE_SELF;
base_type="Object";
basic_type=Variant::NIL;
event_type=InputEvent::NONE;
@@ -1348,6 +1665,7 @@ StringName VisualScriptPropertyGet::_get_base_type() const {
return base_type;
}
+
int VisualScriptPropertyGet::get_input_value_port_count() const{
return (call_mode==CALL_MODE_BASIC_TYPE || call_mode==CALL_MODE_INSTANCE)?1:0;
@@ -1381,17 +1699,75 @@ PropertyInfo VisualScriptPropertyGet::get_input_value_port_info(int p_idx) const
PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) const{
+ return PropertyInfo(type_cache,"value");
+}
+
+String VisualScriptPropertyGet::get_caption() const {
-#ifdef DEBUG_METHODS_ENABLED
+ static const char*cname[4]= {
+ "SelfGet",
+ "NodeGet",
+ "InstanceGet",
+ "BasicGet"
+ };
+
+ return cname[call_mode];
+}
+
+String VisualScriptPropertyGet::get_text() const {
+
+ String prop;
+
+ if (call_mode==CALL_MODE_BASIC_TYPE)
+ prop=Variant::get_type_name(basic_type)+"."+property;
+ else if (call_mode==CALL_MODE_NODE_PATH)
+ prop=String(base_path)+":"+property;
+ else if (call_mode==CALL_MODE_SELF)
+ prop=property;
+ else if (call_mode==CALL_MODE_INSTANCE)
+ prop=String(base_type)+":"+property;
+
+ return prop;
+}
+
+void VisualScriptPropertyGet::set_base_type(const StringName& p_type) {
- //not very efficient but..
+ if (base_type==p_type)
+ return;
+ base_type=p_type;
+ _change_notify();
+ ports_changed_notify();
+}
+
+StringName VisualScriptPropertyGet::get_base_type() const{
+
+ return base_type;
+}
+
+void VisualScriptPropertyGet::set_base_script(const String& p_path) {
+
+ if (base_script==p_path)
+ return;
+
+ base_script=p_path;
+ _change_notify();
+ ports_changed_notify();
+}
+
+String VisualScriptPropertyGet::get_base_script() const {
+
+ return base_script;
+}
+
+
+void VisualScriptPropertyGet::_update_cache() {
- List<PropertyInfo> pinfo;
if (call_mode==CALL_MODE_BASIC_TYPE) {
+ //not super efficient..
Variant v;
if (basic_type==Variant::INPUT_EVENT) {
@@ -1402,71 +1778,91 @@ PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) cons
Variant::CallError ce;
v = Variant::construct(basic_type,NULL,0,ce);
}
+
+ List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- } else if (call_mode==CALL_MODE_NODE_PATH) {
- Node *n = _get_base_node();
- if (n) {
- n->get_property_list(&pinfo);
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ if (E->get().name==property) {
+
+ type_cache=E->get().type;
+ return;
+ }
}
+
} else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
- for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
- if (E->get().name==property) {
+ StringName type;
+ Ref<Script> script;
+ Node *node=NULL;
- PropertyInfo info=E->get();
- info.name="";
- return info;
- }
- }
+ if (call_mode==CALL_MODE_NODE_PATH) {
+ node=_get_base_node();
+ if (node) {
+ type=node->get_type();
+ base_type=type; //cache, too
+ script = node->get_script();
+ }
+ } else if (call_mode==CALL_MODE_SELF) {
-#endif
+ if (get_visual_script().is_valid()) {
+ type=get_visual_script()->get_instance_base_type();
+ base_type=type; //cache, too
+ script=get_visual_script();
+ }
+ } else if (call_mode==CALL_MODE_INSTANCE) {
- return PropertyInfo(Variant::NIL,"");
-}
+ type=base_type;
+ if (base_script!=String()) {
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
-String VisualScriptPropertyGet::get_caption() const {
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
- static const char*cname[4]= {
- "SelfGet",
- "NodeGet",
- "InstanceGet",
- "BasicGet"
- };
+ if (ResourceCache::has(base_script)) {
- return cname[call_mode];
-}
+ script = Ref<Resource>( ResourceCache::get(base_script) );
+ } else {
+ return;
+ }
+ }
+ }
-String VisualScriptPropertyGet::get_text() const {
+ bool valid=false;
- if (call_mode==CALL_MODE_BASIC_TYPE)
- return Variant::get_type_name(basic_type)+"."+property;
- else
- return property;
+ Variant::Type type_ret;
-}
+ type_ret=ObjectTypeDB::get_property_type(base_type,property,&valid);
-void VisualScriptPropertyGet::set_base_type(const StringName& p_type) {
+ if (valid) {
+ type_cache=type_ret;
+ return; //all dandy
+ }
- if (base_type==p_type)
- return;
+ if (node) {
- base_type=p_type;
- _change_notify();
- ports_changed_notify();
-}
+ Variant prop = node->get(property,&valid);
+ if (valid) {
+ type_cache=prop.get_type();
+ return; //all dandy again
+ }
+ }
-StringName VisualScriptPropertyGet::get_base_type() const{
+ if (script.is_valid()) {
- return base_type;
+ type_ret=script->get_static_property_type(property,&valid);
+
+ if (valid) {
+ type_cache=type_ret;
+ return; //all dandy
+ }
+ }
+ }
}
void VisualScriptPropertyGet::set_property(const StringName& p_type){
@@ -1475,6 +1871,9 @@ void VisualScriptPropertyGet::set_property(const StringName& p_type){
return;
property=p_type;
+
+
+ _update_cache();
_change_notify();
ports_changed_notify();
}
@@ -1541,6 +1940,9 @@ void VisualScriptPropertyGet::set_event_type(InputEvent::Type p_type) {
if (event_type==p_type)
return;
event_type=p_type;
+ if(call_mode==CALL_MODE_BASIC_TYPE) {
+ _update_cache();
+ }
_change_notify();
_update_base_type();
ports_changed_notify();
@@ -1551,6 +1953,17 @@ InputEvent::Type VisualScriptPropertyGet::get_event_type() const{
return event_type;
}
+
+void VisualScriptPropertyGet::_set_type_cache(Variant::Type p_type) {
+ type_cache=p_type;
+}
+
+Variant::Type VisualScriptPropertyGet::_get_type_cache() const {
+
+ return type_cache;
+}
+
+
void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
if (property.name=="property/base_type") {
@@ -1559,6 +1972,11 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
}
}
+ if (property.name=="property/base_script") {
+ if (call_mode!=CALL_MODE_INSTANCE) {
+ property.usage=0;
+ }
+ }
if (property.name=="property/basic_type") {
if (call_mode!=CALL_MODE_BASIC_TYPE) {
@@ -1586,55 +2004,45 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
}
if (property.name=="property/property") {
- property.hint=PROPERTY_HINT_ENUM;
-
-
- List<PropertyInfo> pinfo;
if (call_mode==CALL_MODE_BASIC_TYPE) {
- Variant::CallError ce;
- Variant v;
- if (basic_type==Variant::INPUT_EVENT) {
- InputEvent ev;
- ev.type=event_type;
- v=ev;
- } else {
- v = Variant::construct(basic_type,NULL,0,ce);
- }
- v.get_property_list(&pinfo);
- } else if (call_mode==CALL_MODE_NODE_PATH) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE;
+ property.hint_string=Variant::get_type_name(basic_type);
- Node *n = _get_base_node();
- if (n) {
- n->get_property_list(&pinfo);
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
- } else {
- ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
- }
+ } else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+ property.hint_string=itos(get_visual_script()->get_instance_ID());
+ } else if (call_mode==CALL_MODE_INSTANCE) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+ property.hint_string=base_type;
- List<String> mstring;
+ if (base_script!=String()) {
+ if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
- for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ ScriptServer::edit_request_func(base_script); //make sure it's loaded
+ }
- if (E->get().usage&PROPERTY_USAGE_EDITOR)
- mstring.push_back(E->get().name);
- }
+ if (ResourceCache::has(base_script)) {
- String ml;
- for (List<String>::Element *E=mstring.front();E;E=E->next()) {
+ Ref<Script> script = Ref<Resource>( ResourceCache::get(base_script) );
+ if (script.is_valid()) {
- if (ml!=String())
- ml+=",";
- ml+=E->get();
- }
+ property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+ property.hint_string=itos(script->get_instance_ID());
+ }
+ }
+ }
+ } else if (call_mode==CALL_MODE_NODE_PATH) {
+ Node *node = _get_base_node();
+ if (node) {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_INSTANCE;
+ property.hint_string=itos(node->get_instance_ID());
+ } else {
+ property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+ property.hint_string=get_base_type();
+ }
- if (ml==String()) {
- property.usage=PROPERTY_USAGE_NOEDITOR; //do not show for editing if empty
- } else {
- property.hint_string=ml;
}
}
@@ -1646,10 +2054,15 @@ void VisualScriptPropertyGet::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertyGet::set_base_type);
ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptPropertyGet::get_base_type);
+ ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertyGet::set_base_script);
+ ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptPropertyGet::get_base_script);
ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertyGet::set_basic_type);
ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertyGet::get_basic_type);
+ ObjectTypeDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertyGet::_set_type_cache);
+ ObjectTypeDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertyGet::_get_type_cache);
+
ObjectTypeDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertyGet::set_event_type);
ObjectTypeDB::bind_method(_MD("get_event_type"),&VisualScriptPropertyGet::get_event_type);
@@ -1679,9 +2092,22 @@ void VisualScriptPropertyGet::_bind_methods() {
et+=event_type_names[i];
}
+ List<String> script_extensions;
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
+ }
+
+ String script_ext_hint;
+ for (List<String>::Element *E=script_extensions.front();E;E=E->next()) {
+ if (script_ext_hint!=String())
+ script_ext_hint+=",";
+ script_ext_hint+="."+E->get();
+ }
- ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type"),_SCS("set_call_mode"),_SCS("get_call_mode"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_script",PROPERTY_HINT_FILE,script_ext_hint),_SCS("set_base_script"),_SCS("get_base_script"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"property/type_cache",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_type_cache"),_SCS("_get_type_cache"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"property/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"property/event_type",PROPERTY_HINT_ENUM,et),_SCS("set_event_type"),_SCS("get_event_type"));
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"property/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
@@ -1797,10 +2223,11 @@ VisualScriptNodeInstance* VisualScriptPropertyGet::instance(VisualScriptInstance
VisualScriptPropertyGet::VisualScriptPropertyGet() {
- call_mode=CALL_MODE_INSTANCE;
+ call_mode=CALL_MODE_SELF;
base_type="Object";
basic_type=Variant::NIL;
event_type=InputEvent::NONE;
+ type_cache=Variant::NIL;
}
@@ -1815,463 +2242,6 @@ static Ref<VisualScriptNode> create_property_get_node(const String& p_name) {
//////////////////////////////////////////
-////////////////SCRIPT CALL//////////////////////
-//////////////////////////////////////////
-
-int VisualScriptScriptCall::get_output_sequence_port_count() const {
-
- return 1;
-}
-
-bool VisualScriptScriptCall::has_input_sequence_port() const{
-
- return true;
-}
-
-Node *VisualScriptScriptCall::_get_base_node() const {
-
-#ifdef TOOLS_ENABLED
- Ref<Script> script = get_visual_script();
- if (!script.is_valid())
- return NULL;
-
- MainLoop * main_loop = OS::get_singleton()->get_main_loop();
- if (!main_loop)
- return NULL;
-
- SceneTree *scene_tree = main_loop->cast_to<SceneTree>();
-
- if (!scene_tree)
- return NULL;
-
- Node *edited_scene = scene_tree->get_edited_scene_root();
-
- if (!edited_scene)
- return NULL;
-
- Node* script_node = _find_script_node(edited_scene,edited_scene,script);
-
- if (!script_node)
- return NULL;
-
- if (!script_node->has_node(base_path))
- return NULL;
-
- Node *path_to = script_node->get_node(base_path);
-
- return path_to;
-#else
-
- return NULL;
-#endif
-}
-
-
-int VisualScriptScriptCall::get_input_value_port_count() const{
-
-#if 1
- return argument_count;
-#else
- if (call_mode==CALL_MODE_SELF) {
-
- Ref<VisualScript> vs = get_visual_script();
- if (vs.is_valid()) {
-
- if (!vs->has_function(function))
- return 0;
-
- int id = vs->get_function_node_id(function);
- if (id<0)
- return 0;
-
- Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
- return func->get_argument_count();
- }
- } else {
-
- Node*base = _get_base_node();
- if (!base)
- return 0;
- Ref<Script> script = base->get_script();
- if (!script.is_valid())
- return 0;
-
- List<MethodInfo> functions;
- script->get_method_list(&functions);
- for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
- if (E->get().name==function) {
- return E->get().arguments.size();
- }
- }
-
- }
-
-
- return 0;
-#endif
-
-}
-int VisualScriptScriptCall::get_output_value_port_count() const{
- return 1;
-}
-
-String VisualScriptScriptCall::get_output_sequence_port_text(int p_port) const {
-
- return String();
-}
-
-PropertyInfo VisualScriptScriptCall::get_input_value_port_info(int p_idx) const{
-
- if (call_mode==CALL_MODE_SELF) {
-
- Ref<VisualScript> vs = get_visual_script();
- if (vs.is_valid()) {
-
- if (!vs->has_function(function))
- return PropertyInfo();
-
- int id = vs->get_function_node_id(function);
- if (id<0)
- return PropertyInfo();
-
- Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
- if (p_idx>=func->get_argument_count())
- return PropertyInfo();
- return PropertyInfo(func->get_argument_type(p_idx),func->get_argument_name(p_idx));
- }
- } else {
-
- Node*base = _get_base_node();
- if (!base)
- return PropertyInfo();
- Ref<Script> script = base->get_script();
- if (!script.is_valid())
- return PropertyInfo();
-
- List<MethodInfo> functions;
- script->get_method_list(&functions);
- for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
- if (E->get().name==function) {
- if (p_idx<0 || p_idx>=E->get().arguments.size())
- return PropertyInfo();
- return E->get().arguments[p_idx];
- }
- }
-
- }
-
- return PropertyInfo();
-
-}
-
-PropertyInfo VisualScriptScriptCall::get_output_value_port_info(int p_idx) const{
-
- return PropertyInfo();
-}
-
-
-String VisualScriptScriptCall::get_caption() const {
-
- return "ScriptCall";
-}
-
-String VisualScriptScriptCall::get_text() const {
-
- return " "+String(function)+"()";
-}
-
-void VisualScriptScriptCall::_update_argument_count() {
-
- //try to remember the amount of arguments in the function, because if loaded from scratch
- //this information will not be available
-
- if (call_mode==CALL_MODE_SELF) {
-
- Ref<VisualScript> vs = get_visual_script();
- if (vs.is_valid()) {
-
- if (!vs->has_function(function))
- return ;
-
- int id = vs->get_function_node_id(function);
- if (id<0)
- return;
-
- Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
- argument_count=func->get_argument_count();
- }
- } else {
-
- Node*base = _get_base_node();
- if (!base)
- return;
-
- Ref<Script> script = base->get_script();
- if (!script.is_valid())
- return ;
-
- List<MethodInfo> functions;
- script->get_method_list(&functions);
- for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
- if (E->get().name==function) {
- argument_count=E->get().arguments.size();
- return;
- }
- }
-
- }
-}
-
-
-void VisualScriptScriptCall::set_function(const StringName& p_type){
-
- if (function==p_type)
- return;
-
- function=p_type;
- _update_argument_count();
- _change_notify();
- ports_changed_notify();
-}
-StringName VisualScriptScriptCall::get_function() const {
-
-
- return function;
-}
-
-void VisualScriptScriptCall::set_base_path(const NodePath& p_type) {
-
- if (base_path==p_type)
- return;
-
- base_path=p_type;
- _update_argument_count();
- _change_notify();
- ports_changed_notify();
-}
-
-NodePath VisualScriptScriptCall::get_base_path() const {
-
- return base_path;
-}
-
-
-void VisualScriptScriptCall::set_call_mode(CallMode p_mode) {
-
- if (call_mode==p_mode)
- return;
-
- call_mode=p_mode;
- _update_argument_count();
- _change_notify();
- ports_changed_notify();
-
-}
-
-void VisualScriptScriptCall::set_argument_count(int p_count) {
-
- argument_count=p_count;
- _change_notify();
- ports_changed_notify();
-
-}
-
-int VisualScriptScriptCall::get_argument_count() const {
-
- return argument_count;
-}
-
-VisualScriptScriptCall::CallMode VisualScriptScriptCall::get_call_mode() const {
-
- return call_mode;
-}
-
-void VisualScriptScriptCall::_validate_property(PropertyInfo& property) const {
-
-
-
- if (property.name=="function/node_path") {
- if (call_mode!=CALL_MODE_NODE_PATH) {
- property.usage=0;
- } else {
-
- Node *bnode = _get_base_node();
- if (bnode) {
- property.hint_string=bnode->get_path(); //convert to loong string
- } else {
-
- }
- }
- }
-
- if (property.name=="function/function") {
- property.hint=PROPERTY_HINT_ENUM;
-
-
- List<MethodInfo> methods;
-
- if (call_mode==CALL_MODE_SELF) {
-
- Ref<VisualScript> vs = get_visual_script();
- if (vs.is_valid()) {
-
- vs->get_method_list(&methods);
-
- }
- } else {
-
- Node*base = _get_base_node();
- if (!base)
- return;
- Ref<Script> script = base->get_script();
- if (!script.is_valid())
- return;
-
- script->get_method_list(&methods);
-
- }
-
- List<String> mstring;
- for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- if (E->get().name.begins_with("_"))
- continue;
- mstring.push_back(E->get().name.get_slice(":",0));
- }
-
- mstring.sort();
-
- String ml;
- for (List<String>::Element *E=mstring.front();E;E=E->next()) {
-
- if (ml!=String())
- ml+=",";
- ml+=E->get();
- }
-
- property.hint_string=ml;
- }
-
-}
-
-
-void VisualScriptScriptCall::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("set_function","function"),&VisualScriptScriptCall::set_function);
- ObjectTypeDB::bind_method(_MD("get_function"),&VisualScriptScriptCall::get_function);
-
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptScriptCall::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptScriptCall::get_call_mode);
-
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptScriptCall::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptScriptCall::get_base_path);
-
- ObjectTypeDB::bind_method(_MD("set_argument_count","argument_count"),&VisualScriptScriptCall::set_argument_count);
- ObjectTypeDB::bind_method(_MD("get_argument_count"),&VisualScriptScriptCall::get_argument_count);
-
- ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path"),_SCS("set_call_mode"),_SCS("get_call_mode"));
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"function/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
- ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/function"),_SCS("set_function"),_SCS("get_function"));
- ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/argument_count"),_SCS("set_argument_count"),_SCS("get_argument_count"));
-
- BIND_CONSTANT( CALL_MODE_SELF );
- BIND_CONSTANT( CALL_MODE_NODE_PATH);
-
-}
-
-class VisualScriptNodeInstanceScriptCall : public VisualScriptNodeInstance {
-public:
-
-
- VisualScriptScriptCall::CallMode call_mode;
- NodePath node_path;
- int input_args;
- bool returns;
- StringName function;
-
- VisualScriptScriptCall *node;
- VisualScriptInstance *instance;
-
-
-
- //virtual int get_working_memory_size() const { return 0; }
- //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
- //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
-
- virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
-
-
- switch(call_mode) {
-
- case VisualScriptScriptCall::CALL_MODE_SELF: {
-
- Object *object=instance->get_owner_ptr();
-
- *p_outputs[0] = object->call(function,p_inputs,input_args,r_error);
-
- } break;
- case VisualScriptScriptCall::CALL_MODE_NODE_PATH: {
-
- Node* node = instance->get_owner_ptr()->cast_to<Node>();
- if (!node) {
- r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Base object is not a Node!";
- return 0;
- }
-
- Node* another = node->get_node(node_path);
- if (!node) {
- r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Path does not lead Node!";
- return 0;
- }
-
-
- *p_outputs[0] = another->call(function,p_inputs,input_args,r_error);
-
- } break;
-
- }
- return 0;
-
- }
-
-
-};
-
-VisualScriptNodeInstance* VisualScriptScriptCall::instance(VisualScriptInstance* p_instance) {
-
- VisualScriptNodeInstanceScriptCall * instance = memnew(VisualScriptNodeInstanceScriptCall );
- instance->node=this;
- instance->instance=p_instance;
- instance->function=function;
- instance->call_mode=call_mode;
- instance->node_path=base_path;
- instance->input_args = argument_count;
- return instance;
-}
-
-VisualScriptScriptCall::VisualScriptScriptCall() {
-
- call_mode=CALL_MODE_SELF;
- argument_count=0;
-
-
-}
-
-template<VisualScriptScriptCall::CallMode cmode>
-static Ref<VisualScriptNode> create_script_call_node(const String& p_name) {
-
- Ref<VisualScriptScriptCall> node;
- node.instance();
- node->set_call_mode(cmode);
- return node;
-}
-
-
-//////////////////////////////////////////
////////////////EMIT//////////////////////
//////////////////////////////////////////
@@ -2475,24 +2445,13 @@ static Ref<VisualScriptNode> create_basic_type_call_node(const String& p_name) {
void register_visual_script_func_nodes() {
- VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_instance",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_INSTANCE>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_basic_type",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_BASIC_TYPE>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_self",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_SELF>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_node",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_NODE_PATH>);
-
- VisualScriptLanguage::singleton->add_register_func("functions/property_set/instace_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_INSTANCE>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_set/basic_type_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_BASIC_TYPE>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_set/self_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_SELF>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_set/node_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_NODE_PATH>);
-
- VisualScriptLanguage::singleton->add_register_func("functions/property_get/instance_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_INSTANCE>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_get/basic_type_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_BASIC_TYPE>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_get/self_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_SELF>);
- VisualScriptLanguage::singleton->add_register_func("functions/property_get/node_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_NODE_PATH>);
+ VisualScriptLanguage::singleton->add_register_func("functions/call",create_node_generic<VisualScriptFunctionCall>);
+ VisualScriptLanguage::singleton->add_register_func("functions/set",create_node_generic<VisualScriptPropertySet>);
+ VisualScriptLanguage::singleton->add_register_func("functions/get",create_node_generic<VisualScriptPropertyGet>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
- VisualScriptLanguage::singleton->add_register_func("functions/call_script/emit_signal",create_node_generic<VisualScriptEmitSignal>);
+ //VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>);
+// VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
+ VisualScriptLanguage::singleton->add_register_func("functions/emit_signal",create_node_generic<VisualScriptEmitSignal>);
for(int i=0;i<Variant::VARIANT_MAX;i++) {
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 2ccc61242a..f958da8222 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -13,20 +13,39 @@ public:
CALL_MODE_NODE_PATH,
CALL_MODE_INSTANCE,
CALL_MODE_BASIC_TYPE,
+ CALL_MODE_SINGLETON,
};
+
+ enum RPCCallMode {
+ RPC_DISABLED,
+ RPC_RELIABLE,
+ RPC_UNRELIABLE,
+ RPC_RELIABLE_TO_ID,
+ RPC_UNRELIABLE_TO_ID
+ };
+
private:
CallMode call_mode;
StringName base_type;
+ String base_script;
Variant::Type basic_type;
NodePath base_path;
StringName function;
int use_default_args;
+ RPCCallMode rpc_call_mode;
+ StringName singleton;
+
Node *_get_base_node() const;
StringName _get_base_type() const;
- void _update_defargs();
+ MethodInfo method_cache;
+ void _update_method_cache();
+
+ void _set_argument_cache(const Dictionary& p_args);
+ Dictionary _get_argument_cache() const;
+
protected:
virtual void _validate_property(PropertyInfo& property) const;
@@ -58,24 +77,35 @@ public:
void set_base_type(const StringName& p_type);
StringName get_base_type() const;
+ void set_base_script(const String& p_path);
+ String get_base_script() const;
+
+ void set_singleton(const StringName& p_type);
+ StringName get_singleton() const;
+
void set_function(const StringName& p_type);
StringName get_function() const;
void set_base_path(const NodePath& p_type);
NodePath get_base_path() const;
+
void set_call_mode(CallMode p_mode);
CallMode get_call_mode() const;
void set_use_default_args(int p_amount);
int get_use_default_args() const;
+ void set_rpc_call_mode(RPCCallMode p_mode);
+ RPCCallMode get_rpc_call_mode() const;
+
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
VisualScriptFunctionCall();
};
VARIANT_ENUM_CAST(VisualScriptFunctionCall::CallMode );
+VARIANT_ENUM_CAST(VisualScriptFunctionCall::RPCCallMode );
class VisualScriptPropertySet : public VisualScriptNode {
@@ -92,13 +122,14 @@ public:
};
private:
+ PropertyInfo type_cache;
+
CallMode call_mode;
Variant::Type basic_type;
StringName base_type;
+ String base_script;
NodePath base_path;
StringName property;
- bool use_builtin_value;
- Variant builtin_value;
InputEvent::Type event_type;
Node *_get_base_node() const;
@@ -106,6 +137,12 @@ private:
void _update_base_type();
+ void _update_cache();
+
+ void _set_type_cache(const Dictionary& p_type);
+ Dictionary _get_type_cache() const;
+
+
protected:
virtual void _validate_property(PropertyInfo& property) const;
@@ -134,6 +171,9 @@ public:
void set_base_type(const StringName& p_type);
StringName get_base_type() const;
+ void set_base_script(const String& p_path);
+ String get_base_script() const;
+
void set_basic_type(Variant::Type p_type);
Variant::Type get_basic_type() const;
@@ -149,11 +189,6 @@ public:
void set_call_mode(CallMode p_mode);
CallMode get_call_mode() const;
- void set_use_builtin_value(bool p_use);
- bool is_using_builtin_value() const;
-
- void set_builtin_value(const Variant &p_value);
- Variant get_builtin_value() const;
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
@@ -171,14 +206,17 @@ public:
CALL_MODE_SELF,
CALL_MODE_NODE_PATH,
CALL_MODE_INSTANCE,
- CALL_MODE_BASIC_TYPE
+ CALL_MODE_BASIC_TYPE,
};
private:
+ Variant::Type type_cache;
+
CallMode call_mode;
Variant::Type basic_type;
StringName base_type;
+ String base_script;
NodePath base_path;
StringName property;
InputEvent::Type event_type;
@@ -187,6 +225,10 @@ private:
Node *_get_base_node() const;
StringName _get_base_type() const;
+ void _update_cache();
+
+ void _set_type_cache(Variant::Type p_type);
+ Variant::Type _get_type_cache() const;
protected:
virtual void _validate_property(PropertyInfo& property) const;
@@ -216,6 +258,9 @@ public:
void set_base_type(const StringName& p_type);
StringName get_base_type() const;
+ void set_base_script(const String& p_path);
+ String get_base_script() const;
+
void set_basic_type(Variant::Type p_type);
Variant::Type get_basic_type() const;
@@ -244,74 +289,6 @@ VARIANT_ENUM_CAST(VisualScriptPropertyGet::CallMode );
-class VisualScriptScriptCall : public VisualScriptNode {
-
- OBJ_TYPE(VisualScriptScriptCall,VisualScriptNode)
-public:
- enum CallMode {
- CALL_MODE_SELF,
- CALL_MODE_NODE_PATH,
- };
-private:
-
- CallMode call_mode;
- NodePath base_path;
- StringName function;
- int argument_count;
-
-
- Node *_get_base_node() const;
-
-
- void _update_argument_count();
-protected:
- virtual void _validate_property(PropertyInfo& property) const;
-
- static void _bind_methods();
-
-public:
-
- virtual int get_output_sequence_port_count() const;
- virtual bool has_input_sequence_port() const;
-
-
- virtual String get_output_sequence_port_text(int p_port) const;
-
-
- virtual int get_input_value_port_count() const;
- virtual int get_output_value_port_count() const;
-
-
- virtual PropertyInfo get_input_value_port_info(int p_idx) const;
- virtual PropertyInfo get_output_value_port_info(int p_idx) const;
-
- virtual String get_caption() const;
- virtual String get_text() const;
- virtual String get_category() const { return "functions"; }
-
- void set_function(const StringName& p_type);
- StringName get_function() const;
-
- void set_base_path(const NodePath& p_type);
- NodePath get_base_path() const;
-
- void set_call_mode(CallMode p_mode);
- CallMode get_call_mode() const;
-
- void set_argument_count(int p_count);
- int get_argument_count() const;
-
-
- virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
-
- VisualScriptScriptCall();
-};
-
-VARIANT_ENUM_CAST(VisualScriptScriptCall::CallMode );
-
-
-
-
class VisualScriptEmitSignal : public VisualScriptNode {
OBJ_TYPE(VisualScriptEmitSignal,VisualScriptNode)
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index d205a40f76..21a27b91a3 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -4,6 +4,7 @@
#include "scene/main/scene_main_loop.h"
#include "os/os.h"
#include "scene/main/node.h"
+#include "os/input.h"
//////////////////////////////////////////
////////////////FUNCTION//////////////////
@@ -62,6 +63,12 @@ bool VisualScriptFunction::_set(const StringName& p_name, const Variant& p_valu
stack_size=p_value;
return true;
}
+
+ if (p_name=="rpc/mode") {
+ rpc_mode=ScriptInstance::RPCMode(int(p_value));
+ return true;
+ }
+
return false;
}
@@ -99,13 +106,18 @@ bool VisualScriptFunction::_get(const StringName& p_name,Variant &r_ret) const
return true;
}
+ if (p_name=="rpc/mode") {
+ r_ret=rpc_mode;
+ return true;
+ }
+
return false;
}
void VisualScriptFunction::_get_property_list( List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT,"argument_count",PROPERTY_HINT_RANGE,"0,256"));
- String argt="Variant";
+ String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
argt+=","+Variant::get_type_name(Variant::Type(i));
}
@@ -118,6 +130,7 @@ void VisualScriptFunction::_get_property_list( List<PropertyInfo> *p_list) cons
p_list->push_back(PropertyInfo(Variant::INT,"stack/size",PROPERTY_HINT_RANGE,"1,100000"));
}
p_list->push_back(PropertyInfo(Variant::BOOL,"stack/stackless"));
+ p_list->push_back(PropertyInfo(Variant::INT,"rpc/mode",PROPERTY_HINT_ENUM,"Disabled,Remote,Sync,Master,Slave"));
}
@@ -224,6 +237,16 @@ int VisualScriptFunction::get_argument_count() const {
return arguments.size();
}
+
+void VisualScriptFunction::set_rpc_mode(ScriptInstance::RPCMode p_mode) {
+ rpc_mode=p_mode;
+}
+
+ScriptInstance::RPCMode VisualScriptFunction::get_rpc_mode() const {
+ return rpc_mode;
+}
+
+
class VisualScriptNodeInstanceFunction : public VisualScriptNodeInstance {
public:
@@ -272,6 +295,7 @@ VisualScriptFunction::VisualScriptFunction() {
stack_size=256;
stack_less=false;
+ rpc_mode=ScriptInstance::RPC_MODE_DISABLED;
}
@@ -362,6 +386,8 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const{
PropertyInfo pinfo;
pinfo.name=p_idx==0?"A":"B";
pinfo.type=port_types[op][p_idx];
+ if (pinfo.type==Variant::NIL)
+ pinfo.type=typed;
return pinfo;
}
PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const{
@@ -400,6 +426,8 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const{
PropertyInfo pinfo;
pinfo.name="";
pinfo.type=port_types[op];
+ if (pinfo.type==Variant::NIL)
+ pinfo.type=typed;
return pinfo;
}
@@ -492,19 +520,43 @@ Variant::Operator VisualScriptOperator::get_operator() const{
return op;
}
+void VisualScriptOperator::set_typed(Variant::Type p_op) {
+
+ if (typed==p_op)
+ return;
+
+ typed=p_op;
+ ports_changed_notify();
+}
+
+Variant::Type VisualScriptOperator::get_typed() const {
+
+ return typed;
+}
+
void VisualScriptOperator::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_operator","op"),&VisualScriptOperator::set_operator);
ObjectTypeDB::bind_method(_MD("get_operator"),&VisualScriptOperator::get_operator);
+ ObjectTypeDB::bind_method(_MD("set_typed","type"),&VisualScriptOperator::set_typed);
+ ObjectTypeDB::bind_method(_MD("get_typed"),&VisualScriptOperator::get_typed);
+
String types;
for(int i=0;i<Variant::OP_MAX;i++) {
if (i>0)
types+=",";
types+=op_names[i];
}
- ADD_PROPERTY(PropertyInfo(Variant::INT,"operator_value/type",PROPERTY_HINT_ENUM,types),_SCS("set_operator"),_SCS("get_operator"));
+
+ String argt="Any";
+ for(int i=1;i<Variant::VARIANT_MAX;i++) {
+ argt+=","+Variant::get_type_name(Variant::Type(i));
+ }
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"operator_value/type",PROPERTY_HINT_ENUM,types,PROPERTY_USAGE_NOEDITOR),_SCS("set_operator"),_SCS("get_operator"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"typed_value/typed",PROPERTY_HINT_ENUM,argt),_SCS("set_typed"),_SCS("get_typed"));
}
@@ -558,6 +610,7 @@ VisualScriptNodeInstance* VisualScriptOperator::instance(VisualScriptInstance* p
VisualScriptOperator::VisualScriptOperator() {
op=Variant::OP_ADD;
+ typed=Variant::NIL;
}
@@ -1001,6 +1054,125 @@ VisualScriptConstant::VisualScriptConstant() {
}
+//////////////////////////////////////////
+////////////////PRELOAD//////////////////
+//////////////////////////////////////////
+
+int VisualScriptPreload::get_output_sequence_port_count() const {
+
+ return 0;
+}
+
+bool VisualScriptPreload::has_input_sequence_port() const{
+
+ return false;
+}
+
+int VisualScriptPreload::get_input_value_port_count() const{
+
+ return 0;
+}
+int VisualScriptPreload::get_output_value_port_count() const{
+
+ return 1;
+}
+
+String VisualScriptPreload::get_output_sequence_port_text(int p_port) const {
+
+ return String();
+}
+
+PropertyInfo VisualScriptPreload::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo();
+}
+
+PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(Variant::OBJECT,"res");
+}
+
+
+String VisualScriptPreload::get_caption() const {
+
+ return "Preload";
+}
+
+String VisualScriptPreload::get_text() const {
+
+ if (preload.is_valid()) {
+ if (preload->get_path().is_resource_file()) {
+ return preload->get_path();
+ } else if (preload->get_name()!=String()) {
+ return preload->get_name();
+ } else {
+ return preload->get_type();
+ }
+ } else {
+ return "<empty>";
+ }
+}
+
+
+void VisualScriptPreload::set_preload(const Ref<Resource>& p_preload){
+
+ if (preload==p_preload)
+ return;
+
+ preload=p_preload;
+ ports_changed_notify();
+}
+Ref<Resource> VisualScriptPreload::get_preload() const{
+
+ return preload;
+}
+
+
+void VisualScriptPreload::_bind_methods() {
+
+
+ ObjectTypeDB::bind_method(_MD("set_preload","resource"),&VisualScriptPreload::set_preload);
+ ObjectTypeDB::bind_method(_MD("get_preload"),&VisualScriptPreload::get_preload);
+
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"resource",PROPERTY_HINT_RESOURCE_TYPE,"Resource"),_SCS("set_preload"),_SCS("get_preload"));
+
+}
+
+class VisualScriptNodeInstancePreload : public VisualScriptNodeInstance {
+public:
+
+ Ref<Resource> preload;
+ //virtual int get_working_memory_size() const { return 0; }
+ virtual bool is_output_port_unsequenced(int p_idx) const { return true; }
+ virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const {
+
+ *r_value=preload;
+
+ return true;
+
+ }
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptPreload::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstancePreload * instance = memnew(VisualScriptNodeInstancePreload );
+ instance->preload=preload;
+ return instance;
+}
+
+VisualScriptPreload::VisualScriptPreload() {
+
+}
+
+
//////////////////////////////////////////
@@ -2432,6 +2604,816 @@ VisualScriptSubCall::VisualScriptSubCall() {
}
+//////////////////////////////////////////
+////////////////Comment///////////
+//////////////////////////////////////////
+
+int VisualScriptComment::get_output_sequence_port_count() const {
+
+ return 0;
+}
+
+bool VisualScriptComment::has_input_sequence_port() const{
+
+ return false;
+}
+
+int VisualScriptComment::get_input_value_port_count() const{
+ return 0;
+}
+int VisualScriptComment::get_output_value_port_count() const{
+
+ return 0;
+}
+
+String VisualScriptComment::get_output_sequence_port_text(int p_port) const {
+
+ return String();
+}
+
+PropertyInfo VisualScriptComment::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo();
+}
+
+PropertyInfo VisualScriptComment::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo();
+}
+
+
+String VisualScriptComment::get_caption() const {
+
+ return title;
+}
+
+
+String VisualScriptComment::get_text() const {
+
+ return description;
+}
+
+void VisualScriptComment::set_title(const String& p_title) {
+
+
+ if (title==p_title)
+ return;
+ title=p_title;
+ ports_changed_notify();
+}
+
+String VisualScriptComment::get_title() const{
+
+ return title;
+}
+
+void VisualScriptComment::set_description(const String& p_description){
+
+ if (description==p_description)
+ return;
+ description=p_description;
+ ports_changed_notify();
+
+}
+String VisualScriptComment::get_description() const{
+
+ return description;
+}
+
+void VisualScriptComment::set_size(const Size2& p_size){
+
+ if (size==p_size)
+ return;
+ size=p_size;
+ ports_changed_notify();
+
+}
+Size2 VisualScriptComment::get_size() const{
+
+ return size;
+}
+
+
+String VisualScriptComment::get_category() const {
+
+ return "data";
+}
+
+class VisualScriptNodeInstanceComment : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+
+ //virtual int get_working_memory_size() const { return 0; }
+ //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
+ //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; };
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptComment::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceComment * instance = memnew(VisualScriptNodeInstanceComment );
+ instance->instance=p_instance;
+ return instance;
+}
+
+
+
+void VisualScriptComment::_bind_methods() {
+
+
+ ObjectTypeDB::bind_method(_MD("set_title","title"),&VisualScriptComment::set_title);
+ ObjectTypeDB::bind_method(_MD("get_title"),&VisualScriptComment::get_title);
+
+ ObjectTypeDB::bind_method(_MD("set_description","description"),&VisualScriptComment::set_description);
+ ObjectTypeDB::bind_method(_MD("get_description"),&VisualScriptComment::get_description);
+
+ ObjectTypeDB::bind_method(_MD("set_size","size"),&VisualScriptComment::set_size);
+ ObjectTypeDB::bind_method(_MD("get_size"),&VisualScriptComment::get_size);
+
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"description",PROPERTY_HINT_MULTILINE_TEXT),_SCS("set_description"),_SCS("get_description"));
+ ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"size"),_SCS("set_size"),_SCS("get_size"));
+
+}
+
+VisualScriptComment::VisualScriptComment() {
+
+ title="Comment";
+ size=Size2(150,150);
+}
+
+
+//////////////////////////////////////////
+////////////////Constructor///////////
+//////////////////////////////////////////
+
+int VisualScriptConstructor::get_output_sequence_port_count() const {
+
+ return 1;
+}
+
+bool VisualScriptConstructor::has_input_sequence_port() const{
+
+ return true;
+}
+
+int VisualScriptConstructor::get_input_value_port_count() const{
+ return constructor.arguments.size();
+}
+int VisualScriptConstructor::get_output_value_port_count() const{
+
+ return 1;
+}
+
+String VisualScriptConstructor::get_output_sequence_port_text(int p_port) const {
+
+ return "";
+}
+
+PropertyInfo VisualScriptConstructor::get_input_value_port_info(int p_idx) const{
+
+ return constructor.arguments[p_idx];
+}
+
+PropertyInfo VisualScriptConstructor::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(type,"value");
+}
+
+
+String VisualScriptConstructor::get_caption() const {
+
+ return "Construct";
+}
+
+
+String VisualScriptConstructor::get_text() const {
+
+ return "new "+Variant::get_type_name(type)+"()";
+}
+
+
+String VisualScriptConstructor::get_category() const {
+
+ return "functions";
+}
+
+void VisualScriptConstructor::set_constructor_type(Variant::Type p_type) {
+
+ if (type==p_type)
+ return;
+
+ type=p_type;
+ ports_changed_notify();
+}
+
+Variant::Type VisualScriptConstructor::get_constructor_type() const {
+
+ return type;
+}
+
+void VisualScriptConstructor::set_constructor(const Dictionary& p_info) {
+
+ constructor=MethodInfo::from_dict(p_info);
+}
+
+Dictionary VisualScriptConstructor::get_constructor() const {
+
+ return constructor;
+}
+
+
+class VisualScriptNodeInstanceConstructor : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+ Variant::Type type;
+ int argcount;
+
+ //virtual int get_working_memory_size() const { return 0; }
+ //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
+ //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; };
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ Variant::CallError ce;
+ *p_outputs[0]=Variant::construct(type,p_inputs,argcount,ce);
+ if (ce.error!=Variant::CallError::CALL_OK) {
+ r_error_str="Invalid arguments for constructor";
+ }
+
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptConstructor::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceConstructor * instance = memnew(VisualScriptNodeInstanceConstructor );
+ instance->instance=p_instance;
+ instance->type=type;
+ instance->argcount=constructor.arguments.size();
+ return instance;
+}
+
+
+
+void VisualScriptConstructor::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_constructor_type","type"),&VisualScriptConstructor::set_constructor_type);
+ ObjectTypeDB::bind_method(_MD("get_constructor_type"),&VisualScriptConstructor::get_constructor_type);
+
+ ObjectTypeDB::bind_method(_MD("set_constructor","constructor"),&VisualScriptConstructor::set_constructor);
+ ObjectTypeDB::bind_method(_MD("get_constructor"),&VisualScriptConstructor::get_constructor);
+
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_constructor_type"),_SCS("get_constructor_type"));
+ ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"constructor",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_constructor"),_SCS("get_constructor"));
+
+}
+
+VisualScriptConstructor::VisualScriptConstructor() {
+
+ type=Variant::NIL;
+
+}
+
+static Map<String,Pair<Variant::Type,MethodInfo> > constructor_map;
+
+static Ref<VisualScriptNode> create_constructor_node(const String& p_name) {
+
+ ERR_FAIL_COND_V(!constructor_map.has(p_name),Ref<VisualScriptNode>());
+
+ Ref<VisualScriptConstructor> vsc;
+ vsc.instance();
+ vsc->set_constructor_type(constructor_map[p_name].first);
+ vsc->set_constructor(constructor_map[p_name].second);
+
+ return vsc;
+}
+
+//////////////////////////////////////////
+////////////////LocalVar///////////
+//////////////////////////////////////////
+
+int VisualScriptLocalVar::get_output_sequence_port_count() const {
+
+ return 1;
+}
+
+bool VisualScriptLocalVar::has_input_sequence_port() const{
+
+ return true;
+}
+
+int VisualScriptLocalVar::get_input_value_port_count() const{
+ return 1;
+}
+int VisualScriptLocalVar::get_output_value_port_count() const{
+
+ return 1;
+}
+
+String VisualScriptLocalVar::get_output_sequence_port_text(int p_port) const {
+
+ return "";
+}
+
+PropertyInfo VisualScriptLocalVar::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo(type,"set");
+}
+PropertyInfo VisualScriptLocalVar::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(type,"get");
+}
+
+
+String VisualScriptLocalVar::get_caption() const {
+
+ return "LocalVar";
+}
+
+
+String VisualScriptLocalVar::get_text() const {
+
+ return name;
+}
+
+
+String VisualScriptLocalVar::get_category() const {
+
+ return "data";
+}
+
+
+void VisualScriptLocalVar::set_var_name(const StringName& p_name) {
+
+ if (name==p_name)
+ return;
+
+ name=p_name;
+ ports_changed_notify();
+
+}
+
+StringName VisualScriptLocalVar::get_var_name() const {
+
+ return name;
+}
+
+void VisualScriptLocalVar::set_var_type(Variant::Type p_type) {
+
+ type=p_type;
+ ports_changed_notify();
+}
+
+Variant::Type VisualScriptLocalVar::get_var_type() const {
+
+ return type;
+}
+
+
+class VisualScriptNodeInstanceLocalVar : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+ StringName name;
+
+
+ virtual int get_working_memory_size() const { return 1; }
+ virtual bool is_output_port_unsequenced(int p_idx) const { return true; }
+ virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const {
+ *r_value=*p_working_mem;
+ return true;
+ }
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ *p_working_mem=*p_inputs[0];
+ *p_outputs[0]=*p_working_mem;
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptLocalVar::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceLocalVar * instance = memnew(VisualScriptNodeInstanceLocalVar );
+ instance->instance=p_instance;
+ instance->name=name;
+
+ return instance;
+}
+
+
+
+void VisualScriptLocalVar::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVar::set_var_name);
+ ObjectTypeDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVar::get_var_name);
+
+ ObjectTypeDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVar::set_var_type);
+ ObjectTypeDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVar::get_var_type);
+
+ String argt="Any";
+ for(int i=1;i<Variant::VARIANT_MAX;i++) {
+ argt+=","+Variant::get_type_name(Variant::Type(i));
+ }
+
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"variable/name"),_SCS("set_var_name"),_SCS("get_var_name"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"variable/type",PROPERTY_HINT_ENUM,argt),_SCS("set_var_type"),_SCS("get_var_type"));
+
+
+}
+
+VisualScriptLocalVar::VisualScriptLocalVar() {
+
+ name="new_local";
+ type=Variant::NIL;
+
+}
+
+//////////////////////////////////////////
+////////////////LocalVar///////////
+//////////////////////////////////////////
+
+int VisualScriptInputAction::get_output_sequence_port_count() const {
+
+ return 0;
+}
+
+bool VisualScriptInputAction::has_input_sequence_port() const{
+
+ return false;
+}
+
+int VisualScriptInputAction::get_input_value_port_count() const{
+ return 0;
+}
+int VisualScriptInputAction::get_output_value_port_count() const{
+
+ return 1;
+}
+
+String VisualScriptInputAction::get_output_sequence_port_text(int p_port) const {
+
+ return "";
+}
+
+PropertyInfo VisualScriptInputAction::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo();
+}
+PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(Variant::BOOL,"pressed");
+}
+
+
+String VisualScriptInputAction::get_caption() const {
+
+ return "Action";
+}
+
+
+String VisualScriptInputAction::get_text() const {
+
+ return name;
+}
+
+
+String VisualScriptInputAction::get_category() const {
+
+ return "data";
+}
+
+
+void VisualScriptInputAction::set_action_name(const StringName& p_name) {
+
+ if (name==p_name)
+ return;
+
+ name=p_name;
+ ports_changed_notify();
+
+}
+
+StringName VisualScriptInputAction::get_action_name() const {
+
+ return name;
+}
+
+
+class VisualScriptNodeInstanceInputAction : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+ StringName action;
+
+
+ virtual int get_working_memory_size() const { return 1; }
+ virtual bool is_output_port_unsequenced(int p_idx) const { return true; }
+ virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const {
+ *r_value=Input::get_singleton()->is_action_pressed(action);
+ return true;
+ }
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptInputAction::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceInputAction * instance = memnew(VisualScriptNodeInstanceInputAction );
+ instance->instance=p_instance;
+ instance->action=name;
+
+ return instance;
+}
+
+void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
+
+
+ if (property.name=="action") {
+
+ property.hint=PROPERTY_HINT_ENUM;
+ String actions;
+
+ List<PropertyInfo> pinfo;
+ Globals::get_singleton()->get_property_list(&pinfo);
+ Vector<String> al;
+
+ for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ const PropertyInfo &pi=E->get();
+
+ if (!pi.name.begins_with("input/"))
+ continue;
+
+ String name = pi.name.substr(pi.name.find("/")+1,pi.name.length());
+
+
+ al.push_back(name);
+ }
+
+ al.sort();;
+
+ for(int i=0;i<al.size();i++) {
+ if (actions!=String())
+ actions+=",";
+ actions+=al[i];
+ }
+
+ property.hint_string=actions;
+ }
+}
+
+
+void VisualScriptInputAction::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_action_name","name"),&VisualScriptInputAction::set_action_name);
+ ObjectTypeDB::bind_method(_MD("get_action_name"),&VisualScriptInputAction::get_action_name);
+
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"action"),_SCS("set_action_name"),_SCS("get_action_name"));
+
+}
+
+VisualScriptInputAction::VisualScriptInputAction() {
+
+ name="";
+
+}
+
+//////////////////////////////////////////
+////////////////Constructor///////////
+//////////////////////////////////////////
+
+int VisualScriptDeconstruct::get_output_sequence_port_count() const {
+
+ return 1;
+}
+
+bool VisualScriptDeconstruct::has_input_sequence_port() const{
+
+ return true;
+}
+
+int VisualScriptDeconstruct::get_input_value_port_count() const{
+ return 1;
+}
+int VisualScriptDeconstruct::get_output_value_port_count() const{
+
+ return elements.size();
+}
+
+String VisualScriptDeconstruct::get_output_sequence_port_text(int p_port) const {
+
+ return "";
+}
+
+PropertyInfo VisualScriptDeconstruct::get_input_value_port_info(int p_idx) const{
+
+ return PropertyInfo(type,"value");
+}
+
+PropertyInfo VisualScriptDeconstruct::get_output_value_port_info(int p_idx) const{
+
+ return PropertyInfo(elements[p_idx].type,elements[p_idx].name);
+}
+
+
+String VisualScriptDeconstruct::get_caption() const {
+
+ return "Deconstruct";
+}
+
+
+String VisualScriptDeconstruct::get_text() const {
+
+ return "from "+Variant::get_type_name(type)+":";
+}
+
+
+String VisualScriptDeconstruct::get_category() const {
+
+ return "functions";
+}
+
+void VisualScriptDeconstruct::_update_elements() {
+
+ elements.clear();;
+ Variant v;
+ if (type==Variant::INPUT_EVENT) {
+ InputEvent ie;
+ ie.type=input_type;
+ v=ie;
+ } else {
+ Variant::CallError ce;
+ v = Variant::construct(type,NULL,0,ce);
+ }
+
+ List<PropertyInfo> pinfo;
+ v.get_property_list(&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ Element e;
+ e.name=E->get().name;
+ e.type=E->get().type;
+ elements.push_back(e);
+ }
+}
+
+void VisualScriptDeconstruct::set_deconstruct_type(Variant::Type p_type) {
+
+ if (type==p_type)
+ return;
+
+ type=p_type;
+ _update_elements();
+ ports_changed_notify();
+ _change_notify(); //to make input appear/disappear
+}
+
+Variant::Type VisualScriptDeconstruct::get_deconstruct_type() const {
+
+ return type;
+}
+
+void VisualScriptDeconstruct::set_deconstruct_input_type(InputEvent::Type p_input_type) {
+
+ if (input_type==p_input_type)
+ return;
+
+ input_type=p_input_type;
+ _update_elements();
+ ports_changed_notify();
+}
+
+InputEvent::Type VisualScriptDeconstruct::get_deconstruct_input_type() const {
+
+ return input_type;
+}
+
+void VisualScriptDeconstruct::_set_elem_cache(const Array& p_elements) {
+
+ ERR_FAIL_COND(p_elements.size()%2==1);
+ elements.resize(p_elements.size()/2);
+ for(int i=0;i<elements.size();i++) {
+ elements[i].name=p_elements[i*2+0];
+ elements[i].type=Variant::Type(int(p_elements[i*2+1]));
+ }
+}
+
+Array VisualScriptDeconstruct::_get_elem_cache() const {
+
+ Array ret;
+ for(int i=0;i<elements.size();i++) {
+ ret.push_back(elements[i].name);
+ ret.push_back(elements[i].type);
+ }
+ return ret;
+}
+
+class VisualScriptNodeInstanceDeconstruct : public VisualScriptNodeInstance {
+public:
+
+ VisualScriptInstance* instance;
+ Vector<StringName> outputs;
+
+ //virtual int get_working_memory_size() const { return 0; }
+ //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
+ //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; };
+
+ virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
+
+ Variant in=*p_inputs[0];
+
+ for(int i=0;i<outputs.size();i++) {
+ bool valid;
+ *p_outputs[i]=in.get(outputs[i],&valid);
+ if (!valid) {
+ r_error_str="Can't obtain element '"+String(outputs[i])+"' from "+Variant::get_type_name(in.get_type());
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ return 0;
+ }
+
+ }
+
+ return 0;
+ }
+
+
+};
+
+VisualScriptNodeInstance* VisualScriptDeconstruct::instance(VisualScriptInstance* p_instance) {
+
+ VisualScriptNodeInstanceDeconstruct * instance = memnew(VisualScriptNodeInstanceDeconstruct );
+ instance->instance=p_instance;
+ instance->outputs.resize(elements.size());
+ for(int i=0;i<elements.size();i++) {
+ instance->outputs[i]=elements[i].name;
+ }
+
+ return instance;
+}
+
+
+
+void VisualScriptDeconstruct::_validate_property(PropertyInfo& property) const {
+
+ if (property.name=="input_type") {
+ if (type!=Variant::INPUT_EVENT) {
+ property.usage=0;
+ }
+ }
+}
+
+
+void VisualScriptDeconstruct::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_deconstruct_type","type"),&VisualScriptDeconstruct::set_deconstruct_type);
+ ObjectTypeDB::bind_method(_MD("get_deconstruct_type"),&VisualScriptDeconstruct::get_deconstruct_type);
+
+ ObjectTypeDB::bind_method(_MD("set_deconstruct_input_type","input_type"),&VisualScriptDeconstruct::set_deconstruct_input_type);
+ ObjectTypeDB::bind_method(_MD("get_deconstruct_input_type"),&VisualScriptDeconstruct::get_deconstruct_input_type);
+
+ ObjectTypeDB::bind_method(_MD("_set_elem_cache","_cache"),&VisualScriptDeconstruct::_set_elem_cache);
+ ObjectTypeDB::bind_method(_MD("_get_elem_cache"),&VisualScriptDeconstruct::_get_elem_cache);
+
+ String argt="Any";
+ for(int i=1;i<Variant::VARIANT_MAX;i++) {
+ argt+=","+Variant::get_type_name(Variant::Type(i));
+ }
+
+ String iet="None,Key,MouseMotion,MouseButton,JoystickMotion,JoystickButton,ScreenTouch,ScreenDrag,Action";
+
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_ENUM,argt),_SCS("set_deconstruct_type"),_SCS("get_deconstruct_type"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"input_type",PROPERTY_HINT_ENUM,iet),_SCS("set_deconstruct_input_type"),_SCS("get_deconstruct_input_type"));
+ ADD_PROPERTY( PropertyInfo(Variant::ARRAY,"elem_cache",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_elem_cache"),_SCS("_get_elem_cache"));
+
+}
+
+VisualScriptDeconstruct::VisualScriptDeconstruct() {
+
+ type=Variant::NIL;
+ input_type=InputEvent::NONE;
+
+}
+
void register_visual_script_nodes() {
@@ -2447,6 +3429,10 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("data/self",create_node_generic<VisualScriptSelf>);
VisualScriptLanguage::singleton->add_register_func("custom/custom_node",create_node_generic<VisualScriptCustomNode>);
VisualScriptLanguage::singleton->add_register_func("custom/sub_call",create_node_generic<VisualScriptSubCall>);
+ VisualScriptLanguage::singleton->add_register_func("data/comment",create_node_generic<VisualScriptComment>);
+ VisualScriptLanguage::singleton->add_register_func("data/local_var",create_node_generic<VisualScriptLocalVar>);
+ VisualScriptLanguage::singleton->add_register_func("data/preload",create_node_generic<VisualScriptPreload>);
+ VisualScriptLanguage::singleton->add_register_func("data/action",create_node_generic<VisualScriptInputAction>);
VisualScriptLanguage::singleton->add_register_func("index/get_index",create_node_generic<VisualScriptIndexGet>);
@@ -2481,5 +3467,43 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("operators/logic/not",create_op_node<Variant::OP_NOT>);
VisualScriptLanguage::singleton->add_register_func("operators/logic/in",create_op_node<Variant::OP_IN>);
+ VisualScriptLanguage::singleton->add_register_func("functions/deconstruct",create_node_generic<VisualScriptDeconstruct>);
+
+ for(int i=1;i<Variant::VARIANT_MAX;i++) {
+
+ List<MethodInfo> constructors;
+ Variant::get_constructor_list(Variant::Type(i),&constructors);
+
+ for(List<MethodInfo>::Element *E=constructors.front();E;E=E->next()) {
+
+ if (E->get().arguments.size()>0) {
+
+
+ String name = "functions/constructors/"+Variant::get_type_name(Variant::Type(i))+" ( ";
+ for(int j=0;j<E->get().arguments.size();j++) {
+ if (j>0)
+ name+=", ";
+ if (E->get().arguments.size()==1)
+ name+=Variant::get_type_name(E->get().arguments[j].type);
+ else
+ name+=E->get().arguments[j].name;
+ }
+ name+=") ";
+
+ VisualScriptLanguage::singleton->add_register_func(name,create_constructor_node);
+ Pair<Variant::Type,MethodInfo> pair;
+ pair.first=Variant::Type(i);
+ pair.second=E->get();
+ constructor_map[name]=pair;
+ }
+ }
+ }
+}
+
+
+void unregister_visual_script_nodes() {
+
+ constructor_map.clear();
}
+
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 50f61ecfcc..28f99a16e1 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -17,6 +17,7 @@ class VisualScriptFunction : public VisualScriptNode {
bool stack_less;
int stack_size;
+ ScriptInstance::RPCMode rpc_mode;
protected:
@@ -60,6 +61,9 @@ public:
void set_stack_size(int p_size);
int get_stack_size() const;
+ void set_rpc_mode(ScriptInstance::RPCMode p_mode);
+ ScriptInstance::RPCMode get_rpc_mode() const;
+
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
VisualScriptFunction();
@@ -71,6 +75,7 @@ class VisualScriptOperator : public VisualScriptNode {
OBJ_TYPE(VisualScriptOperator,VisualScriptNode)
+ Variant::Type typed;
Variant::Operator op;
protected:
@@ -98,6 +103,9 @@ public:
void set_operator(Variant::Operator p_op);
Variant::Operator get_operator() const;
+ void set_typed(Variant::Type p_op);
+ Variant::Type get_typed() const;
+
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
VisualScriptOperator();
@@ -225,6 +233,45 @@ public:
};
+
+class VisualScriptPreload : public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptPreload,VisualScriptNode)
+
+
+ Ref<Resource> preload;
+protected:
+
+ static void _bind_methods();
+
+public:
+
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const { return "data"; }
+
+ void set_preload(const Ref<Resource>& p_value);
+ Ref<Resource> get_preload() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptPreload();
+};
+
class VisualScriptIndexGet : public VisualScriptNode {
OBJ_TYPE(VisualScriptIndexGet,VisualScriptNode)
@@ -618,7 +665,6 @@ class VisualScriptSubCall: public VisualScriptNode {
protected:
- virtual bool _use_builtin_script() const { return true; }
static void _bind_methods();
public:
@@ -645,7 +691,236 @@ public:
VisualScriptSubCall();
};
+class VisualScriptComment: public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptComment,VisualScriptNode)
+
+
+ String title;
+ String description;
+ Size2 size;
+protected:
+
+ static void _bind_methods();
+public:
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const;
+
+ void set_title(const String& p_title);
+ String get_title() const;
+
+ void set_description(const String& p_description);
+ String get_description() const;
+
+ void set_size(const Size2& p_size);
+ Size2 get_size() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptComment();
+};
+
+class VisualScriptConstructor: public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptConstructor,VisualScriptNode)
+
+
+ Variant::Type type;
+ MethodInfo constructor;
+
+protected:
+
+
+ static void _bind_methods();
+public:
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const;
+
+ void set_constructor_type(Variant::Type p_type);
+ Variant::Type get_constructor_type() const;
+
+ void set_constructor(const Dictionary& p_info);
+ Dictionary get_constructor() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptConstructor();
+};
+
+
+
+
+class VisualScriptLocalVar: public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptLocalVar,VisualScriptNode)
+
+ StringName name;
+ Variant::Type type;
+
+protected:
+
+ static void _bind_methods();
+public:
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const;
+
+ void set_var_name(const StringName& p_name);
+ StringName get_var_name() const;
+
+ void set_var_type(Variant::Type p_type);
+ Variant::Type get_var_type() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptLocalVar();
+};
+
+
+
+
+class VisualScriptInputAction: public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptInputAction,VisualScriptNode)
+
+ StringName name;
+
+protected:
+
+ virtual void _validate_property(PropertyInfo& property) const;
+
+ static void _bind_methods();
+public:
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const;
+
+ void set_action_name(const StringName& p_name);
+ StringName get_action_name() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptInputAction();
+};
+
+
+
+class VisualScriptDeconstruct: public VisualScriptNode {
+
+ OBJ_TYPE(VisualScriptDeconstruct,VisualScriptNode)
+
+
+ struct Element {
+ StringName name;
+ Variant::Type type;
+ };
+
+
+ Vector<Element> elements;
+
+ void _update_elements();
+ Variant::Type type;
+ InputEvent::Type input_type;
+
+ void _set_elem_cache(const Array& p_elements);
+ Array _get_elem_cache() const;
+
+ virtual void _validate_property(PropertyInfo& property) const;
+
+protected:
+
+
+ static void _bind_methods();
+public:
+ virtual int get_output_sequence_port_count() const;
+ virtual bool has_input_sequence_port() const;
+
+
+ virtual String get_output_sequence_port_text(int p_port) const;
+
+
+ virtual int get_input_value_port_count() const;
+ virtual int get_output_value_port_count() const;
+
+
+ virtual PropertyInfo get_input_value_port_info(int p_idx) const;
+ virtual PropertyInfo get_output_value_port_info(int p_idx) const;
+
+ virtual String get_caption() const;
+ virtual String get_text() const;
+ virtual String get_category() const;
+
+ void set_deconstruct_type(Variant::Type p_type);
+ Variant::Type get_deconstruct_type() const;
+
+ void set_deconstruct_input_type(InputEvent::Type p_input_type);
+ InputEvent::Type get_deconstruct_input_type() const;
+
+ virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+
+ VisualScriptDeconstruct();
+};
+
void register_visual_script_nodes();
+void unregister_visual_script_nodes();
#endif // VISUAL_SCRIPT_NODES_H
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index a6f84a97d9..221c46b6fd 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -45,12 +45,13 @@ PropertyInfo VisualScriptYield::get_output_value_port_info(int p_idx) const{
String VisualScriptYield::get_caption() const {
- return "Wait";
+ return yield_mode==YIELD_RETURN?"Yield":"Wait";
}
String VisualScriptYield::get_text() const {
switch (yield_mode) {
+ case YIELD_RETURN: return ""; break;
case YIELD_FRAME: return "Next Frame"; break;
case YIELD_FIXED_FRAME: return "Next Fixed Frame"; break;
case YIELD_WAIT: return rtos(wait_time)+" sec(s)"; break;
@@ -88,8 +89,10 @@ public:
Ref<VisualScriptFunctionState> state;
state.instance();
+ int ret = STEP_YIELD_BIT;
switch(mode) {
+ case VisualScriptYield::YIELD_RETURN: ret=STEP_EXIT_FUNCTION_BIT; break; //return the yield
case VisualScriptYield::YIELD_FRAME: state->connect_to_signal(tree,"idle_frame",Array()); break;
case VisualScriptYield::YIELD_FIXED_FRAME: state->connect_to_signal(tree,"fixed_frame",Array()); break;
case VisualScriptYield::YIELD_WAIT: state->connect_to_signal(tree->create_timer(wait_time).ptr(),"timeout",Array()); break;
@@ -98,7 +101,7 @@ public:
*p_working_mem=state;
- return STEP_YIELD_BIT;
+ return ret;
}
}
@@ -487,7 +490,7 @@ void VisualScriptYieldSignal::_bind_methods() {
bt+=Variant::get_type_name(Variant::Type(i));
}
- ADD_PROPERTY(PropertyInfo(Variant::INT,"signal/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"signal/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance"),_SCS("set_call_mode"),_SCS("get_call_mode"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"signal/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"signal/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"signal/signal"),_SCS("set_signal"),_SCS("get_signal"));
@@ -595,7 +598,7 @@ VisualScriptNodeInstance* VisualScriptYieldSignal::instance(VisualScriptInstance
}
VisualScriptYieldSignal::VisualScriptYieldSignal() {
- call_mode=CALL_MODE_INSTANCE;
+ call_mode=CALL_MODE_SELF;
base_type="Object";
}
@@ -615,8 +618,8 @@ void register_visual_script_yield_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_fixed_frame",create_yield_node<VisualScriptYield::YIELD_FIXED_FRAME>);
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_time",create_yield_node<VisualScriptYield::YIELD_WAIT>);
- VisualScriptLanguage::singleton->add_register_func("functions/yield/instance_signal",create_yield_signal_node<VisualScriptYieldSignal::CALL_MODE_INSTANCE>);
- VisualScriptLanguage::singleton->add_register_func("functions/yield/self_signal",create_yield_signal_node<VisualScriptYieldSignal::CALL_MODE_SELF>);
- VisualScriptLanguage::singleton->add_register_func("functions/yield/node_signal",create_yield_signal_node<VisualScriptYieldSignal::CALL_MODE_NODE_PATH>);
+
+ VisualScriptLanguage::singleton->add_register_func("functions/yield",create_yield_node<VisualScriptYield::YIELD_RETURN>);
+ VisualScriptLanguage::singleton->add_register_func("functions/yield_signal",create_node_generic<VisualScriptYieldSignal>);
}
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index a7e200305d..ae7f8c15c1 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -9,6 +9,7 @@ class VisualScriptYield : public VisualScriptNode {
public:
enum YieldMode {
+ YIELD_RETURN,
YIELD_FRAME,
YIELD_FIXED_FRAME,
YIELD_WAIT
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 320fb9d269..2414cee57e 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -237,8 +237,7 @@ def configure(env):
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
-
- LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
+ LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
@@ -361,7 +360,7 @@ def configure(env):
env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DGLES2_ENABLED'])
- env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+ env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
# if (env["bits"]=="32"):
# env.Append(LIBS=['gcc_s'])
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 26c4ea385f..75fa6054ad 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1226,6 +1226,73 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) {
#endif
}
+
+
+Vector2 KinematicBody2D::move_and_slide(const Vector2& p_linear_velocity,const Vector2& p_floor_direction,int p_max_bounces) {
+
+ Vector2 motion = p_linear_velocity*get_fixed_process_delta_time();
+ Vector2 lv = p_linear_velocity;
+
+ move_and_slide_on_floor=false;
+ move_and_slide_on_ceiling=false;
+ move_and_slide_on_wall=false;
+ move_and_slide_colliders.clear();
+
+ while(motion!=Vector2() && p_max_bounces) {
+
+ motion=move(motion);
+
+ if (is_colliding()) {
+
+ if (p_floor_direction==Vector2()) {
+ //all is a wall
+ move_and_slide_on_wall=true;
+ } else {
+ if ( get_collision_normal().dot(p_floor_direction) > Math::cos(Math::deg2rad(45))) { //floor
+ move_and_slide_on_floor=true;
+ move_and_slide_floor_velocity=get_collider_velocity();
+ } else if ( get_collision_normal().dot(p_floor_direction) < Math::cos(Math::deg2rad(45))) { //ceiling
+ move_and_slide_on_ceiling=true;
+ } else {
+ move_and_slide_on_wall=true;
+ }
+
+ }
+
+ motion=get_collision_normal().slide(motion);
+ lv=get_collision_normal().slide(lv);
+ Variant collider = _get_collider();
+ if (collider.get_type()!=Variant::NIL) {
+ move_and_slide_colliders.push_back(collider);
+ }
+
+ } else {
+ break;
+ }
+
+ p_max_bounces--;
+ }
+
+ return lv;
+}
+
+bool KinematicBody2D::is_move_and_slide_on_floor() const {
+
+ return move_and_slide_on_floor;
+}
+bool KinematicBody2D::is_move_and_slide_on_wall() const{
+
+ return move_and_slide_on_wall;
+}
+bool KinematicBody2D::is_move_and_slide_on_ceiling() const{
+
+ return move_and_slide_on_ceiling;
+}
+Array KinematicBody2D::get_move_and_slide_colliders() const{
+
+ return move_and_slide_colliders;
+}
+
Vector2 KinematicBody2D::move_to(const Vector2& p_position) {
return move(p_position-get_global_pos());
@@ -1300,6 +1367,7 @@ void KinematicBody2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("move","rel_vec"),&KinematicBody2D::move);
ObjectTypeDB::bind_method(_MD("move_to","position"),&KinematicBody2D::move_to);
+ ObjectTypeDB::bind_method(_MD("move_and_slide","linear_velocity","floor_normal","max_bounces"),&KinematicBody2D::move_and_slide,DEFVAL(Vector2(0,0)),DEFVAL(4));
ObjectTypeDB::bind_method(_MD("test_move","rel_vec"),&KinematicBody2D::test_move);
ObjectTypeDB::bind_method(_MD("get_travel"),&KinematicBody2D::get_travel);
@@ -1313,6 +1381,10 @@ void KinematicBody2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_collider:Object"),&KinematicBody2D::_get_collider);
ObjectTypeDB::bind_method(_MD("get_collider_shape"),&KinematicBody2D::get_collider_shape);
ObjectTypeDB::bind_method(_MD("get_collider_metadata:Variant"),&KinematicBody2D::get_collider_metadata);
+ ObjectTypeDB::bind_method(_MD("get_move_and_slide_colliders"),&KinematicBody2D::get_move_and_slide_colliders);
+ ObjectTypeDB::bind_method(_MD("is_move_and_slide_on_floor"),&KinematicBody2D::is_move_and_slide_on_floor);
+ ObjectTypeDB::bind_method(_MD("is_move_and_slide_on_ceiling"),&KinematicBody2D::is_move_and_slide_on_ceiling);
+ ObjectTypeDB::bind_method(_MD("is_move_and_slide_on_wall"),&KinematicBody2D::is_move_and_slide_on_wall);
ObjectTypeDB::bind_method(_MD("set_collision_margin","pixels"),&KinematicBody2D::set_collision_margin);
ObjectTypeDB::bind_method(_MD("get_collision_margin","pixels"),&KinematicBody2D::get_collision_margin);
@@ -1330,6 +1402,11 @@ KinematicBody2D::KinematicBody2D() : PhysicsBody2D(Physics2DServer::BODY_MODE_KI
collider_shape=0;
margin=0.08;
+
+ move_and_slide_on_floor=false;
+ move_and_slide_on_ceiling=false;
+ move_and_slide_on_wall=false;
+
}
KinematicBody2D::~KinematicBody2D() {
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index 5af65bff33..387267cd09 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -302,6 +302,12 @@ class KinematicBody2D : public PhysicsBody2D {
Variant collider_metadata;
Vector2 travel;
+ Vector2 move_and_slide_floor_velocity;
+ bool move_and_slide_on_floor;
+ bool move_and_slide_on_ceiling;
+ bool move_and_slide_on_wall;
+ Array move_and_slide_colliders;
+
Variant _get_collider() const;
_FORCE_INLINE_ bool _ignores_mode(Physics2DServer::BodyMode) const;
@@ -329,6 +335,13 @@ public:
void set_collision_margin(float p_margin);
float get_collision_margin() const;
+ Vector2 move_and_slide(const Vector2& p_linear_velocity,const Vector2& p_floor_direction=Vector2(0,0),int p_max_bounces=4);
+ bool is_move_and_slide_on_floor() const;
+ bool is_move_and_slide_on_wall() const;
+ bool is_move_and_slide_on_ceiling() const;
+ Array get_move_and_slide_colliders() const;
+
+
KinematicBody2D();
~KinematicBody2D();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 71ec508c81..97133a2a3b 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2214,7 +2214,7 @@ void Control::grab_click_focus() {
void Control::minimum_size_changed() {
- if (!is_inside_tree())
+ if (!is_inside_tree() || data.block_minimum_size_adjust)
return;
if (data.pending_min_size_update)
@@ -2374,8 +2374,14 @@ Control *Control::get_root_parent_control() const {
return const_cast<Control*>(root);
}
+void Control::set_block_minimum_size_adjust(bool p_block) {
+ data.block_minimum_size_adjust=p_block;
+}
+bool Control::is_minimum_size_adjust_blocked() const {
+ return data.block_minimum_size_adjust;
+}
void Control::_bind_methods() {
@@ -2603,6 +2609,7 @@ Control::Control() {
data.scale=Vector2(1,1);
data.drag_owner=0;
data.modal_frame=0;
+ data.block_minimum_size_adjust=false;
for (int i=0;i<4;i++) {
diff --git a/scene/gui/control.h b/scene/gui/control.h
index b9ac53067a..e6b0844869 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -128,6 +128,8 @@ private:
bool ignore_mouse;
bool stop_mouse;
+ bool block_minimum_size_adjust;
+
Control *parent;
ObjectID drag_owner;
bool modal;
@@ -396,6 +398,10 @@ public:
Control *get_root_parent_control() const;
+
+ void set_block_minimum_size_adjust(bool p_block);
+ bool is_minimum_size_adjust_blocked() const;
+
Control();
~Control();
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 458e51b4fd..a7a813d335 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -61,6 +61,7 @@ Error GraphEdit::connect_node(const StringName& p_from, int p_from_port,const St
c.to_port=p_to_port;
connections.push_back(c);
top_layer->update();
+ update();
return OK;
}
@@ -85,6 +86,7 @@ void GraphEdit::disconnect_node(const StringName& p_from, int p_from_port,const
connections.erase(E);
top_layer->update();
+ update();
return;
}
}
@@ -118,10 +120,7 @@ void GraphEdit::_scroll_moved(double) {
_update_scroll_offset();
top_layer->update();
- if (is_using_snap()) {
- //must redraw grid
- update();
- }
+ update();
if (!setting_scroll_ofs) {//in godot, signals on change value are avoided as a convention
emit_signal("scroll_offset_changed",get_scroll_ofs());
@@ -194,6 +193,9 @@ void GraphEdit::_graph_node_raised(Node* p_gn) {
GraphNode *gn=p_gn->cast_to<GraphNode>();
ERR_FAIL_COND(!gn);
gn->raise();
+ if (gn->is_comment()) {
+ move_child(gn,0);
+ }
top_layer->raise();
emit_signal("node_selected",p_gn);
@@ -205,6 +207,7 @@ void GraphEdit::_graph_node_moved(Node *p_gn) {
GraphNode *gn=p_gn->cast_to<GraphNode>();
ERR_FAIL_COND(!gn);
top_layer->update();
+ update();
}
void GraphEdit::add_child_notify(Node *p_child) {
@@ -261,6 +264,7 @@ void GraphEdit::_notification(int p_what) {
}
if (p_what==NOTIFICATION_DRAW) {
+
draw_style_box( get_stylebox("bg"),Rect2(Point2(),get_size()) );
VS::get_singleton()->canvas_item_set_clip(get_canvas_item(),true);
@@ -306,11 +310,60 @@ void GraphEdit::_notification(int p_what) {
}
+ {
+ //draw connections
+ List<List<Connection>::Element* > to_erase;
+ for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
+
+ NodePath fromnp(E->get().from);
+
+ Node * from = get_node(fromnp);
+ if (!from) {
+ to_erase.push_back(E);
+ continue;
+ }
+
+ GraphNode *gfrom = from->cast_to<GraphNode>();
+
+ if (!gfrom) {
+ to_erase.push_back(E);
+ continue;
+ }
+
+ NodePath tonp(E->get().to);
+ Node * to = get_node(tonp);
+ if (!to) {
+ to_erase.push_back(E);
+ continue;
+ }
+
+ GraphNode *gto = to->cast_to<GraphNode>();
+
+ if (!gto) {
+ to_erase.push_back(E);
+ continue;
+ }
+
+ Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_pos();
+ Color color = gfrom->get_connection_output_color(E->get().from_port);
+ Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_pos();
+ Color tocolor = gto->get_connection_input_color(E->get().to_port);
+ _draw_cos_line(this,frompos,topos,color,tocolor);
+
+ }
+
+ while(to_erase.size()) {
+ connections.erase(to_erase.front()->get());
+ to_erase.pop_front();
+ }
+ }
+
}
if (p_what==NOTIFICATION_RESIZED) {
_update_scroll();
top_layer->update();
+
}
}
@@ -466,7 +519,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
connecting_to=Vector2(p_ev.mouse_motion.x,p_ev.mouse_motion.y);
connecting_target=false;
- top_layer->update();
+ top_layer->update();
Ref<Texture> port =get_icon("port","GraphNode");
Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y);
@@ -526,18 +579,90 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
}
emit_signal("connection_request",from,from_slot,to,to_slot);
+ } else {
+ String from = connecting_from;
+ int from_slot = connecting_index;
+ Vector2 ofs = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
+ emit_signal("connection_to_empty",from,from_slot,ofs);
}
connecting=false;
top_layer->update();
+ update();
}
}
-void GraphEdit::_draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color,const Color& p_to_color) {
+
+template<class Vector2>
+static _FORCE_INLINE_ Vector2 _bezier_interp(real_t t, Vector2 start, Vector2 control_1, Vector2 control_2, Vector2 end) {
+ /* Formula from Wikipedia article on Bezier curves. */
+ real_t omt = (1.0 - t);
+ real_t omt2 = omt*omt;
+ real_t omt3 = omt2*omt;
+ real_t t2 = t*t;
+ real_t t3 = t2*t;
+
+ return start * omt3
+ + control_1 * omt2 * t * 3.0
+ + control_2 * omt * t2 * 3.0
+ + end * t3;
+}
+
+
+void GraphEdit::_bake_segment2d(CanvasItem* p_where,float p_begin, float p_end,const Vector2& p_a,const Vector2& p_out,const Vector2& p_b, const Vector2& p_in,int p_depth,int p_min_depth,int p_max_depth,float p_tol,const Color& p_color,const Color& p_to_color,int &lines) const {
+
+ float mp = p_begin+(p_end-p_begin)*0.5;
+ Vector2 beg = _bezier_interp(p_begin,p_a,p_a+p_out,p_b+p_in,p_b);
+ Vector2 mid = _bezier_interp(mp,p_a,p_a+p_out,p_b+p_in,p_b);
+ Vector2 end = _bezier_interp(p_end,p_a,p_a+p_out,p_b+p_in,p_b);
+
+ Vector2 na = (mid-beg).normalized();
+ Vector2 nb = (end-mid).normalized();
+ float dp = Math::rad2deg(Math::acos(na.dot(nb)));
+
+ if (p_depth>=p_min_depth && ( dp<p_tol || p_depth>=p_max_depth)) {
+
+
+
+ p_where->draw_line(beg,end,p_color.linear_interpolate(p_to_color,mp),2);
+ lines++;
+ } else {
+ _bake_segment2d(p_where,p_begin,mp,p_a,p_out,p_b,p_in,p_depth+1,p_min_depth,p_max_depth,p_tol,p_color,p_to_color,lines);
+ _bake_segment2d(p_where,mp,p_end,p_a,p_out,p_b,p_in,p_depth+1,p_min_depth,p_max_depth,p_tol,p_color,p_to_color,lines);
+ }
+}
+
+
+void GraphEdit::_draw_cos_line(CanvasItem* p_where,const Vector2& p_from, const Vector2& p_to,const Color& p_color,const Color& p_to_color) {
+
+#if 1
+
+ //cubic bezier code
+ float diff = p_to.x-p_from.x;
+ float cp_offset;
+ int cp_len = get_constant("bezier_len_pos");
+ int cp_neg_len = get_constant("bezier_len_neg");
+
+ if (diff>0) {
+ cp_offset=MAX(cp_len,diff*0.5);
+ } else {
+ cp_offset=MAX(MIN(cp_len-diff,cp_neg_len),-diff*0.5);
+ }
+
+ Vector2 c1 = Vector2(cp_offset,0);
+ Vector2 c2 = Vector2(-cp_offset,0);
+
+ int lines=0;
+ _bake_segment2d(p_where,0,1,p_from,c1,p_to,c2,0,5,12,8,p_color,p_to_color,lines);
+ //print_line("used lines: "+itos(lines));
+
+
+#else
static const int steps = 20;
+ //old cosine code
Rect2 r;
r.pos=p_from;
r.expand_to(p_to);
@@ -547,6 +672,7 @@ void GraphEdit::_draw_cos_line(const Vector2& p_from, const Vector2& p_to,const
Vector2 prev;
for(int i=0;i<=steps;i++) {
+
float d = i/float(steps);
float c=-Math::cos(d*Math_PI) * 0.5+0.5;
if (flip)
@@ -555,11 +681,12 @@ void GraphEdit::_draw_cos_line(const Vector2& p_from, const Vector2& p_to,const
if (i>0) {
- top_layer->draw_line(prev,p,p_color.linear_interpolate(p_to_color,d),2);
+ p_where->draw_line(prev,p,p_color.linear_interpolate(p_to_color,d),2);
}
prev=p;
}
+#endif
}
void GraphEdit::_top_layer_draw() {
@@ -589,53 +716,14 @@ void GraphEdit::_top_layer_draw() {
col.g+=0.4;
col.b+=0.4;
}
- _draw_cos_line(pos,topos,col,col);
- }
-
- List<List<Connection>::Element* > to_erase;
- for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
-
- NodePath fromnp(E->get().from);
-
- Node * from = get_node(fromnp);
- if (!from) {
- to_erase.push_back(E);
- continue;
- }
-
- GraphNode *gfrom = from->cast_to<GraphNode>();
-
- if (!gfrom) {
- to_erase.push_back(E);
- continue;
- }
-
- NodePath tonp(E->get().to);
- Node * to = get_node(tonp);
- if (!to) {
- to_erase.push_back(E);
- continue;
- }
-
- GraphNode *gto = to->cast_to<GraphNode>();
- if (!gto) {
- to_erase.push_back(E);
- continue;
+ if (!connecting_out) {
+ SWAP(pos,topos);
}
-
- Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_pos();
- Color color = gfrom->get_connection_output_color(E->get().from_port);
- Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_pos();
- Color tocolor = gto->get_connection_input_color(E->get().to_port);
- _draw_cos_line(frompos,topos,color,tocolor);
-
+ _draw_cos_line(top_layer,pos,topos,col,col);
}
- while(to_erase.size()) {
- connections.erase(to_erase.front()->get());
- to_erase.pop_front();
- }
+
if (box_selecting)
top_layer->draw_rect(box_selecting_rect,Color(0.7,0.7,1.0,0.3));
}
@@ -765,6 +853,7 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
dragging = false;
top_layer->update();
+ update();
}
if (b.button_index==BUTTON_LEFT && b.pressed) {
@@ -775,6 +864,10 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
gn=get_child(i)->cast_to<GraphNode>();
if (gn) {
+
+ if (gn->is_resizing())
+ continue;
+
Rect2 r = gn->get_rect();
r.size*=zoom;
if (r.has_point(get_local_mouse_pos()))
@@ -1090,6 +1183,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
ADD_SIGNAL(MethodInfo("node_selected",PropertyInfo(Variant::OBJECT,"node")));
+ ADD_SIGNAL(MethodInfo("connection_to_empty",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::VECTOR2,"release_pos")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
@@ -1173,4 +1267,6 @@ GraphEdit::GraphEdit() {
setting_scroll_ofs=false;
+
+
}
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 6d35e1518f..c3276ceacc 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -112,7 +112,9 @@ private:
bool updating;
List<Connection> connections;
- void _draw_cos_line(const Vector2& p_from, const Vector2& p_to, const Color& p_color, const Color &p_to_color);
+ void _bake_segment2d(CanvasItem* p_where,float p_begin, float p_end, const Vector2& p_a, const Vector2& p_out, const Vector2& p_b, const Vector2& p_in, int p_depth, int p_min_depth, int p_max_depth, float p_tol, const Color& p_color, const Color& p_to_color, int &lines) const;
+
+ void _draw_cos_line(CanvasItem* p_where,const Vector2& p_from, const Vector2& p_to, const Color& p_color, const Color &p_to_color);
void _graph_node_raised(Node* p_gn);
void _graph_node_moved(Node *p_gn);
@@ -128,6 +130,10 @@ private:
Array _get_connection_list() const;
+ bool lines_on_bg;
+
+
+
struct ConnType {
union {
@@ -200,6 +206,7 @@ public:
int get_snap() const;
void set_snap(int p_snap);
+
GraphEdit();
};
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 66d2725ad2..5ece970936 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -188,11 +188,13 @@ void GraphNode::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAW) {
- Ref<StyleBox> sb=get_stylebox(selected ? "selectedframe" : "frame");
+ Ref<StyleBox> sb=get_stylebox(comment? "comment": (selected ? "selectedframe" : "frame"));
+
sb=sb->duplicate();
sb->call("set_modulate",modulate);
Ref<Texture> port =get_icon("port");
Ref<Texture> close =get_icon("close");
+ Ref<Texture> resizer =get_icon("resizer");
int close_offset = get_constant("close_offset");
Ref<Font> title_font = get_font("title_font");
int title_offset = get_constant("title_offset");
@@ -258,6 +260,11 @@ void GraphNode::_notification(int p_what) {
}
}
+
+
+ if (resizeable) {
+ draw_texture(resizer,get_size()-resizer->get_size());
+ }
}
if (p_what==NOTIFICATION_SORT_CHILDREN) {
@@ -594,19 +601,49 @@ void GraphNode::_input_event(const InputEvent& p_ev) {
ERR_EXPLAIN("GraphNode must be the child of a GraphEdit node.");
ERR_FAIL_COND(get_parent_control() == NULL);
- get_parent_control()->grab_focus();
-
if(p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
emit_signal("close_request");
+ accept_event();
+ return;
+ }
+
+ Ref<Texture> resizer =get_icon("resizer");
+
+ if (resizeable && mpos.x > get_size().x-resizer->get_width() && mpos.y > get_size().y-resizer->get_height()) {
+
+ resizing=true;
+ resizing_from=mpos;
+ resizing_from_size=get_size();
+ accept_event();
return;
}
+
+ //send focus to parent
emit_signal("raise_request");
+ get_parent_control()->grab_focus();
+
}
+
+ if(!p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
+ resizing=false;
+ }
+
+ }
+
+
+ if (resizing && p_ev.type==InputEvent::MOUSE_MOTION) {
+ Vector2 mpos = Vector2(p_ev.mouse_motion.x,p_ev.mouse_motion.y);
+
+ Vector2 diff = mpos - resizing_from;
+
+ emit_signal("resize_request",resizing_from_size+diff);
+
}
+
}
void GraphNode::set_modulate(const Color &p_color) {
@@ -630,6 +667,30 @@ GraphNode::Overlay GraphNode::get_overlay() const{
return overlay;
}
+void GraphNode::set_comment(bool p_enable) {
+
+ comment=p_enable;
+ update();
+}
+
+bool GraphNode::is_comment() const{
+
+ return comment;
+}
+
+
+void GraphNode::set_resizeable(bool p_enable) {
+
+ resizeable=p_enable;
+ update();
+}
+
+bool GraphNode::is_resizeable() const{
+
+ return resizeable;
+}
+
+
void GraphNode::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_title","title"),&GraphNode::set_title);
@@ -649,6 +710,12 @@ void GraphNode::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_offset","offset"),&GraphNode::set_offset);
ObjectTypeDB::bind_method(_MD("get_offset"),&GraphNode::get_offset);
+ ObjectTypeDB::bind_method(_MD("set_comment","comment"),&GraphNode::set_comment);
+ ObjectTypeDB::bind_method(_MD("is_comment"),&GraphNode::is_comment);
+
+ ObjectTypeDB::bind_method(_MD("set_resizeable","resizeable"),&GraphNode::set_resizeable);
+ ObjectTypeDB::bind_method(_MD("is_resizeable"),&GraphNode::is_resizeable);
+
ObjectTypeDB::bind_method(_MD("get_connection_output_count"),&GraphNode::get_connection_output_count);
ObjectTypeDB::bind_method(_MD("get_connection_input_count"),&GraphNode::get_connection_input_count);
@@ -675,6 +742,7 @@ void GraphNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("dragged",PropertyInfo(Variant::VECTOR2,"from"),PropertyInfo(Variant::VECTOR2,"to")));
ADD_SIGNAL(MethodInfo("raise_request"));
ADD_SIGNAL(MethodInfo("close_request"));
+ ADD_SIGNAL(MethodInfo("resize_request",PropertyInfo(Variant::VECTOR2,"new_minsize")));
BIND_CONSTANT( OVERLAY_DISABLED );
BIND_CONSTANT( OVERLAY_BREAKPOINT );
@@ -688,4 +756,7 @@ GraphNode::GraphNode() {
connpos_dirty=true;
set_stop_mouse(false);
modulate=Color(1,1,1,1);
+ comment=false;
+ resizeable=false;
+ resizing=false;
}
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index e87fb15b93..7357ab5a45 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -60,6 +60,12 @@ private:
String title;
bool show_close;
Vector2 offset;
+ bool comment;
+ bool resizeable;
+
+ bool resizing;
+ Vector2 resizing_from;
+ Vector2 resizing_from_size;
Rect2 close_rect;
@@ -144,8 +150,16 @@ public:
void set_overlay(Overlay p_overlay);
Overlay get_overlay() const;
+ void set_comment(bool p_enable);
+ bool is_comment() const;
+
+ void set_resizeable(bool p_enable);
+ bool is_resizeable() const;
+
virtual Size2 get_minimum_size() const;
+ bool is_resizing() const { return resizing; }
+
GraphNode();
};
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index b265ef840a..4756fdee26 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1768,7 +1768,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
return;
}
- if (k.scancode==KEY_RETURN || k.scancode==KEY_TAB) {
+ if (k.scancode==KEY_ENTER || k.scancode==KEY_RETURN || k.scancode==KEY_TAB) {
_confirm_completion();
accept_event();
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 487f62ed44..4a9c09d187 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2328,9 +2328,22 @@ void Tree::_input_event(InputEvent p_event) {
range_drag_enabled=false;
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
warp_mouse(range_drag_capture_pos);
- } else
- edit_selected();
+ } else {
+
+ if (delayed_text_editor) {
+ uint64_t diff = OS::get_singleton()->get_ticks_msec() - first_selection_time;
+ if (diff >= 400 && diff <= 800)
+ edit_selected();
+ // fast double click
+ else if (diff < 400) {
+ emit_signal("item_double_clicked");
+ }
+ first_selection_time = OS::get_singleton()->get_ticks_msec();
+ } else {
+ edit_selected();
+ }
+ }
pressing_for_editor=false;
}
@@ -2848,7 +2861,6 @@ void Tree::item_changed(int p_column,TreeItem *p_item) {
void Tree::item_selected(int p_column,TreeItem *p_item) {
-
if (select_mode==SELECT_MULTI) {
if (!p_item->cells[p_column].selectable)
@@ -2856,8 +2868,11 @@ void Tree::item_selected(int p_column,TreeItem *p_item) {
p_item->cells[p_column].selected=true;
//emit_signal("multi_selected",p_item,p_column,true); - NO this is for TreeItem::select
+ if (delayed_text_editor)
+ first_selection_time = OS::get_singleton()->get_ticks_msec();
} else {
+
select_single_item(p_item,root,p_column);
}
update();
@@ -3128,7 +3143,7 @@ void Tree::ensure_cursor_is_visible() {
int screenh=get_size().height-h_scroll->get_combined_minimum_size().height;
if (ofs+h>v_scroll->get_val()+screenh)
- v_scroll->set_val(ofs-screenh+h);
+ v_scroll->call_deferred("set_val", ofs-screenh+h);
else if (ofs < v_scroll->get_val())
v_scroll->set_val(ofs);
}
@@ -3503,6 +3518,16 @@ bool Tree::get_allow_rmb_select() const{
return allow_rmb_select;
}
+
+void Tree::set_delayed_text_editor(bool enabled) {
+ delayed_text_editor = enabled;
+}
+
+bool Tree::is_delayed_text_editor_enabled() const {
+ return delayed_text_editor;
+}
+
+
void Tree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_range_click_timeout"),&Tree::_range_click_timeout);
@@ -3556,6 +3581,9 @@ void Tree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_allow_rmb_select","allow"),&Tree::set_allow_rmb_select);
ObjectTypeDB::bind_method(_MD("get_allow_rmb_select"),&Tree::get_allow_rmb_select);
+ ObjectTypeDB::bind_method(_MD("set_delayed_text_editor","enable"),&Tree::set_delayed_text_editor);
+ ObjectTypeDB::bind_method(_MD("is_delayed_text_editor_enabled"),&Tree::is_delayed_text_editor_enabled);
+
ObjectTypeDB::bind_method(_MD("set_single_select_cell_editing_only_when_already_selected","enable"),&Tree::set_single_select_cell_editing_only_when_already_selected);
ObjectTypeDB::bind_method(_MD("get_single_select_cell_editing_only_when_already_selected"),&Tree::get_single_select_cell_editing_only_when_already_selected);
@@ -3566,6 +3594,7 @@ void Tree::_bind_methods() {
ADD_SIGNAL( MethodInfo("item_rmb_selected",PropertyInfo(Variant::VECTOR2,"pos")));
ADD_SIGNAL( MethodInfo("empty_tree_rmb_selected",PropertyInfo(Variant::VECTOR2,"pos")));
ADD_SIGNAL( MethodInfo("item_edited"));
+ ADD_SIGNAL( MethodInfo("item_double_clicked"));
ADD_SIGNAL( MethodInfo("item_collapsed",PropertyInfo(Variant::OBJECT,"item")));
//ADD_SIGNAL( MethodInfo("item_doubleclicked" ) );
ADD_SIGNAL( MethodInfo("button_pressed",PropertyInfo(Variant::OBJECT,"item"),PropertyInfo(Variant::INT,"column"),PropertyInfo(Variant::INT,"id")));
@@ -3669,6 +3698,9 @@ Tree::Tree() {
force_select_on_already_selected=false;
allow_rmb_select=false;
+
+ first_selection_time = 0;
+ delayed_text_editor = false;
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index f5100ab5b6..ff427dbe65 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -433,6 +433,9 @@ friend class TreeItem;
float last_drag_time;
float time_since_motion;*/
+ bool delayed_text_editor;
+ uint64_t first_selection_time;
+
float drag_speed;
float drag_from;
float drag_accum;
@@ -527,6 +530,9 @@ public:
void set_value_evaluator(ValueEvaluator *p_evaluator);
+ void set_delayed_text_editor(bool enabled);
+ bool is_delayed_text_editor_enabled() const;
+
Tree();
~Tree();
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index a53c19d2e7..086b69c1c5 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -36,6 +36,8 @@
#include "instance_placeholder.h"
VARIANT_ENUM_CAST(Node::PauseMode);
+VARIANT_ENUM_CAST(Node::NetworkMode);
+VARIANT_ENUM_CAST(Node::RPCMode);
@@ -77,6 +79,16 @@ void Node::_notification(int p_notification) {
data.pause_owner=this;
}
+ if (data.network_mode==NETWORK_MODE_INHERIT) {
+
+ if (data.parent)
+ data.network_owner=data.parent->data.network_owner;
+ else
+ data.network_owner=NULL;
+ } else {
+ data.network_owner=this;
+ }
+
if (data.input)
add_to_group("_vp_input"+itos(get_viewport()->get_instance_ID()));
if (data.unhandled_input)
@@ -97,6 +109,20 @@ void Node::_notification(int p_notification) {
if (data.unhandled_key_input)
remove_from_group("_vp_unhandled_key_input"+itos(get_viewport()->get_instance_ID()));
+
+ data.pause_owner=NULL;
+ data.network_owner=NULL;
+ if (data.path_cache) {
+ memdelete(data.path_cache);
+ data.path_cache=NULL;
+ }
+ } break;
+ case NOTIFICATION_PATH_CHANGED: {
+
+ if (data.path_cache) {
+ memdelete(data.path_cache);
+ data.path_cache=NULL;
+ }
} break;
case NOTIFICATION_READY: {
@@ -412,6 +438,640 @@ void Node::_propagate_pause_owner(Node*p_owner) {
}
}
+void Node::set_network_mode(NetworkMode p_mode) {
+
+ if (data.network_mode==p_mode)
+ return;
+
+ bool prev_inherits=data.network_mode==NETWORK_MODE_INHERIT;
+ data.network_mode=p_mode;
+ if (!is_inside_tree())
+ return; //pointless
+ if ((data.network_mode==NETWORK_MODE_INHERIT) == prev_inherits)
+ return; ///nothing changed
+
+ Node *owner=NULL;
+
+ if (data.network_mode==NETWORK_MODE_INHERIT) {
+
+ if (data.parent)
+ owner=data.parent->data.network_owner;
+ } else {
+ owner=this;
+ }
+
+ _propagate_network_owner(owner);
+
+
+
+}
+
+Node::NetworkMode Node::get_network_mode() const {
+
+ return data.network_mode;
+}
+
+bool Node::is_network_master() const {
+
+ ERR_FAIL_COND_V(!is_inside_tree(),false);
+
+ switch(data.network_mode) {
+ case NETWORK_MODE_INHERIT: {
+
+ if (data.network_owner)
+ return data.network_owner->is_network_master();
+ else
+ return get_tree()->is_network_server();
+ } break;
+ case NETWORK_MODE_MASTER: {
+
+ return true;
+ } break;
+ case NETWORK_MODE_SLAVE: {
+ return false;
+ } break;
+ }
+
+ return false;
+}
+
+
+
+void Node::_propagate_network_owner(Node*p_owner) {
+
+ if (data.network_mode!=NETWORK_MODE_INHERIT)
+ return;
+ data.network_owner=p_owner;
+ for(int i=0;i<data.children.size();i++) {
+
+ data.children[i]->_propagate_network_owner(p_owner);
+ }
+}
+
+/***** RPC CONFIG ********/
+
+void Node::rpc_config(const StringName& p_method,RPCMode p_mode) {
+
+ if (p_mode==RPC_MODE_DISABLED) {
+ data.rpc_methods.erase(p_method);
+ } else {
+ data.rpc_methods[p_method]=p_mode;
+ };
+}
+
+void Node::rset_config(const StringName& p_property,RPCMode p_mode) {
+
+ if (p_mode==RPC_MODE_DISABLED) {
+ data.rpc_properties.erase(p_property);
+ } else {
+ data.rpc_properties[p_property]=p_mode;
+ };
+}
+
+/***** RPC FUNCTIONS ********/
+
+void Node::rpc(const StringName& p_method,VARIANT_ARG_DECLARE) {
+
+ VARIANT_ARGPTRS;
+
+ int argc=0;
+ for(int i=0;i<VARIANT_ARG_MAX;i++) {
+ if (argptr[i]->get_type()==Variant::NIL)
+ break;
+ argc++;
+ }
+
+ rpcp(0,false,p_method,argptr,argc);
+}
+
+
+void Node::rpc_id(int p_peer_id,const StringName& p_method,VARIANT_ARG_DECLARE) {
+
+ VARIANT_ARGPTRS;
+
+ int argc=0;
+ for(int i=0;i<VARIANT_ARG_MAX;i++) {
+ if (argptr[i]->get_type()==Variant::NIL)
+ break;
+ argc++;
+ }
+
+ rpcp(p_peer_id,false,p_method,argptr,argc);
+}
+
+
+void Node::rpc_unreliable(const StringName& p_method,VARIANT_ARG_DECLARE) {
+
+ VARIANT_ARGPTRS;
+
+ int argc=0;
+ for(int i=0;i<VARIANT_ARG_MAX;i++) {
+ if (argptr[i]->get_type()==Variant::NIL)
+ break;
+ argc++;
+ }
+
+ rpcp(0,true,p_method,argptr,argc);
+}
+
+
+void Node::rpc_unreliable_id(int p_peer_id,const StringName& p_method,VARIANT_ARG_DECLARE) {
+
+ VARIANT_ARGPTRS;
+
+ int argc=0;
+ for(int i=0;i<VARIANT_ARG_MAX;i++) {
+ if (argptr[i]->get_type()==Variant::NIL)
+ break;
+ argc++;
+ }
+
+ rpcp(p_peer_id,true,p_method,argptr,argc);
+}
+
+
+Variant Node::_rpc_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {
+
+ if (p_argcount<1) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=1;
+ return Variant();
+ }
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::STRING;
+ return Variant();
+ }
+
+ StringName method = *p_args[0];
+
+ rpcp(0,false,method,&p_args[1],p_argcount-1);
+
+ r_error.error=Variant::CallError::CALL_OK;
+ return Variant();
+}
+
+
+Variant Node::_rpc_id_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {
+
+ if (p_argcount<2) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=2;
+ return Variant();
+ }
+
+ if (p_args[0]->get_type()!=Variant::INT) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::INT;
+ return Variant();
+ }
+
+ if (p_args[1]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=1;
+ r_error.expected=Variant::STRING;
+ return Variant();
+ }
+
+ int peer_id = *p_args[0];
+ StringName method = *p_args[1];
+
+ rpcp(peer_id,false,method,&p_args[2],p_argcount-2);
+
+ r_error.error=Variant::CallError::CALL_OK;
+ return Variant();
+}
+
+
+Variant Node::_rpc_unreliable_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {
+
+ if (p_argcount<1) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=1;
+ return Variant();
+ }
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::STRING;
+ return Variant();
+ }
+
+ StringName method = *p_args[0];
+
+ rpcp(0,true,method,&p_args[1],p_argcount-1);
+
+ r_error.error=Variant::CallError::CALL_OK;
+ return Variant();
+}
+
+
+Variant Node::_rpc_unreliable_id_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {
+
+ if (p_argcount<2) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=2;
+ return Variant();
+ }
+
+ if (p_args[0]->get_type()!=Variant::INT) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::INT;
+ return Variant();
+ }
+
+ if (p_args[1]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=1;
+ r_error.expected=Variant::STRING;
+ return Variant();
+ }
+
+ int peer_id = *p_args[0];
+ StringName method = *p_args[1];
+
+ rpcp(peer_id,true,method,&p_args[2],p_argcount-2);
+
+ r_error.error=Variant::CallError::CALL_OK;
+ return Variant();
+}
+
+#if 0
+Variant Node::_rpc_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {
+
+ if (p_argcount<1) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=1;
+ return Variant();
+ }
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::STRING;
+ return Variant();
+ }
+
+ StringName method = *p_args[0];
+
+ rpcp(method,&p_args[1],p_argcount-1);
+
+ r_error.error=Variant::CallError::CALL_OK;
+ return Variant();
+}
+
+#endif
+void Node::rpcp(int p_peer_id,bool p_unreliable,const StringName& p_method,const Variant** p_arg,int p_argcount) {
+
+ ERR_FAIL_COND(!is_inside_tree());
+
+ bool skip_rpc=false;
+
+ if (p_peer_id==0 || p_peer_id==get_tree()->get_network_unique_id() || (p_peer_id<0 && p_peer_id!=-get_tree()->get_network_unique_id())) {
+ //check that send mode can use local call
+
+
+ bool call_local=false;
+
+
+
+ Map<StringName,RPCMode>::Element *E = data.rpc_methods.find(p_method);
+ if (E) {
+
+ switch(E->get()) {
+
+ case RPC_MODE_DISABLED: {
+ //do nothing
+ } break;
+ case RPC_MODE_REMOTE: {
+ //do nothing also, no need to call local
+ } break;
+ case RPC_MODE_SYNC: {
+ //call it, sync always results in call
+ call_local=true;
+ } break;
+ case RPC_MODE_MASTER: {
+ call_local=is_network_master();
+ if (call_local) {
+ skip_rpc=true; //no other master so..
+ }
+ } break;
+ case RPC_MODE_SLAVE: {
+ call_local=!is_network_master();
+ } break;
+
+ }
+ }
+
+
+ if (call_local) {
+ Variant::CallError ce;
+ call(p_method,p_arg,p_argcount,ce);
+ if (ce.error!=Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(this,p_method,p_arg,p_argcount,ce);
+ error="rpc() aborted in local call: - "+error;
+ ERR_PRINTS(error);
+ return;
+ }
+ } else if (get_script_instance()){
+ //attempt with script
+ ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rpc_mode(p_method);
+
+ switch(rpc_mode) {
+
+ case ScriptInstance::RPC_MODE_DISABLED: {
+ //do nothing
+ } break;
+ case ScriptInstance::RPC_MODE_REMOTE: {
+ //do nothing also, no need to call local
+ } break;
+ case ScriptInstance::RPC_MODE_SYNC: {
+ //call it, sync always results in call
+ call_local=true;
+ } break;
+ case ScriptInstance::RPC_MODE_MASTER: {
+ call_local=is_network_master();
+ if (call_local) {
+ skip_rpc=true; //no other master so..
+ }
+ } break;
+ case ScriptInstance::RPC_MODE_SLAVE: {
+ call_local=!is_network_master();
+ } break;
+ }
+
+ if (call_local) {
+ Variant::CallError ce;
+ ce.error=Variant::CallError::CALL_OK;
+ get_script_instance()->call(p_method,p_arg,p_argcount,ce);
+ if (ce.error!=Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(this,p_method,p_arg,p_argcount,ce);
+ error="rpc() aborted in script local call: - "+error;
+ ERR_PRINTS(error);
+ return;
+ }
+ }
+ }
+ }
+
+ if (skip_rpc)
+ return;
+
+
+ get_tree()->_rpc(this,p_peer_id,p_unreliable,false,p_method,p_arg,p_argcount);
+
+}
+
+
+/******** RSET *********/
+
+
+void Node::rsetp(int p_peer_id,bool p_unreliable,const StringName& p_property,const Variant& p_value) {
+
+ ERR_FAIL_COND(!is_inside_tree());
+
+ bool skip_rset=false;
+
+ if (p_peer_id==0 || p_peer_id==get_tree()->get_network_unique_id() || (p_peer_id<0 && p_peer_id!=-get_tree()->get_network_unique_id())) {
+ //check that send mode can use local call
+
+
+ bool set_local=false;
+
+ Map<StringName,RPCMode>::Element *E = data.rpc_properties.find(p_property);
+ if (E) {
+
+ switch(E->get()) {
+
+ case RPC_MODE_DISABLED: {
+ //do nothing
+ } break;
+ case RPC_MODE_REMOTE: {
+ //do nothing also, no need to call local
+ } break;
+ case RPC_MODE_SYNC: {
+ //call it, sync always results in call
+ set_local=true;
+ } break;
+ case RPC_MODE_MASTER: {
+ set_local=is_network_master();
+ if (set_local) {
+ skip_rset=true;
+ }
+
+ } break;
+ case RPC_MODE_SLAVE: {
+ set_local=!is_network_master();
+ } break;
+
+ }
+ }
+
+
+ if (set_local) {
+ bool valid;
+ set(p_property,p_value,&valid);
+
+ if (!valid) {
+ String error="rset() aborted in local set, property not found: - "+String(p_property);
+ ERR_PRINTS(error);
+ return;
+ }
+ } else if (get_script_instance()){
+ //attempt with script
+ ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rset_mode(p_property);
+
+ switch(rpc_mode) {
+
+ case ScriptInstance::RPC_MODE_DISABLED: {
+ //do nothing
+ } break;
+ case ScriptInstance::RPC_MODE_REMOTE: {
+ //do nothing also, no need to call local
+ } break;
+ case ScriptInstance::RPC_MODE_SYNC: {
+ //call it, sync always results in call
+ set_local=true;
+ } break;
+ case ScriptInstance::RPC_MODE_MASTER: {
+ set_local=is_network_master();
+ if (set_local) {
+ skip_rset=true;
+ }
+ } break;
+ case ScriptInstance::RPC_MODE_SLAVE: {
+ set_local=!is_network_master();
+ } break;
+ }
+
+ if (set_local) {
+
+ bool valid = get_script_instance()->set(p_property,p_value);
+
+ if (!valid) {
+ String error="rset() aborted in local script set, property not found: - "+String(p_property);
+ ERR_PRINTS(error);
+ return;
+ }
+ }
+
+ }
+ }
+
+ if (skip_rset)
+ return;
+
+ const Variant*vptr = &p_value;
+
+ get_tree()->_rpc(this,p_peer_id,p_unreliable,true,p_property,&vptr,1);
+
+}
+
+
+
+void Node::rset(const StringName& p_property,const Variant& p_value) {
+
+ rsetp(0,false,p_property,p_value);
+
+}
+
+void Node::rset_id(int p_peer_id,const StringName& p_property,const Variant& p_value) {
+
+ rsetp(p_peer_id,false,p_property,p_value);
+
+}
+
+void Node::rset_unreliable(const StringName& p_property,const Variant& p_value) {
+
+ rsetp(0,true,p_property,p_value);
+
+}
+
+void Node::rset_unreliable_id(int p_peer_id,const StringName& p_property,const Variant& p_value) {
+
+ rsetp(p_peer_id,true,p_property,p_value);
+
+}
+
+//////////// end of rpc
+
+bool Node::can_call_rpc(const StringName& p_method) const {
+
+ const Map<StringName,RPCMode>::Element *E = data.rpc_methods.find(p_method);
+ if (E) {
+
+ switch(E->get()) {
+
+ case RPC_MODE_DISABLED: {
+ return false;
+ } break;
+ case RPC_MODE_REMOTE: {
+ return true;
+ } break;
+ case RPC_MODE_SYNC: {
+ return true;
+ } break;
+ case RPC_MODE_MASTER: {
+ return is_network_master();
+ } break;
+ case RPC_MODE_SLAVE: {
+ return !is_network_master();
+ } break;
+ }
+ }
+
+
+ if (get_script_instance()){
+ //attempt with script
+ ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rpc_mode(p_method);
+
+ switch(rpc_mode) {
+
+ case ScriptInstance::RPC_MODE_DISABLED: {
+ return false;
+ } break;
+ case ScriptInstance::RPC_MODE_REMOTE: {
+ return true;
+ } break;
+ case ScriptInstance::RPC_MODE_SYNC: {
+ return true;
+ } break;
+ case ScriptInstance::RPC_MODE_MASTER: {
+ return is_network_master();
+ } break;
+ case ScriptInstance::RPC_MODE_SLAVE: {
+ return !is_network_master();
+ } break;
+ }
+
+ }
+
+ ERR_PRINTS("RPC on unauthorized method attempted: "+String(p_method)+" on base: "+String(Variant(this)));
+ return false;
+}
+
+bool Node::can_call_rset(const StringName& p_property) const {
+
+ const Map<StringName,RPCMode>::Element *E = data.rpc_properties.find(p_property);
+ if (E) {
+
+ switch(E->get()) {
+
+ case RPC_MODE_DISABLED: {
+ return false;
+ } break;
+ case RPC_MODE_REMOTE: {
+ return true;
+ } break;
+ case RPC_MODE_SYNC: {
+ return true;
+ } break;
+ case RPC_MODE_MASTER: {
+ return is_network_master();
+ } break;
+ case RPC_MODE_SLAVE: {
+ return !is_network_master();
+ } break;
+ }
+ }
+
+
+ if (get_script_instance()){
+ //attempt with script
+ ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rset_mode(p_property);
+
+ switch(rpc_mode) {
+
+ case ScriptInstance::RPC_MODE_DISABLED: {
+ return false;
+ } break;
+ case ScriptInstance::RPC_MODE_REMOTE: {
+ return true;
+ } break;
+ case ScriptInstance::RPC_MODE_SYNC: {
+ return true;
+ } break;
+ case ScriptInstance::RPC_MODE_MASTER: {
+ return is_network_master();
+ } break;
+ case ScriptInstance::RPC_MODE_SLAVE: {
+ return !is_network_master();
+ } break;
+ }
+
+ }
+
+ ERR_PRINTS("RSET on unauthorized property attempted: "+String(p_property)+" on base: "+String(Variant(this)));
+
+ return false;
+}
+
+
bool Node::can_process() const {
ERR_FAIL_COND_V( !is_inside_tree(), false );
@@ -567,6 +1227,8 @@ void Node::set_name(const String& p_name) {
data.parent->_validate_child_name(this);
}
+ propagate_notification(NOTIFICATION_PATH_CHANGED);
+
if (is_inside_tree()) {
emit_signal("renamed");
@@ -1210,6 +1872,10 @@ NodePath Node::get_path_to(const Node *p_node) const {
NodePath Node::get_path() const {
ERR_FAIL_COND_V(!is_inside_tree(),NodePath());
+
+ if (data.path_cache)
+ return *data.path_cache;
+
const Node *n = this;
Vector<StringName> path;
@@ -1221,7 +1887,9 @@ NodePath Node::get_path() const {
path.invert();
- return NodePath( path, true );
+ data.path_cache = memnew( NodePath( path, true ) );
+
+ return *data.path_cache;
}
bool Node::is_in_group(const StringName& p_identifier) const {
@@ -2212,7 +2880,13 @@ void Node::_bind_methods() {
ObjectTypeDB::bind_method(_MD("queue_free"),&Node::queue_delete);
+ ObjectTypeDB::bind_method(_MD("set_network_mode","mode"),&Node::set_network_mode);
+ ObjectTypeDB::bind_method(_MD("get_network_mode"),&Node::get_network_mode);
+
+ ObjectTypeDB::bind_method(_MD("is_network_master"),&Node::is_network_master);
+ ObjectTypeDB::bind_method(_MD("rpc_config","method","mode"),&Node::rpc_config);
+ ObjectTypeDB::bind_method(_MD("rset_config","property","mode"),&Node::rset_config);
#ifdef TOOLS_ENABLED
@@ -2222,6 +2896,33 @@ void Node::_bind_methods() {
#endif
+ {
+ MethodInfo mi;
+
+ mi.arguments.push_back( PropertyInfo( Variant::STRING, "method"));
+
+
+ mi.name="rpc";
+ ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc",&Node::_rpc_bind,mi);
+ mi.name="rpc_unreliable";
+ ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable",&Node::_rpc_unreliable_bind,mi);
+
+ mi.arguments.push_front( PropertyInfo( Variant::INT, "peer_") );
+
+ mi.name="rpc_id";
+ ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_id",&Node::_rpc_id_bind,mi);
+ mi.name="rpc_unreliable_id";
+ ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable_id",&Node::_rpc_unreliable_id_bind,mi);
+
+
+ }
+
+ ObjectTypeDB::bind_method(_MD("rset","property","value:Variant"),&Node::rset);
+ ObjectTypeDB::bind_method(_MD("rset_id","peer_id","property","value:Variant"),&Node::rset_id);
+ ObjectTypeDB::bind_method(_MD("rset_unreliable","property","value:Variant"),&Node::rset_unreliable);
+ ObjectTypeDB::bind_method(_MD("rset_unreliable_id","peer_id","property","value:Variant"),&Node::rset_unreliable_id);
+
+
BIND_CONSTANT( NOTIFICATION_ENTER_TREE );
BIND_CONSTANT( NOTIFICATION_EXIT_TREE );
BIND_CONSTANT( NOTIFICATION_MOVED_IN_PARENT );
@@ -2236,8 +2937,18 @@ void Node::_bind_methods() {
BIND_CONSTANT( NOTIFICATION_INSTANCED );
BIND_CONSTANT( NOTIFICATION_DRAG_BEGIN );
BIND_CONSTANT( NOTIFICATION_DRAG_END );
+ BIND_CONSTANT( NOTIFICATION_PATH_CHANGED);
+ BIND_CONSTANT( NETWORK_MODE_INHERIT );
+ BIND_CONSTANT( NETWORK_MODE_MASTER );
+ BIND_CONSTANT( NETWORK_MODE_SLAVE );
+
+ BIND_CONSTANT( RPC_MODE_DISABLED );
+ BIND_CONSTANT( RPC_MODE_REMOTE );
+ BIND_CONSTANT( RPC_MODE_SYNC );
+ BIND_CONSTANT( RPC_MODE_MASTER );
+ BIND_CONSTANT( RPC_MODE_SLAVE );
BIND_CONSTANT( PAUSE_MODE_INHERIT );
BIND_CONSTANT( PAUSE_MODE_STOP );
@@ -2286,11 +2997,15 @@ Node::Node() {
data.unhandled_key_input=false;
data.pause_mode=PAUSE_MODE_INHERIT;
data.pause_owner=NULL;
+ data.network_mode=NETWORK_MODE_INHERIT;
+ data.network_owner=NULL;
+ data.path_cache=NULL;
data.parent_owned=false;
data.in_constructor=true;
data.viewport=NULL;
data.use_placeholder=false;
data.display_folded=false;
+
}
Node::~Node() {
diff --git a/scene/main/node.h b/scene/main/node.h
index 18e403cd61..3568da2ab0 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -53,6 +53,21 @@ public:
PAUSE_MODE_PROCESS
};
+ enum NetworkMode {
+
+ NETWORK_MODE_INHERIT,
+ NETWORK_MODE_MASTER,
+ NETWORK_MODE_SLAVE
+ };
+
+ enum RPCMode {
+
+ RPC_MODE_DISABLED, //no rpc for this method, calls to this will be blocked (default)
+ RPC_MODE_REMOTE, // using rpc() on it will call method / set property in all other peers
+ RPC_MODE_SYNC, // using rpc() on it will call method / set property in all other peers and locally
+ RPC_MODE_MASTER, // usinc rpc() on it will call method on wherever the master is, be it local or remote
+ RPC_MODE_SLAVE, // usinc rpc() on it will call method for all slaves, be it local or remote
+ };
struct Comparator {
@@ -68,6 +83,8 @@ private:
GroupData() { persistent=false; }
};
+
+
struct Data {
String filename;
@@ -98,6 +115,13 @@ private:
PauseMode pause_mode;
Node *pause_owner;
+
+ NetworkMode network_mode;
+ Node *network_owner;
+ Map<StringName,RPCMode> rpc_methods;
+ Map<StringName,RPCMode> rpc_properties;
+
+
// variables used to properly sort the node when processing, ignored otherwise
//should move all the stuff below to bits
bool fixed_process;
@@ -113,6 +137,8 @@ private:
bool display_folded;
+ mutable NodePath *path_cache;
+
} data;
@@ -134,6 +160,7 @@ private:
void _propagate_validate_owner();
void _print_stray_nodes();
void _propagate_pause_owner(Node*p_owner);
+ void _propagate_network_owner(Node*p_owner);
Array _get_node_and_resource(const NodePath& p_path);
void _duplicate_signals(const Node* p_original,Node* p_copy) const;
@@ -143,6 +170,11 @@ private:
Array _get_children() const;
Array _get_groups() const;
+ Variant _rpc_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
+ Variant _rpc_unreliable_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
+ Variant _rpc_id_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
+ Variant _rpc_unreliable_id_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
+
friend class SceneTree;
void _set_tree(SceneTree *p_tree);
@@ -186,6 +218,7 @@ public:
NOTIFICATION_INSTANCED=20,
NOTIFICATION_DRAG_BEGIN=21,
NOTIFICATION_DRAG_END=22,
+ NOTIFICATION_PATH_CHANGED=23,
};
/* NODE/TREE */
@@ -331,7 +364,32 @@ public:
void set_display_folded(bool p_folded);
bool is_displayed_folded() const;
- /* CANVAS */
+ /* NETWORK */
+
+ void set_network_mode(NetworkMode p_mode);
+ NetworkMode get_network_mode() const;
+ bool is_network_master() const;
+
+ void rpc_config(const StringName& p_method,RPCMode p_mode); // config a local method for RPC
+ void rset_config(const StringName& p_property,RPCMode p_mode); // config a local property for RPC
+
+ void rpc(const StringName& p_method,VARIANT_ARG_LIST); //rpc call, honors RPCMode
+ void rpc_unreliable(const StringName& p_method,VARIANT_ARG_LIST); //rpc call, honors RPCMode
+ void rpc_id(int p_peer_id,const StringName& p_method,VARIANT_ARG_LIST); //rpc call, honors RPCMode
+ void rpc_unreliable_id(int p_peer_id,const StringName& p_method,VARIANT_ARG_LIST); //rpc call, honors RPCMode
+
+ void rpcp(int p_peer_id,bool p_unreliable,const StringName& p_method,const Variant** p_arg,int p_argcount);
+
+ void rset(const StringName& p_property, const Variant& p_value); //remote set call, honors RPCMode
+ void rset_unreliable(const StringName& p_property,const Variant& p_value); //remote set call, honors RPCMode
+ void rset_id(int p_peer_id,const StringName& p_property,const Variant& p_value); //remote set call, honors RPCMode
+ void rset_unreliable_id(int p_peer_id,const StringName& p_property,const Variant& p_value); //remote set call, honors RPCMode
+
+ void rsetp(int p_peer_id,bool p_unreliable,const StringName& p_property,const Variant& p_value);
+
+ bool can_call_rpc(const StringName& p_method) const;
+ bool can_call_rset(const StringName& p_property) const;
+
Node();
~Node();
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 77156203b8..4c7b7c1399 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -44,7 +44,7 @@
#include "scene/resources/packed_scene.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
-
+#include "io/marshalls.h"
void SceneTreeTimer::_bind_methods() {
@@ -545,6 +545,8 @@ bool SceneTree::idle(float p_time){
idle_process_time=p_time;
+ _network_poll();
+
emit_signal("idle_frame");
_flush_transform_notifications();
@@ -1655,6 +1657,500 @@ Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec) {
return stt;
}
+void SceneTree::_network_peer_connected(int p_id) {
+
+
+ connected_peers.insert(p_id);
+ path_get_cache.insert(p_id,PathGetCache());
+
+
+ emit_signal("network_peer_connected",p_id);
+}
+
+void SceneTree::_network_peer_disconnected(int p_id) {
+
+ connected_peers.erase(p_id);
+ path_get_cache.erase(p_id); //I no longer need your cache, sorry
+ emit_signal("network_peer_disconnected",p_id);
+}
+
+void SceneTree::_connected_to_server() {
+
+ emit_signal("connected_to_server");
+}
+
+void SceneTree::_connection_failed() {
+
+ emit_signal("connection_failed");
+}
+
+void SceneTree::_server_disconnected() {
+
+ emit_signal("server_disconnected");
+}
+
+void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer>& p_network_peer) {
+ if (network_peer.is_valid()) {
+ network_peer->disconnect("peer_connected",this,"_network_peer_connected");
+ network_peer->disconnect("peer_disconnected",this,"_network_peer_disconnected");
+ network_peer->disconnect("connection_succeeded",this,"_connected_to_server");
+ network_peer->disconnect("connection_failed",this,"_connection_failed");
+ network_peer->disconnect("server_disconnected",this,"_server_disconnected");
+ connected_peers.clear();
+ path_get_cache.clear();
+ path_send_cache.clear();
+ last_send_cache_id=1;
+ }
+
+ ERR_EXPLAIN("Supplied NetworkedNetworkPeer must be connecting or connected.");
+ ERR_FAIL_COND(p_network_peer.is_valid() && p_network_peer->get_connection_status()==NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED);
+
+ network_peer=p_network_peer;
+
+ if (network_peer.is_valid()) {
+ network_peer->connect("peer_connected",this,"_network_peer_connected");
+ network_peer->connect("peer_disconnected",this,"_network_peer_disconnected");
+ network_peer->connect("connection_succeeded",this,"_connected_to_server");
+ network_peer->connect("connection_failed",this,"_connection_failed");
+ network_peer->connect("server_disconnected",this,"_server_disconnected");
+ }
+}
+
+bool SceneTree::is_network_server() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(),false);
+ return network_peer->is_server();
+
+}
+
+int SceneTree::get_network_unique_id() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(),0);
+ return network_peer->get_unique_id();
+}
+
+void SceneTree::set_refuse_new_network_connections(bool p_refuse) {
+ ERR_FAIL_COND(!network_peer.is_valid());
+ network_peer->set_refuse_new_connections(p_refuse);
+}
+
+bool SceneTree::is_refusing_new_network_connections() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(),false);
+
+ return network_peer->is_refusing_new_connections();
+
+}
+
+
+void SceneTree::_rpc(Node* p_from,int p_to,bool p_unreliable,bool p_set,const StringName& p_name,const Variant** p_arg,int p_argcount) {
+
+ if (network_peer.is_null()) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is not active in SceneTree.");
+ ERR_FAIL();
+ }
+
+ if (network_peer->get_connection_status()==NetworkedMultiplayerPeer::CONNECTION_CONNECTING) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is not connected yet in SceneTree.");
+ ERR_FAIL();
+ }
+
+ if (network_peer->get_connection_status()==NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is disconnected.");
+ ERR_FAIL();
+ }
+
+ if (p_argcount>255) {
+ ERR_EXPLAIN("Too many arguments >255.");
+ ERR_FAIL();
+ }
+
+ if (p_to!=0 && !connected_peers.has(ABS(p_to))) {
+ if (p_to==get_network_unique_id()) {
+ ERR_EXPLAIN("Attempt to remote call/set yourself! unique ID: "+itos(get_network_unique_id()));
+ } else {
+ ERR_EXPLAIN("Attempt to remote call unexisting ID: "+itos(p_to));
+
+ }
+
+ ERR_FAIL();
+ }
+
+ NodePath from_path = p_from->get_path();
+ ERR_FAIL_COND(from_path.is_empty());
+
+
+
+ //see if the path is cached
+ PathSentCache *psc = path_send_cache.getptr(from_path);
+ if (!psc) {
+ //path is not cached, create
+ path_send_cache[from_path]=PathSentCache();
+ psc = path_send_cache.getptr(from_path);
+ psc->id=last_send_cache_id++;
+
+ }
+
+
+ //create base packet, lots of harcode because it must be tight
+
+ int ofs=0;
+
+#define MAKE_ROOM(m_amount) if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
+
+ //encode type
+ MAKE_ROOM(1);
+ packet_cache[0]=p_set ? NETWORK_COMMAND_REMOTE_SET : NETWORK_COMMAND_REMOTE_CALL;
+ ofs+=1;
+
+ //encode ID
+ MAKE_ROOM(ofs+4);
+ encode_uint32(psc->id,&packet_cache[ofs]);
+ ofs+=4;
+
+ //encode function name
+ CharString name = String(p_name).utf8();
+ int len = encode_cstring(name.get_data(),NULL);
+ MAKE_ROOM(ofs+len);
+ encode_cstring(name.get_data(),&packet_cache[ofs]);
+ ofs+=len;
+
+ if (p_set) {
+ //set argument
+ Error err = encode_variant(*p_arg[0],NULL,len);
+ ERR_FAIL_COND(err!=OK);
+ MAKE_ROOM(ofs+len);
+ encode_variant(*p_arg[0],&packet_cache[ofs],len);
+ ofs+=len;
+
+ } else {
+ //call arguments
+ MAKE_ROOM(ofs+1);
+ packet_cache[ofs]=p_argcount;
+ ofs+=1;
+ for(int i=0;i<p_argcount;i++) {
+ Error err = encode_variant(*p_arg[i],NULL,len);
+ ERR_FAIL_COND(err!=OK);
+ MAKE_ROOM(ofs+len);
+ encode_variant(*p_arg[i],&packet_cache[ofs],len);
+ ofs+=len;
+ }
+
+ }
+
+ //see if all peers have cached path (is so, call can be fast)
+ bool has_all_peers=true;
+
+ List<int> peers_to_add; //if one is missing, take note to add it
+
+ for (Set<int>::Element *E=connected_peers.front();E;E=E->next()) {
+
+ if (p_to<0 && E->get()==-p_to)
+ continue; //continue, excluded
+
+ if (p_to>0 && E->get()!=p_to)
+ continue; //continue, not for this peer
+
+ Map<int,bool>::Element *F = psc->confirmed_peers.find(E->get());
+
+ if (!F || F->get()==false) {
+ //path was not cached, or was cached but is unconfirmed
+ if (!F) {
+ //not cached at all, take note
+ peers_to_add.push_back(E->get());
+ }
+
+ has_all_peers=false;
+ }
+ }
+
+ //those that need to be added, send a message for this
+
+ for (List<int>::Element *E=peers_to_add.front();E;E=E->next()) {
+
+ //encode function name
+ CharString pname = String(from_path).utf8();
+ int len = encode_cstring(pname.get_data(),NULL);
+
+ Vector<uint8_t> packet;
+
+ packet.resize(1+4+len);
+ packet[0]=NETWORK_COMMAND_SIMPLIFY_PATH;
+ encode_uint32(psc->id,&packet[1]);
+ encode_cstring(pname.get_data(),&packet[5]);
+
+ network_peer->set_target_peer(E->get()); //to all of you
+ network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+ network_peer->put_packet(packet.ptr(),packet.size());
+
+ psc->confirmed_peers.insert(E->get(),false); //insert into confirmed, but as false since it was not confirmed
+ }
+
+ //take chance and set transfer mode, since all send methods will use it
+ network_peer->set_transfer_mode(p_unreliable ? NetworkedMultiplayerPeer::TRANSFER_MODE_UNRELIABLE : NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+
+ if (has_all_peers) {
+
+ //they all have verified paths, so send fast
+ network_peer->set_target_peer(p_to); //to all of you
+ network_peer->put_packet(packet_cache.ptr(),ofs); //a message with love
+ } else {
+ //not all verified path, so send one by one
+
+ //apend path at the end, since we will need it for some packets
+ CharString pname = String(from_path).utf8();
+ int path_len = encode_cstring(pname.get_data(),NULL);
+ MAKE_ROOM(ofs+path_len);
+ encode_cstring(pname.get_data(),&packet_cache[ofs]);
+
+
+ for (Set<int>::Element *E=connected_peers.front();E;E=E->next()) {
+
+ if (p_to<0 && E->get()==-p_to)
+ continue; //continue, excluded
+
+ if (p_to>0 && E->get()!=p_to)
+ continue; //continue, not for this peer
+
+ Map<int,bool>::Element *F = psc->confirmed_peers.find(E->get());
+ ERR_CONTINUE(!F);//should never happen
+
+ network_peer->set_target_peer(E->get()); //to this one specifically
+
+ if (F->get()==true) {
+ //this one confirmed path, so use id
+ encode_uint32(psc->id,&packet_cache[1]);
+ network_peer->put_packet(packet_cache.ptr(),ofs);
+ } else {
+ //this one did not confirm path yet, so use entire path (sorry!)
+ encode_uint32(0x80000000|ofs,&packet_cache[1]); //offset to path and flag
+ network_peer->put_packet(packet_cache.ptr(),ofs+path_len);
+ }
+
+ }
+ }
+}
+
+
+void SceneTree::_network_process_packet(int p_from, const uint8_t* p_packet, int p_packet_len) {
+
+ ERR_FAIL_COND(p_packet_len<5);
+
+ uint8_t packet_type = p_packet[0];
+
+ switch(packet_type) {
+
+ case NETWORK_COMMAND_REMOTE_CALL:
+ case NETWORK_COMMAND_REMOTE_SET: {
+
+ ERR_FAIL_COND(p_packet_len<5);
+ uint32_t target = decode_uint32(&p_packet[1]);
+
+
+ Node *node=NULL;
+
+ if (target&0x80000000) {
+
+ int ofs = target&0x7FFFFFFF;
+ ERR_FAIL_COND(ofs>=p_packet_len);
+
+ String paths;
+ paths.parse_utf8((const char*)&p_packet[ofs],p_packet_len-ofs);
+
+ NodePath np = paths;
+
+ node = get_root()->get_node(np);
+ if (node==NULL) {
+ ERR_EXPLAIN("Failed to get path from RPC: "+String(np));
+ ERR_FAIL_COND(node==NULL);
+ }
+ } else {
+
+ int id = target;
+
+ Map<int,PathGetCache>::Element *E=path_get_cache.find(p_from);
+ ERR_FAIL_COND(!E);
+
+ Map<int,PathGetCache::NodeInfo>::Element *F=E->get().nodes.find(id);
+ ERR_FAIL_COND(!F);
+
+ PathGetCache::NodeInfo *ni = &F->get();
+ //do proper caching later
+
+ node = get_root()->get_node(ni->path);
+ if (node==NULL) {
+ ERR_EXPLAIN("Failed to get cached path from RPC: "+String(ni->path));
+ ERR_FAIL_COND(node==NULL);
+ }
+
+
+ }
+
+ ERR_FAIL_COND(p_packet_len<6);
+
+ //detect cstring end
+ int len_end=5;
+ for(;len_end<p_packet_len;len_end++) {
+ if (p_packet[len_end]==0) {
+ break;
+ }
+ }
+
+ ERR_FAIL_COND(len_end>=p_packet_len);
+
+ StringName name = String::utf8((const char*)&p_packet[5]);
+
+
+
+
+ if (packet_type==NETWORK_COMMAND_REMOTE_CALL) {
+
+ if (!node->can_call_rpc(name))
+ return;
+
+ int ofs = len_end+1;
+
+ ERR_FAIL_COND(ofs>=p_packet_len);
+
+ int argc = p_packet[ofs];
+ Vector<Variant> args;
+ Vector<const Variant*> argp;
+ args.resize(argc);
+ argp.resize(argc);
+
+ ofs++;
+
+ for(int i=0;i<argc;i++) {
+
+ ERR_FAIL_COND(ofs>=p_packet_len);
+ int vlen;
+ Error err = decode_variant(args[i],&p_packet[ofs],p_packet_len-ofs,&vlen);
+ ERR_FAIL_COND(err!=OK);
+ //args[i]=p_packet[3+i];
+ argp[i]=&args[i];
+ ofs+=vlen;
+ }
+
+ Variant::CallError ce;
+
+ node->call(name,argp.ptr(),argc,ce);
+ if (ce.error!=Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(node,name,argp.ptr(),argc,ce);
+ error="RPC - "+error;
+ ERR_PRINTS(error);
+ }
+
+ } else {
+
+ if (!node->can_call_rset(name))
+ return;
+
+ int ofs = len_end+1;
+
+ ERR_FAIL_COND(ofs>=p_packet_len);
+
+ Variant value;
+ decode_variant(value,&p_packet[ofs],p_packet_len-ofs);
+
+ bool valid;
+
+ node->set(name,value,&valid);
+ if (!valid) {
+ String error = "Error setting remote property '"+String(name)+"', not found in object of type "+node->get_type();
+ ERR_PRINTS(error);
+ }
+ }
+
+ } break;
+ case NETWORK_COMMAND_SIMPLIFY_PATH: {
+
+ ERR_FAIL_COND(p_packet_len<5);
+ int id = decode_uint32(&p_packet[1]);
+
+ String paths;
+ paths.parse_utf8((const char*)&p_packet[5],p_packet_len-5);
+
+ NodePath path = paths;
+
+ if (!path_get_cache.has(p_from)) {
+ path_get_cache[p_from]=PathGetCache();
+ }
+
+ PathGetCache::NodeInfo ni;
+ ni.path=path;
+ ni.instance=0;
+
+ path_get_cache[p_from].nodes[id]=ni;
+
+
+ {
+ //send ack
+
+ //encode path
+ CharString pname = String(path).utf8();
+ int len = encode_cstring(pname.get_data(),NULL);
+
+ Vector<uint8_t> packet;
+
+ packet.resize(1+len);
+ packet[0]=NETWORK_COMMAND_CONFIRM_PATH;
+ encode_cstring(pname.get_data(),&packet[1]);
+
+ network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+ network_peer->set_target_peer(p_from);
+ network_peer->put_packet(packet.ptr(),packet.size());
+ }
+ } break;
+ case NETWORK_COMMAND_CONFIRM_PATH: {
+
+ String paths;
+ paths.parse_utf8((const char*)&p_packet[1],p_packet_len-1);
+
+ NodePath path = paths;
+
+ PathSentCache *psc = path_send_cache.getptr(path);
+ ERR_FAIL_COND(!psc);
+
+ Map<int,bool>::Element *E=psc->confirmed_peers.find(p_from);
+ ERR_FAIL_COND(!E);
+ E->get()=true;
+ } break;
+ }
+
+}
+
+void SceneTree::_network_poll() {
+
+ if (!network_peer.is_valid() || network_peer->get_connection_status()==NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED)
+ return;
+
+ network_peer->poll();
+
+ if (!network_peer.is_valid()) //it's possible that polling might have resulted in a disconnection, so check here
+ return;
+
+ while(network_peer->get_available_packet_count()) {
+
+ int sender = network_peer->get_packet_peer();
+ const uint8_t *packet;
+ int len;
+
+ Error err = network_peer->get_packet(&packet,len);
+ if (err!=OK) {
+ ERR_PRINT("Error getting packet!");
+ }
+
+ _network_process_packet(sender,packet,len);
+
+ if (!network_peer.is_valid()) {
+ break; //it's also possible that a packet or RPC caused a disconnection, so also check here
+ }
+ }
+
+
+}
+
+
void SceneTree::_bind_methods() {
@@ -1722,6 +2218,18 @@ void SceneTree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_change_scene"),&SceneTree::_change_scene);
+
+ ObjectTypeDB::bind_method(_MD("set_network_peer","peer:NetworkedMultiplayerPeer"),&SceneTree::set_network_peer);
+ ObjectTypeDB::bind_method(_MD("is_network_server"),&SceneTree::is_network_server);
+ ObjectTypeDB::bind_method(_MD("get_network_unique_id"),&SceneTree::get_network_unique_id);
+ ObjectTypeDB::bind_method(_MD("set_refuse_new_network_connections","refuse"),&SceneTree::set_refuse_new_network_connections);
+ ObjectTypeDB::bind_method(_MD("is_refusing_new_network_connections"),&SceneTree::is_refusing_new_network_connections);
+ ObjectTypeDB::bind_method(_MD("_network_peer_connected"),&SceneTree::_network_peer_connected);
+ ObjectTypeDB::bind_method(_MD("_network_peer_disconnected"),&SceneTree::_network_peer_disconnected);
+ ObjectTypeDB::bind_method(_MD("_connected_to_server"),&SceneTree::_connected_to_server);
+ ObjectTypeDB::bind_method(_MD("_connection_failed"),&SceneTree::_connection_failed);
+ ObjectTypeDB::bind_method(_MD("_server_disconnected"),&SceneTree::_server_disconnected);
+
ADD_SIGNAL( MethodInfo("tree_changed") );
ADD_SIGNAL( MethodInfo("node_removed",PropertyInfo( Variant::OBJECT, "node") ) );
ADD_SIGNAL( MethodInfo("screen_resized") );
@@ -1731,6 +2239,11 @@ void SceneTree::_bind_methods() {
ADD_SIGNAL( MethodInfo("fixed_frame"));
ADD_SIGNAL( MethodInfo("files_dropped",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) );
+ ADD_SIGNAL( MethodInfo("network_peer_connected",PropertyInfo(Variant::INT,"id")));
+ ADD_SIGNAL( MethodInfo("network_peer_disconnected",PropertyInfo(Variant::INT,"id")));
+ ADD_SIGNAL( MethodInfo("connected_to_server"));
+ ADD_SIGNAL( MethodInfo("connection_failed"));
+ ADD_SIGNAL( MethodInfo("server_disconnected"));
BIND_CONSTANT( GROUP_CALL_DEFAULT );
BIND_CONSTANT( GROUP_CALL_REVERSE );
@@ -1831,6 +2344,8 @@ SceneTree::SceneTree() {
live_edit_root=NodePath("/root");
+ last_send_cache_id=1;
+
#endif
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index 6129a12446..1c0f88862c 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -35,6 +35,9 @@
#include "scene/resources/world_2d.h"
#include "os/thread_safe.h"
#include "self_list.h"
+#include "io/networked_multiplayer_peer.h"
+
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -173,9 +176,60 @@ private:
List<Ref<SceneTreeTimer> > timers;
+
+ ///network///
+
+ enum NetworkCommands {
+ NETWORK_COMMAND_REMOTE_CALL,
+ NETWORK_COMMAND_REMOTE_SET,
+ NETWORK_COMMAND_SIMPLIFY_PATH,
+ NETWORK_COMMAND_CONFIRM_PATH,
+ };
+
+ Ref<NetworkedMultiplayerPeer> network_peer;
+
+ Set<int> connected_peers;
+ void _network_peer_connected(int p_id);
+ void _network_peer_disconnected(int p_id);
+
+ void _connected_to_server();
+ void _connection_failed();
+ void _server_disconnected();
+
+ //path sent caches
+ struct PathSentCache {
+ Map<int,bool> confirmed_peers;
+ int id;
+ };
+
+ HashMap<NodePath,PathSentCache> path_send_cache;
+ int last_send_cache_id;
+
+ //path get caches
+ struct PathGetCache {
+ struct NodeInfo {
+ NodePath path;
+ ObjectID instance;
+ };
+
+ Map<int,NodeInfo> nodes;
+ };
+
+ Map<int,PathGetCache> path_get_cache;
+
+ Vector<uint8_t> packet_cache;
+
+ void _network_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len);
+ void _network_poll();
+
static SceneTree *singleton;
friend class Node;
+
+
+
+ void _rpc(Node* p_from,int p_to,bool p_unreliable,bool p_set,const StringName& p_name,const Variant** p_arg,int p_argcount);
+
void tree_changed();
void node_removed(Node *p_node);
@@ -251,6 +305,7 @@ friend class Viewport;
#endif
protected:
+
void _notification(int p_notification);
static void _bind_methods();
@@ -366,6 +421,15 @@ public:
void drop_files(const Vector<String>& p_files,int p_from_screen=0);
+ //network API
+
+ void set_network_peer(const Ref<NetworkedMultiplayerPeer>& p_network_peer);
+ bool is_network_server() const;
+ int get_network_unique_id() const;
+
+ void set_refuse_new_network_connections(bool p_refuse);
+ bool is_refusing_new_network_connections() const;
+
SceneTree();
~SceneTree();
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 2033599307..8c1233b634 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -627,6 +627,7 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
// GraphNode
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
+ Ref<StyleBoxTexture> graphsbcomment = make_stylebox(graph_node_comment_png,6,24,6,5,16,24,16,5);
Ref<StyleBoxTexture> graphsbselected = make_stylebox(graph_node_selected_png,6,24,6,5,16,24,16,5);
Ref<StyleBoxTexture> graphsbdefault = make_stylebox(graph_node_default_png,4,4,4,4,6,4,4,4);
Ref<StyleBoxTexture> graphsbdeffocus = make_stylebox(graph_node_default_focus_png,4,4,4,4,6,4,4,4);
@@ -639,11 +640,13 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
t->set_stylebox("selectedframe","GraphNode", graphsbselected );
t->set_stylebox("defaultframe", "GraphNode", graphsbdefault );
t->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus );
+ t->set_stylebox("comment", "GraphNode", graphsbcomment );
t->set_stylebox("breakpoint", "GraphNode", graph_bpoint );
t->set_stylebox("position", "GraphNode", graph_position );
t->set_constant("separation","GraphNode", 1 *scale);
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );
+ t->set_icon("resizer","GraphNode", make_icon( window_resizer_png ) );
t->set_font("title_font","GraphNode", default_font );
t->set_color("title_color","GraphNode", Color(0,0,0,1));
t->set_constant("title_offset","GraphNode", 20 *scale);
@@ -930,6 +933,8 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
t->set_stylebox("bg","GraphEdit", make_stylebox( tree_bg_png,4,4,4,5) );
t->set_color("grid_minor","GraphEdit", Color(1,1,1,0.05) );
t->set_color("grid_major","GraphEdit", Color(1,1,1,0.2) );
+ t->set_constant("bezier_len_pos","GraphEdit", 80*scale );
+ t->set_constant("bezier_len_neg","GraphEdit", 160*scale );
diff --git a/scene/resources/default_theme/graph_node.png b/scene/resources/default_theme/graph_node.png
index ed0b6a6cd2..d4b4dd3c1f 100644
--- a/scene/resources/default_theme/graph_node.png
+++ b/scene/resources/default_theme/graph_node.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_comment.png b/scene/resources/default_theme/graph_node_comment.png
new file mode 100644
index 0000000000..f2d6daa259
--- /dev/null
+++ b/scene/resources/default_theme/graph_node_comment.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_selected.png b/scene/resources/default_theme/graph_node_selected.png
index 33c4d06128..f76c9703dd 100644
--- a/scene/resources/default_theme/graph_node_selected.png
+++ b/scene/resources/default_theme/graph_node_selected.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index d62ca07c38..ea68901196 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -100,7 +100,7 @@ static const unsigned char full_panel_bg_png[]={
static const unsigned char graph_node_png[]={
-0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x7,0x1d,0x1,0x8,0x10,0x1e,0x6f,0x12,0x2b,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x2,0x6a,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0xbb,0x6e,0x13,0x51,0x10,0x86,0xbf,0xf1,0x2e,0xb1,0x83,0x85,0x63,0x5,0x10,0xe2,0x22,0xa5,0x0,0x1a,0x24,0x90,0x22,0x9e,0x81,0x2,0xd1,0x53,0xf1,0x2,0x20,0xa,0x1a,0xa,0xa0,0x44,0xd0,0xd0,0x20,0x81,0xe0,0x5,0xa8,0xe8,0x11,0x5,0xcf,0x80,0x22,0x81,0x42,0x3,0x14,0x91,0xb8,0x4,0x85,0x58,0x8e,0x21,0x78,0xd7,0xd9,0x73,0x86,0xe2,0x9c,0xdd,0xec,0xae,0xd7,0xce,0x85,0xe,0xed,0x34,0xbb,0x3a,0x3e,0xf3,0xcd,0xcc,0x3f,0x63,0x69,0x47,0xd8,0x36,0x1,0x1a,0x40,0xe0,0x9f,0x42,0xd1,0x14,0xb0,0x80,0xf1,0x4f,0x25,0x77,0xa9,0x1,0x1c,0x4,0xe6,0x81,0xa3,0x40,0x7,0x38,0x50,0x2,0x6c,0x1,0x3,0x60,0xd,0xe8,0x1,0x7f,0x0,0x9b,0x46,0x6d,0x3,0x67,0xe6,0xe,0x75,0xaf,0xb7,0x9a,0xad,0xcb,0x33,0x33,0xcd,0x53,0x54,0xd8,0x68,0x14,0x7f,0x89,0xe2,0xe8,0xf5,0xc6,0xaf,0xfe,0x73,0xe0,0x13,0xb0,0x29,0x3e,0xd2,0xc2,0x7c,0xf7,0xf0,0xe3,0xd3,0xb,0x67,0xaf,0x3c,0xb8,0xfb,0x88,0xd9,0x4e,0xab,0xca,0x9f,0xe1,0x20,0xe2,0xde,0xc3,0xdb,0x7c,0x5e,0xf9,0xf8,0xaa,0xd7,0x5f,0xbf,0x5,0xac,0x8,0xd0,0x2,0x16,0x8f,0x1f,0x3b,0xf9,0xe6,0xc5,0xb3,0x97,0xed,0x24,0xb1,0x24,0xa3,0xa4,0x12,0x10,0xce,0x84,0x84,0x61,0x83,0x6b,0x37,0xae,0x6e,0x7e,0xff,0xf1,0xf5,0x12,0xb0,0x14,0x7a,0x1d,0xda,0x61,0x10,0xb6,0x87,0xbf,0x63,0x10,0x75,0x47,0xa,0x2a,0x79,0x85,0x95,0x51,0xbc,0xc5,0x28,0x86,0x30,0x8,0xdb,0xbe,0x6c,0x49,0x1,0x1,0x80,0x51,0xeb,0xfc,0x9d,0xc0,0x4e,0x6b,0xf,0xd1,0xfc,0xb9,0xb3,0x20,0x5,0x68,0xfa,0x8b,0x5a,0x8b,0xaa,0x80,0x28,0x82,0xa0,0x28,0xa2,0x92,0x73,0xd3,0xb1,0xde,0x86,0x85,0x46,0x5b,0x45,0x51,0x50,0x45,0xc4,0x95,0x61,0x53,0x27,0x71,0x61,0x74,0x1a,0xc0,0xaa,0xcd,0x6e,0xa8,0x64,0x2f,0xee,0x5d,0x29,0x8a,0x32,0x39,0x3,0x5f,0xb6,0x2f,0x4c,0x45,0x73,0x5a,0xd8,0x31,0x48,0x1,0x60,0xac,0x2d,0xf1,0x5,0x51,0x75,0x45,0x68,0x5a,0xbf,0x4e,0xcf,0x60,0xfb,0x82,0x2b,0x5a,0x73,0x4e,0xb6,0xe2,0xf,0x52,0x2,0xd8,0x82,0xe2,0x14,0x50,0x54,0xc4,0x2f,0x8b,0x68,0xad,0x1f,0x99,0x54,0x79,0x41,0xdd,0x0,0xf8,0xb6,0x82,0x88,0x4e,0xeb,0x82,0x66,0x89,0xaa,0x3b,0xc8,0x52,0x48,0x41,0x56,0x76,0xcc,0x60,0x7b,0x74,0x75,0xac,0x1a,0x49,0x47,0x72,0x72,0x6,0xe2,0xe7,0x56,0x45,0xfd,0x5d,0xc9,0x44,0x28,0x40,0x2b,0x45,0x34,0xea,0x7,0xa8,0x14,0xc9,0x92,0x75,0x64,0x7,0x11,0x8d,0x8f,0x98,0x9b,0x87,0xf2,0xf4,0x4d,0xd5,0x40,0xd5,0xc9,0x97,0xf,0xa3,0x5a,0x74,0x9c,0x36,0x89,0xf7,0x9f,0xdc,0x61,0xaf,0x96,0x1,0x92,0x2d,0xc3,0xe2,0xf9,0x8b,0xbb,0x72,0x5a,0x7a,0xff,0xb6,0x3a,0x83,0x8d,0x41,0x7f,0xcf,0x19,0x34,0xf8,0x47,0xab,0x1,0x35,0xa0,0x6,0xd4,0x80,0x1a,0x50,0x3,0x6a,0xc0,0x7f,0x9,0x90,0x8a,0x4f,0xe0,0x3d,0x67,0x60,0xf7,0xe1,0x6b,0x53,0x80,0x5,0x22,0x63,0x4c,0x6c,0x93,0x5d,0x78,0x25,0x60,0x8c,0x89,0x81,0x8,0xb0,0xd,0xbf,0xca,0xae,0x47,0xf1,0x70,0x79,0xad,0xb7,0xca,0x34,0x88,0x4d,0x60,0xad,0xb7,0x4a,0x14,0xf,0x97,0x81,0x75,0xc0,0xa4,0x9b,0xeb,0x1c,0x70,0xa1,0xd3,0xee,0x3e,0x6d,0x35,0x67,0xcf,0x5,0x41,0x50,0x29,0xae,0x31,0xc6,0x46,0xf1,0xf0,0xc3,0x60,0xb3,0x7f,0x13,0x78,0x7,0x6c,0x48,0x6e,0x85,0xeb,0x0,0x27,0x80,0x23,0x40,0x73,0xc2,0xf2,0x1d,0x3,0x3f,0x81,0x6f,0x7e,0x8f,0x36,0x52,0x12,0x34,0x4c,0xf7,0xc1,0x9,0x55,0xa8,0x2f,0x39,0xd9,0xa7,0xf0,0xe3,0xf6,0x17,0x4c,0x97,0x1d,0x24,0x5b,0x8,0x8b,0x95,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x8,0x17,0xd,0x5,0x12,0xa1,0x38,0x83,0x9b,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x2,0x74,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0x3d,0x6f,0xd3,0x60,0x10,0xc7,0x7f,0x17,0x9b,0x26,0x25,0x22,0xad,0xa,0x8,0xf1,0x52,0x75,0x0,0x16,0x24,0x90,0x2a,0x96,0x7c,0x1,0x6,0xc4,0xce,0xc4,0x17,0x0,0x31,0xb0,0x30,0x0,0x23,0x82,0x85,0x5,0x9,0x4,0x5f,0x80,0x89,0x1d,0x31,0xf0,0x5,0x58,0x50,0x25,0x50,0x59,0x80,0xa1,0xe2,0xad,0x28,0x34,0x4a,0x3,0x25,0x76,0xea,0xe7,0x39,0x6,0x3f,0x76,0x6d,0xc7,0x49,0x5f,0xd8,0x90,0x6f,0xb1,0xf5,0xe4,0xb9,0xdf,0xdd,0xfd,0xef,0x22,0xf9,0x84,0x2d,0x13,0xa0,0x6,0x78,0xee,0x29,0xe4,0x4d,0x1,0xb,0x18,0xf7,0x54,0x32,0x97,0x6a,0xc0,0x7e,0x60,0xe,0x38,0xc,0xb4,0x80,0x7d,0x5,0xc0,0x26,0xd0,0x7,0x3a,0x40,0x17,0xf8,0x3,0xd8,0x24,0x6a,0x13,0x38,0x35,0x73,0x60,0xf6,0x6a,0xa3,0xde,0xb8,0x38,0x35,0x55,0x3f,0x41,0x89,0xd,0x87,0xe1,0x97,0x20,0xc,0x5e,0xae,0xff,0xea,0x3d,0x5,0x3e,0x2,0x1b,0xe2,0x22,0x2d,0xcc,0xcd,0x1e,0x7c,0x78,0x72,0xe1,0xf4,0xa5,0x7b,0xb7,0x1f,0x7c,0x9e,0x6e,0x35,0xca,0xfc,0x19,0xf4,0x3,0xee,0xdc,0xbf,0x39,0xff,0x69,0xe5,0xc3,0x8b,0x6e,0x6f,0xed,0x6,0xb0,0x22,0x40,0x3,0x58,0x3c,0x7a,0xe4,0xf8,0xab,0x67,0x4f,0x9e,0x77,0xa3,0xc8,0x12,0xd,0xa3,0x52,0x80,0x3f,0xe5,0xe3,0xfb,0x35,0xae,0x5c,0xbb,0x3c,0xf7,0xfd,0xc7,0xd7,0xb,0xc0,0x92,0xef,0x74,0x68,0xfa,0x9e,0xdf,0x1c,0xfc,0xe,0xbb,0x88,0xc6,0x47,0xa,0x2a,0x59,0x85,0x95,0x61,0xb8,0xc9,0x30,0x4,0xdf,0xf3,0x9b,0xae,0x6c,0x49,0x0,0x1e,0x80,0x51,0x1b,0xfb,0xc7,0x2,0xc7,0x5a,0x3b,0x88,0x66,0xcf,0x63,0xf3,0x12,0x80,0x26,0xbf,0xa8,0xb5,0xa8,0xa,0x88,0x22,0x8,0x8a,0x22,0x2a,0x19,0x37,0x1d,0xe9,0xad,0x9f,0x6b,0xb4,0x55,0x14,0x5,0x55,0x44,0xe2,0x32,0x6c,0xe2,0x24,0x71,0x18,0x9d,0x4,0xb0,0x6a,0xd3,0x1b,0x2a,0xe9,0x4b,0xfc,0xae,0xe4,0x45,0x19,0x9f,0x81,0x2b,0xdb,0x15,0xa6,0xa2,0x19,0x2d,0xec,0x8,0x24,0x7,0x30,0xd6,0x16,0xf8,0x82,0xa8,0xc6,0x45,0x68,0x52,0xbf,0x4e,0xce,0x60,0xeb,0x42,0x5c,0xb4,0x66,0x9c,0x6c,0xc9,0x1f,0xa4,0x0,0xb0,0x39,0xc5,0xc9,0xa1,0x28,0x89,0x5f,0x14,0xd1,0x5a,0x37,0x32,0x89,0xf2,0x82,0xc6,0x3,0xe0,0xda,0xa,0x22,0x3a,0xa9,0xb,0x9a,0x26,0xaa,0xf1,0x41,0x9a,0x42,0x2,0xb2,0xb2,0x6d,0x6,0x5b,0xa3,0xab,0x23,0xd5,0x48,0x32,0x92,0xe3,0x33,0x10,0x37,0xb7,0x2a,0xea,0xee,0x4a,0x2a,0x42,0xe,0x5a,0x2a,0xa2,0x51,0x37,0x40,0x85,0x48,0x96,0xb4,0x23,0xdb,0x88,0x68,0x5c,0xc4,0xcc,0x3c,0x14,0xa7,0x6f,0xa2,0x6,0xaa,0xb1,0x7c,0xd9,0x30,0xaa,0x79,0xc7,0x49,0x93,0x78,0xf7,0xd1,0xad,0x79,0x76,0x69,0x29,0x20,0xda,0x34,0x2c,0x9e,0x3d,0xff,0x7a,0x27,0x4e,0x4b,0xef,0xde,0xb4,0x4b,0x33,0x58,0xef,0xf7,0x76,0x9b,0x0,0x35,0xfe,0xd1,0x2a,0x40,0x5,0xa8,0x0,0x15,0xa0,0x2,0x54,0x80,0xa,0xf0,0x5f,0x2,0xa4,0xe4,0x13,0x78,0xd7,0x19,0xd8,0x3d,0xf8,0xda,0x4,0x60,0x81,0xc0,0x18,0x13,0xda,0x68,0x7,0x5e,0x11,0x18,0x63,0x42,0x20,0x0,0x6c,0xcd,0xad,0xb2,0x6b,0x41,0x38,0x58,0xee,0x74,0x57,0xdb,0x93,0x20,0x36,0x82,0x4e,0x77,0xb5,0x1d,0x84,0x83,0x65,0x60,0xd,0x30,0xc9,0xe6,0x3a,0x3,0x9c,0x6b,0x35,0x67,0x1f,0x37,0xea,0xd3,0x67,0x3c,0xcf,0x2b,0x15,0xd7,0x18,0x63,0x83,0x70,0xf0,0xbe,0xbf,0xd1,0xbb,0xe,0xbc,0x5,0xd6,0x25,0xb3,0xc2,0xb5,0x80,0x63,0xc0,0x21,0xa0,0x3e,0x66,0xf9,0xe,0x81,0x9f,0xc0,0x37,0xb7,0x47,0x1b,0x29,0x8,0xea,0x27,0xfb,0xe0,0x98,0x2a,0xd4,0x95,0x1c,0xed,0x51,0xf8,0x51,0xfb,0xb,0x1,0xbe,0x20,0x9f,0x90,0x81,0x17,0xaa,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
@@ -114,6 +114,11 @@ static const unsigned char graph_node_close_png[]={
};
+static const unsigned char graph_node_comment_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x8,0x19,0x11,0x2a,0x1d,0xd6,0x78,0x8b,0x40,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x74,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0xbf,0x4e,0xc2,0x50,0x14,0xc6,0x7f,0x6d,0x91,0x56,0x1b,0x90,0x80,0x2c,0x44,0xc2,0xa0,0x2e,0xe,0x3e,0x3,0x89,0x93,0xf1,0x1d,0x4c,0x18,0x4d,0x1c,0x7c,0xb,0x57,0x7,0x13,0x47,0x13,0x77,0x46,0xe3,0xc4,0x4b,0x98,0x60,0x4c,0xd4,0x81,0x60,0x58,0x94,0xff,0x22,0x2d,0xd0,0xd6,0xe5,0xde,0x88,0x8,0x2,0x35,0x6e,0xf7,0x5b,0x6e,0x9a,0x9c,0xef,0x77,0xee,0x39,0x37,0x1d,0x3e,0x8d,0x2f,0x69,0x80,0xe,0x18,0xe2,0xd4,0xf8,0xae,0x0,0xf0,0x1,0x4f,0x9c,0x1,0x63,0x45,0x3a,0xb0,0x6,0x24,0x81,0x34,0x10,0x7,0x56,0x26,0x0,0x43,0xa0,0x3,0xbc,0x2,0xd,0xe0,0x3,0xf0,0x65,0x57,0x1b,0xd8,0x5e,0x8f,0x25,0x8e,0x2d,0xd3,0x3a,0x88,0x46,0xcd,0x4d,0xa6,0x68,0x30,0x70,0x5f,0x1c,0xd7,0xb9,0x6d,0x77,0x5b,0x97,0xc0,0x13,0xd0,0xd3,0x44,0xa7,0x5c,0x32,0x91,0x3a,0xdf,0xca,0xed,0x1c,0x16,0x52,0xdd,0x2a,0xbf,0xe8,0xaa,0x1e,0xcb,0x3e,0x57,0x1e,0x6f,0x1a,0xad,0xfa,0x29,0x50,0x91,0x33,0xa7,0x4d,0xd3,0xca,0xcf,0x33,0x3,0x14,0x52,0xdd,0xaa,0x69,0x5a,0x79,0x31,0xaa,0x21,0x97,0x65,0x47,0x8c,0x88,0xcd,0x82,0x12,0xb5,0x36,0xa0,0x49,0x80,0xc1,0xf2,0x32,0x24,0x20,0x90,0x4f,0x12,0x46,0x3a,0x7f,0x94,0x2,0x28,0x80,0x2,0x88,0x5f,0x7b,0xfc,0xe3,0xec,0xe1,0x3d,0x1b,0x1a,0x30,0x1a,0x7a,0x1c,0x65,0xd8,0x5f,0xc4,0x74,0x5d,0xa3,0xa4,0x5e,0x41,0x1,0x14,0x40,0x1,0x14,0x40,0x1,0x14,0x40,0x1,0xfe,0x15,0xa0,0x4d,0xc9,0x88,0x4b,0xdf,0xc0,0xf,0xe1,0xf5,0x25,0xc0,0x7,0x1c,0xcf,0xf3,0xdc,0x45,0x9d,0xa2,0xd6,0x1,0x7c,0x5d,0x44,0xd9,0xba,0xe3,0xf6,0xcb,0xc5,0xa6,0x5d,0x9a,0x67,0x2e,0x36,0xed,0x92,0xe3,0xf6,0xcb,0x40,0x1d,0xf0,0x64,0x72,0x5d,0x7,0xf6,0xe2,0x76,0xe2,0xc2,0x32,0x57,0x77,0xd,0xc3,0xd0,0x67,0x74,0xf6,0x1d,0xb7,0x7f,0xdf,0xe9,0xb5,0x4e,0x80,0x3b,0xa0,0xad,0x8d,0x45,0xb8,0x38,0x90,0x1,0x36,0x0,0x73,0x46,0xf8,0x76,0x81,0x37,0xa0,0x26,0x72,0xb4,0xa7,0x4d,0x2c,0x34,0x22,0xf3,0xe0,0x8c,0x9,0x2,0x31,0xf2,0x28,0xe4,0xe2,0x7f,0xea,0x13,0x64,0x47,0x6c,0x83,0x36,0x6d,0xd2,0x40,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+};
+
+
static const unsigned char graph_node_default_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x3,0x0,0x0,0x0,0x28,0x2d,0xf,0x53,0x0,0x0,0x0,0x4,0x67,0x41,0x4d,0x41,0x0,0x0,0xb1,0x8f,0xb,0xfc,0x61,0x5,0x0,0x0,0x0,0x20,0x63,0x48,0x52,0x4d,0x0,0x0,0x7a,0x26,0x0,0x0,0x80,0x84,0x0,0x0,0xfa,0x0,0x0,0x0,0x80,0xe8,0x0,0x0,0x75,0x30,0x0,0x0,0xea,0x60,0x0,0x0,0x3a,0x98,0x0,0x0,0x17,0x70,0x9c,0xba,0x51,0x3c,0x0,0x0,0x0,0x39,0x50,0x4c,0x54,0x45,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x16,0x12,0x19,0xe,0xb,0x10,0xe,0xb,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x16,0x12,0x19,0x0,0x0,0x0,0x19,0x15,0x1c,0x24,0x1e,0x27,0x16,0x12,0x19,0xff,0xff,0xff,0x2b,0x4d,0xfd,0x66,0x0,0x0,0x0,0xf,0x74,0x52,0x4e,0x53,0x0,0x46,0x47,0x3f,0x2b,0x11,0x3,0xfd,0xd3,0xcd,0x2a,0x73,0x45,0xf8,0x3d,0x3f,0x57,0xda,0x84,0x0,0x0,0x0,0x1,0x62,0x4b,0x47,0x44,0x12,0x7b,0xbc,0x6c,0x0,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x6,0x16,0x12,0x2b,0x4,0x4e,0x1d,0x2,0xaf,0x0,0x0,0x0,0x38,0x49,0x44,0x41,0x54,0x18,0xd3,0x63,0x60,0x64,0x2,0x2,0x46,0x8,0xc9,0xcc,0xc2,0xca,0xc6,0xc0,0x8f,0x4,0xd8,0x39,0x98,0x59,0x19,0x50,0x80,0x0,0x27,0x17,0xaa,0x0,0x83,0x20,0x37,0x9a,0x0,0x3f,0xd3,0xc0,0x8,0xf0,0xa0,0x9,0xf0,0xf2,0x61,0x3a,0x1d,0xc3,0x73,0xe8,0xde,0x7,0x0,0x89,0x4d,0x2,0xf2,0x16,0xd3,0x74,0x45,0x0,0x0,0x0,0x25,0x74,0x45,0x58,0x74,0x64,0x61,0x74,0x65,0x3a,0x63,0x72,0x65,0x61,0x74,0x65,0x0,0x32,0x30,0x31,0x36,0x2d,0x30,0x36,0x2d,0x32,0x32,0x54,0x32,0x30,0x3a,0x33,0x39,0x3a,0x32,0x36,0x2b,0x30,0x32,0x3a,0x30,0x30,0xc9,0xad,0xc8,0x52,0x0,0x0,0x0,0x25,0x74,0x45,0x58,0x74,0x64,0x61,0x74,0x65,0x3a,0x6d,0x6f,0x64,0x69,0x66,0x79,0x0,0x32,0x30,0x31,0x36,0x2d,0x30,0x36,0x2d,0x32,0x32,0x54,0x32,0x30,0x3a,0x33,0x39,0x3a,0x32,0x36,0x2b,0x30,0x32,0x3a,0x30,0x30,0xb8,0xf0,0x70,0xee,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
@@ -130,7 +135,7 @@ static const unsigned char graph_node_position_png[]={
static const unsigned char graph_node_selected_png[]={
-0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x8,0x6,0xc,0x29,0x12,0x71,0x6e,0xb2,0xf8,0x0,0x0,0x3,0x37,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0x4f,0x88,0xdc,0x74,0x14,0xc7,0xbf,0xef,0x97,0x7f,0x9b,0xcc,0xee,0xec,0x64,0x64,0x76,0x5,0xd1,0xd5,0xc2,0x6e,0x41,0x8f,0xbd,0xef,0x49,0x7a,0x10,0xa,0xeb,0x61,0xa1,0xb5,0x16,0xc4,0xa3,0x87,0xbd,0xb9,0x17,0x8f,0x5e,0xa4,0xc7,0x16,0xbc,0x8,0xa2,0xdb,0x16,0xf,0x7b,0xb0,0x50,0x28,0x54,0x7a,0xea,0xdd,0xa3,0x82,0x16,0x14,0x5,0xc1,0xd9,0xe9,0x4e,0x32,0x3b,0xc9,0x64,0x26,0xbf,0xe4,0xf7,0x3c,0x24,0xd9,0x26,0x99,0x35,0x73,0xf0,0x26,0xf3,0x60,0x66,0x12,0xe6,0xbd,0xcf,0xf7,0xbd,0xef,0xef,0x17,0xc8,0x8f,0x98,0x99,0x0,0x88,0x47,0x8f,0x7e,0xb4,0x92,0xa1,0x67,0xf,0xcf,0x6,0x96,0x62,0x25,0xa4,0x8c,0x9,0xa5,0x30,0xc,0x93,0x5,0x9,0xd5,0x6d,0xf7,0x66,0x7a,0xd7,0x8d,0xae,0x5d,0xbb,0x32,0x3,0xa0,0x88,0x99,0xb5,0x87,0xdf,0x3c,0x5c,0x1b,0x85,0x93,0xd7,0x86,0xbe,0x7f,0x69,0x34,0xf2,0x36,0x83,0x30,0x70,0xe2,0x38,0xd6,0xcb,0x0,0xd3,0x34,0x93,0xd5,0xd6,0xea,0x64,0x7d,0xdd,0xed,0x77,0x3b,0x9d,0xdf,0xd6,0x5b,0xce,0x5f,0x7b,0x1f,0xed,0x8d,0xe9,0xe8,0xe8,0x49,0x2b,0x1e,0xf6,0xdf,0xf2,0x46,0xc3,0xdd,0xf7,0x6f,0xec,0xde,0x31,0x2d,0x5d,0x43,0x43,0xc4,0xb3,0x24,0xfd,0xfe,0xbb,0x67,0x7,0xee,0x7a,0xf7,0x99,0xd9,0xdd,0xfc,0x5d,0x48,0xcf,0x77,0xfa,0x2f,0x4e,0x76,0xf6,0xae,0xef,0xde,0x65,0x66,0x6d,0x7a,0xda,0x46,0x12,0xb8,0x48,0xc3,0x6e,0xe5,0x93,0x4,0x2e,0xa6,0xa7,0x6d,0x30,0xb3,0xb6,0x77,0x7d,0xf7,0x6e,0xff,0xc5,0xc9,0x8e,0xf4,0x7c,0x47,0x8f,0x93,0xc8,0xc,0x83,0xf1,0x86,0xb5,0xa2,0x8b,0x99,0xb7,0x6,0x12,0x84,0x44,0x2a,0x50,0x4d,0x99,0x1,0x90,0x20,0x20,0xea,0xc2,0x72,0xc7,0x22,0xc,0xc6,0x1b,0xb1,0x1b,0x99,0x42,0xb1,0x12,0x93,0x68,0x62,0x3,0x40,0x2a,0x19,0xcc,0x79,0xb1,0xaa,0x56,0x13,0x18,0xcc,0x8c,0x34,0x61,0x0,0xc0,0x24,0x9a,0xd8,0x8a,0x95,0x10,0x52,0x4a,0x4a,0x91,0x12,0x0,0x30,0x65,0xba,0xcc,0xc,0x88,0x5c,0x16,0x0,0x8,0x60,0x5,0x80,0x19,0xe0,0x2c,0x27,0x45,0x4a,0x52,0x4a,0xd2,0xd,0xc3,0x60,0xa4,0x79,0xa2,0x62,0x30,0x8,0x20,0xc6,0xf9,0xc,0x39,0x84,0x99,0x2b,0xbf,0x45,0x4d,0x65,0xa9,0x98,0x19,0x20,0x2,0xc0,0x28,0xf2,0xea,0xc1,0xb5,0x3f,0xf4,0xda,0xbf,0x60,0x95,0x27,0x10,0x97,0xdc,0x2b,0x75,0xd3,0x4,0xe0,0x4c,0xbb,0x7c,0x93,0x15,0xab,0x97,0x90,0x7a,0x67,0x15,0x80,0x52,0xa5,0xd9,0x73,0xf7,0x88,0x73,0x5f,0x98,0x41,0x8b,0x47,0x28,0x4b,0x50,0xa9,0x9f,0xec,0x5b,0x2d,0xea,0x0,0xac,0xc0,0xaa,0x66,0xff,0xbc,0x8b,0xd,0x1e,0xe4,0x73,0xe7,0x4d,0x23,0xdf,0x3e,0xc5,0x30,0xd9,0x55,0x53,0x7,0x19,0x40,0xe5,0x85,0x25,0x35,0x7a,0x39,0xbb,0x6a,0x6,0xa8,0xac,0xbe,0xa2,0x5d,0x56,0xa5,0xc5,0xcb,0x48,0xc5,0x7e,0xa0,0x62,0x33,0x51,0xe1,0x67,0xfe,0x3c,0x34,0x75,0xa0,0xb2,0xc2,0x39,0x25,0x85,0xf3,0x15,0xa9,0x5b,0x3b,0xbf,0x95,0xb9,0xfe,0x28,0x36,0xc7,0xbc,0x89,0x75,0x8d,0x92,0x91,0xb5,0x8b,0x79,0xc0,0x67,0x9f,0x7f,0x8a,0x9f,0x7f,0xfd,0xa9,0x51,0xf1,0xed,0x9d,0x77,0xf0,0xd5,0xb7,0x5f,0x5c,0xc,0xb8,0xb4,0xb5,0xd,0x4d,0x18,0x8d,0x80,0xad,0xd7,0xdf,0xfc,0xf7,0xe,0xc2,0x30,0xc0,0xe8,0xcc,0x6f,0x4,0x84,0x61,0x50,0xb9,0x17,0xf8,0x8f,0xb1,0x4,0x2c,0x1,0x4b,0xc0,0x12,0xb0,0x4,0x2c,0x1,0x4b,0xc0,0xff,0xf,0x20,0xa5,0x24,0x68,0x17,0xbe,0xfe,0x5c,0x1c,0x45,0x8e,0x56,0xea,0x40,0x83,0xc6,0x0,0x60,0xe8,0xfa,0xc2,0xfa,0x22,0xa7,0xa8,0x11,0x96,0x69,0xa5,0x96,0x69,0xc6,0x0,0xe0,0xd8,0xab,0xb,0x1,0x45,0x8e,0x65,0x9a,0xb1,0x65,0x5a,0xa9,0x6e,0xea,0x76,0xbc,0x62,0x3b,0x83,0xd9,0x54,0xf2,0xc1,0xe1,0x7,0x74,0xe7,0x36,0x61,0x12,0x8d,0x21,0x93,0xa4,0x72,0xe8,0x32,0x74,0x1d,0x8e,0xbd,0x86,0x83,0xc3,0x1b,0x98,0x4d,0x25,0xaf,0xd8,0xce,0xc0,0xd4,0xed,0x98,0x8e,0x8e,0x9e,0xb4,0x4e,0xff,0x7c,0xbe,0xed,0x9f,0x79,0xef,0x7e,0xf8,0xf1,0x7b,0xb7,0x2d,0xdb,0x68,0x74,0x62,0x16,0x49,0xbe,0xff,0xf5,0xe3,0xc3,0x4e,0xdb,0x7d,0xfa,0xca,0x1b,0xdb,0xcf,0x89,0x99,0xb5,0x7,0x5f,0x3e,0x68,0xf,0x3c,0x7f,0xcb,0xf3,0xfd,0xcb,0x93,0x28,0xdc,0x90,0x52,0x1a,0x4a,0x55,0xdf,0x56,0x85,0x10,0x30,0xc,0x43,0x3a,0x76,0xeb,0xc4,0xed,0x74,0x7e,0xe9,0xb9,0x9d,0x3f,0x6e,0x7e,0x72,0xf3,0x8c,0x8a,0xd3,0xfb,0xbd,0x7b,0x3f,0xac,0x4,0x7f,0xf7,0x5b,0x52,0xcd,0x4c,0x66,0x75,0xe1,0xf2,0x12,0x9,0x65,0x8,0x2b,0x5e,0x7d,0x75,0x33,0xbc,0x75,0xeb,0xea,0x14,0xc0,0xf9,0xf1,0x4,0xcc,0x4c,0xc7,0xc7,0xc7,0xa2,0xd7,0xeb,0x35,0x8e,0x30,0x18,0xc,0x78,0x7f,0x7f,0x5f,0x11,0x65,0xc7,0xba,0x7f,0x0,0xff,0xc4,0xaa,0x19,0xfd,0xaf,0x1e,0xb7,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x8,0x17,0xd,0x4,0x3b,0xfa,0x91,0x2a,0xb6,0x0,0x0,0x3,0x44,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0x3f,0x68,0xdc,0x76,0x14,0xc7,0xbf,0xef,0xa7,0x9f,0x7e,0x3a,0xdd,0x39,0xf6,0xdd,0x95,0xb3,0x3,0xc1,0x75,0x1b,0x70,0xa,0xe9,0x98,0x25,0x93,0x87,0x52,0x3a,0x4,0x2,0xce,0xe0,0xd2,0x34,0x35,0x94,0x8e,0x1d,0xbc,0xd5,0x4b,0xc7,0x2e,0x25,0x63,0x2,0x5d,0xa,0xa5,0xb1,0x1b,0x2,0xf5,0xd0,0x40,0xa0,0x90,0x10,0x3a,0x64,0xca,0x92,0x31,0x81,0x24,0xd0,0xd2,0x9a,0x40,0x2f,0x17,0xdf,0x1f,0xfb,0x74,0xf2,0xe9,0x27,0xfd,0x5e,0x7,0x49,0xb6,0x4e,0xe7,0xea,0x86,0x6e,0xe5,0x1e,0xdc,0x49,0x42,0xef,0x7d,0xde,0xf7,0x7d,0xf5,0x13,0xe8,0x47,0xcc,0x4c,0x0,0xc4,0xbd,0x7b,0x4f,0x9c,0xb0,0xdd,0x71,0xdb,0xfb,0x2d,0xc7,0xb0,0x11,0x5a,0x7,0x84,0x4c,0xd8,0xb6,0x62,0x41,0xc2,0xd4,0x67,0x1b,0x43,0x59,0xaf,0xf9,0x97,0x2f,0x5f,0x18,0x2,0x30,0xc4,0xcc,0xd6,0xdd,0x1f,0xef,0x9e,0xea,0x79,0x83,0x33,0xed,0x6e,0xf7,0x6c,0xaf,0xd7,0x59,0xe8,0x7b,0xfd,0x72,0x10,0x4,0x32,0xb,0x50,0x4a,0x85,0x33,0x95,0x99,0xc1,0xdc,0x5c,0xad,0x59,0xaf,0x56,0x7f,0x9f,0xab,0x94,0x5f,0xad,0x7e,0xbe,0x7a,0x40,0x5b,0x5b,0xf7,0x2b,0x41,0xbb,0xf9,0x6e,0xa7,0xd7,0x5e,0xb9,0x72,0x75,0xe5,0x86,0x72,0xa4,0x85,0x82,0x8,0x86,0x61,0xf4,0xcb,0x9d,0x47,0x1b,0xb5,0xb9,0xfa,0x23,0x55,0x5f,0xf8,0x43,0xea,0x4e,0xb7,0xdc,0x7c,0xf3,0xfa,0xdc,0xc7,0xeb,0x1f,0xdc,0x64,0x66,0x71,0xb8,0x37,0xbb,0x2b,0x1d,0xb,0x44,0x23,0x13,0x80,0x99,0x11,0xe,0x23,0x50,0x65,0x6f,0x71,0xf5,0x93,0x95,0x9b,0x3f,0x6f,0xff,0xb6,0x76,0x9a,0x9c,0xa6,0x8,0x42,0x5f,0x79,0xfd,0x83,0x79,0xa7,0x24,0x5,0xfc,0xfa,0x2e,0x9,0x42,0xa8,0xd,0xc2,0x20,0x1a,0xfd,0x69,0x3,0x12,0x4,0xf8,0xf5,0x5d,0xa7,0x24,0x85,0xd7,0x3f,0x98,0xf,0x42,0x5f,0x9,0xc3,0x46,0xc,0xfc,0x81,0xb,0x0,0x91,0x66,0x30,0x1b,0x10,0x0,0x98,0x6c,0x7b,0x80,0xc0,0x60,0x66,0x44,0x21,0x3,0x0,0x6,0xfe,0xc0,0x35,0x6c,0x84,0xd0,0x5a,0x53,0x84,0x88,0x0,0x80,0x13,0xd9,0xcc,0xc,0x88,0xb8,0x10,0x0,0x40,0x0,0x1b,0x0,0xcc,0x0,0xc7,0x39,0x11,0x22,0xd2,0x5a,0x93,0xb4,0x6d,0x9b,0x11,0x25,0x89,0x86,0xc1,0x20,0x80,0x18,0xa0,0xe3,0xee,0x47,0xd0,0xcc,0x31,0xad,0x91,0x79,0xa3,0x40,0x4,0x80,0x91,0xe6,0xe5,0x83,0x73,0x37,0x64,0xee,0x2e,0xd8,0x24,0x9,0xc4,0xc7,0xa,0xb2,0x6a,0x8a,0x0,0x1c,0xf7,0xce,0x5e,0xc4,0xc5,0xe6,0x18,0x92,0x57,0x36,0x2,0x30,0x26,0x33,0x7b,0xe2,0x1e,0x71,0xe2,0xb,0x33,0x68,0xf2,0x8,0xd9,0x16,0x94,0xd1,0x13,0xff,0x9b,0x49,0xa,0xc0,0x6,0x6c,0x72,0xf6,0x8f,0xbb,0x58,0xe0,0x41,0x32,0x77,0x22,0x1a,0xc9,0xf2,0x49,0x87,0x89,0xcf,0x8a,0x14,0xc4,0x0,0x93,0x14,0x66,0xba,0xd1,0xf1,0xec,0xa6,0x18,0x60,0xe2,0xfa,0x91,0xde,0xd9,0xae,0x34,0xf9,0x31,0x52,0xba,0x1e,0x28,0x5d,0x4c,0x94,0xfa,0x99,0xbc,0xf,0x45,0xa,0x4c,0x5c,0x38,0xd6,0xc9,0xe0,0xe8,0x89,0xe4,0xad,0x1d,0x5f,0xca,0x9c,0x7f,0x15,0x8b,0x63,0xdc,0xc4,0x7c,0x8f,0x8c,0x91,0xb9,0x93,0x71,0xc0,0xd7,0xdf,0x7c,0xf5,0xea,0xd9,0x8b,0xa7,0x85,0x1d,0xcf,0x9f,0x7b,0x1f,0xdf,0xdf,0xfa,0x76,0xf1,0x44,0xc0,0xd9,0xa5,0x65,0x58,0xc2,0x2e,0x4,0x2c,0x2d,0xbe,0xf3,0xef,0xa,0x3c,0xaf,0x8f,0xde,0x7e,0xb7,0x10,0xe0,0x79,0xfd,0x91,0x6b,0x81,0xff,0x18,0x53,0xc0,0x14,0x30,0x5,0x4c,0x1,0x53,0xc0,0x14,0x30,0x5,0xfc,0xff,0x0,0x5a,0x6b,0x82,0x75,0xe2,0xe7,0xcf,0xc9,0x91,0xe6,0x58,0x19,0x5,0x16,0x2c,0x6,0x0,0x5b,0xca,0x89,0xf5,0x69,0x4e,0x5a,0x23,0x1c,0xe5,0x44,0x8e,0x52,0x1,0x0,0x94,0xdd,0x99,0x89,0x80,0x34,0xc7,0x51,0x2a,0x70,0x94,0x13,0x49,0x25,0xdd,0xa0,0xe4,0x96,0x5b,0xc3,0x43,0xcd,0x1b,0x9b,0x9f,0x5e,0xbc,0x71,0x9d,0x1e,0xf,0xfc,0x3,0xe8,0x30,0x1c,0xd9,0x74,0xd9,0x52,0xa2,0xec,0x9e,0xc2,0xc6,0xe6,0xd5,0x8b,0xc3,0x43,0xcd,0x25,0xb7,0xdc,0x52,0xd2,0xd,0x68,0x6b,0xeb,0x7e,0x65,0xef,0xaf,0x97,0xcb,0xdd,0xfd,0xce,0x87,0x9f,0x7d,0x71,0xe9,0xba,0xe3,0xda,0x85,0x4e,0xc,0x7d,0xcd,0x3f,0xfd,0xf0,0xeb,0x66,0x75,0xb6,0xf6,0xf0,0xad,0xb7,0x97,0x5f,0x12,0x33,0x5b,0xb7,0xbf,0xbb,0x3d,0xdb,0xea,0x74,0x97,0x3a,0xdd,0xee,0x7b,0x3,0xdf,0x9b,0xd7,0x5a,0xdb,0xc6,0x8c,0x7e,0xad,0xa,0x21,0x60,0xdb,0xb6,0x2e,0xbb,0x95,0xd7,0xb5,0x6a,0xf5,0x79,0xa3,0x56,0xfd,0xf3,0xda,0x97,0xd7,0xf6,0x29,0xdd,0xbd,0x6f,0x6f,0x3f,0x28,0xf5,0xff,0x6e,0x56,0xb4,0x19,0x2a,0x66,0x73,0xe2,0xe3,0x25,0x12,0xc6,0x16,0x4e,0x30,0x73,0x7a,0xc1,0x5b,0x5f,0xff,0xe8,0x10,0xc0,0xd1,0xf6,0x4,0xcc,0x4c,0x3b,0x3b,0x3b,0xa2,0xd1,0x68,0x14,0x8e,0xd0,0x6a,0xb5,0x78,0x6d,0x6d,0xcd,0x10,0xc5,0xdb,0xba,0x7f,0x0,0xb2,0x1f,0xaf,0x82,0x62,0x7a,0x69,0xbb,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
@@ -544,6 +549,11 @@ static const unsigned char vsplitter_png[]={
};
+static const unsigned char window_resizer_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x8,0x19,0x11,0x33,0x13,0xaa,0xc0,0xf,0x5f,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x0,0x2f,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0x60,0x18,0x5,0x24,0x81,0x17,0x2f,0x5e,0xf4,0xa3,0x8b,0x31,0x91,0xa2,0xb9,0xb9,0xb9,0x99,0x7c,0x9b,0xb3,0xb3,0xb3,0xfb,0x87,0x81,0x66,0x6c,0x81,0x48,0x92,0x66,0xa2,0x5c,0x43,0x91,0xe6,0x11,0xa,0x0,0x73,0x5b,0x34,0x19,0x10,0xa0,0xb6,0x7d,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+};
+
+
diff --git a/scene/resources/default_theme/window_resizer.png b/scene/resources/default_theme/window_resizer.png
new file mode 100644
index 0000000000..ed51968c4e
--- /dev/null
+++ b/scene/resources/default_theme/window_resizer.png
Binary files differ
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index 398267937b..479b99a03d 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -276,14 +276,9 @@ void DocData::generate(bool p_basic_types) {
default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")";
break;
- case Variant::VECTOR2: // 5
- case Variant::RECT2:
- case Variant::VECTOR3:
- case Variant::PLANE:
- case Variant::QUAT:
case Variant::_AABB: //sorry naming convention fail :( not like it's used often // 10
- case Variant::MATRIX3:
case Variant::COLOR:
+ case Variant::PLANE:
case Variant::RAW_ARRAY:
case Variant::INT_ARRAY:
case Variant::REAL_ARRAY:
@@ -293,7 +288,18 @@ void DocData::generate(bool p_basic_types) {
case Variant::COLOR_ARRAY:
default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")";
break;
+ case Variant::VECTOR2: // 5
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ case Variant::QUAT:
+ case Variant::MATRIX3:
+ default_arg_text=Variant::get_type_name(default_arg.get_type())+default_arg_text;
+ break;
case Variant::OBJECT:
+ if (default_arg.is_zero()) {
+ default_arg_text="NULL";
+ break;
+ }
case Variant::INPUT_EVENT:
case Variant::DICTIONARY: // 20
case Variant::ARRAY:
diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp
index b0cdd79798..5aac8bff09 100644
--- a/tools/editor/create_dialog.cpp
+++ b/tools/editor/create_dialog.cpp
@@ -140,7 +140,7 @@ void CreateDialog::_update_search() {
search_options->clear();
-
+ help_bit->set_text("");
/*
TreeItem *root = search_options->create_item();
_parse_fs(EditorFileSystem::get_singleton()->get_filesystem());
@@ -336,11 +336,27 @@ String CreateDialog::get_base_type() const {
return base_type;
}
+void CreateDialog::_item_selected() {
+
+ TreeItem *item = search_options->get_selected();
+ if (!item)
+ return;
+
+ String name = item->get_text(0);
+
+ if (!EditorHelp::get_doc_data()->class_list.has(name))
+ return;
+
+ help_bit->set_text(EditorHelp::get_doc_data()->class_list[name].brief_description);
+
+}
+
void CreateDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_text_changed"),&CreateDialog::_text_changed);
ObjectTypeDB::bind_method(_MD("_confirmed"),&CreateDialog::_confirmed);
ObjectTypeDB::bind_method(_MD("_sbox_input"),&CreateDialog::_sbox_input);
+ ObjectTypeDB::bind_method(_MD("_item_selected"),&CreateDialog::_item_selected);
ADD_SIGNAL(MethodInfo("create"));
@@ -364,9 +380,14 @@ CreateDialog::CreateDialog() {
register_text_enter(search_box);
set_hide_on_ok(false);
search_options->connect("item_activated",this,"_confirmed");
+ search_options->connect("cell_selected",this,"_item_selected");
// search_options->set_hide_root(true);
base_type="Object";
+ help_bit = memnew( EditorHelpBit );
+ vbc->add_margin_child(TTR("Description:"),help_bit);
+ help_bit->connect("request_hide",this,"_closed");
+
}
diff --git a/tools/editor/create_dialog.h b/tools/editor/create_dialog.h
index 8957479beb..41156b538a 100644
--- a/tools/editor/create_dialog.h
+++ b/tools/editor/create_dialog.h
@@ -34,6 +34,7 @@
#include "scene/gui/tree.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/label.h"
+#include "editor_help.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -49,6 +50,10 @@ class CreateDialog : public ConfirmationDialog {
Tree *search_options;
String base_type;
+ EditorHelpBit *help_bit;
+
+ void _item_selected();
+
void _update_search();
void _sbox_input(const InputEvent& p_ie);
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 8d3fd6c9c2..35ec1ebfcc 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -834,7 +834,7 @@ void EditorSelection::_node_removed(Node *p_node) {
void EditorSelection::add_node(Node *p_node) {
ERR_FAIL_NULL(p_node);
-
+ ERR_FAIL_COND(!p_node->is_inside_tree());
if (selection.has(p_node))
return;
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp
index 4ab86ad512..8f486ba0c2 100644
--- a/tools/editor/editor_help.cpp
+++ b/tools/editor/editor_help.cpp
@@ -31,7 +31,7 @@
#include "editor_settings.h"
#include "os/keyboard.h"
#include "doc_data_compressed.h"
-
+#include "tools/editor/plugins/script_editor_plugin.h"
#include "os/keyboard.h"
@@ -1256,16 +1256,20 @@ void EditorHelp::_help_callback(const String& p_topic) {
}
-void EditorHelp::_add_text(const String& p_bbcode) {
- /*class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color"));
- class_desc->push_font( get_font("normal","Fonts") );
- class_desc->push_indent(1);*/
+static void _add_text_to_rt(const String& p_bbcode,RichTextLabel *p_rt) {
+
+ DocData *doc = EditorHelp::get_doc_data();
+ String base_path;
+
+ /*p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/text_color"));
+ p_rt->push_font( get_font("normal","Fonts") );
+ p_rt->push_indent(1);*/
int pos = 0;
- Ref<Font> doc_font = get_font("doc","EditorFonts");
- Ref<Font> doc_code_font = get_font("doc_source","EditorFonts");
+ Ref<Font> doc_font = p_rt->get_font("doc","EditorFonts");
+ Ref<Font> doc_code_font = p_rt->get_font("doc_source","EditorFonts");
String bbcode=p_bbcode.replace("\t"," ").replace("\r"," ").strip_edges();
@@ -1333,7 +1337,7 @@ void EditorHelp::_add_text(const String& p_bbcode) {
brk_pos=bbcode.length();
if (brk_pos > pos) {
- class_desc->add_text(bbcode.substr(pos,brk_pos-pos));
+ p_rt->add_text(bbcode.substr(pos,brk_pos-pos));
}
@@ -1344,7 +1348,7 @@ void EditorHelp::_add_text(const String& p_bbcode) {
if (brk_end==-1) {
//no close, add the rest
- class_desc->add_text(bbcode.substr(brk_pos,bbcode.length()-brk_pos));
+ p_rt->add_text(bbcode.substr(brk_pos,bbcode.length()-brk_pos));
break;
}
@@ -1362,7 +1366,7 @@ void EditorHelp::_add_text(const String& p_bbcode) {
}
if (!tag_ok) {
- class_desc->add_text("[");
+ p_rt->add_text("[");
pos++;
continue;
}
@@ -1370,32 +1374,32 @@ void EditorHelp::_add_text(const String& p_bbcode) {
tag_stack.pop_front();
pos=brk_end+1;
if (tag!="/img")
- class_desc->pop();
+ p_rt->pop();
} else if (tag.begins_with("method ")) {
String m = tag.substr(7,tag.length());
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
- class_desc->push_meta("@"+m);
- class_desc->add_text(m+"()");
- class_desc->pop();
- class_desc->pop();
+ p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
+ p_rt->push_meta("@"+m);
+ p_rt->add_text(m+"()");
+ p_rt->pop();
+ p_rt->pop();
pos=brk_end+1;
} else if (doc->class_list.has(tag)) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
- class_desc->push_meta("#"+tag);
- class_desc->add_text(tag);
- class_desc->pop();
- class_desc->pop();
+ p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
+ p_rt->push_meta("#"+tag);
+ p_rt->add_text(tag);
+ p_rt->pop();
+ p_rt->pop();
pos=brk_end+1;
} else if (tag=="b") {
//use bold font
- class_desc->push_font(doc_code_font);
+ p_rt->push_font(doc_code_font);
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag=="i") {
@@ -1406,37 +1410,37 @@ void EditorHelp::_add_text(const String& p_bbcode) {
text_color.r*=1.1;
text_color.g*=1.1;
text_color.b*=1.1;
- class_desc->push_color(text_color);
- //class_desc->push_font(get_font("italic","Fonts"));
+ p_rt->push_color(text_color);
+ //p_rt->push_font(get_font("italic","Fonts"));
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag=="code" || tag=="codeblock") {
//use monospace font
- class_desc->push_font(doc_code_font);
+ p_rt->push_font(doc_code_font);
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag=="center") {
//use monospace font
- class_desc->push_align(RichTextLabel::ALIGN_CENTER);
+ p_rt->push_align(RichTextLabel::ALIGN_CENTER);
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag=="br") {
//use monospace font
- class_desc->add_newline();
+ p_rt->add_newline();
pos=brk_end+1;
} else if (tag=="u") {
//use underline
- class_desc->push_underline();
+ p_rt->push_underline();
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag=="s") {
//use strikethrough (not supported underline instead)
- class_desc->push_underline();
+ p_rt->push_underline();
pos=brk_end+1;
tag_stack.push_front(tag);
@@ -1447,14 +1451,14 @@ void EditorHelp::_add_text(const String& p_bbcode) {
if (end==-1)
end=bbcode.length();
String url = bbcode.substr(brk_end+1,end-brk_end-1);
- class_desc->push_meta(url);
+ p_rt->push_meta(url);
pos=brk_end+1;
tag_stack.push_front(tag);
} else if (tag.begins_with("url=")) {
String url = tag.substr(4,tag.length());
- class_desc->push_meta(url);
+ p_rt->push_meta(url);
pos=brk_end+1;
tag_stack.push_front("url");
} else if (tag=="img") {
@@ -1467,7 +1471,7 @@ void EditorHelp::_add_text(const String& p_bbcode) {
Ref<Texture> texture = ResourceLoader::load(base_path+"/"+image,"Texture");
if (texture.is_valid())
- class_desc->add_image(texture);
+ p_rt->add_image(texture);
pos=end;
tag_stack.push_front(tag);
@@ -1515,7 +1519,7 @@ void EditorHelp::_add_text(const String& p_bbcode) {
- class_desc->push_color(color);
+ p_rt->push_color(color);
pos=brk_end+1;
tag_stack.push_front("color");
@@ -1526,9 +1530,9 @@ void EditorHelp::_add_text(const String& p_bbcode) {
Ref<Font> font = ResourceLoader::load(base_path+"/"+fnt,"Font");
if (font.is_valid())
- class_desc->push_font(font);
+ p_rt->push_font(font);
else {
- class_desc->push_font(doc_font);
+ p_rt->push_font(doc_font);
}
pos=brk_end+1;
@@ -1537,15 +1541,23 @@ void EditorHelp::_add_text(const String& p_bbcode) {
} else {
- class_desc->add_text("["); //ignore
+ p_rt->add_text("["); //ignore
pos=brk_pos+1;
}
}
- /*class_desc->pop();
- class_desc->pop();
- class_desc->pop();*/
+ /*p_rt->pop();
+ p_rt->pop();
+ p_rt->pop();*/
+
+}
+
+
+void EditorHelp::_add_text(const String& p_bbcode) {
+
+
+ _add_text_to_rt(p_bbcode,class_desc);
}
@@ -1703,3 +1715,71 @@ EditorHelp::~EditorHelp() {
}
+/////////////
+
+
+
+void EditorHelpBit::_go_to_help(String p_what) {
+
+ EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
+ ScriptEditor::get_singleton()->goto_help(p_what);
+ emit_signal("request_hide");
+}
+
+void EditorHelpBit::_meta_clicked(String p_select) {
+
+
+ // print_line("LINK: "+p_select);
+ if (p_select.begins_with("#")) {
+ //_goto_desc(p_select.substr(1,p_select.length()));
+ _go_to_help("class_name:"+p_select.substr(1,p_select.length()));
+ return;
+ } else if (p_select.begins_with("@")) {
+
+ String m = p_select.substr(1,p_select.length());
+
+ if (m.find(".")!=-1) {
+ //must go somewhere else
+
+ _go_to_help("class_method:"+m.get_slice(".",0)+":"+m.get_slice(".",0));
+ } else {
+//
+ // if (!method_line.has(m))
+ // return;
+ //class_desc->scroll_to_line(method_line[m]);
+ }
+
+ }
+
+
+}
+
+void EditorHelpBit::_bind_methods() {
+
+ ObjectTypeDB::bind_method("_meta_clicked",&EditorHelpBit::_meta_clicked);
+ ADD_SIGNAL(MethodInfo("request_hide"));
+}
+
+void EditorHelpBit::_notification(int p_what){
+
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+ add_style_override("panel",get_stylebox("normal","TextEdit"));
+ }
+}
+
+
+void EditorHelpBit::set_text(const String& p_text) {
+
+ rich_text->clear();
+ _add_text_to_rt(p_text,rich_text);
+}
+
+EditorHelpBit::EditorHelpBit() {
+
+ rich_text = memnew( RichTextLabel );
+ add_child(rich_text);
+ rich_text->set_area_as_parent_rect(8*EDSCALE);
+ rich_text->connect("meta_clicked",this,"_meta_clicked");
+ set_custom_minimum_size(Size2(0,70*EDSCALE));
+
+}
diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h
index c3d19894df..b0dc2809fe 100644
--- a/tools/editor/editor_help.h
+++ b/tools/editor/editor_help.h
@@ -200,6 +200,23 @@ public:
+class EditorHelpBit : public Panel {
+ OBJ_TYPE( EditorHelpBit, Panel);
+
+ RichTextLabel *rich_text;
+ void _go_to_help(String p_what);
+ void _meta_clicked(String p_what);
+
+
+protected:
+
+ static void _bind_methods();
+ void _notification(int p_what);
+public:
+
+ void set_text(const String& p_text);
+ EditorHelpBit();
+};
#endif // EDITOR_HELP_H
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 85c560bf9d..ea553c5597 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -1673,7 +1673,7 @@ void EditorNode::_edit_current() {
if (main_plugin) {
- if (main_plugin!=editor_plugin_screen) {
+ if (main_plugin!=editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible() || ScriptEditor::get_singleton()->can_take_away_focus())) {
// update screen main_plugin
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 0d162cbe56..5e671549ef 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -211,15 +211,22 @@ void EditorPlugin::clear() {
}
-void EditorPlugin::save_external_data() {} // if editor references external resources/scenes, save them
+// if editor references external resources/scenes, save them
+void EditorPlugin::save_external_data() {
+
+ if (get_script_instance() && get_script_instance()->has_method("save_external_data")) {
+ get_script_instance()->call("save_external_data");
+ }
+}
+
+// if changes are pending in editor, apply them
void EditorPlugin::apply_changes() {
if (get_script_instance() && get_script_instance()->has_method("apply_changes")) {
get_script_instance()->call("apply_changes");
}
+}
-
-} // if changes are pending in editor, apply them
void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) {
if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) {
@@ -239,10 +246,21 @@ void EditorPlugin::save_global_state() {}
void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
+ if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) {
+ get_script_instance()->call("set_window_layout", p_layout);
+ }
}
void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout){
+ if (get_script_instance() && get_script_instance()->has_method("get_window_layout")) {
+ get_script_instance()->call("get_window_layout", p_layout);
+ }
+}
+
+void EditorPlugin::queue_save_layout() const {
+
+ EditorNode::get_singleton()->save_layout();
}
EditorSelection* EditorPlugin::get_selection() {
@@ -302,6 +320,7 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection);
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings);
+ ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout);
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
@@ -317,8 +336,11 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::DICTIONARY,"get_state"));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("set_state",PropertyInfo(Variant::DICTIONARY,"state")));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("clear"));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("save_external_data"));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("apply_changes"));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING_ARRAY,"get_breakpoints"));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("set_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("get_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile")));
BIND_CONSTANT( CONTAINER_TOOLBAR );
BIND_CONSTANT( CONTAINER_SPATIAL_EDITOR_MENU );
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index b960a7d5af..9a9c32357d 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -118,6 +118,7 @@ public:
virtual void get_window_layout(Ref<ConfigFile> p_layout);
virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them
+ void queue_save_layout() const;
Control *get_base_control();
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 582462aa19..d77234bece 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -731,6 +731,25 @@ void EditorSettings::notify_changes() {
}
+void EditorSettings::_add_property_info_bind(const Dictionary& p_info) {
+
+ ERR_FAIL_COND(!p_info.has("name"));
+ ERR_FAIL_COND(!p_info.has("type"));
+
+ PropertyInfo pinfo;
+ pinfo.name = p_info["name"];
+ ERR_FAIL_COND(!props.has(pinfo.name));
+ pinfo.type = Variant::Type(p_info["type"].operator int());
+ ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX);
+
+ if (p_info.has("hint"))
+ pinfo.hint = PropertyHint(p_info["hint"].operator int());
+ if (p_info.has("hint_string"))
+ pinfo.hint_string = p_info["hint_string"];
+
+ add_property_hint(pinfo);
+}
+
void EditorSettings::add_property_hint(const PropertyInfo& p_hint) {
_THREAD_SAFE_METHOD_
@@ -1001,6 +1020,8 @@ void EditorSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_settings_path"),&EditorSettings::get_settings_path);
ObjectTypeDB::bind_method(_MD("get_project_settings_path"),&EditorSettings::get_project_settings_path);
+ ObjectTypeDB::bind_method(_MD("add_property_info", "info"),&EditorSettings::_add_property_info_bind);
+
ObjectTypeDB::bind_method(_MD("set_favorite_dirs","dirs"),&EditorSettings::set_favorite_dirs);
ObjectTypeDB::bind_method(_MD("get_favorite_dirs"),&EditorSettings::get_favorite_dirs);
diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h
index 937956a366..2a7d3bb4f0 100644
--- a/tools/editor/editor_settings.h
+++ b/tools/editor/editor_settings.h
@@ -104,6 +104,8 @@ private:
Map<String,Ref<ShortCut> > shortcuts;
+ void _add_property_info_bind(const Dictionary& p_info);
+
protected:
static void _bind_methods();
diff --git a/tools/editor/icons/2x/icon_capsule_shape_2d.png b/tools/editor/icons/2x/icon_capsule_shape_2d.png
index 7f4734618b..e449ce4985 100644
--- a/tools/editor/icons/2x/icon_capsule_shape_2d.png
+++ b/tools/editor/icons/2x/icon_capsule_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_circle_shape_2d.png b/tools/editor/icons/2x/icon_circle_shape_2d.png
index 5975c90f91..feb84d2f1c 100644
--- a/tools/editor/icons/2x/icon_circle_shape_2d.png
+++ b/tools/editor/icons/2x/icon_circle_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_concave_polygon_shape_2d.png b/tools/editor/icons/2x/icon_concave_polygon_shape_2d.png
index 39e4d888af..1ad3f30950 100644
--- a/tools/editor/icons/2x/icon_concave_polygon_shape_2d.png
+++ b/tools/editor/icons/2x/icon_concave_polygon_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_convex_polygon_shape_2d.png b/tools/editor/icons/2x/icon_convex_polygon_shape_2d.png
index 38ed87089d..6d46a96f9d 100644
--- a/tools/editor/icons/2x/icon_convex_polygon_shape_2d.png
+++ b/tools/editor/icons/2x/icon_convex_polygon_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_line_shape_2d.png b/tools/editor/icons/2x/icon_line_shape_2d.png
index 5ec406ea1f..490db5ca5b 100644
--- a/tools/editor/icons/2x/icon_line_shape_2d.png
+++ b/tools/editor/icons/2x/icon_line_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_aabb.png b/tools/editor/icons/2x/icon_mini_aabb.png
new file mode 100644
index 0000000000..f0fd5620e9
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_aabb.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_array.png b/tools/editor/icons/2x/icon_mini_array.png
new file mode 100644
index 0000000000..5c7bde2639
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_boolean.png b/tools/editor/icons/2x/icon_mini_boolean.png
new file mode 100644
index 0000000000..a7d00056bb
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_boolean.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_color.png b/tools/editor/icons/2x/icon_mini_color.png
new file mode 100644
index 0000000000..f4059bfb91
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_color.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_color_array.png b/tools/editor/icons/2x/icon_mini_color_array.png
new file mode 100644
index 0000000000..26f1d9fce4
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_color_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_dictionary.png b/tools/editor/icons/2x/icon_mini_dictionary.png
new file mode 100644
index 0000000000..241e0587b4
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_dictionary.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_float.png b/tools/editor/icons/2x/icon_mini_float.png
new file mode 100644
index 0000000000..6edf76ece1
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_float.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_float_array.png b/tools/editor/icons/2x/icon_mini_float_array.png
new file mode 100644
index 0000000000..5a79fab721
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_float_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_image.png b/tools/editor/icons/2x/icon_mini_image.png
new file mode 100644
index 0000000000..98faebeef2
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_image.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_input.png b/tools/editor/icons/2x/icon_mini_input.png
new file mode 100644
index 0000000000..48536e156c
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_input.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_int_array.png b/tools/editor/icons/2x/icon_mini_int_array.png
new file mode 100644
index 0000000000..790ed44c30
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_int_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_integer.png b/tools/editor/icons/2x/icon_mini_integer.png
new file mode 100644
index 0000000000..cd9118f024
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_integer.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_matrix3.png b/tools/editor/icons/2x/icon_mini_matrix3.png
new file mode 100644
index 0000000000..93783177e1
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_matrix3.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_matrix32.png b/tools/editor/icons/2x/icon_mini_matrix32.png
new file mode 100644
index 0000000000..c2f7ea3817
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_matrix32.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_object.png b/tools/editor/icons/2x/icon_mini_object.png
new file mode 100644
index 0000000000..7987f750ff
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_object.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_path.png b/tools/editor/icons/2x/icon_mini_path.png
new file mode 100644
index 0000000000..2e60a46086
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_path.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_plane.png b/tools/editor/icons/2x/icon_mini_plane.png
new file mode 100644
index 0000000000..12b5cd26cc
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_plane.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_quat.png b/tools/editor/icons/2x/icon_mini_quat.png
new file mode 100644
index 0000000000..9a33902e59
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_quat.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_raw_array.png b/tools/editor/icons/2x/icon_mini_raw_array.png
new file mode 100644
index 0000000000..629b01e72a
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_raw_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_rect2.png b/tools/editor/icons/2x/icon_mini_rect2.png
new file mode 100644
index 0000000000..88b12e3a3a
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_rect2.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_rid.png b/tools/editor/icons/2x/icon_mini_rid.png
new file mode 100644
index 0000000000..5388c19817
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_rid.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_string.png b/tools/editor/icons/2x/icon_mini_string.png
new file mode 100644
index 0000000000..2264451c73
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_string.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_string_array.png b/tools/editor/icons/2x/icon_mini_string_array.png
new file mode 100644
index 0000000000..fa8109b88a
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_string_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_transform.png b/tools/editor/icons/2x/icon_mini_transform.png
new file mode 100644
index 0000000000..cb106ba5fa
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_transform.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_variant.png b/tools/editor/icons/2x/icon_mini_variant.png
new file mode 100644
index 0000000000..ae0aad16cf
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_variant.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_vector2.png b/tools/editor/icons/2x/icon_mini_vector2.png
new file mode 100644
index 0000000000..9e608e61c1
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_vector2.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_vector2_array.png b/tools/editor/icons/2x/icon_mini_vector2_array.png
new file mode 100644
index 0000000000..247c0e2592
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_vector2_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_vector3.png b/tools/editor/icons/2x/icon_mini_vector3.png
new file mode 100644
index 0000000000..0b84b4628f
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_vector3.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_mini_vector3_array.png b/tools/editor/icons/2x/icon_mini_vector3_array.png
new file mode 100644
index 0000000000..68058e4232
--- /dev/null
+++ b/tools/editor/icons/2x/icon_mini_vector3_array.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_ray_shape_2d.png b/tools/editor/icons/2x/icon_ray_shape_2d.png
index 37eedfb7de..2dc7041a93 100644
--- a/tools/editor/icons/2x/icon_ray_shape_2d.png
+++ b/tools/editor/icons/2x/icon_ray_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_rectangle_shape_2d.png b/tools/editor/icons/2x/icon_rectangle_shape_2d.png
index a2754e6880..51a93cdb1d 100644
--- a/tools/editor/icons/2x/icon_rectangle_shape_2d.png
+++ b/tools/editor/icons/2x/icon_rectangle_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_segment_shape_2d.png b/tools/editor/icons/2x/icon_segment_shape_2d.png
index 11b28d81df..43d5d837cc 100644
--- a/tools/editor/icons/2x/icon_segment_shape_2d.png
+++ b/tools/editor/icons/2x/icon_segment_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_capsule_shape_2d.png b/tools/editor/icons/icon_capsule_shape_2d.png
index f4f990f72f..6f6554fbc7 100644
--- a/tools/editor/icons/icon_capsule_shape_2d.png
+++ b/tools/editor/icons/icon_capsule_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_circle_shape_2d.png b/tools/editor/icons/icon_circle_shape_2d.png
index 281658b062..7865ed3dbe 100644
--- a/tools/editor/icons/icon_circle_shape_2d.png
+++ b/tools/editor/icons/icon_circle_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_concave_polygon_shape_2d.png b/tools/editor/icons/icon_concave_polygon_shape_2d.png
index 71d8e62dbc..2e87eea5aa 100644
--- a/tools/editor/icons/icon_concave_polygon_shape_2d.png
+++ b/tools/editor/icons/icon_concave_polygon_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_convex_polygon_shape_2d.png b/tools/editor/icons/icon_convex_polygon_shape_2d.png
index 283bc68786..e449c6930f 100644
--- a/tools/editor/icons/icon_convex_polygon_shape_2d.png
+++ b/tools/editor/icons/icon_convex_polygon_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_line_shape_2d.png b/tools/editor/icons/icon_line_shape_2d.png
index a4fb049f3f..e31722d69c 100644
--- a/tools/editor/icons/icon_line_shape_2d.png
+++ b/tools/editor/icons/icon_line_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_loop_interpolation.png b/tools/editor/icons/icon_loop_interpolation.png
new file mode 100644
index 0000000000..488b33316e
--- /dev/null
+++ b/tools/editor/icons/icon_loop_interpolation.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_aabb.png b/tools/editor/icons/icon_mini_aabb.png
index a0b11821a9..3a6be5605a 100644
--- a/tools/editor/icons/icon_mini_aabb.png
+++ b/tools/editor/icons/icon_mini_aabb.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_array.png b/tools/editor/icons/icon_mini_array.png
index 2df4a7d516..ade885e4d4 100644
--- a/tools/editor/icons/icon_mini_array.png
+++ b/tools/editor/icons/icon_mini_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_boolean.png b/tools/editor/icons/icon_mini_boolean.png
index 8753084a5b..9cb64fc983 100644
--- a/tools/editor/icons/icon_mini_boolean.png
+++ b/tools/editor/icons/icon_mini_boolean.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_color.png b/tools/editor/icons/icon_mini_color.png
index ef4e6b5468..bebf64e262 100644
--- a/tools/editor/icons/icon_mini_color.png
+++ b/tools/editor/icons/icon_mini_color.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_color_array.png b/tools/editor/icons/icon_mini_color_array.png
index fa82c20664..434b2f96f5 100644
--- a/tools/editor/icons/icon_mini_color_array.png
+++ b/tools/editor/icons/icon_mini_color_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_dictionary.png b/tools/editor/icons/icon_mini_dictionary.png
index 581a7e4e94..11fd536a83 100644
--- a/tools/editor/icons/icon_mini_dictionary.png
+++ b/tools/editor/icons/icon_mini_dictionary.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_float.png b/tools/editor/icons/icon_mini_float.png
index 240fe7741b..f8c8d9a174 100644
--- a/tools/editor/icons/icon_mini_float.png
+++ b/tools/editor/icons/icon_mini_float.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_float_array.png b/tools/editor/icons/icon_mini_float_array.png
index 205c117522..8b8177e151 100644
--- a/tools/editor/icons/icon_mini_float_array.png
+++ b/tools/editor/icons/icon_mini_float_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_image.png b/tools/editor/icons/icon_mini_image.png
index 8433f57b33..2ad359bdbe 100644
--- a/tools/editor/icons/icon_mini_image.png
+++ b/tools/editor/icons/icon_mini_image.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_input.png b/tools/editor/icons/icon_mini_input.png
index 5d52ed70f8..fec26dd68e 100644
--- a/tools/editor/icons/icon_mini_input.png
+++ b/tools/editor/icons/icon_mini_input.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_int_array.png b/tools/editor/icons/icon_mini_int_array.png
index 3b7bf7dc62..d1bd2e82a7 100644
--- a/tools/editor/icons/icon_mini_int_array.png
+++ b/tools/editor/icons/icon_mini_int_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_integer.png b/tools/editor/icons/icon_mini_integer.png
index 17f3762a46..dad1bb160b 100644
--- a/tools/editor/icons/icon_mini_integer.png
+++ b/tools/editor/icons/icon_mini_integer.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_matrix3.png b/tools/editor/icons/icon_mini_matrix3.png
index be97f2014a..dd59d093cc 100644
--- a/tools/editor/icons/icon_mini_matrix3.png
+++ b/tools/editor/icons/icon_mini_matrix3.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_matrix32.png b/tools/editor/icons/icon_mini_matrix32.png
index 33963066b0..6018a00747 100644
--- a/tools/editor/icons/icon_mini_matrix32.png
+++ b/tools/editor/icons/icon_mini_matrix32.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_object.png b/tools/editor/icons/icon_mini_object.png
index ba38ad06b1..4afe7cfca1 100644
--- a/tools/editor/icons/icon_mini_object.png
+++ b/tools/editor/icons/icon_mini_object.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_path.png b/tools/editor/icons/icon_mini_path.png
index 7645ba6257..9eb0632571 100644
--- a/tools/editor/icons/icon_mini_path.png
+++ b/tools/editor/icons/icon_mini_path.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_plane.png b/tools/editor/icons/icon_mini_plane.png
index d4f2bda241..45676236bd 100644
--- a/tools/editor/icons/icon_mini_plane.png
+++ b/tools/editor/icons/icon_mini_plane.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_quat.png b/tools/editor/icons/icon_mini_quat.png
index 991b684fcb..4ed2f5695c 100644
--- a/tools/editor/icons/icon_mini_quat.png
+++ b/tools/editor/icons/icon_mini_quat.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_raw_array.png b/tools/editor/icons/icon_mini_raw_array.png
index a655edde01..66bcf7c740 100644
--- a/tools/editor/icons/icon_mini_raw_array.png
+++ b/tools/editor/icons/icon_mini_raw_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_rect2.png b/tools/editor/icons/icon_mini_rect2.png
index 9d5d48f78c..db13e1a48e 100644
--- a/tools/editor/icons/icon_mini_rect2.png
+++ b/tools/editor/icons/icon_mini_rect2.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_rid.png b/tools/editor/icons/icon_mini_rid.png
index c85e40f315..278a9d1ee6 100644
--- a/tools/editor/icons/icon_mini_rid.png
+++ b/tools/editor/icons/icon_mini_rid.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_string.png b/tools/editor/icons/icon_mini_string.png
index 0e1198eac0..504556dd74 100644
--- a/tools/editor/icons/icon_mini_string.png
+++ b/tools/editor/icons/icon_mini_string.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_string_array.png b/tools/editor/icons/icon_mini_string_array.png
index 2d8e4ff0aa..5177014185 100644
--- a/tools/editor/icons/icon_mini_string_array.png
+++ b/tools/editor/icons/icon_mini_string_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_transform.png b/tools/editor/icons/icon_mini_transform.png
index b90ee1cef8..0107107a96 100644
--- a/tools/editor/icons/icon_mini_transform.png
+++ b/tools/editor/icons/icon_mini_transform.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_variant.png b/tools/editor/icons/icon_mini_variant.png
index 84b1e04264..285f0bcd16 100644
--- a/tools/editor/icons/icon_mini_variant.png
+++ b/tools/editor/icons/icon_mini_variant.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_vector2.png b/tools/editor/icons/icon_mini_vector2.png
index 56b7726137..a7caa1797f 100644
--- a/tools/editor/icons/icon_mini_vector2.png
+++ b/tools/editor/icons/icon_mini_vector2.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_vector2_array.png b/tools/editor/icons/icon_mini_vector2_array.png
index a8dd5e89a0..de546de16c 100644
--- a/tools/editor/icons/icon_mini_vector2_array.png
+++ b/tools/editor/icons/icon_mini_vector2_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_vector3.png b/tools/editor/icons/icon_mini_vector3.png
index b8999c9c22..69baeb229b 100644
--- a/tools/editor/icons/icon_mini_vector3.png
+++ b/tools/editor/icons/icon_mini_vector3.png
Binary files differ
diff --git a/tools/editor/icons/icon_mini_vector3_array.png b/tools/editor/icons/icon_mini_vector3_array.png
index 94a6f64043..6bddbaf627 100644
--- a/tools/editor/icons/icon_mini_vector3_array.png
+++ b/tools/editor/icons/icon_mini_vector3_array.png
Binary files differ
diff --git a/tools/editor/icons/icon_ray_shape_2d.png b/tools/editor/icons/icon_ray_shape_2d.png
index 2f102bbb91..c91a63570d 100644
--- a/tools/editor/icons/icon_ray_shape_2d.png
+++ b/tools/editor/icons/icon_ray_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_rectangle_shape_2d.png b/tools/editor/icons/icon_rectangle_shape_2d.png
index eb123c6f6a..002730b942 100644
--- a/tools/editor/icons/icon_rectangle_shape_2d.png
+++ b/tools/editor/icons/icon_rectangle_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/icon_segment_shape_2d.png b/tools/editor/icons/icon_segment_shape_2d.png
index c90255a405..8f3771be7a 100644
--- a/tools/editor/icons/icon_segment_shape_2d.png
+++ b/tools/editor/icons/icon_segment_shape_2d.png
Binary files differ
diff --git a/tools/editor/icons/source/icon_capsule_shape_2d.svg b/tools/editor/icons/source/icon_capsule_shape_2d.svg
index 03ac3f8255..13c6648368 100644
--- a/tools/editor/icons/source/icon_capsule_shape_2d.svg
+++ b/tools/editor/icons/source/icon_capsule_shape_2d.svg
@@ -40,8 +40,8 @@
showgrid="true"
inkscape:current-layer="layer1"
inkscape:document-units="px"
- inkscape:cy="10.812487"
- inkscape:cx="8.3752367"
+ inkscape:cy="10.749987"
+ inkscape:cx="2.8752365"
inkscape:zoom="31.999999"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
@@ -73,7 +73,7 @@
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<path
- style="opacity:1;fill:#a5b7f4;fill-opacity:0.98823529;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ style="opacity:1;fill:#68b6ff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="M 8 1 A 4 4 0 0 0 4 5 L 4 11 A 4 4 0 0 0 8 15 A 4 4 0 0 0 12 11 L 12 5 A 4 4 0 0 0 8 1 z M 8 3 A 2.0000174 2.0000174 0 0 1 10 5 L 10 11 A 2.0000174 2.0000174 0 0 1 8 13 A 2.0000174 2.0000174 0 0 1 6 11 L 6 5 A 2.0000174 2.0000174 0 0 1 8 3 z "
transform="translate(0,1036.3622)"
id="path4135" />
diff --git a/tools/editor/icons/source/icon_circle_shape_2d.svg b/tools/editor/icons/source/icon_circle_shape_2d.svg
index 4f81ae0e62..56ac538672 100644
--- a/tools/editor/icons/source/icon_circle_shape_2d.svg
+++ b/tools/editor/icons/source/icon_circle_shape_2d.svg
@@ -1,21 +1,82 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="icon_circle_shape_2d.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_box_shape.png" inkscape:version="0.91 r13725" version="1.1" id="svg2" viewBox="0 0 16 16" height="16" width="16">
- <sodipodi:namedview inkscape:snap-smooth-nodes="false" inkscape:object-nodes="false" inkscape:snap-intersection-paths="false" inkscape:object-paths="false" inkscape:window-maximized="1" inkscape:window-y="0" inkscape:window-x="0" inkscape:window-height="1055" inkscape:window-width="1920" inkscape:snap-center="true" inkscape:snap-object-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" units="px" showgrid="true" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:cy="11.031037" inkscape:cx="-1.7366522" inkscape:zoom="22.627416" inkscape:pageshadow="2" inkscape:pageopacity="0.0" borderopacity="1.0" bordercolor="#666666" pagecolor="#ffffff" id="base">
- <inkscape:grid id="grid3336" type="xygrid" empspacing="4" />
- </sodipodi:namedview>
- <defs id="defs4" />
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g transform="translate(0,-1036.3622)" id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
- <path style="opacity:1;fill:none;fill-opacity:1;stroke:#a5b7f3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.98823529" d="m 8,1038.3622 a 6,6 0 0 0 -6,6 6,6 0 0 0 6,6 6,6 0 0 0 6,-6 6,6 0 0 0 -6,-6 z" id="path4157" inkscape:connector-curvature="0" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ sodipodi:docname="icon_circle_shape_2d.svg"
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_box_shape.png"
+ inkscape:version="0.91 r13725"
+ version="1.1"
+ id="svg2"
+ viewBox="0 0 16 16"
+ height="16"
+ width="16">
+ <sodipodi:namedview
+ inkscape:snap-smooth-nodes="false"
+ inkscape:object-nodes="false"
+ inkscape:snap-intersection-paths="false"
+ inkscape:object-paths="false"
+ inkscape:window-maximized="1"
+ inkscape:window-y="27"
+ inkscape:window-x="0"
+ inkscape:window-height="1016"
+ inkscape:window-width="1920"
+ inkscape:snap-center="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:bbox-nodes="true"
+ inkscape:bbox-paths="true"
+ inkscape:snap-bbox="true"
+ units="px"
+ showgrid="true"
+ inkscape:current-layer="layer1"
+ inkscape:document-units="px"
+ inkscape:cy="10.942649"
+ inkscape:cx="-9.5148271"
+ inkscape:zoom="22.627416"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base">
+ <inkscape:grid
+ id="grid3336"
+ type="xygrid"
+ empspacing="4" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(0,-1036.3622)"
+ id="layer1"
+ inkscape:groupmode="layer"
+ inkscape:label="Layer 1">
+ <path
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#68b6ff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8,1038.3622 a 6,6 0 0 0 -6,6 6,6 0 0 0 6,6 6,6 0 0 0 6,-6 6,6 0 0 0 -6,-6 z"
+ id="path4157"
+ inkscape:connector-curvature="0" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_concave_polygon_shape_2d.svg b/tools/editor/icons/source/icon_concave_polygon_shape_2d.svg
index 79e71425f7..624105e5a8 100644
--- a/tools/editor/icons/source/icon_concave_polygon_shape_2d.svg
+++ b/tools/editor/icons/source/icon_concave_polygon_shape_2d.svg
@@ -1,21 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_concave_polygon_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="22.627416" inkscape:cx="-0.53108971" inkscape:cy="10.128279" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <path style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98823529" d="m 14,1050.3622 -12,0 0,-12 6,6 6,-6 z" id="path4139" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_concave_polygon_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="31.999999"
+ inkscape:cx="9.3658684"
+ inkscape:cy="6.9741169"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1050.3622 -12,0 0,-12 6,6 6,-6 z"
+ id="path4139"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_convex_polygon_shape_2d.svg b/tools/editor/icons/source/icon_convex_polygon_shape_2d.svg
index fc84cf931b..3b55df7fba 100644
--- a/tools/editor/icons/source/icon_convex_polygon_shape_2d.svg
+++ b/tools/editor/icons/source/icon_convex_polygon_shape_2d.svg
@@ -1,21 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_convex_polygon_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="22.627416" inkscape:cx="-0.53108971" inkscape:cy="10.128279" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <path style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98823529" d="m 14,1050.3622 -12,0 0,-6 6,-6 6,6 z" id="path4139" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_convex_polygon_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="31.999999"
+ inkscape:cx="3.9121254"
+ inkscape:cy="7.1557164"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1050.3622 -12,0 0,-6 6,-6 6,6 z"
+ id="path4139"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_line_shape_2d.svg b/tools/editor/icons/source/icon_line_shape_2d.svg
index 551439b4f3..6a8ab39ef3 100644
--- a/tools/editor/icons/source/icon_line_shape_2d.svg
+++ b/tools/editor/icons/source/icon_line_shape_2d.svg
@@ -1,23 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_line_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="22.627416" inkscape:cx="-0.53108971" inkscape:cy="10.128279" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <path style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.39215687" d="m 1,1037.3622 14,14" id="path4139" inkscape:connector-curvature="0" sodipodi:nodetypes="cc" />
- <path sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4201" d="m 3,1039.3622 10,10" style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58823532" />
- <path style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98823529" d="m 5,1041.3622 6,6" id="path4203" inkscape:connector-curvature="0" sodipodi:nodetypes="cc" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_line_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627416"
+ inkscape:cx="0.66215304"
+ inkscape:cy="8.0069586"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:#68b6ff;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.39215687;fill-opacity:1"
+ d="m 1,1037.3622 14,14"
+ id="path4139"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path4201"
+ d="m 3,1039.3622 10,10"
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58823532" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 5,1041.3622 6,6"
+ id="path4203"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_mini_aabb.svg b/tools/editor/icons/source/icon_mini_aabb.svg
new file mode 100644
index 0000000000..f6cc3feda1
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_aabb.svg
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_aabb.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="3.148993"
+ inkscape:cy="6.4579802"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="false"
+ inkscape:snap-smooth-nodes="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#ee7991;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 5,1041.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 l 2,0 0,-6 -2,0 z m 0,2 0,2 a 1.0000174,1.0000174 0 0 1 -1,-1 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4893"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#f5acbb;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1046.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 l 2,0 0,-6 -2,0 z m 0,2 0,2 a 1.0000174,1.0000174 0 0 1 -1,-1 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4234"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path4145"
+ d="m 12.999983,1043.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#ee7991;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#ee7991;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 12.999983,1049.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ id="path4147" />
+ <rect
+ transform="matrix(0,1,1,0,0,0)"
+ y="11"
+ x="1041.3622"
+ height="2.0000002"
+ width="8.0000172"
+ id="rect4149"
+ style="fill:#ee7991;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#f5acbb;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1044.3622 0,8 2,0 a 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 l 0,-2 -2,0 z m 2,4 a 1.0000174,1.0000174 0 0 1 1,1 1.0000174,1.0000174 0 0 1 -1,1 l 0,-2 z"
+ id="path4151"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_array.svg b/tools/editor/icons/source/icon_mini_array.svg
new file mode 100644
index 0000000000..a0a2014fbb
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_array.svg
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="9.4953495"
+ inkscape:cy="4.8350599"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4245"
+ width="2"
+ height="2.999984"
+ x="11"
+ y="1047.3622" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4253"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="1047.3622"
+ x="7"
+ height="2.999984"
+ width="2"
+ id="rect4150"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4152"
+ d="m 10,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path4849"
+ d="m 4,1050.3625 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 4,1044.3625 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4851" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="4"
+ height="6.0000014"
+ width="2"
+ id="rect4853"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4141"
+ width="1"
+ height="2.0000174"
+ x="10"
+ y="1044.3622" />
+ <rect
+ y="1044.3622"
+ x="14"
+ height="2.0000174"
+ width="1"
+ id="rect4143"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_boolean.svg b/tools/editor/icons/source/icon_mini_boolean.svg
new file mode 100644
index 0000000000..eb17279a62
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_boolean.svg
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_boolean.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000002"
+ inkscape:cx="3.4941399"
+ inkscape:cy="6.2480463"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4364"
+ width="2"
+ height="5.9999666"
+ x="-2"
+ y="1044.3622"
+ transform="scale(-1,1)" />
+ <rect
+ y="1044.3622"
+ x="-2"
+ height="2.0000174"
+ width="1"
+ id="rect4368"
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <path
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 2,1044.3623 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4370"
+ inkscape:connector-curvature="0" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1047.3622"
+ x="13"
+ height="5"
+ width="2"
+ id="rect4374"
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4378"
+ d="m 2,1050.3623 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1,1)"
+ y="1042.3622"
+ x="-2"
+ height="3.9999492"
+ width="2"
+ id="rect4384"
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16,1050.3623 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4392"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7,1044.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 z m 0,2 a 1.0000174,1.0000174 0 0 1 1,1 1.0000174,1.0000174 0 0 1 -1,1 1.0000174,1.0000174 0 0 1 -1,-1 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4148"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#8da6f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 11,1044.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 z m 0,2 a 1.0000174,1.0000174 0 0 1 1,1 1.0000174,1.0000174 0 0 1 -1,1 1.0000174,1.0000174 0 0 1 -1,-1 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4174"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_color.svg b/tools/editor/icons/source/icon_mini_color.svg
new file mode 100644
index 0000000000..cdc176e00c
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_color.svg
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_color.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ id="clipPath4253"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4255"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4199"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ id="path4201"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4392">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ id="path4394"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ id="clipPath4196"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4198"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="5.4869016"
+ inkscape:cy="6.8192689"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#ff7070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 4 4 A 3 3 0 0 0 1 7 A 3 3 0 0 0 4 10 L 5 10 L 5 8 L 4 8 A 1.0000174 1.0000174 0 0 1 3 7 A 1.0000174 1.0000174 0 0 1 4 6 L 5 6 L 5 4 L 4 4 z "
+ transform="translate(0,1040.3622)"
+ id="rect4667" />
+ <path
+ style="fill:#70bfff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 14 4 A 3 3 0 0 0 11 7 L 11 10 L 13 10 L 13 7 A 1.0000174 1.0000174 0 0 1 14 6 L 15 6 L 15 4 L 14 4 z "
+ transform="translate(0,1040.3622)"
+ id="rect4245" />
+ <path
+ style="fill:#7aff70;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 6 2 L 6 7 A 3 3 0 0 0 9 10 L 10 10 L 10 8 L 9 8 A 1.0000174 1.0000174 0 0 1 8 7 L 8 2 L 6 2 z "
+ transform="translate(0,1040.3622)"
+ id="rect4815" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_color_array.svg b/tools/editor/icons/source/icon_mini_color_array.svg
new file mode 100644
index 0000000000..2ec0e186b5
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_color_array.svg
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_color_array.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-7">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-5"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-3">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-5"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-6"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-2"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-9">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-1"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-75">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-3"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-5">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-6"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-2"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-9"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-1">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-2"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000002"
+ inkscape:cx="2.3647109"
+ inkscape:cy="10.148485"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1050.3622"
+ x="0"
+ height="1.9999826"
+ width="4"
+ id="rect4158"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4160"
+ width="2"
+ height="12.000017"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4162"
+ width="4"
+ height="2.0000174"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4155"
+ width="4"
+ height="1.9999826"
+ x="-16"
+ y="1050.3622"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="12.000017"
+ width="2"
+ id="rect4157"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="2.0000174"
+ width="4"
+ id="rect4159"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <path
+ style="fill:#ff7070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 6 3.5 A 3 3 0 0 0 3 6.5 A 3 3 0 0 0 6 9.5 L 7 9.5 L 7 7.5 L 6 7.5 A 1.0000174 1.0000174 0 0 1 5 6.5 A 1.0000174 1.0000174 0 0 1 6 5.5 L 7 5.5 L 7 3.5 L 6 3.5 z "
+ transform="translate(0,1040.3622)"
+ id="rect4667" />
+ <rect
+ style="fill:#70bfff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4245"
+ width="2"
+ height="2.999984"
+ x="10"
+ y="1046.8622" />
+ <path
+ style="fill:#70bfff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1043.8622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4253"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#7aff70;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 7 1.5 L 7 6.5 A 3 3 0 0 0 10 9.5 L 10 7.5 A 1.0000174 1.0000174 0 0 1 9 6.5 L 9 1.5 L 7 1.5 z "
+ transform="translate(0,1040.3622)"
+ id="rect4815" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_dictionary.svg b/tools/editor/icons/source/icon_mini_dictionary.svg
new file mode 100644
index 0000000000..813ba97613
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_dictionary.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_dictionary.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="4.4726786"
+ inkscape:cy="6.5768127"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4607"
+ width="2"
+ height="4.9999828"
+ x="13"
+ y="-1047.3623" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1046.3623"
+ x="15"
+ height="2.0000174"
+ width="1"
+ id="rect4609"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4611"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 11,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4617"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4621"
+ d="m 11,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4412"
+ width="2"
+ height="3.9999492"
+ x="6"
+ y="1046.3623" />
+ <rect
+ y="1042.3623"
+ x="6"
+ height="1.9999928"
+ width="2"
+ id="rect4432"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1044.362 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4843" />
+ <path
+ id="path4845"
+ d="m 3,1050.362 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4847"
+ width="2"
+ height="7.9999843"
+ x="3"
+ y="1042.3622" />
+ <rect
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4144"
+ width="1"
+ height="1.9999928"
+ x="11"
+ y="1044.3622" />
+ <rect
+ y="1048.3622"
+ x="11"
+ height="1.9999928"
+ width="1"
+ id="rect4146"
+ style="fill:#77edb1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_float.svg b/tools/editor/icons/source/icon_mini_float.svg
new file mode 100644
index 0000000000..1007955ea9
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_float.svg
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_float.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="5.8021561"
+ inkscape:cy="5.7934213"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1045.3623"
+ x="0"
+ height="4.9999828"
+ width="2"
+ id="rect4498"
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4500"
+ width="2"
+ height="2.0000174"
+ x="2"
+ y="1046.3623" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4502"
+ d="m 3,1042.3623 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4504"
+ width="2"
+ height="5"
+ x="6"
+ y="-1047.3622"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4506"
+ d="m 9,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="-1047.3623"
+ x="12"
+ height="4.9999828"
+ width="2"
+ id="rect4508"
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4512"
+ d="m 15,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#61daf4;fill-opacity:1;stroke:none"
+ id="rect4142"
+ width="1"
+ height="2"
+ x="9"
+ y="1048.3622" />
+ <rect
+ y="1044.3622"
+ x="14"
+ height="2"
+ width="2"
+ id="rect4144"
+ style="fill:#61daf4;fill-opacity:1;stroke:none" />
+ <rect
+ style="fill:#61daf4;fill-opacity:1;stroke:none"
+ id="rect4146"
+ width="1"
+ height="2"
+ x="15"
+ y="1048.3622" />
+ <rect
+ y="1042.3622"
+ x="3"
+ height="2"
+ width="1"
+ id="rect4148"
+ style="fill:#61daf4;fill-opacity:1;stroke:none" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_float_array.svg b/tools/editor/icons/source/icon_mini_float_array.svg
new file mode 100644
index 0000000000..86807ca731
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_float_array.svg
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_float_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="64.000006"
+ inkscape:cx="5.0069742"
+ inkscape:cy="7.9592671"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1050.3622"
+ x="0"
+ height="2.0000174"
+ width="4"
+ id="rect4158"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4160"
+ width="2"
+ height="12.000017"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4162"
+ width="4"
+ height="2.0000174"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4170"
+ width="4"
+ height="2.0000174"
+ x="-16"
+ y="1050.3622"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="12.000017"
+ width="2"
+ id="rect4172"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="2.0000174"
+ width="4"
+ id="rect4175"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <path
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 6,1042.3622 a 3,3 0 0 0 -3,3 l 0,5 2,0 0,-2 1,0 0,-2 -1,0 0,-1 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4146" />
+ <path
+ style="fill:#61daf4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10,1042.3622 0,5 a 3,3 0 0 0 3,3 l 0,-2 a 1.0000174,1.0000174 0 0 1 -1,-1 l 0,-1 1,0 0,-2 -1,0 0,-2 -2,0 z"
+ id="rect4498"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#c6f2fb;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7,1042.3622 0,5 a 3,3 0 0 0 3,3 l 0,-2 a 1.0000174,1.0000174 0 0 1 -1,-1 l 0,-5 -2,0 z"
+ id="rect4504"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_image.svg b/tools/editor/icons/source/icon_mini_image.svg
new file mode 100644
index 0000000000..57faded5c8
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_image.svg
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_image.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="3.9410412"
+ inkscape:cy="6.0438587"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4412"
+ width="2"
+ height="3.9999492"
+ x="0"
+ y="1045.3622" />
+ <rect
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4414"
+ width="2"
+ height="5.9999843"
+ x="3"
+ y="1043.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4428"
+ d="m 5,1043.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1046.3622"
+ x="6"
+ height="3.0000174"
+ width="2"
+ id="rect4430"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1041.3622"
+ x="0"
+ height="1.9999928"
+ width="2"
+ id="rect4432"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1043.3622"
+ x="6"
+ height="5.9999843"
+ width="2"
+ id="rect4175"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1043.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4177"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4179"
+ width="2"
+ height="3.0000174"
+ x="9"
+ y="1046.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1049.3624 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4843" />
+ <path
+ id="path4845"
+ d="m 14,1043.3624 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4847"
+ width="2"
+ height="6.0000014"
+ x="14"
+ y="-1049.3622"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1052.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ id="path4408" />
+ <rect
+ style="fill:#93f1b9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4410"
+ width="1"
+ height="2"
+ x="12"
+ y="1050.3622" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_input.svg b/tools/editor/icons/source/icon_mini_input.svg
new file mode 100644
index 0000000000..9e966f77d1
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_input.svg
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_input.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="2.8417629"
+ inkscape:cy="8.0681941"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ id="path4809"
+ d="m 10,1050.3625 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10,1044.3625 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4811" />
+ <rect
+ transform="scale(-1,-1)"
+ y="-1052.3622"
+ x="-10"
+ height="7.9999843"
+ width="2"
+ id="rect4813"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4412"
+ width="2"
+ height="3.9999492"
+ x="0"
+ y="1046.3625" />
+ <rect
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4414"
+ width="2"
+ height="5.9999843"
+ x="3"
+ y="1044.3624" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4428"
+ d="m 5,1044.3625 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1047.3624"
+ x="6"
+ height="3.0000174"
+ width="2"
+ id="rect4430"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1042.3625"
+ x="0"
+ height="1.9999928"
+ width="2"
+ id="rect4432"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4455"
+ width="2"
+ height="4.9999828"
+ x="13"
+ y="-1047.3625" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1046.3625"
+ x="15"
+ height="2.0000174"
+ width="1"
+ id="rect4457"
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#adf18f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16,1050.3625 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4459"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_int_array.svg b/tools/editor/icons/source/icon_mini_int_array.svg
new file mode 100644
index 0000000000..23b086d5e1
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_int_array.svg
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_int_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="4.3434649"
+ inkscape:cy="6.0813959"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 0 0 L 0 2 L 0 10 L 0 12 L 2 12 L 4 12 L 4 10 L 2 10 L 2 2 L 4 2 L 4 0 L 0 0 z M 12 0 L 12 2 L 14 2 L 14 10 L 12 10 L 12 12 L 16 12 L 16 10 L 16 2 L 16 0 L 14 0 L 12 0 z "
+ transform="translate(0,1040.3622)"
+ id="rect4158" />
+ <path
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 3 2 L 3 4 L 5 4 L 5 2 L 3 2 z M 3 6 L 3 10 L 5 10 L 5 6 L 3 6 z "
+ id="rect4412"
+ transform="translate(0,1040.3622)" />
+ <path
+ style="fill:#c8e7f9;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 5 4 L 5 10 L 7 10 L 7 6 A 1.0000174 1.0000174 0 0 1 8 7 L 8 10 L 10 10 L 10 7 A 3 3 0 0 0 7 4 L 5 4 z "
+ transform="translate(0,1040.3622)"
+ id="rect4414" />
+ <path
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 10 2 L 10 7 A 3 3 0 0 0 13 10 L 13 8 A 1.0000174 1.0000174 0 0 1 12 7 L 12 6 L 13 6 L 13 4 L 12 4 L 12 2 L 10 2 z "
+ id="rect4455"
+ transform="translate(0,1040.3622)" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_integer.svg b/tools/editor/icons/source/icon_mini_integer.svg
new file mode 100644
index 0000000000..c21322adb2
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_integer.svg
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_integer.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254837"
+ inkscape:cx="7.0145943"
+ inkscape:cy="6.0949691"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4412"
+ width="2"
+ height="3.9999492"
+ x="1"
+ y="1046.3622" />
+ <rect
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4414"
+ width="2"
+ height="5.9999843"
+ x="4"
+ y="1044.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4428"
+ d="m 7,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1047.3622"
+ x="8"
+ height="3.0000174"
+ width="2"
+ id="rect4430"
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1042.3622"
+ x="1"
+ height="1.9999928"
+ width="2"
+ id="rect4432"
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4455"
+ width="2"
+ height="4.9999828"
+ x="12"
+ y="-1047.3622" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1046.3622"
+ x="14"
+ height="2.0000174"
+ width="2"
+ id="rect4457"
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 15,1050.3621 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4459"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4142"
+ width="2"
+ height="1.9999928"
+ x="5"
+ y="1044.3622" />
+ <rect
+ style="fill:#7dc6ef;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4144"
+ width="1"
+ height="2.0000174"
+ x="15"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_matrix3.svg b/tools/editor/icons/source/icon_mini_matrix3.svg
new file mode 100644
index 0000000000..592230d13c
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_matrix3.svg
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_matrix3.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="4.071303"
+ inkscape:cy="4.582959"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 12.00042,1044.3622 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0.226563,-2.5 l -2.824219,0 z"
+ id="path4753"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4757"
+ d="m 12.00042,1046.3622 0,2 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597656,-1.5 z"
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4771"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1050.3622"
+ x="4"
+ height="3"
+ width="2"
+ id="rect4773"
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4775"
+ width="2"
+ height="5.9999828"
+ x="1"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="4"
+ height="5.9999828"
+ width="2"
+ id="rect4777"
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4779"
+ d="m 6,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4781"
+ width="2"
+ height="3.0000002"
+ x="7"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4783"
+ width="4.0004196"
+ height="2"
+ x="11"
+ y="1043.3622" />
+ <rect
+ y="1050.3622"
+ x="11"
+ height="2"
+ width="1"
+ id="rect4173"
+ style="fill:#e3ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_matrix32.svg b/tools/editor/icons/source/icon_mini_matrix32.svg
new file mode 100644
index 0000000000..5159ea0b87
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_matrix32.svg
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_matrix32.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="1.5471383"
+ inkscape:cy="5.978497"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#ddf4aa;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8 2 L 8 4 L 9 4 L 10 4 A 1 1 0 0 1 9 5 L 9 7 A 1 1 0 0 1 10 8 A 1 1 0 0 1 9 9 L 8 9 L 8 11 L 9 11 A 3 3 0 0 0 11.597656 9.5 A 3 3 0 0 0 11.597656 6.5 A 3 3 0 0 0 11.232422 5.9980469 A 3 3 0 0 0 11.597656 5.5 A 3 3 0 0 0 11.994141 4 L 12 4 L 12 2 L 9 2 L 8 2 z "
+ transform="translate(0,1040.3622)"
+ id="path4753" />
+ <rect
+ y="1048.3622"
+ x="11"
+ height="2"
+ width="5"
+ id="rect4763"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ sodipodi:open="true"
+ d="m 13,1050.3622 a 2,2 0 0 1 -1.732051,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.732051,-1"
+ sodipodi:end="4.712389"
+ sodipodi:start="1.5707963"
+ sodipodi:ry="2"
+ sodipodi:rx="2"
+ sodipodi:cy="1048.3622"
+ sodipodi:cx="13"
+ sodipodi:type="arc"
+ id="path4765"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4767"
+ d="m 13,1042.3622 0,2 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597656,-1.5 z"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 2,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4771"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1050.3622"
+ x="3"
+ height="3"
+ width="2"
+ id="rect4773"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4775"
+ width="2"
+ height="5.9999828"
+ x="0"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="3"
+ height="5.9999828"
+ width="2"
+ id="rect4777"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4779"
+ d="m 5,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4781"
+ width="2"
+ height="3.0000002"
+ x="6"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_object.svg b/tools/editor/icons/source/icon_mini_object.svg
new file mode 100644
index 0000000000..380be34903
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_object.svg
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_object.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254836"
+ inkscape:cx="1.4141272"
+ inkscape:cy="5.8428771"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1050.3622 a 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 l 0,-2 -2,0 0,8 2,0 z m 0,-2 0,-2 a 1.0000174,1.0000174 0 0 1 1,1 1.0000174,1.0000174 0 0 1 -1,1 z"
+ id="path4843"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path4849"
+ d="m 3,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4851" />
+ <path
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 15,1044.3622 0,5 a 3,3 0 0 1 -3,3 l 0,-2 a 1.0000174,1.0000174 0 0 0 1,-1 l 0,-5 2,0 z"
+ id="rect4293-6"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1050.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ id="path4174" />
+ <path
+ id="path4176"
+ d="m 3,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#79f3e8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4140"
+ width="1"
+ height="2"
+ x="11"
+ y="1050.3622" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_path.svg b/tools/editor/icons/source/icon_mini_path.svg
new file mode 100644
index 0000000000..ef247b8b8c
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_path.svg
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_path.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254835"
+ inkscape:cx="8.9618505"
+ inkscape:cy="5.9123718"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="-1047.3622"
+ x="6"
+ height="4.9999828"
+ width="2"
+ id="rect4293"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4295"
+ width="2"
+ height="2.0000174"
+ x="8"
+ y="-1046.3622"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4297"
+ d="m 9,1050.3621 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4299"
+ width="2"
+ height="7.9999828"
+ x="11"
+ y="-1050.3622" />
+ <path
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4301"
+ inkscape:connector-curvature="0" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="14"
+ height="3.0000348"
+ width="2"
+ id="rect4303"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 2,1048.3625 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ id="path4461" />
+ <path
+ id="path4463"
+ d="m 2,1042.3625 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4465"
+ width="2"
+ height="7.9999843"
+ x="-2"
+ y="-1050.3622"
+ transform="scale(-1,-1)" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="9"
+ height="2.0000174"
+ width="1"
+ id="rect4143"
+ style="fill:#6993ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_plane.svg b/tools/editor/icons/source/icon_mini_plane.svg
new file mode 100644
index 0000000000..bc3992cdd6
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_plane.svg
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_plane.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="5.5391662"
+ inkscape:cy="7.4683409"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ id="path4809"
+ d="m 3,1048.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1042.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4811" />
+ <rect
+ transform="scale(-1,-1)"
+ y="-1050.3619"
+ x="-3"
+ height="7.9999843"
+ width="2"
+ id="rect4813"
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4815"
+ width="2"
+ height="4.9999828"
+ x="7"
+ y="-1047.3623" />
+ <path
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4819"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="1044.3622"
+ x="11"
+ height="5.9999843"
+ width="2"
+ id="rect4324"
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4342"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#f77070;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4344"
+ width="2"
+ height="3.0000174"
+ x="14"
+ y="1047.3622" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_quat.svg b/tools/editor/icons/source/icon_mini_quat.svg
new file mode 100644
index 0000000000..27188a3410
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_quat.svg
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_quat.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254836"
+ inkscape:cx="7.0330887"
+ inkscape:cy="6.0717303"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1049.3625 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4843" />
+ <path
+ id="path4845"
+ d="m 3,1043.3625 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4847"
+ width="2"
+ height="7.9999843"
+ x="3"
+ y="-1051.3622"
+ transform="scale(1,-1)" />
+ <rect
+ y="-1046.3623"
+ x="13"
+ height="4.9999828"
+ width="2"
+ id="rect4293-6"
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4295-2"
+ width="1"
+ height="2.0000174"
+ x="15"
+ y="-1045.3623"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4297-9"
+ d="m 16,1049.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#f298c0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 4,1043.3622 0,3 a 3,3 0 0 0 3,3 l 2,0 0,-6 -2,0 0,4 a 1.0000174,1.0000174 0 0 1 -1,-1 l 0,-3 -2,0 z"
+ id="rect4366"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ec69a3;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 11 3 A 3 3 0 0 0 8 6 A 3 3 0 0 0 11 9 L 13 9 L 13 3 L 11 3 z M 11 5 L 11 7 A 1.0000174 1.0000174 0 0 1 10 6 A 1.0000174 1.0000174 0 0 1 11 5 z "
+ transform="translate(0,1040.3622)"
+ id="path4849" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_raw_array.svg b/tools/editor/icons/source/icon_mini_raw_array.svg
new file mode 100644
index 0000000000..cb735b5615
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_raw_array.svg
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_raw_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="-2.5947078"
+ inkscape:cy="7.7867435"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 0 0 L 0 2 L 0 10 L 0 12 L 4 12 L 4 10 L 2 10 L 2 2 L 4 2 L 4 0 L 2 0 L 0 0 z M 12 0 L 12 2 L 14 2 L 14 10 L 12 10 L 12 12 L 16 12 L 16 10 L 16 2 L 16 0 L 14 0 L 12 0 z "
+ transform="translate(0,1040.3622)"
+ id="rect4158" />
+ <rect
+ style="fill:#69ec9e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4245"
+ width="2"
+ height="2.999984"
+ x="2"
+ y="1046.3622" />
+ <rect
+ y="1043.3622"
+ x="5"
+ height="2.0000174"
+ width="1"
+ id="rect4251"
+ style="fill:#69ec9e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#69ec9e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 5,1043.3623 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4253"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#aaf4c8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 6,1049.3622 0,-6 2,0 0,4 a 1.0000174,1.0000174 0 0 0 1,-1 l 0,-3 2,0 0,3 0,1 a 1.0000174,1.0000174 0 0 0 1,-1 l 0,-3 2,0 0,3 a 3,3 0 0 1 -3,3 l -2,0 0,-0.1758 a 3,3 0 0 1 -1,0.1758 l -2,0 z"
+ id="path4771"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_rect2.svg b/tools/editor/icons/source/icon_mini_rect2.svg
new file mode 100644
index 0000000000..ded27f049f
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_rect2.svg
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_rect2.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000002"
+ inkscape:cx="2.7000496"
+ inkscape:cy="5.1067461"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1047.3622"
+ x="0"
+ height="2.999984"
+ width="2"
+ id="rect4601"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4605"
+ d="m 3,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4607"
+ width="2"
+ height="4.9999828"
+ x="13"
+ y="-1047.3622" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1046.3622"
+ x="15"
+ height="2.0000174"
+ width="1"
+ id="rect4609"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16,1050.3621 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4611"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4617"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4619"
+ width="1"
+ height="2.0000174"
+ x="7"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4621"
+ d="m 7,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4144"
+ width="1"
+ height="2.0000174"
+ x="12"
+ y="1044.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4146"
+ d="m 12,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="12"
+ height="2.0000174"
+ width="1"
+ id="rect4148"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 12,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4150"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4152"
+ d="m 7,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4154"
+ width="2"
+ height="1"
+ x="6"
+ y="1046.3622" />
+ <rect
+ style="fill:#f191a5;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4156"
+ width="1"
+ height="2.0000174"
+ x="3"
+ y="-1046.3622"
+ transform="scale(1,-1)" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_rid.svg b/tools/editor/icons/source/icon_mini_rid.svg
new file mode 100644
index 0000000000..6df13ae43d
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_rid.svg
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_rid.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254836"
+ inkscape:cx="8.577775"
+ inkscape:cy="6.6679205"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="false"
+ inkscape:snap-smooth-nodes="false"
+ inkscape:snap-nodes="true"
+ inkscape:snap-midpoints="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4245"
+ width="2"
+ height="2.999984"
+ x="1"
+ y="1047.3622" />
+ <rect
+ y="1042.3623"
+ x="7"
+ height="1.9998953"
+ width="2"
+ id="rect4247"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4249"
+ width="2"
+ height="4.0000014"
+ x="7"
+ y="1046.3622" />
+ <rect
+ y="1044.3622"
+ x="4"
+ height="2.0000174"
+ width="1"
+ id="rect4251"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 4,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4253"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path4260"
+ d="m 13,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4262" />
+ <rect
+ y="1042.3622"
+ x="14"
+ height="7.9999843"
+ width="2"
+ id="rect4264"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4142"
+ width="1"
+ height="2.0000174"
+ x="13"
+ y="1044.3622" />
+ <rect
+ y="1048.3622"
+ x="13"
+ height="2.0000174"
+ width="1"
+ id="rect4144"
+ style="fill:#69ec9a;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_string.svg b/tools/editor/icons/source/icon_mini_string.svg
new file mode 100644
index 0000000000..a655f70d33
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_string.svg
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_string.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ id="clipPath4253"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4255"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4199"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ id="path4201"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4392">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ id="path4394"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ id="clipPath4196"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4198"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4253-75"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4255-3"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4199-5"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ id="path4201-6"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4392-2">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ id="path4394-9"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ id="clipPath4196-1"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4198-2"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4253-7"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4255-5"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4199-3"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ id="path4201-5"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4392-6">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ id="path4394-2"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ id="clipPath4196-9"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4198-1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="10.223117"
+ inkscape:cy="7.0200789"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 5,1042.3622 a 3,3 0 0 0 -3,3 l 0,2 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 3,-3 l 0,-2 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4534"
+ inkscape:connector-curvature="0" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4540"
+ width="2"
+ height="4.9999828"
+ x="7"
+ y="-1047.3623" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1046.3623"
+ x="9"
+ height="2.0000174"
+ width="2"
+ id="rect4542"
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4544"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 15 4 A 3 3 0 0 0 12 7 L 12 10 L 14 10 L 14 7 A 1.0000174 1.0000174 0 0 1 15 6 L 16 6 L 16 4 L 15 4 z "
+ transform="translate(0,1040.3622)"
+ id="rect4245-5" />
+ <rect
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4208"
+ width="1"
+ height="2"
+ x="0"
+ y="1048.3622" />
+ <rect
+ y="1042.3622"
+ x="5"
+ height="2"
+ width="1"
+ id="rect4210"
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4165"
+ width="1"
+ height="2.0000174"
+ x="10"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_string_array.svg b/tools/editor/icons/source/icon_mini_string_array.svg
new file mode 100644
index 0000000000..cd2e850c49
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_string_array.svg
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_string_array.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-7">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-5"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-3">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-5"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-6"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-2"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-9">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-1"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-753">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-56"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-2">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-9"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-1"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-27"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-0">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-9"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-75">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-3"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-5">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-6"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-2"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-9"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-1">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-2"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253-7-3">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255-5-6"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199-3-0">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201-5-6"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4392-6-2"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4394-2-6"
+ d="m 8.072266,1041.3622 a 5,5 0 0 0 -3.607422,1.4648 5,5 0 0 0 0,7.0704 5,5 0 0 0 7.070312,0 l -1.416015,-1.4161 A 3,3 0 0 1 8,1049.3622 a 3,3 0 0 1 -3,-3 3,3 0 0 1 3,-3 3,3 0 0 1 2.119141,0.8809 l 1.416015,-1.4161 a 5,5 0 0 0 -3.46289,-1.4648 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4196-9-1">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 8.0624999,1025.8622 a 3.375,2.9999997 0 0 0 -3.375,3 3.375,2.9999997 0 0 0 1.6875,2.5957 l 0,9.8115 a 3.375,2.9999997 0 0 0 -1.6875,2.5928 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.3750001,-3 3.375,2.9999997 0 0 0 -1.6875001,-2.5957 l 0,-8.7832 11.9311511,10.6054 a 3.375,2.9999997 0 0 0 -0.118651,0.7735 3.375,2.9999997 0 0 0 3.375,3 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -0.873413,0.1025 l -11.927857,-10.6025 9.884399,0 a 3.375,2.9999997 0 0 0 2.916871,1.5 3.375,2.9999997 0 0 0 3.375,-3 3.375,2.9999997 0 0 0 -3.375,-3 3.375,2.9999997 0 0 0 -2.920166,1.5 l -11.037964,0 a 3.375,2.9999997 0 0 0 -2.9168701,-1.5 z"
+ id="path4198-1-8"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254838"
+ inkscape:cx="8.8695857"
+ inkscape:cy="6.6197"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 0 0 L 0 2 L 0 10 L 0 12 L 2 12 L 4 12 L 4 10 L 2 10 L 2 2 L 4 2 L 4 0 L 2 0 L 0 0 z M 12 0 L 12 2 L 14 2 L 14 10 L 12 10 L 12 12 L 16 12 L 16 10 L 16 0 L 12 0 z "
+ transform="translate(0,1040.3622)"
+ id="rect4158" />
+ <path
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7,1042.3622 a 3,3 0 0 0 -3,3 l 0,2 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 3,-3 l 0,-2 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4184"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1044.3622 a 3,3 0 0 0 -3,3 l 0,3 2,0 0,-3 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4534"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b5d3f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1042.3622 0,5 a 3,3 0 0 0 3,3 l 0,-2 a 1.0000174,1.0000174 0 0 1 -1,-1 l 0,-1 1,0 0,-2 -1,0 0,-2 -2,0 z"
+ id="rect4540"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none"
+ id="rect4184"
+ width="1"
+ height="2"
+ x="7"
+ y="1042.3622" />
+ <rect
+ y="1048.3622"
+ x="2"
+ height="2"
+ width="1"
+ id="rect4186"
+ style="fill:#6ba7ec;fill-opacity:1;stroke:none" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_transform.svg b/tools/editor/icons/source/icon_mini_transform.svg
new file mode 100644
index 0000000000..a844171dd4
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_transform.svg
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_transform.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="5.8969613"
+ inkscape:cy="6.372864"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#f3e49c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1042.3622 a 3,3 0 0 0 -3,3 l 0,5 2,0 0,-2 1,0 0,-2 -1,0 0,-1 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="rect4455"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ecd669;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1044.3622 0,6 2,0 0,-4 a 1.0000174,1.0000174 0 0 1 1,1 l 0,3 2,0 0,-3 0,-1 a 1.0000174,1.0000174 0 0 1 1,1 l 0,3 2,0 0,-3 a 3,3 0 0 0 -3,-3 l -2,0 0,0.1758 a 3,3 0 0 0 -1,-0.1758 l -2,0 z"
+ id="path4771"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ecd669;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7,1044.3622 a 3,3 0 0 0 -3,3 l 0,3 2,0 0,-3 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="rect4601"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#f3e49c;fill-opacity:1;stroke:none"
+ id="rect4139"
+ width="1"
+ height="2"
+ x="3"
+ y="1042.3622" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_variant.svg b/tools/editor/icons/source/icon_mini_variant.svg
new file mode 100644
index 0000000000..6883baa584
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_variant.svg
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_variant.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="5.8864792"
+ inkscape:cy="6.2518921"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1044.3622"
+ x="3"
+ height="5.9999666"
+ width="2"
+ id="rect4320"
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1044.3622"
+ x="6"
+ height="5.9999843"
+ width="2"
+ id="rect4324"
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4326"
+ width="1"
+ height="2.0000174"
+ x="3"
+ y="1044.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4328"
+ d="m 3,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4330" />
+ <rect
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4334"
+ width="2"
+ height="7.9999843"
+ x="14"
+ y="-1052.3622"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4338"
+ width="2"
+ height="2.9999826"
+ x="11"
+ y="-1047.3622"
+ transform="scale(1,-1)" />
+ <path
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4340"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4342"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#69ecbd;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4344"
+ width="2"
+ height="3.0000174"
+ x="9"
+ y="1047.3622" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_vector2.svg b/tools/editor/icons/source/icon_mini_vector2.svg
new file mode 100644
index 0000000000..5c9aaeccff
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_vector2.svg
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_vector2.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="-0.61809703"
+ inkscape:cy="8.3891446"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1050.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ id="path4301"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="1044.3622"
+ x="4"
+ height="3"
+ width="2"
+ id="rect4303"
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#dcc5f8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4159"
+ width="5"
+ height="2"
+ x="11"
+ y="1048.3622" />
+ <rect
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4661"
+ width="2"
+ height="5.9999828"
+ x="1"
+ y="1044.3622" />
+ <rect
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4667"
+ width="1"
+ height="2.0000174"
+ x="9"
+ y="1044.3622" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4669"
+ d="m 9,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="9"
+ height="2.0000174"
+ width="1"
+ id="rect4671"
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 9,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ id="path4673"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#dcc5f8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4677"
+ sodipodi:type="arc"
+ sodipodi:cx="13"
+ sodipodi:cy="1048.3622"
+ sodipodi:rx="2"
+ sodipodi:ry="2"
+ sodipodi:start="1.5707963"
+ sodipodi:end="4.712389"
+ d="m 13,1050.3622 a 2,2 0 0 1 -1.732051,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.732051,-1"
+ sodipodi:open="true" />
+ <path
+ style="fill:#dcc5f8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13,1042.3622 0,2 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597656,-1.5 z"
+ id="path4679"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="1042.3622"
+ x="12"
+ height="2"
+ width="1"
+ id="rect4684"
+ style="fill:#dcc5f8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_vector2_array.svg b/tools/editor/icons/source/icon_mini_vector2_array.svg
new file mode 100644
index 0000000000..03850f7c86
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_vector2_array.svg
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_vector2_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="7.5779741"
+ inkscape:cy="8.910903"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1050.3622"
+ x="0"
+ height="2.0000174"
+ width="4"
+ id="rect4158"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4160"
+ width="2"
+ height="12.000017"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4162"
+ width="4"
+ height="2.0000174"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4170"
+ width="4"
+ height="2.0000174"
+ x="-16"
+ y="1050.3622"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="12.000017"
+ width="2"
+ id="rect4172"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="2.0000174"
+ width="4"
+ id="rect4175"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <path
+ style="fill:#bd91f1;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 3 3 L 3 9 L 5 9 A 3 3 0 0 0 8 6 L 8 3 L 6 3 L 6 6 A 1.0000174 1.0000174 0 0 1 5 7 L 5 3 L 3 3 z "
+ transform="translate(0,1040.3622)"
+ id="path4301" />
+ <path
+ style="fill:#dcc5f8;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8.9999969,1042.3622 0,2 1.0000001,0 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 2,2 0 0 0 -1.732422,1 2,2 0 0 0 -0.265625,1 l -0.00195,0 0,0.047 0,1.9531 2,0 3,0 0,-2 -3,0 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597659,-1.5001 l -1.0000001,0 z"
+ id="rect4159"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_vector3.svg b/tools/editor/icons/source/icon_mini_vector3.svg
new file mode 100644
index 0000000000..e99a211ae0
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_vector3.svg
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_vector3.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000002"
+ inkscape:cx="5.3282118"
+ inkscape:cy="6.0229362"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4705"
+ d="m 3.0004202,1050.3622 a 3,3 0 0 0 3,-3 l -2,0 a 1.0000174,1.0000174 0 0 1 -1,1 l 0,2 z"
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4707"
+ width="2"
+ height="3"
+ x="4.0004206"
+ y="1044.3622" />
+ <rect
+ y="1044.3622"
+ x="1.0004202"
+ height="5.9999828"
+ width="2"
+ id="rect4711"
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1044.3622"
+ x="9.0004196"
+ height="2.0000174"
+ width="1"
+ id="rect4713"
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 9.0004202,1044.3622 a 3,3 0 0 0 -3,3 l 2,0 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z"
+ id="path4715"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4717"
+ width="1"
+ height="2.0000174"
+ x="9.0004196"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4719"
+ d="m 9.0004202,1050.3622 a 3,3 0 0 1 -3,-3 l 2,0 a 1.0000174,1.0000174 0 0 0 1,1 l 0,2 z"
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#eeb9f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 13 2 L 13 3 A 1 1 0 0 1 14 4 A 1 1 0 0 1 13 5 L 13 7 A 3 3 0 0 0 15.597656 5.5 A 3 3 0 0 0 15.597656 2.5 A 3 3 0 0 0 15.234375 2 L 13 2 z "
+ transform="translate(0,1040.3622)"
+ id="path4723" />
+ <rect
+ style="fill:#eeb9f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4725"
+ width="3.9995804"
+ height="2"
+ x="12.00042"
+ y="1042.3622" />
+ <path
+ style="fill:#eeb9f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13.00042,1045.3622 0,2 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597656,-1.5 z"
+ id="path4727"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="1049.3622"
+ x="12.00042"
+ height="2"
+ width="1"
+ id="rect4729"
+ style="fill:#eeb9f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_mini_vector3_array.svg b/tools/editor/icons/source/icon_mini_vector3_array.svg
new file mode 100644
index 0000000000..bbac554614
--- /dev/null
+++ b/tools/editor/icons/source/icon_mini_vector3_array.svg
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_mini_vector3_array.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="4.9242706"
+ inkscape:cy="8.3355467"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <rect
+ y="1050.3622"
+ x="0"
+ height="2.0000174"
+ width="4"
+ id="rect4158"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4160"
+ width="2"
+ height="12.000017"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4162"
+ width="4"
+ height="2.0000174"
+ x="0"
+ y="1040.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4170"
+ width="4"
+ height="2.0000174"
+ x="-16"
+ y="1050.3622"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="12.000017"
+ width="2"
+ id="rect4172"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <rect
+ y="1040.3622"
+ x="-16"
+ height="2.0000174"
+ width="4"
+ id="rect4175"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(-1,1)" />
+ <path
+ style="fill:#e286f0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 3 3 L 3 9 L 5 9 A 3 3 0 0 0 8 6 L 8 3 L 6 3 L 6 6 A 1.0000174 1.0000174 0 0 1 5 7 L 5 3 L 3 3 z "
+ transform="translate(0,1040.3622)"
+ id="path4705" />
+ <path
+ style="fill:#eeb9f6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8 1 L 8 3 L 9 3 L 10 3 A 1 1 0 0 1 9 4 L 9 6 A 1 1 0 0 1 10 7 A 1 1 0 0 1 9 8 L 8 8 L 8 10 L 9 10 A 3 3 0 0 0 11.597656 8.5 A 3 3 0 0 0 11.597656 5.5 A 3 3 0 0 0 11.232422 4.9980469 A 3 3 0 0 0 11.597656 4.5 A 3 3 0 0 0 11.996094 3 L 12 3 L 12 1 L 11.234375 1 L 9 1 L 8 1 z "
+ transform="translate(0,1040.3622)"
+ id="path4723" />
+ </g>
+</svg>
diff --git a/tools/editor/icons/source/icon_ray_shape_2d.svg b/tools/editor/icons/source/icon_ray_shape_2d.svg
index e6ac9c40fa..7ffc2ff3b5 100644
--- a/tools/editor/icons/source/icon_ray_shape_2d.svg
+++ b/tools/editor/icons/source/icon_ray_shape_2d.svg
@@ -1,22 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_ray_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1" inkscape:cx="-0.53108971" inkscape:cy="10.128279" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <path style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98823529" d="m 8,1038.3622 0,12" id="path4203" inkscape:connector-curvature="0" sodipodi:nodetypes="cc" />
- <path sodipodi:nodetypes="ccc" inkscape:connector-curvature="0" id="path4224" d="m 5,1047.3622 3,3 3,-3" style="fill:none;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98823529" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_ray_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="-3.626492"
+ inkscape:cy="10.256723"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 8,1038.3622 0,12"
+ id="path4203"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="ccc"
+ inkscape:connector-curvature="0"
+ id="path4224"
+ d="m 5,1047.3622 3,3 3,-3"
+ style="fill:none;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_rectangle_shape_2d.svg b/tools/editor/icons/source/icon_rectangle_shape_2d.svg
index dd0941fe85..d362944e7a 100644
--- a/tools/editor/icons/source/icon_rectangle_shape_2d.svg
+++ b/tools/editor/icons/source/icon_rectangle_shape_2d.svg
@@ -1,21 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_rectangle_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="52.6875" inkscape:cx="8" inkscape:cy="8" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <rect style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:none;fill-opacity:0.98823529;fill-rule:evenodd;stroke:#a5b7f3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:0.98823529;marker:none;enable-background:accumulate" id="rect4226" width="12" height="7.9999824" x="2" y="1040.3622" rx="1.7382812e-05" ry="1.7382812e-05" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_rectangle_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="52.6875"
+ inkscape:cx="4.6595492"
+ inkscape:cy="7.9620403"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <rect
+ style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:none;fill-opacity:0.98823529;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate"
+ id="rect4226"
+ width="12"
+ height="7.9999824"
+ x="2"
+ y="1040.3622"
+ rx="1.7382812e-05"
+ ry="1.7382812e-05" />
+ </g>
</svg>
diff --git a/tools/editor/icons/source/icon_segment_shape_2d.svg b/tools/editor/icons/source/icon_segment_shape_2d.svg
index 99c8f80e9b..b509a31362 100644
--- a/tools/editor/icons/source/icon_segment_shape_2d.svg
+++ b/tools/editor/icons/source/icon_segment_shape_2d.svg
@@ -1,21 +1,82 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="16" height="16" viewBox="0 0 16 16" id="svg2" version="1.1" inkscape:version="0.91 r13725" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_segment_shape_2d.svg">
- <defs id="defs4" />
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="52.6875" inkscape:cx="8" inkscape:cy="8" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" inkscape:window-width="1920" inkscape:window-height="1055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:object-paths="true" inkscape:snap-intersection-paths="true" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true">
- <inkscape:grid type="xygrid" id="grid3336" />
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)">
- <path style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#a4b6f2;fill-opacity:1;fill-rule:evenodd;stroke:#a5b7f4;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:0.98823529;marker:none;enable-background:accumulate" d="m 2,1050.3622 12,-12" id="path4268" inkscape:connector-curvature="0" />
- </g>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_segment_shape_2d.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="52.6875"
+ inkscape:cx="5.5326216"
+ inkscape:cy="8.6453144"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:snap-midpoints="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#68b6ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate"
+ d="m 2,1050.3622 12,-12"
+ id="path4268"
+ inkscape:connector-curvature="0" />
+ </g>
</svg>
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 02a24f8ddb..66b24dab44 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2979,57 +2979,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case VIEW_CENTER_TO_SELECTION:
case VIEW_FRAME_TO_SELECTION: {
- Vector2 center(0.f, 0.f);
- Rect2 rect;
- int count = 0;
-
- Map<Node*,Object*> &selection = editor_selection->get_selection();
- for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
- CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
- if (!canvas_item) continue;
- if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
- continue;
-
-
- // counting invisible items, for now
- //if (!canvas_item->is_visible()) continue;
- ++count;
-
- Rect2 item_rect = canvas_item->get_item_rect();
-
- Vector2 pos = canvas_item->get_global_transform().get_origin();
- Vector2 scale = canvas_item->get_global_transform().get_scale();
- real_t angle = canvas_item->get_global_transform().get_rotation();
-
- Matrix32 t(angle, Vector2(0.f,0.f));
- item_rect = t.xform(item_rect);
- Rect2 canvas_item_rect(pos + scale*item_rect.pos, scale*item_rect.size);
- if (count == 1) {
- rect = canvas_item_rect;
- } else {
- rect = rect.merge(canvas_item_rect);
- }
- };
- if (count==0) break;
-
- if (p_op == VIEW_CENTER_TO_SELECTION) {
-
- center = rect.pos + rect.size/2;
- Vector2 offset = viewport->get_size()/2 - editor->get_scene_root()->get_global_canvas_transform().xform(center);
- h_scroll->set_val(h_scroll->get_val() - offset.x/zoom);
- v_scroll->set_val(v_scroll->get_val() - offset.y/zoom);
-
- } else { // VIEW_FRAME_TO_SELECTION
-
- if (rect.size.x > CMP_EPSILON && rect.size.y > CMP_EPSILON) {
- float scale_x = viewport->get_size().x/rect.size.x;
- float scale_y = viewport->get_size().y/rect.size.y;
- zoom = scale_x < scale_y? scale_x:scale_y;
- zoom *= 0.90;
- _update_scroll(0);
- call_deferred("_popup_callback", VIEW_CENTER_TO_SELECTION);
- }
- }
+ _focus_selection(p_op);
} break;
case SKELETON_MAKE_BONES: {
@@ -3142,6 +3092,62 @@ template< class P, class C > void CanvasItemEditor::space_selected_items() {
}
#endif
+
+void CanvasItemEditor::_focus_selection(int p_op) {
+ Vector2 center(0.f, 0.f);
+ Rect2 rect;
+ int count = 0;
+
+ Map<Node*,Object*> &selection = editor_selection->get_selection();
+ for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
+ CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
+ if (!canvas_item) continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
+
+ // counting invisible items, for now
+ //if (!canvas_item->is_visible()) continue;
+ ++count;
+
+ Rect2 item_rect = canvas_item->get_item_rect();
+
+ Vector2 pos = canvas_item->get_global_transform().get_origin();
+ Vector2 scale = canvas_item->get_global_transform().get_scale();
+ real_t angle = canvas_item->get_global_transform().get_rotation();
+
+ Matrix32 t(angle, Vector2(0.f,0.f));
+ item_rect = t.xform(item_rect);
+ Rect2 canvas_item_rect(pos + scale*item_rect.pos, scale*item_rect.size);
+ if (count == 1) {
+ rect = canvas_item_rect;
+ } else {
+ rect = rect.merge(canvas_item_rect);
+ }
+ };
+ if (count==0) return;
+
+ if (p_op == VIEW_CENTER_TO_SELECTION) {
+
+ center = rect.pos + rect.size/2;
+ Vector2 offset = viewport->get_size()/2 - editor->get_scene_root()->get_global_canvas_transform().xform(center);
+ h_scroll->set_val(h_scroll->get_val() - offset.x/zoom);
+ v_scroll->set_val(v_scroll->get_val() - offset.y/zoom);
+
+ } else { // VIEW_FRAME_TO_SELECTION
+
+ if (rect.size.x > CMP_EPSILON && rect.size.y > CMP_EPSILON) {
+ float scale_x = viewport->get_size().x/rect.size.x;
+ float scale_y = viewport->get_size().y/rect.size.y;
+ zoom = scale_x < scale_y? scale_x:scale_y;
+ zoom *= 0.90;
+ _update_scroll(0);
+ call_deferred("_popup_callback", VIEW_CENTER_TO_SELECTION);
+ }
+ }
+}
+
+
void CanvasItemEditor::_bind_methods() {
ObjectTypeDB::bind_method("_node_removed",&CanvasItemEditor::_node_removed);
@@ -3247,6 +3253,12 @@ VSplitContainer *CanvasItemEditor::get_bottom_split() {
return bottom_split;
}
+
+void CanvasItemEditor::focus_selection() {
+ _focus_selection(VIEW_CENTER_TO_SELECTION);
+}
+
+
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
tool = TOOL_SELECT;
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index 22acfceed0..ea582f6fa7 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -352,6 +352,8 @@ class CanvasItemEditor : public VBoxContainer {
void _viewport_input_event(const InputEvent& p_event);
void _viewport_draw();
+ void _focus_selection(int p_op);
+
void _set_anchor(Control::AnchorType p_left,Control::AnchorType p_top,Control::AnchorType p_right,Control::AnchorType p_bottom);
HSplitContainer *palette_split;
@@ -414,10 +416,12 @@ public:
Control *get_viewport_control() { return viewport; }
-
bool get_remove_list(List<Node*> *p_list);
void set_undo_redo(UndoRedo *p_undo_redo) {undo_redo=p_undo_redo; }
void edit(CanvasItem *p_canvas_item);
+
+ void focus_selection();
+
CanvasItemEditor(EditorNode *p_editor);
};
diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp
index f4258836e5..876fab0d6e 100644
--- a/tools/editor/plugins/material_editor_plugin.cpp
+++ b/tools/editor/plugins/material_editor_plugin.cpp
@@ -103,7 +103,7 @@ MaterialEditor::MaterialEditor() {
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);
- viewport->set_process_input(false);
+ viewport->set_disable_input(true);
camera = memnew( Camera );
camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp
index 71cf33ba1b..b70cbad25f 100644
--- a/tools/editor/plugins/mesh_editor_plugin.cpp
+++ b/tools/editor/plugins/mesh_editor_plugin.cpp
@@ -147,7 +147,7 @@ MeshEditor::MeshEditor() {
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);
- viewport->set_process_input(false);
+ viewport->set_disable_input(true);
camera = memnew( Camera );
camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 74c8ac9766..fdb7856b83 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -987,6 +987,20 @@ void ScriptEditor::_notification(int p_what) {
}
+bool ScriptEditor::can_take_away_focus() const {
+
+ int selected = tab_container->get_current_tab();
+ if (selected<0 || selected>=tab_container->get_child_count())
+ return true;
+
+ ScriptEditorBase *current = tab_container->get_child(selected)->cast_to<ScriptEditorBase>();
+ if (!current)
+ return true;
+
+
+ return current->can_lose_focus_on_node_selection();
+
+}
void ScriptEditor::close_builtin_scripts_from_scene(const String& p_scene) {
@@ -1397,7 +1411,7 @@ void ScriptEditor::_update_script_names() {
-void ScriptEditor::edit(const Ref<Script>& p_script) {
+void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) {
if (p_script.is_null())
return;
@@ -1471,7 +1485,9 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
}
- _go_to_tab(tab_container->get_tab_count()-1);
+ if (p_grab_focus) {
+ _go_to_tab(tab_container->get_tab_count()-1);
+ }
@@ -1932,6 +1948,13 @@ void ScriptEditor::_help_search(String p_text) {
help_search_dialog->popup(p_text);
}
+void ScriptEditor::_open_script_request(const String& p_path) {
+
+ Ref<Script> script = ResourceLoader::load(p_path);
+ if (script.is_valid()) {
+ script_editor->edit(script,false);
+ }
+}
int ScriptEditor::script_editor_func_count=0;
CreateScriptEditorFunc ScriptEditor::script_editor_funcs[ScriptEditor::SCRIPT_EDITOR_FUNC_MAX];
@@ -2208,6 +2231,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
edit_pass=0;
trim_trailing_whitespace_on_save = false;
+
+ ScriptServer::edit_request_func=_open_script_request;
}
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 5cb70e13d7..1a23ffed72 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -101,6 +101,7 @@ public:
virtual void add_callback(const String& p_function,StringArray p_args)=0;
virtual void update_settings()=0;
virtual void set_debugger_active(bool p_active)=0;
+ virtual bool can_lose_focus_on_node_selection() { return true; }
virtual void set_tooltip_request_func(String p_method,Object* p_obj)=0;
virtual Control *get_edit_menu()=0;
@@ -285,6 +286,8 @@ class ScriptEditor : public VBoxContainer {
int file_dialog_option;
void _file_dialog_action(String p_file);
+ static void _open_script_request(const String& p_path);
+
static ScriptEditor *script_editor;
protected:
void _notification(int p_what);
@@ -297,7 +300,7 @@ public:
void apply_scripts() const;
void ensure_select_current();
- void edit(const Ref<Script>& p_script);
+ void edit(const Ref<Script>& p_script,bool p_grab_focus=true);
Dictionary get_state() const;
void set_state(const Dictionary& p_state);
@@ -320,6 +323,10 @@ public:
void close_builtin_scripts_from_scene(const String& p_scene);
+ void goto_help(const String& p_desc) { _help_class_goto(p_desc); }
+
+ bool can_take_away_focus() const;
+
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index a70df78697..95106d2c81 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -1980,33 +1980,8 @@ void SpatialEditorViewport::_menu_option(int p_option) {
} break;
case VIEW_CENTER_TO_SELECTION: {
- if (!get_selected_count())
- break;
-
- Vector3 center;
- int count=0;
-
- List<Node*> &selection = editor_selection->get_selected_node_list();
-
- for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
-
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ focus_selection();
- SpatialEditorSelectedItem *se=editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
- continue;
-
- center+=sp->get_global_transform().origin;
- count++;
- }
-
- if( count != 0 ) {
- center/=float(count);
- }
-
- cursor.pos=center;
} break;
case VIEW_ALIGN_SELECTION_WITH_VIEW: {
@@ -2323,6 +2298,38 @@ void SpatialEditorViewport::reset() {
_update_name();
}
+
+void SpatialEditorViewport::focus_selection() {
+ if (!get_selected_count())
+ return;
+
+ Vector3 center;
+ int count=0;
+
+ List<Node*> &selection = editor_selection->get_selected_node_list();
+
+ for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
+
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
+
+ SpatialEditorSelectedItem *se=editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
+
+ center+=sp->get_global_transform().origin;
+ count++;
+ }
+
+ if( count != 0 ) {
+ center/=float(count);
+ }
+
+ cursor.pos=center;
+}
+
+
SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, EditorNode *p_editor, int p_index) {
_edit.mode=TRANSFORM_NONE;
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index 54086b0031..975092a01d 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -253,6 +253,9 @@ public:
void set_state(const Dictionary& p_state);
Dictionary get_state() const;
void reset();
+
+ void focus_selection();
+
Viewport *get_viewport_node() { return viewport; }
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index 3d220b8474..43086fb208 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -388,6 +388,10 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
drag_index = -1;
}
}
+ } else if (mb.button_index == BUTTON_WHEEL_UP) {
+ _zoom_in();
+ } else if (mb.button_index == BUTTON_WHEEL_DOWN) {
+ _zoom_out();
}
} else if (p_input.type==InputEvent::MOUSE_MOTION) {
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index d686c37d1a..316077c5d5 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -34,6 +34,7 @@
#include "canvas_item_editor_plugin.h"
#include "tools/editor/editor_settings.h"
+#include "tools/editor/editor_scale.h"
void TileMapEditor::_notification(int p_what) {
@@ -50,6 +51,12 @@ void TileMapEditor::_notification(int p_what) {
rotate_270->set_icon(get_icon("Rotate270","EditorIcons"));
} break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
+ if (is_visible()) {
+ _update_palette();
+ }
+ } break;
}
}
@@ -205,16 +212,16 @@ void TileMapEditor::_update_palette() {
if (tiles.empty())
return;
+ float min_size = EDITOR_DEF("tile_map/preview_size", 64);
+ min_size *= EDSCALE;
+ int hseparation = EDITOR_DEF("tile_map/palette_item_hseparation",8);
+ bool show_tile_names = bool(EDITOR_DEF("tile_map/show_tile_names", true));
- palette->set_max_columns(0);
- palette->add_constant_override("hseparation", 6);
+ palette->add_constant_override("hseparation", hseparation*EDSCALE);
+ palette->add_constant_override("vseparation", 8*EDSCALE);
- float min_size = EDITOR_DEF("tile_map/preview_size",64);
palette->set_fixed_icon_size(Size2(min_size, min_size));
- palette->set_fixed_column_width(min_size*3/2);
- palette->set_icon_mode(ItemList::ICON_MODE_TOP);
- palette->set_max_text_lines(2);
-
+ palette->set_fixed_column_width(min_size * MAX(size_slider->get_val(), 1));
String filter = search_box->get_text().strip_edges();
@@ -228,10 +235,14 @@ void TileMapEditor::_update_palette() {
name = "#"+itos(E->get());
}
- if (filter != "" && name.findn(filter) == -1)
+ if (filter != "" && !filter.is_subsequence_ofi(name))
continue;
- palette->add_item(name);
+ if (show_tile_names) {
+ palette->add_item(name);
+ } else {
+ palette->add_item(String());
+ }
Ref<Texture> tex = tileset->tile_get_texture(E->get());
@@ -252,7 +263,7 @@ void TileMapEditor::_update_palette() {
if (selected != -1)
set_selected_tile(selected);
else
- palette->select(0, true);
+ palette->select(0);
}
void TileMapEditor::_pick_tile(const Point2& p_pos) {
@@ -1348,6 +1359,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
palette = memnew( ItemList );
palette->set_v_size_flags(SIZE_EXPAND_FILL);
palette->set_custom_minimum_size(Size2(mw,0));
+ palette->set_max_columns(0);
+ palette->set_icon_mode(ItemList::ICON_MODE_TOP);
+ palette->set_max_text_lines(2);
add_child(palette);
// Add menu items
@@ -1458,6 +1472,9 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("tile_map/preview_size",64);
+ EDITOR_DEF("tile_map/palette_item_hseparation",8);
+ EDITOR_DEF("tile_map/show_tile_names", true);
+
tile_map_editor = memnew( TileMapEditor(p_node) );
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);
tile_map_editor->hide();
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index e8d22143ee..02d95abfa2 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -245,7 +245,7 @@ void ProjectSettings::_device_input_add() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
-
+ _show_last_added(ie);
}
@@ -283,7 +283,34 @@ void ProjectSettings::_press_a_key_confirm() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
+ _show_last_added(ie);
+}
+
+void ProjectSettings::_show_last_added(const InputEvent& p_event) {
+ TreeItem *r = input_editor->get_root();
+
+ if (!r)
+ return;
+ r=r->get_children();
+ if (!r)
+ return;
+ bool found = false;
+ while(r){
+ TreeItem *child = r->get_children();
+ while(child){
+ Variant input = child->get_meta("__input");
+ if (p_event==input){
+ child->select(0);
+ found = true;
+ break;
+ }
+ child=child->get_next();
+ }
+ if (found) break;
+ r=r->get_next();
+ }
+ if (found) input_editor->ensure_cursor_is_visible();
}
void ProjectSettings::_wait_for_key(const InputEvent& p_event) {
@@ -337,7 +364,7 @@ void ProjectSettings::_add_item(int p_item){
device_index->add_item(TTR("Button 7"));
device_index->add_item(TTR("Button 8"));
device_index->add_item(TTR("Button 9"));
- device_input->popup_centered(Size2(350,95));
+ device_input->popup_centered_minsize(Size2(350,95));
} break;
case InputEvent::JOYSTICK_MOTION: {
@@ -349,12 +376,12 @@ void ProjectSettings::_add_item(int p_item){
String desc = _axis_names[i];
device_index->add_item(TTR("Axis")+" "+itos(i/2)+" "+(i&1?"+":"-")+desc);
}
- device_input->popup_centered(Size2(350,95));
+ device_input->popup_centered_minsize(Size2(350,95));
} break;
case InputEvent::JOYSTICK_BUTTON: {
- device_id->set_val(0);
+ device_id->set_val(3);
device_index_label->set_text(TTR("Joystick Button Index:"));
device_index->clear();
@@ -362,7 +389,7 @@ void ProjectSettings::_add_item(int p_item){
device_index->add_item(itos(i)+": "+String(_button_names[i]));
}
- device_input->popup_centered(Size2(350,95));
+ device_input->popup_centered_minsize(Size2(350,95));
} break;
default:{}
@@ -543,6 +570,7 @@ void ProjectSettings::_update_actions() {
}
action->add_button(0,get_icon("Remove","EditorIcons"),2);
action->set_metadata(0,i);
+ action->set_meta("__input", ie);
}
}
}
@@ -1432,30 +1460,32 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
device_input->get_ok()->set_text(TTR("Add"));
device_input->connect("confirmed",this,"_device_input_add");
- l = memnew( Label );
- l->set_text(TTR("Device:"));
- l->set_pos(Point2(15,10));
- device_input->add_child(l);
+ hbc = memnew( HBoxContainer );
+ device_input->add_child(hbc);
+ device_input->set_child_rect(hbc);
+
+ VBoxContainer *vbc_left = memnew( VBoxContainer );
+ hbc->add_child(vbc_left);
l = memnew( Label );
- l->set_text(TTR("Index:"));
- l->set_pos(Point2(90,10));
- device_input->add_child(l);
- device_index_label=l;
+ l->set_text(TTR("Device:"));
+ vbc_left->add_child(l);
device_id = memnew( SpinBox );
- device_id->set_pos(Point2(20,30));
- device_id->set_size(Size2(70,10));
device_id->set_val(0);
+ vbc_left->add_child(device_id);
- device_input->add_child(device_id);
+ VBoxContainer *vbc_right = memnew( VBoxContainer );
+ hbc->add_child(vbc_right);
+ vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);
- device_index = memnew( OptionButton );
- device_index->set_pos(Point2(95,30));
- device_index->set_size(Size2(300,10));
- device_index->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10);
+ l = memnew( Label );
+ l->set_text(TTR("Index:"));
+ vbc_right->add_child(l);
+ device_index_label=l;
- device_input->add_child(device_index);
+ device_index = memnew( OptionButton );
+ vbc_right->add_child(device_index);
/*
save = memnew( Button );
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index 46e98f69ad..61ad094d00 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -111,7 +111,7 @@ class ProjectSettings : public AcceptDialog {
void _action_button_pressed(Object* p_obj, int p_column,int p_id);
void _wait_for_key(const InputEvent& p_event);
void _press_a_key_confirm();
-
+ void _show_last_added(const InputEvent& p_event);
void _settings_prop_edited(const String& p_name);
void _settings_changed();
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 0518018e5a..9fc9d52aa1 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -46,6 +46,7 @@
#include "scene/main/viewport.h"
#include "editor_file_system.h"
#include "create_dialog.h"
+#include "property_selector.h"
void CustomPropertyEditor::_notification(int p_what) {
@@ -83,6 +84,11 @@ void CustomPropertyEditor::_menu_option(int p_which) {
v=val;
emit_signal("variant_changed");
+ } else if (hint==PROPERTY_HINT_ENUM) {
+
+ v=p_which;
+ emit_signal("variant_changed");
+
}
} break;
case Variant::OBJECT: {
@@ -282,6 +288,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
switch(type) {
+ case Variant::BOOL: {
+
+ CheckBox *c=checks20[0];
+ c->set_text("True");
+ c->set_pos(Vector2(4,4));
+ c->set_pressed(v);
+ c->show();
+ set_size(checks20[0]->get_pos()+checks20[0]->get_size()+Vector2(4,4)*EDSCALE);
+
+ } break;
case Variant::INT:
case Variant::REAL: {
@@ -322,9 +338,24 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
set_size(Size2(70,35)*EDSCALE);
}
+ } else if (hint==PROPERTY_HINT_ENUM) {
+
+ menu->clear();
+ Vector<String> options = hint_text.split(",");
+ for(int i=0;i<options.size();i++) {
+ menu->add_item(options[i],i);
+ }
+ menu->set_pos(get_pos());
+ menu->popup();
+ hide();
+ updating=false;
+ return false;
+
} else if (hint==PROPERTY_HINT_ALL_FLAGS) {
+ checks20[0]->set_text("");
+
uint32_t flgs = v;
for(int i=0;i<2;i++) {
@@ -438,6 +469,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
} else if (hint==PROPERTY_HINT_TYPE_STRING) {
+
if (!create_dialog) {
create_dialog = memnew( CreateDialog );
create_dialog->connect("create",this,"_create_dialog_callback");
@@ -452,6 +484,112 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
create_dialog->popup(false);
hide();
+ updating=false;
+ return false;
+
+
+ } else if (hint==PROPERTY_HINT_METHOD_OF_VARIANT_TYPE) {
+#define MAKE_PROPSELECT if (!property_select) { property_select = memnew(PropertySelector); property_select->connect("selected",this,"_create_selected_property"); add_child(property_select); } hide();
+
+ MAKE_PROPSELECT;
+
+ Variant::Type type=Variant::NIL;
+ for(int i=0;i<Variant::VARIANT_MAX;i++) {
+ if (hint_text==Variant::get_type_name(Variant::Type(i))) {
+ type=Variant::Type(i);
+ }
+ }
+ if (type)
+ property_select->select_method_from_basic_type(type,v);
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_METHOD_OF_BASE_TYPE) {
+ MAKE_PROPSELECT
+
+ property_select->select_method_from_base_type(hint_text,v);
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_METHOD_OF_INSTANCE) {
+
+ MAKE_PROPSELECT
+
+ Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+ if (instance)
+ property_select->select_method_from_instance(instance,v);
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_METHOD_OF_SCRIPT) {
+ MAKE_PROPSELECT
+
+ Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+ if (obj && obj->cast_to<Script>()) {
+ property_select->select_method_from_script(obj->cast_to<Script>(),v);
+ }
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE) {
+
+ MAKE_PROPSELECT
+ Variant::Type type=Variant::NIL;
+ String tname=hint_text;
+ if (tname.find(".")!=-1)
+ tname=tname.get_slice(".",0);
+ for(int i=0;i<Variant::VARIANT_MAX;i++) {
+ if (tname==Variant::get_type_name(Variant::Type(i))) {
+ type=Variant::Type(Variant::Type(i));
+ }
+ }
+ InputEvent::Type iet = InputEvent::NONE;
+ if (hint_text.find(".")!=-1) {
+ iet=InputEvent::Type(int(hint_text.get_slice(".",1).to_int()));
+ }
+ if (type)
+ property_select->select_property_from_basic_type(type,iet,v);
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_PROPERTY_OF_BASE_TYPE) {
+
+ MAKE_PROPSELECT
+
+ property_select->select_property_from_base_type(hint_text,v);
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_PROPERTY_OF_INSTANCE) {
+
+ Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+ if (instance)
+ property_select->select_property_from_instance(instance,v);
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_PROPERTY_OF_SCRIPT) {
+ MAKE_PROPSELECT
+
+ Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+ if (obj && obj->cast_to<Script>()) {
+ property_select->select_property_from_script(obj->cast_to<Script>(),v);
+ }
+
+ updating=false;
+ return false;
+
+ } else if (hint==PROPERTY_HINT_TYPE_STRING) {
+ if (!create_dialog) {
+ create_dialog = memnew( CreateDialog );
+ create_dialog->connect("create",this,"_create_dialog_callback");
+ add_child(create_dialog);
+ }
} else {
List<String> names;
@@ -1009,6 +1147,10 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
return;
switch(type) {
+ case Variant::BOOL: {
+ v=checks20[0]->is_pressed();
+ emit_signal("variant_changed");
+ } break;
case Variant::INT: {
if (hint==PROPERTY_HINT_ALL_FLAGS) {
@@ -1043,6 +1185,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
file->clear_filters();
+
if (hint_text!="") {
Vector<String> extensions=hint_text.split(",");
for(int i=0;i<extensions.size();i++) {
@@ -1360,6 +1503,13 @@ void CustomPropertyEditor::_create_dialog_callback() {
emit_signal("variant_changed");
}
+void CustomPropertyEditor::_create_selected_property(const String& p_prop) {
+
+
+ v=p_prop;
+ emit_signal("variant_changed");
+}
+
void CustomPropertyEditor::_modified(String p_string) {
if (updating)
@@ -1753,6 +1903,7 @@ void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_text_edit_changed",&CustomPropertyEditor::_text_edit_changed);
ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option);
ObjectTypeDB::bind_method( "_create_dialog_callback",&CustomPropertyEditor::_create_dialog_callback);
+ ObjectTypeDB::bind_method( "_create_selected_property",&CustomPropertyEditor::_create_selected_property);
@@ -1877,6 +2028,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
slider->connect("value_changed",this,"_range_modified");
create_dialog = NULL;
+ property_select = NULL;
}
bool PropertyEditor::_might_be_in_instance() {
@@ -2150,6 +2302,19 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
p_item->set_text(1,obj->get(p_name));
}
+ if ( p_hint==PROPERTY_HINT_METHOD_OF_VARIANT_TYPE ||
+ p_hint==PROPERTY_HINT_METHOD_OF_BASE_TYPE ||
+ p_hint==PROPERTY_HINT_METHOD_OF_INSTANCE ||
+ p_hint==PROPERTY_HINT_METHOD_OF_SCRIPT ||
+ p_hint==PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE ||
+ p_hint==PROPERTY_HINT_PROPERTY_OF_BASE_TYPE ||
+ p_hint==PROPERTY_HINT_PROPERTY_OF_INSTANCE ||
+ p_hint==PROPERTY_HINT_PROPERTY_OF_SCRIPT ) {
+
+ p_item->set_text(1,obj->get(p_name));
+ }
+
+
if (p_hint==PROPERTY_HINT_ENUM) {
Vector<String> strings = p_hint_text.split(",");
@@ -3172,6 +3337,14 @@ void PropertyEditor::update_tree() {
} break;
+ case PROPERTY_HINT_METHOD_OF_VARIANT_TYPE: ///< a property of a type
+ case PROPERTY_HINT_METHOD_OF_BASE_TYPE: ///< a method of a base type
+ case PROPERTY_HINT_METHOD_OF_INSTANCE: ///< a method of an instance
+ case PROPERTY_HINT_METHOD_OF_SCRIPT: ///< a method of a script & base
+ case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: ///< a property of a type
+ case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: ///< a property of a base type
+ case PROPERTY_HINT_PROPERTY_OF_INSTANCE: ///< a property of an instance
+ case PROPERTY_HINT_PROPERTY_OF_SCRIPT: ///< a property of a script & base
case PROPERTY_HINT_TYPE_STRING: {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM);
@@ -3181,6 +3354,7 @@ void PropertyEditor::update_tree() {
item->set_text(1,obj->get(p.name));
} break;
+
default: {
item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING );
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index d911aae883..6c6c309d32 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -49,6 +49,8 @@
class PropertyValueEvaluator;
class CreateDialog;
+class PropertySelector;
+
class CustomPropertyEditor : public Popup {
OBJ_TYPE( CustomPropertyEditor, Popup );
@@ -103,6 +105,7 @@ class CustomPropertyEditor : public Popup {
Control *easing_draw;
CreateDialog *create_dialog;
+ PropertySelector *property_select;
Object* owner;
@@ -120,6 +123,7 @@ class CustomPropertyEditor : public Popup {
void _action_pressed(int p_which);
void _type_create_selected(int p_idx);
void _create_dialog_callback();
+ void _create_selected_property(const String &p_prop);
void _color_changed(const Color& p_color);
diff --git a/tools/editor/property_selector.cpp b/tools/editor/property_selector.cpp
new file mode 100644
index 0000000000..20b72240d9
--- /dev/null
+++ b/tools/editor/property_selector.cpp
@@ -0,0 +1,598 @@
+#include "property_selector.h"
+#include "editor_scale.h"
+
+#include "os/keyboard.h"
+
+void PropertySelector::_text_changed(const String& p_newtext) {
+
+ _update_search();
+}
+
+void PropertySelector::_sbox_input(const InputEvent& p_ie) {
+
+ if (p_ie.type==InputEvent::KEY) {
+
+ switch(p_ie.key.scancode) {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN: {
+
+ search_options->call("_input_event", p_ie);
+ search_box->accept_event();
+
+ TreeItem *root = search_options->get_root();
+ if (!root->get_children())
+ break;
+
+ TreeItem *current = search_options->get_selected();
+
+ TreeItem *item = search_options->get_next_selected(root);
+ while (item) {
+ item->deselect(0);
+ item = search_options->get_next_selected(item);
+ }
+
+ current->select(0);
+
+ } break;
+ }
+ }
+}
+
+
+void PropertySelector::_update_search() {
+
+
+ if (properties)
+ set_title(TTR("Select Property"));
+ else
+ set_title(TTR("Select Method"));
+
+ search_options->clear();
+ help_bit->set_text("");
+
+
+ TreeItem *root = search_options->create_item();
+
+
+ if (properties) {
+
+ List<PropertyInfo> props;
+
+ if (instance) {
+ instance->get_property_list(&props,true);
+ } else if (type!=Variant::NIL) {
+ Variant v;
+ if (type==Variant::INPUT_EVENT) {
+ InputEvent ie;
+ ie.type=event_type;
+ v=ie;
+ } else {
+ Variant::CallError ce;
+ v=Variant::construct(type,NULL,0,ce);
+ }
+
+ v.get_property_list(&props);
+ } else {
+
+
+ Object *obj = ObjectDB::get_instance(script);
+ if (obj && obj->cast_to<Script>()) {
+
+ props.push_back(PropertyInfo(Variant::NIL,"Script Variables",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_CATEGORY));
+ obj->cast_to<Script>()->get_script_property_list(&props);
+ }
+
+ StringName base=base_type;
+ while(base) {
+ props.push_back(PropertyInfo(Variant::NIL,base,PROPERTY_HINT_NONE,"",PROPERTY_USAGE_CATEGORY));
+ ObjectTypeDB::get_property_list(base,&props,true);
+ base=ObjectTypeDB::type_inherits_from(base);
+ }
+
+ }
+
+ TreeItem *category=NULL;
+
+ bool found=false;
+
+ Ref<Texture> type_icons[Variant::VARIANT_MAX]={
+ Control::get_icon("MiniVariant","EditorIcons"),
+ Control::get_icon("MiniBoolean","EditorIcons"),
+ Control::get_icon("MiniInteger","EditorIcons"),
+ Control::get_icon("MiniFloat","EditorIcons"),
+ Control::get_icon("MiniString","EditorIcons"),
+ Control::get_icon("MiniVector2","EditorIcons"),
+ Control::get_icon("MiniRect2","EditorIcons"),
+ Control::get_icon("MiniVector3","EditorIcons"),
+ Control::get_icon("MiniMatrix2","EditorIcons"),
+ Control::get_icon("MiniPlane","EditorIcons"),
+ Control::get_icon("MiniQuat","EditorIcons"),
+ Control::get_icon("MiniAabb","EditorIcons"),
+ Control::get_icon("MiniMatrix3","EditorIcons"),
+ Control::get_icon("MiniTransform","EditorIcons"),
+ Control::get_icon("MiniColor","EditorIcons"),
+ Control::get_icon("MiniImage","EditorIcons"),
+ Control::get_icon("MiniPath","EditorIcons"),
+ Control::get_icon("MiniRid","EditorIcons"),
+ Control::get_icon("MiniObject","EditorIcons"),
+ Control::get_icon("MiniInput","EditorIcons"),
+ Control::get_icon("MiniDictionary","EditorIcons"),
+ Control::get_icon("MiniArray","EditorIcons"),
+ Control::get_icon("MiniRawArray","EditorIcons"),
+ Control::get_icon("MiniIntArray","EditorIcons"),
+ Control::get_icon("MiniFloatArray","EditorIcons"),
+ Control::get_icon("MiniStringArray","EditorIcons"),
+ Control::get_icon("MiniVector2Array","EditorIcons"),
+ Control::get_icon("MiniVector3Array","EditorIcons"),
+ Control::get_icon("MiniColorArray","EditorIcons")
+ };
+
+
+ for (List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
+ if (E->get().usage==PROPERTY_USAGE_CATEGORY) {
+ if (category && category->get_children()==NULL) {
+ memdelete(category); //old category was unused
+ }
+ category = search_options->create_item(root);
+ category->set_text(0,E->get().name);
+ category->set_selectable(0,false);
+
+ Ref<Texture> icon;
+ if (E->get().name=="Script Variables") {
+ icon=get_icon("Script","EditorIcons");
+ } else if (has_icon(E->get().name,"EditorIcons")) {
+ icon=get_icon(E->get().name,"EditorIcons");
+ } else {
+ icon=get_icon("Object","EditorIcons");
+ }
+ category->set_icon(0,icon);
+ continue;
+ }
+
+ if (!(E->get().usage&PROPERTY_USAGE_EDITOR))
+ continue;
+
+ if (search_box->get_text()!=String() && E->get().name.find(search_box->get_text())==-1)
+ continue;
+ TreeItem *item = search_options->create_item(category?category:root);
+ item->set_text(0,E->get().name);
+ item->set_metadata(0,E->get().name);
+ item->set_icon(0,type_icons[E->get().type]);
+
+ if (!found && search_box->get_text()!=String() && E->get().name.find(search_box->get_text())!=-1) {
+ item->select(0);
+ found=true;
+ }
+
+ item->set_selectable(0,true);
+ }
+
+ if (category && category->get_children()==NULL) {
+ memdelete(category); //old category was unused
+ }
+ } else {
+
+ List<MethodInfo> methods;
+
+ if (type!=Variant::NIL) {
+ Variant v;
+ Variant::CallError ce;
+ v=Variant::construct(type,NULL,0,ce);
+ v.get_method_list(&methods);
+ } else {
+
+
+ Object *obj = ObjectDB::get_instance(script);
+ if (obj && obj->cast_to<Script>()) {
+
+ methods.push_back(MethodInfo("*Script Methods"));
+ obj->cast_to<Script>()->get_script_method_list(&methods);
+ }
+
+ StringName base=base_type;
+ while(base) {
+ methods.push_back(MethodInfo("*"+String(base)));
+ ObjectTypeDB::get_method_list(base,&methods,true);
+ base=ObjectTypeDB::type_inherits_from(base);
+ }
+
+ }
+
+ TreeItem *category=NULL;
+
+ bool found=false;
+ bool script_methods=false;
+
+ for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
+ if (E->get().name.begins_with("*")) {
+ if (category && category->get_children()==NULL) {
+ memdelete(category); //old category was unused
+ }
+ category = search_options->create_item(root);
+ category->set_text(0,E->get().name.replace_first("*",""));
+ category->set_selectable(0,false);
+
+ Ref<Texture> icon;
+ script_methods=false;
+ if (E->get().name=="*Script Methods") {
+ icon=get_icon("Script","EditorIcons");
+ script_methods=true;
+ } else if (has_icon(E->get().name,"EditorIcons")) {
+ icon=get_icon(E->get().name,"EditorIcons");
+ } else {
+ icon=get_icon("Object","EditorIcons");
+ }
+ category->set_icon(0,icon);
+
+ continue;
+ }
+
+ String name = E->get().name.get_slice(":",0);
+ if (!script_methods && name.begins_with("_") && !(E->get().flags&METHOD_FLAG_VIRTUAL))
+ continue;
+
+ if (search_box->get_text()!=String() && name.find(search_box->get_text())==-1)
+ continue;
+
+ TreeItem *item = search_options->create_item(category?category:root);
+
+ MethodInfo mi=E->get();
+
+ String desc;
+ if (mi.name.find(":")!=-1) {
+ desc=mi.name.get_slice(":",1)+" ";
+ mi.name=mi.name.get_slice(":",0);
+ } else if (mi.return_val.type!=Variant::NIL)
+ desc=Variant::get_type_name(mi.return_val.type);
+ else
+ desc="void ";
+
+
+
+ desc+=" "+mi.name+" ( ";
+
+ for(int i=0;i<mi.arguments.size();i++) {
+
+ if (i>0)
+ desc+=", ";
+
+ if (mi.arguments[i].type==Variant::NIL)
+ desc+="var ";
+ else if (mi.arguments[i].name.find(":")!=-1) {
+ desc+=mi.arguments[i].name.get_slice(":",1)+" ";
+ mi.arguments[i].name=mi.arguments[i].name.get_slice(":",0);
+ } else
+ desc+=Variant::get_type_name(mi.arguments[i].type)+" ";
+
+ desc+=mi.arguments[i].name;
+
+ }
+
+ desc+=" )";
+
+ item->set_text(0,desc);
+ item->set_metadata(0,name);
+ item->set_selectable(0,true);
+
+ if (!found && search_box->get_text()!=String() && name.find(search_box->get_text())!=-1) {
+ item->select(0);
+ found=true;
+ }
+
+ }
+
+ if (category && category->get_children()==NULL) {
+ memdelete(category); //old category was unused
+ }
+
+ }
+
+ get_ok()->set_disabled(root->get_children()==NULL);
+
+}
+
+
+
+void PropertySelector::_confirmed() {
+
+ TreeItem *ti = search_options->get_selected();
+ if (!ti)
+ return;
+ emit_signal("selected",ti->get_metadata(0));
+ hide();
+}
+
+void PropertySelector::_item_selected() {
+
+ help_bit->set_text("");
+
+ TreeItem *item=search_options->get_selected();
+ if (!item)
+ return;
+ String name = item->get_metadata(0);
+
+ String class_type;
+ if (properties && type==Variant::INPUT_EVENT) {
+
+ switch(event_type) {
+ case InputEvent::NONE: class_type="InputEvent"; break;
+ case InputEvent::KEY: class_type="InputEventKey"; break;
+ case InputEvent::MOUSE_MOTION: class_type="InputEventMouseMotion"; break;
+ case InputEvent::MOUSE_BUTTON: class_type="InputEventMouseButton"; break;
+ case InputEvent::JOYSTICK_MOTION: class_type="InputEventJoystickMotion"; break;
+ case InputEvent::JOYSTICK_BUTTON: class_type="InputEventJoystickButton"; break;
+ case InputEvent::SCREEN_TOUCH: class_type="InputEventScreenTouch"; break;
+ case InputEvent::SCREEN_DRAG: class_type="InputEventScreenDrag"; break;
+ case InputEvent::ACTION: class_type="InputEventAction"; break;
+ default: {}
+ }
+
+ } else if (type) {
+ class_type=Variant::get_type_name(type);
+
+ } else {
+ class_type=base_type;
+ }
+
+ DocData *dd=EditorHelp::get_doc_data();
+ String text;
+
+
+ if (properties) {
+
+ String at_class=class_type;
+
+
+
+ while(at_class!=String()) {
+
+
+ Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(at_class);
+ if (E) {
+ for(int i=0;i<E->get().properties.size();i++) {
+ if (E->get().properties[i].name==name) {
+ text=E->get().properties[i].description;
+ }
+ }
+ }
+
+ at_class=ObjectTypeDB::type_inherits_from(at_class);
+ }
+
+ if (text==String()) {
+
+ StringName setter;
+ StringName type;
+ if (ObjectTypeDB::get_setter_and_type_for_property(class_type,name,type,setter)) {
+ Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(type);
+ if (E) {
+ for(int i=0;i<E->get().methods.size();i++) {
+ if (E->get().methods[i].name==setter.operator String()) {
+ text=E->get().methods[i].description;
+ }
+ }
+ }
+
+
+ }
+ }
+
+ } else {
+
+
+ String at_class=class_type;
+
+ while(at_class!=String()) {
+
+ Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(at_class);
+ if (E) {
+ for(int i=0;i<E->get().methods.size();i++) {
+ if (E->get().methods[i].name==name) {
+ text=E->get().methods[i].description;
+ }
+ }
+ }
+
+ at_class=ObjectTypeDB::type_inherits_from(at_class);
+ }
+ }
+
+
+ if (text==String())
+ return;
+
+ help_bit->set_text(text);
+
+}
+
+
+void PropertySelector::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+
+ connect("confirmed",this,"_confirmed");
+
+ }
+}
+
+
+
+void PropertySelector::select_method_from_base_type(const String& p_base,const String& p_current) {
+
+ base_type=p_base;
+ selected=p_current;
+ type=Variant::NIL;
+ script=0;
+ properties=false;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+}
+
+void PropertySelector::select_method_from_script(const Ref<Script>& p_script,const String& p_current){
+
+ ERR_FAIL_COND( p_script.is_null() );
+ base_type=p_script->get_instance_base_type();
+ selected=p_current;
+ type=Variant::NIL;
+ script=p_script->get_instance_ID();
+ properties=false;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const String &p_current){
+
+ ERR_FAIL_COND(p_type==Variant::NIL);
+ base_type="";
+ selected=p_current;
+ type=p_type;
+ script=0;
+ properties=false;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+
+void PropertySelector::select_method_from_instance(Object* p_instance, const String &p_current){
+
+
+ base_type=p_instance->get_type();
+ selected=p_current;
+ type=Variant::NIL;
+ script=0;
+ {
+ Ref<Script> scr = p_instance->get_script();
+ if (scr.is_valid())
+ script=scr->get_instance_ID();
+ }
+ properties=false;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+
+
+void PropertySelector::select_property_from_base_type(const String& p_base,const String& p_current) {
+
+ base_type=p_base;
+ selected=p_current;
+ type=Variant::NIL;
+ script=0;
+ properties=true;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+}
+
+void PropertySelector::select_property_from_script(const Ref<Script>& p_script,const String& p_current){
+
+ ERR_FAIL_COND( p_script.is_null() );
+
+ base_type=p_script->get_instance_base_type();
+ selected=p_current;
+ type=Variant::NIL;
+ script=p_script->get_instance_ID();
+ properties=true;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+void PropertySelector::select_property_from_basic_type(Variant::Type p_type, InputEvent::Type p_event_type, const String &p_current){
+
+ ERR_FAIL_COND(p_type==Variant::NIL);
+ base_type="";
+ selected=p_current;
+ type=p_type;
+ event_type=p_event_type;
+ script=0;
+ properties=true;
+ instance=NULL;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+
+void PropertySelector::select_property_from_instance(Object* p_instance, const String &p_current){
+
+
+ base_type="";
+ selected=p_current;
+ type=Variant::NIL;
+ script=0;
+ properties=true;
+ instance=p_instance;
+
+ popup_centered_ratio(0.6);
+ search_box->set_text("");
+ search_box->grab_focus();
+ _update_search();
+
+}
+
+void PropertySelector::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("_text_changed"),&PropertySelector::_text_changed);
+ ObjectTypeDB::bind_method(_MD("_confirmed"),&PropertySelector::_confirmed);
+ ObjectTypeDB::bind_method(_MD("_sbox_input"),&PropertySelector::_sbox_input);
+ ObjectTypeDB::bind_method(_MD("_item_selected"),&PropertySelector::_item_selected);
+
+ ADD_SIGNAL(MethodInfo("selected",PropertyInfo(Variant::STRING,"name")));
+
+}
+
+
+PropertySelector::PropertySelector() {
+
+
+ VBoxContainer *vbc = memnew( VBoxContainer );
+ add_child(vbc);
+ set_child_rect(vbc);
+ search_box = memnew( LineEdit );
+ vbc->add_margin_child(TTR("Search:"),search_box);
+ search_box->connect("text_changed",this,"_text_changed");
+ search_box->connect("input_event",this,"_sbox_input");
+ search_options = memnew( Tree );
+ vbc->add_margin_child(TTR("Matches:"),search_options,true);
+ get_ok()->set_text(TTR("Open"));
+ get_ok()->set_disabled(true);
+ register_text_enter(search_box);
+ set_hide_on_ok(false);
+ search_options->connect("item_activated",this,"_confirmed");
+ search_options->connect("cell_selected",this,"_item_selected");
+ search_options->set_hide_root(true);
+ search_options->set_hide_folding(true);
+
+ help_bit = memnew( EditorHelpBit );
+ vbc->add_margin_child(TTR("Description:"),help_bit);
+ help_bit->connect("request_hide",this,"_closed");
+
+
+}
diff --git a/tools/editor/property_selector.h b/tools/editor/property_selector.h
new file mode 100644
index 0000000000..f7f0e7e167
--- /dev/null
+++ b/tools/editor/property_selector.h
@@ -0,0 +1,55 @@
+#ifndef PROPERTYSELECTOR_H
+#define PROPERTYSELECTOR_H
+
+#include "tools/editor/property_editor.h"
+#include "scene/gui/rich_text_label.h"
+#include "editor_help.h"
+
+class PropertySelector : public ConfirmationDialog {
+ OBJ_TYPE(PropertySelector,ConfirmationDialog )
+
+
+ LineEdit *search_box;
+ Tree *search_options;
+
+ void _update_search();
+
+ void _sbox_input(const InputEvent& p_ie);
+
+ void _confirmed();
+ void _text_changed(const String& p_newtext);
+
+ EditorHelpBit *help_bit;
+
+ bool properties;
+ String selected;
+ Variant::Type type;
+ InputEvent::Type event_type;
+ String base_type;
+ ObjectID script;
+ Object *instance;
+
+ void _item_selected();
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+
+
+public:
+
+
+ void select_method_from_base_type(const String& p_base,const String& p_current="");
+ void select_method_from_script(const Ref<Script>& p_script,const String& p_current="");
+ void select_method_from_basic_type(Variant::Type p_type,const String& p_current="");
+ void select_method_from_instance(Object* p_instance, const String &p_current="");
+
+ void select_property_from_base_type(const String& p_base,const String& p_current="");
+ void select_property_from_script(const Ref<Script>& p_script,const String& p_current="");
+ void select_property_from_basic_type(Variant::Type p_type,InputEvent::Type p_event_type,const String& p_current="");
+ void select_property_from_instance(Object* p_instance, const String &p_current="");
+
+ PropertySelector();
+};
+
+#endif // PROPERTYSELECTOR_H
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 94587456f1..506dfd3889 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -33,6 +33,7 @@
#include "scene/resources/packed_scene.h"
#include "editor_settings.h"
#include "tools/editor/plugins/canvas_item_editor_plugin.h"
+#include "tools/editor/plugins/spatial_editor_plugin.h"
#include "script_editor_debugger.h"
#include "tools/editor/plugins/script_editor_plugin.h"
#include "core/io/resource_saver.h"
@@ -1825,6 +1826,21 @@ void SceneTreeDock::set_filter(const String& p_filter){
scene_tree->set_filter(p_filter);
}
+
+void SceneTreeDock::_focus_node() {
+
+ Node *node = scene_tree->get_selected();
+ ERR_FAIL_COND(!node);
+
+ if (node->is_type("CanvasItem")) {
+ CanvasItemEditorPlugin *editor = editor_data->get_editor("2D")->cast_to<CanvasItemEditorPlugin>();
+ editor->get_canvas_item_editor()->focus_selection();
+ } else {
+ SpatialEditorPlugin *editor = editor_data->get_editor("3D")->cast_to<SpatialEditorPlugin>();
+ editor->get_spatial_editor()->get_editor_viewport(0)->focus_selection();
+ }
+}
+
void SceneTreeDock::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_tool_selected"),&SceneTreeDock::_tool_selected,DEFVAL(false));
@@ -1849,6 +1865,7 @@ void SceneTreeDock::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_files_dropped"),&SceneTreeDock::_files_dropped);
ObjectTypeDB::bind_method(_MD("_tree_rmb"),&SceneTreeDock::_tree_rmb);
ObjectTypeDB::bind_method(_MD("_filter_changed"),&SceneTreeDock::_filter_changed);
+ ObjectTypeDB::bind_method(_MD("_focus_node"),&SceneTreeDock::_focus_node);
ObjectTypeDB::bind_method(_MD("instance"),&SceneTreeDock::instance);
@@ -1930,6 +1947,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
scene_tree->connect("files_dropped",this,"_files_dropped");
scene_tree->connect("nodes_dragged",this,"_nodes_drag_begin");
+ scene_tree->get_scene_tree()->connect("item_double_clicked", this, "_focus_node");
+ scene_tree->get_scene_tree()->set_delayed_text_editor(true);
+
scene_tree->set_undo_redo(&editor_data->get_undo_redo());
scene_tree->set_editor_selection(editor_selection);
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index af612cbc77..d92f12c34b 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -163,6 +163,8 @@ public:
String get_filter();
void set_filter(const String& p_filter);
+ void _focus_node();
+
void import_subscene();
void set_edited_scene(Node* p_scene);
void instance(const String& p_path);