summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/chibi/cp_config.h2
-rw-r--r--modules/chibi/cp_envelope.cpp2
-rw-r--r--modules/chibi/cp_envelope.h2
-rw-r--r--modules/chibi/cp_file_access_wrapper.h2
-rw-r--r--modules/chibi/cp_instrument.cpp2
-rw-r--r--modules/chibi/cp_instrument.h2
-rw-r--r--modules/chibi/cp_loader.h2
-rw-r--r--modules/chibi/cp_loader_it.cpp2
-rw-r--r--modules/chibi/cp_loader_it.h2
-rw-r--r--modules/chibi/cp_loader_it_info.cpp2
-rw-r--r--modules/chibi/cp_loader_it_instruments.cpp2
-rw-r--r--modules/chibi/cp_loader_it_patterns.cpp2
-rw-r--r--modules/chibi/cp_loader_it_samples.cpp4
-rw-r--r--modules/chibi/cp_loader_mod.cpp4
-rw-r--r--modules/chibi/cp_loader_mod.h2
-rw-r--r--modules/chibi/cp_loader_s3m.cpp8
-rw-r--r--modules/chibi/cp_loader_s3m.h2
-rw-r--r--modules/chibi/cp_loader_xm.cpp4
-rw-r--r--modules/chibi/cp_loader_xm.h2
-rw-r--r--modules/chibi/cp_mixer.h2
-rw-r--r--modules/chibi/cp_note.h2
-rw-r--r--modules/chibi/cp_order.h2
-rw-r--r--modules/chibi/cp_pattern.cpp2
-rw-r--r--modules/chibi/cp_pattern.h2
-rw-r--r--modules/chibi/cp_player_data.cpp2
-rw-r--r--modules/chibi/cp_player_data.h4
-rw-r--r--modules/chibi/cp_player_data_control.cpp2
-rw-r--r--modules/chibi/cp_player_data_effects.cpp4
-rw-r--r--modules/chibi/cp_player_data_envelopes.cpp2
-rw-r--r--modules/chibi/cp_player_data_events.cpp32
-rw-r--r--modules/chibi/cp_player_data_filter.cpp2
-rw-r--r--modules/chibi/cp_player_data_nna.cpp2
-rw-r--r--modules/chibi/cp_player_data_notes.cpp4
-rw-r--r--modules/chibi/cp_player_data_utils.cpp8
-rw-r--r--modules/chibi/cp_sample.cpp2
-rw-r--r--modules/chibi/cp_sample.h2
-rw-r--r--modules/chibi/cp_sample_defs.h2
-rw-r--r--modules/chibi/cp_sample_manager.cpp2
-rw-r--r--modules/chibi/cp_sample_manager.h2
-rw-r--r--modules/chibi/cp_song.cpp2
-rw-r--r--modules/chibi/cp_song.h2
-rw-r--r--modules/chibi/cp_tables.cpp2
-rw-r--r--modules/chibi/cp_tables.h2
-rw-r--r--modules/chibi/event_stream_chibi.cpp20
-rw-r--r--modules/chibi/event_stream_chibi.h10
-rw-r--r--modules/chibi/register_types.cpp2
-rw-r--r--modules/chibi/register_types.h2
-rw-r--r--modules/cscript/godot_c.h14
-rw-r--r--modules/cscript/register_types.cpp2
-rw-r--r--modules/cscript/register_types.h2
-rw-r--r--modules/dds/register_types.cpp2
-rw-r--r--modules/dds/register_types.h2
-rw-r--r--modules/dds/texture_loader_dds.cpp51
-rw-r--r--modules/dds/texture_loader_dds.h2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp31
-rw-r--r--modules/enet/networked_multiplayer_enet.h4
-rw-r--r--modules/enet/register_types.cpp4
-rw-r--r--modules/enet/register_types.h2
-rw-r--r--modules/etc1/image_etc.cpp40
-rw-r--r--modules/etc1/image_etc.h2
-rw-r--r--modules/etc1/register_types.cpp2
-rw-r--r--modules/etc1/register_types.h2
-rw-r--r--modules/etc1/texture_loader_pkm.cpp10
-rw-r--r--modules/freetype/register_types.cpp2
-rw-r--r--modules/freetype/register_types.h2
-rw-r--r--modules/freetype/uwpdef.h2
-rw-r--r--modules/gdscript/gd_compiler.cpp205
-rw-r--r--modules/gdscript/gd_compiler.h6
-rw-r--r--modules/gdscript/gd_editor.cpp209
-rw-r--r--modules/gdscript/gd_function.cpp62
-rw-r--r--modules/gdscript/gd_function.h4
-rw-r--r--modules/gdscript/gd_functions.cpp141
-rw-r--r--modules/gdscript/gd_functions.h6
-rw-r--r--modules/gdscript/gd_parser.cpp822
-rw-r--r--modules/gdscript/gd_parser.h55
-rw-r--r--modules/gdscript/gd_script.cpp93
-rw-r--r--modules/gdscript/gd_script.h12
-rw-r--r--modules/gdscript/gd_tokenizer.cpp52
-rw-r--r--modules/gdscript/gd_tokenizer.h4
-rw-r--r--modules/gdscript/register_types.cpp12
-rw-r--r--modules/gdscript/register_types.h2
-rw-r--r--modules/gridmap/config.py3
-rw-r--r--modules/gridmap/grid_map.cpp145
-rw-r--r--modules/gridmap/grid_map.h8
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp93
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h6
-rw-r--r--modules/gridmap/register_types.cpp4
-rw-r--r--modules/gridmap/register_types.h2
-rw-r--r--modules/jpg/image_loader_jpegd.cpp18
-rw-r--r--modules/jpg/image_loader_jpegd.h2
-rw-r--r--modules/jpg/register_types.cpp2
-rw-r--r--modules/jpg/register_types.h2
-rw-r--r--modules/mpc/SCsub28
-rw-r--r--modules/mpc/audio_stream_mpc.cpp414
-rw-r--r--modules/mpc/audio_stream_mpc.h146
-rw-r--r--modules/mpc/config.py7
-rw-r--r--modules/mpc/register_types.cpp45
-rw-r--r--modules/mpc/register_types.h30
-rw-r--r--modules/ogg/register_types.cpp2
-rw-r--r--modules/ogg/register_types.h2
-rw-r--r--modules/openssl/register_types.cpp4
-rw-r--r--modules/openssl/register_types.h2
-rw-r--r--modules/openssl/stream_peer_openssl.cpp36
-rw-r--r--modules/openssl/stream_peer_openssl.h10
-rw-r--r--modules/opus/audio_stream_opus.cpp4
-rw-r--r--modules/opus/audio_stream_opus.h6
-rw-r--r--modules/opus/register_types.cpp4
-rw-r--r--modules/opus/register_types.h2
-rw-r--r--modules/pbm/bitmap_loader_pbm.cpp24
-rw-r--r--modules/pbm/bitmap_loader_pbm.h2
-rw-r--r--modules/pbm/register_types.cpp2
-rw-r--r--modules/pbm/register_types.h2
-rw-r--r--modules/pvr/register_types.cpp2
-rw-r--r--modules/pvr/register_types.h2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp84
-rw-r--r--modules/pvr/texture_loader_pvr.h2
-rw-r--r--modules/regex/regex.cpp34
-rw-r--r--modules/regex/regex.h6
-rw-r--r--modules/regex/register_types.cpp6
-rw-r--r--modules/regex/register_types.h2
-rw-r--r--modules/register_module_types.h2
-rw-r--r--modules/squish/image_compress_squish.cpp30
-rw-r--r--modules/squish/image_compress_squish.h2
-rw-r--r--modules/squish/register_types.cpp2
-rw-r--r--modules/squish/register_types.h2
-rw-r--r--modules/theora/register_types.cpp4
-rw-r--r--modules/theora/register_types.h2
-rw-r--r--modules/theora/video_stream_theora.cpp35
-rw-r--r--modules/theora/video_stream_theora.h8
-rw-r--r--modules/visual_script/register_types.cpp106
-rw-r--r--modules/visual_script/register_types.h2
-rw-r--r--modules/visual_script/visual_script.cpp142
-rw-r--r--modules/visual_script/visual_script.h12
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp50
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h3
-rw-r--r--modules/visual_script/visual_script_editor.cpp192
-rw-r--r--modules/visual_script/visual_script_editor.h6
-rw-r--r--modules/visual_script/visual_script_expression.h2
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp70
-rw-r--r--modules/visual_script/visual_script_flow_control.h16
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp174
-rw-r--r--modules/visual_script/visual_script_func_nodes.h8
-rw-r--r--modules/visual_script/visual_script_nodes.cpp162
-rw-r--r--modules/visual_script/visual_script_nodes.h52
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp32
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h4
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp6
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h6
-rw-r--r--modules/vorbis/register_types.cpp4
-rw-r--r--modules/vorbis/register_types.h2
-rw-r--r--modules/webm/libvpx/SCsub8
-rw-r--r--modules/webm/register_types.cpp4
-rw-r--r--modules/webm/register_types.h2
-rw-r--r--modules/webm/video_stream_webm.cpp12
-rw-r--r--modules/webm/video_stream_webm.h8
-rw-r--r--modules/webp/image_loader_webp.cpp54
-rw-r--r--modules/webp/image_loader_webp.h2
-rw-r--r--modules/webp/register_types.cpp2
-rw-r--r--modules/webp/register_types.h2
159 files changed, 2580 insertions, 1884 deletions
diff --git a/modules/chibi/cp_config.h b/modules/chibi/cp_config.h
index 2ad704ace7..35312b68be 100644
--- a/modules/chibi/cp_config.h
+++ b/modules/chibi/cp_config.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_envelope.cpp b/modules/chibi/cp_envelope.cpp
index 9892b6d4b0..36259e8d63 100644
--- a/modules/chibi/cp_envelope.cpp
+++ b/modules/chibi/cp_envelope.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_envelope.h b/modules/chibi/cp_envelope.h
index d1ada53f7d..af27f5f185 100644
--- a/modules/chibi/cp_envelope.h
+++ b/modules/chibi/cp_envelope.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_file_access_wrapper.h b/modules/chibi/cp_file_access_wrapper.h
index 5b361c0ea8..ade077c1ef 100644
--- a/modules/chibi/cp_file_access_wrapper.h
+++ b/modules/chibi/cp_file_access_wrapper.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_instrument.cpp b/modules/chibi/cp_instrument.cpp
index 7a732e33a4..606a4217e0 100644
--- a/modules/chibi/cp_instrument.cpp
+++ b/modules/chibi/cp_instrument.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_instrument.h b/modules/chibi/cp_instrument.h
index d8eb8333ee..e51612a38d 100644
--- a/modules/chibi/cp_instrument.h
+++ b/modules/chibi/cp_instrument.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader.h b/modules/chibi/cp_loader.h
index 9d1074d1b8..1630444481 100644
--- a/modules/chibi/cp_loader.h
+++ b/modules/chibi/cp_loader.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it.cpp b/modules/chibi/cp_loader_it.cpp
index 20a3960a23..bfffd9b509 100644
--- a/modules/chibi/cp_loader_it.cpp
+++ b/modules/chibi/cp_loader_it.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it.h b/modules/chibi/cp_loader_it.h
index 38a1cdd9c4..5ce62a6a49 100644
--- a/modules/chibi/cp_loader_it.h
+++ b/modules/chibi/cp_loader_it.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it_info.cpp b/modules/chibi/cp_loader_it_info.cpp
index 0360f7f9a4..a474fcd2f9 100644
--- a/modules/chibi/cp_loader_it_info.cpp
+++ b/modules/chibi/cp_loader_it_info.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it_instruments.cpp b/modules/chibi/cp_loader_it_instruments.cpp
index ccb24bd81c..446e841c5f 100644
--- a/modules/chibi/cp_loader_it_instruments.cpp
+++ b/modules/chibi/cp_loader_it_instruments.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it_patterns.cpp b/modules/chibi/cp_loader_it_patterns.cpp
index d951a91620..528d99fff7 100644
--- a/modules/chibi/cp_loader_it_patterns.cpp
+++ b/modules/chibi/cp_loader_it_patterns.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_it_samples.cpp b/modules/chibi/cp_loader_it_samples.cpp
index ced7252a6c..c736c99c0f 100644
--- a/modules/chibi/cp_loader_it_samples.cpp
+++ b/modules/chibi/cp_loader_it_samples.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -147,7 +147,7 @@ CPLoader::Error CPLoader_IT::load_sample(CPSample *p_sample) {
p_sample->set_sample_data(samp_id);
if (!samp_id.is_null()) {
- // printf("Loaded ID: stereo: %i len %i 16bit %i\n",CPSampleManager::get_singleton()->is_stereo(samp_id), CPSampleManager::get_singleton()->get_size( samp_id), CPSampleManager::get_singleton()->is_16bits( samp_id) );
+ //printf("Loaded ID: stereo: %i len %i 16bit %i\n",CPSampleManager::get_singleton()->is_stereo(samp_id), CPSampleManager::get_singleton()->get_size( samp_id), CPSampleManager::get_singleton()->is_16bits( samp_id) );
}
CP_ERR_COND_V( file->eof_reached(),FILE_CORRUPTED );
diff --git a/modules/chibi/cp_loader_mod.cpp b/modules/chibi/cp_loader_mod.cpp
index f867b77914..cfa3e34736 100644
--- a/modules/chibi/cp_loader_mod.cpp
+++ b/modules/chibi/cp_loader_mod.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -208,7 +208,7 @@ CPLoader::Error CPLoader_MOD::load_song(const char *p_file,CPSong *p_song,bool p
uint8_t order_count=file->get_byte();
-// uint8_t loop_to=file->get_byte();
+ //uint8_t loop_to=file->get_byte();
int pattern_count=0;
diff --git a/modules/chibi/cp_loader_mod.h b/modules/chibi/cp_loader_mod.h
index 636f4f00f2..57f7128bc0 100644
--- a/modules/chibi/cp_loader_mod.h
+++ b/modules/chibi/cp_loader_mod.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_s3m.cpp b/modules/chibi/cp_loader_s3m.cpp
index 0fc15c1e2f..4943e6d86c 100644
--- a/modules/chibi/cp_loader_s3m.cpp
+++ b/modules/chibi/cp_loader_s3m.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -102,7 +102,7 @@ void CPLoader_S3M::set_header() {
song->set_name( header.songname );
-// song->variables.filename=
+ //song->variables.filename=
song->set_row_highlight_minor( 4 );
song->set_row_highlight_major( 16 );
@@ -135,7 +135,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) {
uint32_t samplepos=(uint32_t)file->get_byte() << 16;
samplepos|=file->get_word();
samplepos*=16;
-// printf("sample at %i\n",samplepos);
+ //printf("sample at %i\n",samplepos);
/**/
int sample_size=file->get_dword();
@@ -178,7 +178,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) {
if ((type!=1) || scrs[0]!='S' || scrs[1]!='C' || scrs[2]!='R' || scrs[3]!='S' ) {
-// printf("type: %i, %c%c%c%c\n",type,scrs[0],scrs[1],scrs[2],scrs[3]);
+ //printf("type: %i, %c%c%c%c\n",type,scrs[0],scrs[1],scrs[2],scrs[3]);
CP_PRINTERR("Not an S3M CPSample!");
return FILE_CORRUPTED;
}
diff --git a/modules/chibi/cp_loader_s3m.h b/modules/chibi/cp_loader_s3m.h
index 175e5e80fe..04ee0b2917 100644
--- a/modules/chibi/cp_loader_s3m.h
+++ b/modules/chibi/cp_loader_s3m.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_loader_xm.cpp b/modules/chibi/cp_loader_xm.cpp
index bff8615a32..cbd883642c 100644
--- a/modules/chibi/cp_loader_xm.cpp
+++ b/modules/chibi/cp_loader_xm.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -399,7 +399,7 @@ CPLoader::Error CPLoader_XM::load_song(const char *p_file,CPSong *p_song,bool p_
instrument.set_name( instrname );
-// printf("Header Len: %i, CPInstrument %i, %i samples , name: s,\n",hsize,i,sampnum,instrname);
+ //printf("Header Len: %i, CPInstrument %i, %i samples , name: s,\n",hsize,i,sampnum,instrname);
if (sampnum==0) {
//aux=file->get_dword(); //Why is this for? -- for nothing, skipped
diff --git a/modules/chibi/cp_loader_xm.h b/modules/chibi/cp_loader_xm.h
index 9ae480cc8f..0889569b38 100644
--- a/modules/chibi/cp_loader_xm.h
+++ b/modules/chibi/cp_loader_xm.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_mixer.h b/modules/chibi/cp_mixer.h
index 7ad22ac146..d8564bae00 100644
--- a/modules/chibi/cp_mixer.h
+++ b/modules/chibi/cp_mixer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_note.h b/modules/chibi/cp_note.h
index 5cfa3f11ec..f9a3ef39fc 100644
--- a/modules/chibi/cp_note.h
+++ b/modules/chibi/cp_note.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_order.h b/modules/chibi/cp_order.h
index 03ecc00bba..8df67df40c 100644
--- a/modules/chibi/cp_order.h
+++ b/modules/chibi/cp_order.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_pattern.cpp b/modules/chibi/cp_pattern.cpp
index 83e165bf87..8671b6247d 100644
--- a/modules/chibi/cp_pattern.cpp
+++ b/modules/chibi/cp_pattern.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_pattern.h b/modules/chibi/cp_pattern.h
index 4065caa5e5..fc3b032523 100644
--- a/modules/chibi/cp_pattern.h
+++ b/modules/chibi/cp_pattern.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data.cpp b/modules/chibi/cp_player_data.cpp
index 3f3e9a5202..c8cbfbd06e 100644
--- a/modules/chibi/cp_player_data.cpp
+++ b/modules/chibi/cp_player_data.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data.h b/modules/chibi/cp_player_data.h
index 282592b8f4..2157319855 100644
--- a/modules/chibi/cp_player_data.h
+++ b/modules/chibi/cp_player_data.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -124,7 +124,7 @@ class CPPlayer {
CPInstrument* instrument_ptr;
CPSample* sample_ptr;
-// Sample_Data *sample_data;
+ //Sample_Data *sample_data;
int32_t period;
diff --git a/modules/chibi/cp_player_data_control.cpp b/modules/chibi/cp_player_data_control.cpp
index d9aaed904f..2ef1c1de8c 100644
--- a/modules/chibi/cp_player_data_control.cpp
+++ b/modules/chibi/cp_player_data_control.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data_effects.cpp b/modules/chibi/cp_player_data_effects.cpp
index 3a52a3b91b..56fb7a2905 100644
--- a/modules/chibi/cp_player_data_effects.cpp
+++ b/modules/chibi/cp_player_data_effects.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -615,7 +615,7 @@ void CPPlayer::do_effect_S(int p_track) {
break;
case 8: {/* S8x set panning position */
-// if (pf->panflag) {
+ //if (pf->panflag) {
if (inf<=8) inf<<=4;
else inf*=17;
control.channel[p_track].panning=control.channel[p_track].channel_panning=inf;
diff --git a/modules/chibi/cp_player_data_envelopes.cpp b/modules/chibi/cp_player_data_envelopes.cpp
index 96af42d19f..a720eaf734 100644
--- a/modules/chibi/cp_player_data_envelopes.cpp
+++ b/modules/chibi/cp_player_data_envelopes.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data_events.cpp b/modules/chibi/cp_player_data_events.cpp
index fb5090461b..94a048ab2f 100644
--- a/modules/chibi/cp_player_data_events.cpp
+++ b/modules/chibi/cp_player_data_events.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -194,7 +194,7 @@ void CPPlayer::Voice_Control::update_info_from_master_channel() {
reverb_send=master_channel->reverb_send;
chorus_send=master_channel->chorus_send;
-// last_note_type=master_channel->last_note_type;
+ //last_note_type=master_channel->last_note_type;
sample_start_index=master_channel->sample_start_index;
filter=master_channel->filter;
@@ -262,7 +262,7 @@ void CPPlayer::update_mixer() {
/* Start Envelopes */
if ( song->has_instruments() && ((v.kick==KICK_NOTE)||(v.kick==KICK_ENVELOPE))) {
-// Voice_Control *carry=0;
+ //Voice_Control *carry=0;
if (v.has_master_channel && v.master_channel->carry.maybe) {
@@ -462,7 +462,7 @@ void CPPlayer::update_mixer() {
} else {
filter_env=pe_value+32; //max 64
-// printf("pitch envelope at %i",filter_env);
+ //printf("pitch envelope at %i",filter_env);
}
}
@@ -602,17 +602,19 @@ void CPPlayer::handle_tick() {
/* process pattern-delay. pf->patdly2 is the counter and pf->patdly is
the command memory. */
-// if (control.pattern_delay_1) {
-
-// control.pattern_delay_2=control.pattern_delay_1;
-// control.pattern_delay_1=0;
-// }
-// if (control.pattern_delay_2) {
-// patterndelay active
-// if (--control.pattern_delay_2)
-// so turn back pf->patpos by 1
-// if (pf->patpos) pf->patpos--;
-// }
+ /*
+ if (control.pattern_delay_1) {
+
+ control.pattern_delay_2=control.pattern_delay_1;
+ control.pattern_delay_1=0;
+ }
+ if (control.pattern_delay_2) {
+ patterndelay active
+ if (--control.pattern_delay_2)
+ // so turn back pf->patpos by 1
+ if (pf->patpos) pf->patpos--;
+ }
+ */
if (control.play_mode!=PLAY_NOTHING) {
diff --git a/modules/chibi/cp_player_data_filter.cpp b/modules/chibi/cp_player_data_filter.cpp
index 30db807eed..e04ae126fd 100644
--- a/modules/chibi/cp_player_data_filter.cpp
+++ b/modules/chibi/cp_player_data_filter.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data_nna.cpp b/modules/chibi/cp_player_data_nna.cpp
index 844f043694..3c50bfb01f 100644
--- a/modules/chibi/cp_player_data_nna.cpp
+++ b/modules/chibi/cp_player_data_nna.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_player_data_notes.cpp b/modules/chibi/cp_player_data_notes.cpp
index 621be019e1..189403343c 100644
--- a/modules/chibi/cp_player_data_notes.cpp
+++ b/modules/chibi/cp_player_data_notes.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -67,7 +67,7 @@ void CPPlayer::process_new_note(int p_track,uint8_t p_note) { // if there's real
bool CPPlayer::process_new_instrument(int p_track,uint8_t p_instrument) {
-// bool different_instrument=false;
+ //bool different_instrument=false;
ERR_FAIL_INDEX_V(p_instrument,CPSong::MAX_INSTRUMENTS,false);
if ( song->has_instruments() ) {
diff --git a/modules/chibi/cp_player_data_utils.cpp b/modules/chibi/cp_player_data_utils.cpp
index 170a849863..b99dbfcb99 100644
--- a/modules/chibi/cp_player_data_utils.cpp
+++ b/modules/chibi/cp_player_data_utils.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -111,8 +111,10 @@ int CPPlayer::find_empty_voice() {
for (i=0;i<control.max_voices;i++) {
/* allow us to take over a nonexisting sample */
-// if ((voice[i].s==NULL)
-// return k;
+ /*
+ if ((voice[i].s==NULL)
+ return k;
+ */
if ((voice[i].kick==KICK_NOTHING)||(voice[i].kick==KICK_ENVELOPE)) {
diff --git a/modules/chibi/cp_sample.cpp b/modules/chibi/cp_sample.cpp
index 55c2c910a5..bea8835548 100644
--- a/modules/chibi/cp_sample.cpp
+++ b/modules/chibi/cp_sample.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_sample.h b/modules/chibi/cp_sample.h
index 4b3d218106..c02b220c84 100644
--- a/modules/chibi/cp_sample.h
+++ b/modules/chibi/cp_sample.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_sample_defs.h b/modules/chibi/cp_sample_defs.h
index 169963c98e..5ae57aed82 100644
--- a/modules/chibi/cp_sample_defs.h
+++ b/modules/chibi/cp_sample_defs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_sample_manager.cpp b/modules/chibi/cp_sample_manager.cpp
index 5c2988e3f9..2ad0a720b4 100644
--- a/modules/chibi/cp_sample_manager.cpp
+++ b/modules/chibi/cp_sample_manager.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_sample_manager.h b/modules/chibi/cp_sample_manager.h
index 74bcafc0cf..b6d47a3013 100644
--- a/modules/chibi/cp_sample_manager.h
+++ b/modules/chibi/cp_sample_manager.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_song.cpp b/modules/chibi/cp_song.cpp
index 4aa1a4228d..197e44f69d 100644
--- a/modules/chibi/cp_song.cpp
+++ b/modules/chibi/cp_song.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_song.h b/modules/chibi/cp_song.h
index da5d106a63..ba0fa3e80a 100644
--- a/modules/chibi/cp_song.h
+++ b/modules/chibi/cp_song.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_tables.cpp b/modules/chibi/cp_tables.cpp
index 8c62150f31..a7ed34ff31 100644
--- a/modules/chibi/cp_tables.cpp
+++ b/modules/chibi/cp_tables.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/cp_tables.h b/modules/chibi/cp_tables.h
index ac7ee562b7..4baa1c6488 100644
--- a/modules/chibi/cp_tables.h
+++ b/modules/chibi/cp_tables.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp
index b88f4ee70e..ab34080525 100644
--- a/modules/chibi/event_stream_chibi.cpp
+++ b/modules/chibi/event_stream_chibi.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -298,9 +298,9 @@ void CPSampleManagerImpl::unlock_data(CPSample_ID p_id){
sd->locks--;
if (sd->locks==0) {
- sd->w=DVector<uint8_t>::Write();
+ sd->w=PoolVector<uint8_t>::Write();
AudioServer::get_singleton()->sample_set_data(sd->rid,sd->lock);
- sd->lock=DVector<uint8_t>();
+ sd->lock=PoolVector<uint8_t>();
}
}
@@ -408,8 +408,8 @@ void CPMixerImpl::set_voice_chorus_send(int p_voice_index,int p_chorus){
void CPMixerImpl::set_reverb_mode(ReverbMode p_mode){
-// Voice &v=voices[p_voice_index];
-// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
+ //Voice &v=voices[p_voice_index];
+ //ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
switch(p_mode) {
case CPMixer::REVERB_MODE_STUDIO_SMALL: reverb_type=AudioMixer::REVERB_SMALL; break;
case CPMixer::REVERB_MODE_STUDIO_MEDIUM: reverb_type=AudioMixer::REVERB_MEDIUM; break;
@@ -422,8 +422,8 @@ void CPMixerImpl::set_reverb_mode(ReverbMode p_mode){
void CPMixerImpl::set_chorus_params(unsigned int p_delay_ms,unsigned int p_separation_ms,unsigned int p_depth_ms10,unsigned int p_speed_hz10){
-// Voice &v=voices[p_voice_index];
-// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
+ //Voice &v=voices[p_voice_index];
+ //ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
}
@@ -785,7 +785,7 @@ RES ResourceFormatLoaderChibi::load(const String &p_path, const String& p_origin
if (r_error)
*r_error=ERR_FILE_CANT_OPEN;
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
CPFileAccessWrapperImpl f;
@@ -849,7 +849,7 @@ bool ResourceFormatLoaderChibi::handles_type(const String& p_type) const {
}
String ResourceFormatLoaderChibi::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
if (el=="it" || el=="s3m" || el=="xm" || el=="mod")
return "EventStreamChibi";
return "";
@@ -860,7 +860,7 @@ void initialize_chibi() {
sample_manager = memnew( CPSampleManagerImpl );
resource_loader = memnew( ResourceFormatLoaderChibi );
- ObjectTypeDB::register_type<EventStreamChibi>();
+ ClassDB::register_class<EventStreamChibi>();
ResourceLoader::add_resource_format_loader( resource_loader );
}
diff --git a/modules/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h
index cc7b0ace86..0244ee0a95 100644
--- a/modules/chibi/event_stream_chibi.h
+++ b/modules/chibi/event_stream_chibi.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -54,8 +54,8 @@ class CPSampleManagerImpl : public CPSampleManager {
int loop_begin;
int loop_end;
int locks;
- DVector<uint8_t> lock;
- DVector<uint8_t>::Write w;
+ PoolVector<uint8_t> lock;
+ PoolVector<uint8_t>::Write w;
CPSample_Loop_Type loop_type;
};
@@ -223,7 +223,7 @@ class EventStreamChibi;
class EventStreamPlaybackChibi : public EventStreamPlayback {
- OBJ_TYPE(EventStreamPlaybackChibi,EventStreamPlayback);
+ GDCLASS(EventStreamPlaybackChibi,EventStreamPlayback);
CPMixerImpl mixer;
uint64_t total_usec;
@@ -275,7 +275,7 @@ public:
class EventStreamChibi : public EventStream {
- OBJ_TYPE(EventStreamChibi,EventStream);
+ GDCLASS(EventStreamChibi,EventStream);
friend class ResourceFormatLoaderChibi;
friend class EventStreamPlaybackChibi;
diff --git a/modules/chibi/register_types.cpp b/modules/chibi/register_types.cpp
index b2ba16fa03..1a0c808819 100644
--- a/modules/chibi/register_types.cpp
+++ b/modules/chibi/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/chibi/register_types.h b/modules/chibi/register_types.h
index 159823b85d..08856c0744 100644
--- a/modules/chibi/register_types.h
+++ b/modules/chibi/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h
index b0465d8524..3bf86d1aeb 100644
--- a/modules/cscript/godot_c.h
+++ b/modules/cscript/godot_c.h
@@ -123,8 +123,8 @@ void GDAPI godot_array_free(godot_array p_array);
#define INPUT_EVENT_TYPE_KEY 1
#define INPUT_EVENT_TYPE_MOUSE_MOTION 2
#define INPUT_EVENT_TYPE_MOUSE_BUTTON 3
-#define INPUT_EVENT_TYPE_JOYSTICK_MOTION 4
-#define INPUT_EVENT_TYPE_JOYSTICK_BUTTON 5
+#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4
+#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5
#define INPUT_EVENT_TYPE_SCREEN_TOUCH 6
#define INPUT_EVENT_TYPE_SCREEN_DRAG 7
#define INPUT_EVENT_TYPE_ACTION 8
@@ -166,12 +166,12 @@ int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_even
int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event);
int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_motion_get_axis(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_motion_get_axis_value(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_joystick_button_is_pressed(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_button_get_pressure(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event);
+godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event);
int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event);
diff --git a/modules/cscript/register_types.cpp b/modules/cscript/register_types.cpp
index 267e5245ed..d2101bbd49 100644
--- a/modules/cscript/register_types.cpp
+++ b/modules/cscript/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/cscript/register_types.h b/modules/cscript/register_types.h
index a0f41eee5d..6614ee3a19 100644
--- a/modules/cscript/register_types.h
+++ b/modules/cscript/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp
index 0d28e2bbef..917305f543 100644
--- a/modules/dds/register_types.cpp
+++ b/modules/dds/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h
index f9ecfb8ef9..69f47006e2 100644
--- a/modules/dds/register_types.h
+++ b/modules/dds/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 0cc84f02f7..5295183c35 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -74,21 +74,20 @@ struct DDSFormatInfo {
static const DDSFormatInfo dds_format_info[DDS_MAX]={
- {"DXT1",true,false,4,8,Image::FORMAT_BC1},
- {"DXT3",true,false,4,16,Image::FORMAT_BC2},
- {"DXT5",true,false,4,16,Image::FORMAT_BC3},
- {"ATI1",true,false,4,8,Image::FORMAT_BC4},
- {"ATI2",true,false,4,16,Image::FORMAT_BC5},
- {"BGRA8",false,false,1,4,Image::FORMAT_RGBA},
- {"BGR8",false,false,1,3,Image::FORMAT_RGB},
- {"RGBA8",false,false,1,4,Image::FORMAT_RGBA},
- {"RGB8",false,false,1,3,Image::FORMAT_RGB},
- {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA},
- {"BGR565",false,false,1,2,Image::FORMAT_RGB},
- {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA},
- {"INDEXED",false,true,1,1,Image::FORMAT_INDEXED},
- {"GRAYSCALE",false,false,1,1,Image::FORMAT_GRAYSCALE},
- {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_GRAYSCALE_ALPHA}
+ {"DXT1",true,false,4,8,Image::FORMAT_DXT1},
+ {"DXT3",true,false,4,16,Image::FORMAT_DXT3},
+ {"DXT5",true,false,4,16,Image::FORMAT_DXT5},
+ {"ATI1",true,false,4,8,Image::FORMAT_ATI1},
+ {"ATI2",true,false,4,16,Image::FORMAT_ATI2},
+ {"BGRA8",false,false,1,4,Image::FORMAT_RGBA8},
+ {"BGR8",false,false,1,3,Image::FORMAT_RGB8},
+ {"RGBA8",false,false,1,4,Image::FORMAT_RGBA8},
+ {"RGB8",false,false,1,3,Image::FORMAT_RGB8},
+ {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA8},
+ {"BGR565",false,false,1,2,Image::FORMAT_RGB8},
+ {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA8},
+ {"GRAYSCALE",false,false,1,1,Image::FORMAT_L8},
+ {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_LA8}
};
@@ -222,9 +221,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
if (!(flags&DDSD_MIPMAPCOUNT))
mipmaps=1;
-// print_line("found format: "+String(dds_format_info[dds_format].name));
+ //print_line("found format: "+String(dds_format_info[dds_format].name));
- DVector<uint8_t> src_data;
+ PoolVector<uint8_t> src_data;
const DDSFormatInfo &info=dds_format_info[dds_format];
uint32_t w = width;
@@ -248,9 +247,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
} else if (info.palette) {
@@ -282,7 +281,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
src_data.resize(size + 256*colsize );
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
for(int i=0;i<256;i++) {
@@ -297,7 +296,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
} else {
//uncompressed generic...
@@ -317,7 +316,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
size=size*2;
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
@@ -450,7 +449,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
}
@@ -474,12 +473,12 @@ void ResourceFormatDDS::get_recognized_extensions(List<String> *p_extensions) co
bool ResourceFormatDDS::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatDDS::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="dds")
+ if (p_path.get_extension().to_lower()=="dds")
return "ImageTexture";
return "";
}
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 371eb1858c..d09af680c7 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index a82283591d..d10634e9ea 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -77,7 +77,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
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);
- ERR_FAIL_COND_V(p_ip.type != IP_Address::TYPE_IPV4, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(!p_ip.is_ipv4(), ERR_INVALID_PARAMETER);
host = enet_host_create (NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
@@ -91,7 +91,7 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port
_setup_compressor();
ENetAddress address;
- address.host=p_ip.field32[0];
+ address.host=*((uint32_t *)p_ip.get_ipv4());
address.port=p_port;
//enet_address_set_host (& address, "localhost");
@@ -150,8 +150,7 @@ void NetworkedMultiplayerENet::poll(){
}
IP_Address ip;
- ip.type = IP_Address::TYPE_IPV4;
- ip.field32[0]=event.peer -> address.host;
+ ip.set_ipv4((uint8_t *)&(event.peer -> address.host));
int *new_id = memnew( int );
*new_id = event.data;
@@ -507,8 +506,10 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
(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)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(
@@ -644,12 +645,12 @@ void NetworkedMultiplayerENet::enet_compressor_destroy(void * context){
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);
- ObjectTypeDB::bind_method(_MD("set_bind_ip", "ip"),&NetworkedMultiplayerENet::set_bind_ip);
+ ClassDB::bind_method(_MD("create_server","port","max_clients","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_server,DEFVAL(32),DEFVAL(0),DEFVAL(0));
+ ClassDB::bind_method(_MD("create_client","ip","port","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_client,DEFVAL(0),DEFVAL(0));
+ ClassDB::bind_method(_MD("close_connection"),&NetworkedMultiplayerENet::close_connection);
+ ClassDB::bind_method(_MD("set_compression_mode","mode"),&NetworkedMultiplayerENet::set_compression_mode);
+ ClassDB::bind_method(_MD("get_compression_mode"),&NetworkedMultiplayerENet::get_compression_mode);
+ ClassDB::bind_method(_MD("set_bind_ip", "ip"),&NetworkedMultiplayerENet::set_bind_ip);
BIND_CONSTANT( COMPRESS_NONE );
BIND_CONSTANT( COMPRESS_RANGE_CODER );
@@ -685,6 +686,6 @@ NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
// sets IP for ENet to bind when using create_server
// if no IP is set, then ENet bind to ENET_HOST_ANY
void NetworkedMultiplayerENet::set_bind_ip(const IP_Address& p_ip){
- ERR_FAIL_COND(p_ip.type != IP_Address::TYPE_IPV4);
- bind_ip=p_ip.field32[0];
+ ERR_FAIL_COND(!p_ip.is_ipv4());
+ bind_ip=*(uint32_t *)p_ip.get_ipv4();
}
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 3db318c96a..dcf8c2429b 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -35,7 +35,7 @@
class NetworkedMultiplayerENet : public NetworkedMultiplayerPeer {
- OBJ_TYPE(NetworkedMultiplayerENet,NetworkedMultiplayerPeer)
+ GDCLASS(NetworkedMultiplayerENet,NetworkedMultiplayerPeer)
public:
enum CompressionMode {
COMPRESS_NONE,
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
index 630b76ced8..2b4dd35d33 100644
--- a/modules/enet/register_types.cpp
+++ b/modules/enet/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -40,7 +40,7 @@ void register_enet_types() {
enet_ok=true;
}
- ObjectTypeDB::register_type<NetworkedMultiplayerENet>();
+ ClassDB::register_class<NetworkedMultiplayerENet>();
}
void unregister_enet_types() {
diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h
index 50f34dc67f..14cb1ba868 100644
--- a/modules/enet/register_types.h
+++ b/modules/enet/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp
index cf2384240b..36ff1b86df 100644
--- a/modules/etc1/image_etc.cpp
+++ b/modules/etc1/image_etc.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -37,19 +37,19 @@ static void _decompress_etc(Image *p_img) {
int imgw = p_img->get_width();
int imgh = p_img->get_height();
- DVector<uint8_t> src=p_img->get_data();
- DVector<uint8_t> dst;
+ PoolVector<uint8_t> src=p_img->get_data();
+ PoolVector<uint8_t> dst;
- DVector<uint8_t>::Read r = src.read();
+ PoolVector<uint8_t>::Read r = src.read();
- int mmc=p_img->get_mipmaps();
+ int mmc=p_img->get_mipmap_count();
for(int i=0;i<=mmc;i++) {
dst.resize(dst.size()+imgw*imgh*3);
const uint8_t *srcbr=&r[p_img->get_mipmap_offset(i)];
- DVector<uint8_t>::Write w = dst.write();
+ PoolVector<uint8_t>::Write w = dst.write();
uint8_t *wptr = &w[dst.size()-imgw*imgh*3];
@@ -91,11 +91,11 @@ static void _decompress_etc(Image *p_img) {
}
- r=DVector<uint8_t>::Read();
+ r=PoolVector<uint8_t>::Read();
//print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps()));
- *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->get_mipmaps(),Image::FORMAT_RGB,dst);
- if (p_img->get_mipmaps())
- p_img->generate_mipmaps(-1,true);
+ *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst);
+ if (p_img->has_mipmaps())
+ p_img->generate_mipmaps(true);
}
@@ -108,18 +108,18 @@ static void _compress_etc(Image *p_img) {
ERR_FAIL_COND( nearest_power_of_2(imgw)!=imgw || nearest_power_of_2(imgh)!=imgh );
- if (img.get_format()!=Image::FORMAT_RGB)
- img.convert(Image::FORMAT_RGB);
+ if (img.get_format()!=Image::FORMAT_RGB8)
+ img.convert(Image::FORMAT_RGB8);
- int mmc=img.get_mipmaps();
+ int mmc=img.get_mipmap_count();
if (mmc==0)
img.generate_mipmaps(); // force mipmaps, so it works on most hardware
- DVector<uint8_t> res_data;
- DVector<uint8_t> dst_data;
- DVector<uint8_t>::Read r = img.get_data().read();
+ PoolVector<uint8_t> res_data;
+ PoolVector<uint8_t> dst_data;
+ PoolVector<uint8_t>::Read r = img.get_data().read();
int mc=0;
@@ -134,17 +134,17 @@ static void _compress_etc(Image *p_img) {
const uint8_t *src = &r[img.get_mipmap_offset(i)];
int mmsize = MAX(bw,1)*MAX(bh,1)*8;
dst_data.resize(dst_data.size()+mmsize);
- DVector<uint8_t>::Write w=dst_data.write();
+ PoolVector<uint8_t>::Write w=dst_data.write();
uint8_t *dst = &w[dst_data.size()-mmsize];
-// print_line("bh: "+itos(bh)+" bw: "+itos(bw));
+ //print_line("bh: "+itos(bh)+" bw: "+itos(bw));
for(int y=0;y<bh;y++) {
for(int x=0;x<bw;x++) {
-// print_line("x: "+itos(x)+" y: "+itos(y));
+ //print_line("x: "+itos(x)+" y: "+itos(y));
uint8_t block[4*4*4];
zeromem(block,4*4*4);
@@ -186,7 +186,7 @@ static void _compress_etc(Image *p_img) {
}
- *p_img=Image(p_img->get_width(),p_img->get_height(),mc-1,Image::FORMAT_ETC,dst_data);
+ *p_img=Image(p_img->get_width(),p_img->get_height(),(mc-1)?true:false,Image::FORMAT_ETC,dst_data);
}
diff --git a/modules/etc1/image_etc.h b/modules/etc1/image_etc.h
index edcff39bfd..6ab10126f8 100644
--- a/modules/etc1/image_etc.h
+++ b/modules/etc1/image_etc.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/etc1/register_types.cpp b/modules/etc1/register_types.cpp
index e9eba6c864..d02ef83478 100644
--- a/modules/etc1/register_types.cpp
+++ b/modules/etc1/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/etc1/register_types.h b/modules/etc1/register_types.h
index bc26699d54..fe92496cea 100644
--- a/modules/etc1/register_types.h
+++ b/modules/etc1/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp
index 275afc1fd6..e720e1fb4c 100644
--- a/modules/etc1/texture_loader_pkm.cpp
+++ b/modules/etc1/texture_loader_pkm.cpp
@@ -43,13 +43,13 @@ RES ResourceFormatPKM::load(const String &p_path, const String& p_original_path,
h.origWidth = f->get_16();
h.origHeight = f->get_16();
- DVector<uint8_t> src_data;
+ PoolVector<uint8_t> src_data;
uint32_t size = h.texWidth * h.texHeight / 2;
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
int mipmaps = h.format;
int width = h.origWidth;
@@ -73,12 +73,12 @@ void ResourceFormatPKM::get_recognized_extensions(List<String> *p_extensions) co
bool ResourceFormatPKM::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatPKM::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pkm")
+ if (p_path.get_extension().to_lower()=="pkm")
return "ImageTexture";
return "";
}
diff --git a/modules/freetype/register_types.cpp b/modules/freetype/register_types.cpp
index 2b9f47f54c..2579a925d4 100644
--- a/modules/freetype/register_types.cpp
+++ b/modules/freetype/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h
index 326cd2e6ea..2837898123 100644
--- a/modules/freetype/register_types.h
+++ b/modules/freetype/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/freetype/uwpdef.h b/modules/freetype/uwpdef.h
index c7dce80461..b4aabb1929 100644
--- a/modules/freetype/uwpdef.h
+++ b/modules/freetype/uwpdef.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index b75b13551e..a5351a584b 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -29,6 +29,31 @@
#include "gd_compiler.h"
#include "gd_script.h"
+bool GDCompiler::_is_class_member_property(CodeGen & codegen, const StringName & p_name) {
+
+ if (!codegen.function_node || codegen.function_node->_static)
+ return false;
+
+ return _is_class_member_property(codegen.script,p_name);
+}
+
+bool GDCompiler::_is_class_member_property(GDScript *owner, const StringName & p_name) {
+
+
+ GDScript *scr = owner;
+ GDNativeClass *nc=NULL;
+ while(scr) {
+
+ if (scr->native.is_valid())
+ nc=scr->native.ptr();
+ scr=scr->_base;
+ }
+
+ ERR_FAIL_COND_V(!nc,false);
+
+ return ClassDB::has_property(nc->get_name(),p_name);
+}
+
void GDCompiler::_set_error(const String& p_error,const GDParser::Node *p_node) {
@@ -164,6 +189,17 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
StringName identifier = in->name;
+
+ if (_is_class_member_property(codegen,identifier)) {
+ //get property
+ codegen.opcodes.push_back(GDFunction::OPCODE_GET_MEMBER); // perform operator
+ codegen.opcodes.push_back(codegen.get_name_map_pos(identifier)); // argument 2 (unary only takes one parameter)
+ int dst_addr=(p_stack_level)|(GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS);
+ codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode
+ codegen.alloc_stack(p_stack_level);
+ return dst_addr;
+ }
+
// TRY STACK!
if (!p_initializer && codegen.stack_identifiers.has(identifier)) {
@@ -208,7 +244,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
if (nc) {
bool success=false;
- int constant = ObjectTypeDB::get_integer_constant(nc->get_name(),identifier,&success);
+ int constant = ClassDB::get_integer_constant(nc->get_name(),identifier,&success);
if (success) {
Variant key=constant;
int idx;
@@ -776,6 +812,8 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
/* Find chain of sets */
+ StringName assign_property;
+
List<GDParser::OperatorNode*> chain;
{
@@ -784,8 +822,20 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
while(true) {
chain.push_back(n);
- if (n->arguments[0]->type!=GDParser::Node::TYPE_OPERATOR)
+ if (n->arguments[0]->type!=GDParser::Node::TYPE_OPERATOR) {
+
+ //check for a built-in property
+ if (n->arguments[0]->type==GDParser::Node::TYPE_IDENTIFIER) {
+
+ GDParser::IdentifierNode *identifier = static_cast<GDParser::IdentifierNode*>(n->arguments[0]);
+ if (_is_class_member_property(codegen,identifier->name)) {
+ assign_property = identifier->name;
+
+ }
+
+ }
break;
+ }
n = static_cast<GDParser::OperatorNode*>(n->arguments[0]);
if (n->op!=GDParser::OperatorNode::OP_INDEX && n->op!=GDParser::OperatorNode::OP_INDEX_NAMED)
break;
@@ -810,6 +860,17 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
Vector<int> setchain;
+
+ if (assign_property!=StringName()) {
+
+ // recover and assign at the end, this allows stuff like
+ // position.x+=2.0
+ // in Node2D
+ setchain.push_back(prev_pos);
+ setchain.push_back(codegen.get_name_map_pos(assign_property));
+ setchain.push_back(GDFunction::OPCODE_SET_MEMBER);
+ }
+
for(List<GDParser::OperatorNode*>::Element *E=chain.back();E;E=E->prev()) {
@@ -840,7 +901,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
}
- if (key_idx<0)
+ if (key_idx<0) //error
return key_idx;
codegen.opcodes.push_back(named ? GDFunction::OPCODE_GET_NAMED : GDFunction::OPCODE_GET);
@@ -852,7 +913,10 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
codegen.opcodes.push_back(dst_pos);
+
//add in reverse order, since it will be reverted
+
+
setchain.push_back(dst_pos);
setchain.push_back(key_idx);
setchain.push_back(prev_pos);
@@ -881,7 +945,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
}
- if (set_index<0)
+ if (set_index<0) //error
return set_index;
if (set_index&GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS) {
@@ -891,7 +955,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
int set_value = _parse_assign_right_expression(codegen,on,slevel+1);
- if (set_value<0)
+ if (set_value<0) //error
return set_value;
codegen.opcodes.push_back(named?GDFunction::OPCODE_SET_NAMED:GDFunction::OPCODE_SET);
@@ -899,20 +963,36 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
codegen.opcodes.push_back(set_index);
codegen.opcodes.push_back(set_value);
- for(int i=0;i<setchain.size();i+=4) {
+ for(int i=0;i<setchain.size();i++) {
- codegen.opcodes.push_back(setchain[i+0]);
- codegen.opcodes.push_back(setchain[i+1]);
- codegen.opcodes.push_back(setchain[i+2]);
- codegen.opcodes.push_back(setchain[i+3]);
+ codegen.opcodes.push_back(setchain[i]);
}
return retval;
+ } else if (on->arguments[0]->type==GDParser::Node::TYPE_IDENTIFIER && _is_class_member_property(codegen,static_cast<GDParser::IdentifierNode*>(on->arguments[0])->name)) {
+ //assignment to member property
+
+ int slevel = p_stack_level;
+
+ int src_address = _parse_assign_right_expression(codegen,on,slevel);
+ if (src_address<0)
+ return -1;
+
+ StringName name = static_cast<GDParser::IdentifierNode*>(on->arguments[0])->name;
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_SET_MEMBER);
+ codegen.opcodes.push_back(codegen.get_name_map_pos(name));
+ codegen.opcodes.push_back(src_address);
+
+ return GDFunction::ADDR_TYPE_NIL<<GDFunction::ADDR_BITS;
} else {
- //ASSIGNMENT MODE!!
+
+
+
+ //REGULAR ASSIGNMENT MODE!!
int slevel = p_stack_level;
@@ -1019,7 +1099,72 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
switch(cf->cf_type) {
-
+ case GDParser::ControlFlowNode::CF_MATCH: {
+ GDParser::MatchNode *match = cf->match;
+
+ GDParser::IdentifierNode *id = memnew(GDParser::IdentifierNode);
+ id->name = "#match_value";
+
+ // var #match_value
+ // copied because there is no _parse_statement :(
+ codegen.add_stack_identifier(id->name, p_stack_level++);
+ codegen.alloc_stack(p_stack_level);
+ new_identifiers++;
+
+ GDParser::OperatorNode *op = memnew(GDParser::OperatorNode);
+ op->op=GDParser::OperatorNode::OP_ASSIGN;
+ op->arguments.push_back(id);
+ op->arguments.push_back(match->val_to_match);
+
+ int ret = _parse_expression(codegen, op, p_stack_level);
+ if (ret < 0) {
+ return ERR_PARSE_ERROR;
+ }
+
+ // break address
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(codegen.opcodes.size() + 3);
+ int break_addr = codegen.opcodes.size();
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(0); // break addr
+
+ for (int j = 0; j < match->compiled_pattern_branches.size(); j++) {
+ GDParser::MatchNode::CompiledPatternBranch branch = match->compiled_pattern_branches[j];
+
+ // jump over continue
+ // jump unconditionally
+ // continue address
+ // compile the condition
+ int ret = _parse_expression(codegen, branch.compiled_pattern, p_stack_level);
+ if (ret < 0) {
+ return ERR_PARSE_ERROR;
+ }
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF);
+ codegen.opcodes.push_back(ret);
+ codegen.opcodes.push_back(codegen.opcodes.size() + 3);
+ int continue_addr = codegen.opcodes.size();
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(0);
+
+
+
+ Error err = _parse_block(codegen, branch.body, p_stack_level, p_break_addr, continue_addr);
+ if (err) {
+ return ERR_PARSE_ERROR;
+ }
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(break_addr);
+
+ codegen.opcodes[continue_addr + 1] = codegen.opcodes.size();
+ }
+
+ codegen.opcodes[break_addr + 1] = codegen.opcodes.size();
+
+
+ } break;
+
case GDParser::ControlFlowNode::CF_IF: {
#ifdef DEBUG_ENABLED
@@ -1211,6 +1356,11 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode*>(s);
+ if (_is_class_member_property(codegen,lv->name)) {
+ _set_error("Name for local variable '"+String(lv->name)+"' can't shadow class property of the same name.",lv);
+ return ERR_ALREADY_EXISTS;
+ }
+
codegen.add_stack_identifier(lv->name,p_stack_level++);
codegen.alloc_stack(p_stack_level);
new_identifiers++;
@@ -1249,6 +1399,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
if (p_func) {
for(int i=0;i<p_func->arguments.size();i++) {
+ if (_is_class_member_property(p_script,p_func->arguments[i])) {
+ _set_error("Name for argument '"+String(p_func->arguments[i])+"' can't shadow class property of the same name.",p_func);
+ return ERR_ALREADY_EXISTS;
+ }
codegen.add_stack_identifier(p_func->arguments[i],i);
#ifdef TOOLS_ENABLED
argnames.push_back(p_func->arguments[i]);
@@ -1331,9 +1485,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
GDFunction *gdfunc=NULL;
- //if (String(p_func->name)=="") { //initializer func
- // gdfunc = &p_script->initializer;
-
+ /*
+ if (String(p_func->name)=="") { //initializer func
+ gdfunc = &p_script->initializer;
+ */
//} else { //regular func
p_script->member_functions[func_name]=memnew(GDFunction);
gdfunc = p_script->member_functions[func_name];
@@ -1640,9 +1795,14 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
}
+ }else {
+ // without extends, implicitly extend Reference
+ int native_idx = GDScriptLanguage::get_singleton()->get_global_map()["Reference"];
+ native = GDScriptLanguage::get_singleton()->get_global_array()[native_idx];
+ ERR_FAIL_COND_V(native.is_null(), ERR_BUG);
+ p_script->native=native;
}
-
//print_line("Script: "+p_script->get_path()+" indices: "+itos(p_script->member_indices.size()));
@@ -1653,6 +1813,10 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
_set_error("Member '"+name+"' already exists (in current or parent class)",p_class);
return ERR_ALREADY_EXISTS;
}
+ if (_is_class_member_property(p_script,name)) {
+ _set_error("Member '"+name+"' already exists as a class property.",p_class);
+ return ERR_ALREADY_EXISTS;
+ }
if (p_class->variables[i]._export.type!=Variant::NIL) {
@@ -1691,6 +1855,11 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
StringName name = p_class->constant_expressions[i].identifier;
ERR_CONTINUE( p_class->constant_expressions[i].expression->type!=GDParser::Node::TYPE_CONSTANT );
+ if (_is_class_member_property(p_script,name)) {
+ _set_error("Member '"+name+"' already exists as a class property.",p_class);
+ return ERR_ALREADY_EXISTS;
+ }
+
GDParser::ConstantNode *constant = static_cast<GDParser::ConstantNode*>(p_class->constant_expressions[i].expression);
p_script->constants.insert(name,constant->value);
@@ -1723,7 +1892,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
}
if (native.is_valid()) {
- if (ObjectTypeDB::has_signal(native->get_name(),name)) {
+ if (ClassDB::has_signal(native->get_name(),name)) {
_set_error("Signal '"+name+"' redefined (original in native class '"+String(native->get_name())+"')",p_class);
return ERR_ALREADY_EXISTS;
}
diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h
index 7cf575e3d6..dd211a852c 100644
--- a/modules/gdscript/gd_compiler.h
+++ b/modules/gdscript/gd_compiler.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -37,6 +37,7 @@ class GDCompiler {
const GDParser *parser;
struct CodeGen {
+
GDScript *script;
const GDParser::ClassNode *class_node;
const GDParser::FunctionNode *function_node;
@@ -134,6 +135,9 @@ class GDCompiler {
Ref<GDScript> _parse_class(GDParser::ClassNode *p_class);
#endif
+ bool _is_class_member_property(CodeGen & codegen, const StringName & p_name);
+ bool _is_class_member_property(GDScript *owner, const StringName & p_name);
+
void _set_error(const String& p_error,const GDParser::Node *p_node);
bool _create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index c3e59836a2..19472d3d46 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -325,7 +325,7 @@ void GDScriptLanguage::get_public_constants(List<Pair<String,Variant> > *p_const
p_constants->push_back(pi);
}
-String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const {
+String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const {
String s="func "+p_name+"(";
if (p_args.size()) {
@@ -364,11 +364,13 @@ static GDCompletionIdentifier _get_type_from_variant(const Variant& p_variant) {
if (p_variant.get_type()==Variant::OBJECT) {
Object *obj = p_variant;
if (obj) {
- //if (obj->cast_to<GDNativeClass>()) {
- // t.obj_type=obj->cast_to<GDNativeClass>()->get_name();
- // t.value=Variant();
- //} else {
- t.obj_type=obj->get_type();
+ /*
+ if (obj->cast_to<GDNativeClass>()) {
+ t.obj_type=obj->cast_to<GDNativeClass>()->get_name();
+ t.value=Variant();
+ } else {
+ */
+ t.obj_type=obj->get_class();
//}
}
}
@@ -614,10 +616,10 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
}
}
- if (ObjectTypeDB::has_method(base.obj_type,id)) {
+ if (ClassDB::has_method(base.obj_type,id)) {
#ifdef TOOLS_ENABLED
- MethodBind *mb = ObjectTypeDB::get_method(base.obj_type,id);
+ MethodBind *mb = ClassDB::get_method(base.obj_type,id);
PropertyInfo pi = mb->get_argument_info(-1);
//try calling the function if constant and all args are constant, should not crash..
@@ -643,14 +645,14 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
}
}
- if (all_valid && String(id)=="get_node" && ObjectTypeDB::is_type(base.obj_type,"Node") && args.size()) {
+ if (all_valid && String(id)=="get_node" && ClassDB::is_parent_class(base.obj_type,"Node") && args.size()) {
String arg1=args[0];
if (arg1.begins_with("/root/")) {
String which = arg1.get_slice("/",2);
if (which!="") {
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
//print_line("find singleton");
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -662,7 +664,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
String name = s.get_slice("/",1);
//print_line("name: "+name+", which: "+which);
if (name==which) {
- String script = Globals::get_singleton()->get(s);
+ String script = GlobalConfig::get_singleton()->get(s);
if (!script.begins_with("res://")) {
script="res://"+script;
@@ -671,7 +673,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -940,6 +942,15 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
static bool _guess_identifier_type_in_block(GDCompletionContext& context,int p_line,const StringName& p_identifier,GDCompletionIdentifier &r_type) {
+ GDCompletionIdentifier gdi = _get_native_class(context);
+ if (gdi.obj_type!=StringName()) {
+ bool valid;
+ Variant::Type t = ClassDB::get_property_type(gdi.obj_type,p_identifier,&valid);
+ if (t!=Variant::NIL && valid) {
+ r_type.type=t;
+ return true;
+ }
+ }
const GDParser::Node *last_assign=NULL;
int last_assign_line=-1;
@@ -1068,7 +1079,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
//this kinda sucks but meh
List<MethodInfo> vmethods;
- ObjectTypeDB::get_virtual_methods(id.obj_type,&vmethods);
+ ClassDB::get_virtual_methods(id.obj_type,&vmethods);
for (List<MethodInfo>::Element *E=vmethods.front();E;E=E->next()) {
@@ -1142,7 +1153,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
//autoloads as singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -1152,14 +1163,14 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
String name = s.get_slice("/",1);
if (name==String(p_identifier)) {
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
String script =path.substr(1,path.length());
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -1298,26 +1309,43 @@ static void _find_identifiers_in_class(GDCompletionContext& context,bool p_stati
base=script->get_native();
} else if (nc.is_valid()) {
+ StringName type = nc->get_name();
+
if (!p_only_functions) {
- StringName type = nc->get_name();
+
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(type,&constants);
+ ClassDB::get_integer_constant_list(type,&constants);
for(List<String>::Element *E=constants.front();E;E=E->next()) {
result.insert(E->get());
}
- List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
- for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- if (E->get().name.begins_with("_"))
+ List<PropertyInfo> pinfo;
+
+ ClassDB::get_property_list(type,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
continue;
- if (E->get().arguments.size())
- result.insert(E->get().name+"(");
- else
- result.insert(E->get().name+"()");
+ if (E->get().name.find("/")!=-1)
+ continue;
+ result.insert(E->get().name);
}
+
}
+ List<MethodInfo> methods;
+ ClassDB::get_method_list(type,&methods);
+ for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
+ if (E->get().name.begins_with("_"))
+ continue;
+ if (E->get().arguments.size())
+ result.insert(E->get().name+"(");
+ else
+ result.insert(E->get().name+"()");
+ }
+
+
+
break;
} else
break;
@@ -1367,7 +1395,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
}
static const char*_type_names[Variant::VARIANT_MAX]={
- "null","bool","int","float","String","Vector2","Rect2","Vector3","Matrix32","Plane","Quat","AABB","Matrix3","Transform",
+ "null","bool","int","float","String","Vector2","Rect2","Vector3","Transform2D","Plane","Quat","AABB","Basis","Transform",
"Color","Image","NodePath","RID","Object","InputEvent","Dictionary","Array","RawArray","IntArray","FloatArray","StringArray",
"Vector2Array","Vector3Array","ColorArray"};
@@ -1377,7 +1405,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
//autoload singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -1385,7 +1413,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
if (!s.begins_with("autoload/"))
continue;
String name = s.get_slice("/",1);
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
result.insert(name);
}
@@ -1470,7 +1498,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
if (id.type==Variant::INPUT_EVENT && String(p_method)=="is_action" && p_argidx==0) {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
const PropertyInfo &pi=E->get();
@@ -1486,7 +1514,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
} else if (id.type==Variant::OBJECT && id.obj_type!=StringName()) {
- MethodBind *m = ObjectTypeDB::get_method(id.obj_type,p_method);
+ MethodBind *m = ClassDB::get_method(id.obj_type,p_method);
if (!m) {
//not in static method, see script
@@ -1699,7 +1727,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
if (p_argidx==0) {
List<MethodInfo> sigs;
- ObjectTypeDB::get_signal_list(id.obj_type,&sigs);
+ ClassDB::get_signal_list(id.obj_type,&sigs);
if (id.script.is_valid()) {
id.script->get_script_signal_list(&sigs);
@@ -1735,17 +1763,17 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
}*/
} else {
- if (p_argidx==0 && (String(p_method)=="get_node" || String(p_method)=="has_node") && ObjectTypeDB::is_type(id.obj_type,"Node")) {
+ if (p_argidx==0 && (String(p_method)=="get_node" || String(p_method)=="has_node") && ClassDB::is_parent_class(id.obj_type,"Node")) {
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
String s = E->get().name;
if (!s.begins_with("autoload/"))
continue;
- // print_line("found "+s);
+ //print_line("found "+s);
String name = s.get_slice("/",1);
result.insert("\"/root/"+name+"\"");
}
@@ -1970,12 +1998,12 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
//guess type..
/*
List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
+ ClassDB::get_method_list(type,&methods);
for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- //if (E->get().arguments.size())
- // result.insert(E->get().name+"(");
- //else
- // result.insert(E->get().name+"()");
+ if (E->get().arguments.size())
+ result.insert(E->get().name+"(");
+ else
+ result.insert(E->get().name+"()");
}*/
}
break;
@@ -2063,13 +2091,13 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
StringName type = nc->get_name();
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(type,&constants);
+ ClassDB::get_integer_constant_list(type,&constants);
for(List<String>::Element *E=constants.front();E;E=E->next()) {
result.insert(E->get());
}
List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
+ ClassDB::get_method_list(type,&methods);
for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
if (E->get().arguments.size())
result.insert(E->get().name+"(");
@@ -2129,6 +2157,27 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
case GDParser::COMPLETION_PARENT_FUNCTION: {
} break;
+ case GDParser::COMPLETION_GET_NODE: {
+
+ if (p_owner) {
+ List<String> opts;
+ p_owner->get_argument_options("get_node",0,&opts);
+
+ for (List<String>::Element *E=opts.front();E;E=E->next()) {
+
+ String opt = E->get().strip_edges();
+ if (opt.begins_with("\"") && opt.ends_with("\"")) {
+ String idopt=opt.substr(1,opt.length()-2);
+ if (idopt.replace("/","_").is_valid_identifier()) {
+ options.insert(idopt);
+ } else {
+ options.insert(opt);
+ }
+ }
+ }
+
+ }
+ } break;
case GDParser::COMPLETION_METHOD:
isfunction=true;
case GDParser::COMPLETION_INDEX: {
@@ -2149,10 +2198,21 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (gdn.is_valid()) {
StringName cn = gdn->get_name();
List<String> cnames;
- ObjectTypeDB::get_integer_constant_list(cn,&cnames);
+ ClassDB::get_integer_constant_list(cn,&cnames);
for (List<String>::Element *E=cnames.front();E;E=E->next()) {
options.insert(E->get());
}
+
+ List<PropertyInfo> pinfo;
+ ClassDB::get_property_list(cn,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
+ continue;
+ if (E->get().name.find("/")!=-1)
+ continue;
+ options.insert(E->get().name);
+ }
}
} else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
@@ -2288,10 +2348,23 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (!isfunction) {
- ObjectTypeDB::get_integer_constant_list(t.obj_type,r_options);
+ ClassDB::get_integer_constant_list(t.obj_type,r_options);
+
+ List<PropertyInfo> pinfo;
+ ClassDB::get_property_list(t.obj_type,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
+ continue;
+ if (E->get().name.find("/")!=-1)
+ continue;
+ r_options->push_back(E->get().name);
+ }
}
+
+
List<MethodInfo> mi;
- ObjectTypeDB::get_method_list(t.obj_type,&mi);
+ ClassDB::get_method_list(t.obj_type,&mi);
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
if (E->get().name.begins_with("_"))
@@ -2320,8 +2393,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
"# Key",
"# MouseMotion",
"# MouseButton",
- "# JoystickMotion",
- "# JoystickButton",
+ "# JoypadMotion",
+ "# JoypadButton",
"# ScreenTouch",
"# ScreenDrag",
"# Action"
@@ -2397,7 +2470,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (cid.obj_type!=StringName()) {
List<MethodInfo> vm;
- ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm);
+ ClassDB::get_virtual_methods(cid.obj_type,&vm);
for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) {
MethodInfo &mi=E->get();
@@ -2433,7 +2506,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
List<MethodInfo> sigs;
- ObjectTypeDB::get_signal_list(t.obj_type,&sigs);
+ ClassDB::get_signal_list(t.obj_type,&sigs);
for (List<MethodInfo>::Element *E=sigs.front();E;E=E->next()) {
options.insert("\""+E->get().name+"\"");
}
@@ -2531,7 +2604,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
//before parsing, try the usual stuff
- if (ObjectTypeDB::type_exists(p_symbol)) {
+ if (ClassDB::class_exists(p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS;
r_result.class_name=p_symbol;
return OK;
@@ -2612,7 +2685,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
GDCompletionIdentifier identifier = _get_native_class(context);
print_line("identifier: "+String(identifier.obj_type));
- if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) {
+ if (ClassDB::has_method(identifier.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=identifier.obj_type;
@@ -2653,7 +2726,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
GDCompletionIdentifier identifier = _get_native_class(context);
- if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) {
+ if (ClassDB::has_method(identifier.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=identifier.obj_type;
@@ -2663,6 +2736,19 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
} else {
+ GDCompletionIdentifier gdi = _get_native_class(context);
+ if (gdi.obj_type!=StringName()) {
+ bool valid;
+ Variant::Type t = ClassDB::get_property_type(gdi.obj_type,p_symbol,&valid);
+ if (t!=Variant::NIL && valid) {
+ r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY;
+ r_result.class_name=gdi.obj_type;
+ r_result.class_member=p_symbol;
+ return OK;
+
+ }
+ }
+
const GDParser::BlockNode *block=context.block;
//search in blocks going up (local var?)
while(block) {
@@ -2731,7 +2817,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
//guess in autoloads as singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -2741,14 +2827,14 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
String name = s.get_slice("/",1);
if (name==String(p_symbol)) {
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
String script =path.substr(1,path.length());
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -2777,7 +2863,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
} else {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS;
- r_result.class_name=obj->get_type();
+ r_result.class_name=obj->get_class();
}
return OK;
}
@@ -2858,7 +2944,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
}
}
- if (ObjectTypeDB::has_method(t.obj_type,p_symbol)) {
+ if (ClassDB::has_method(t.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=t.obj_type;
@@ -2868,7 +2954,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
}
bool success;
- ObjectTypeDB::get_integer_constant(t.obj_type,p_symbol,&success);
+ ClassDB::get_integer_constant(t.obj_type,p_symbol,&success);
if (success) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name=t.obj_type;
@@ -2876,7 +2962,8 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
return OK;
}
- ObjectTypeDB::get_property_type(t.obj_type,p_symbol,&success);
+
+ ClassDB::get_property_type(t.obj_type,p_symbol,&success);
if (success) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY;
@@ -2936,7 +3023,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
if (cid.obj_type!=StringName()) {
List<MethodInfo> vm;
- ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm);
+ ClassDB::get_virtual_methods(cid.obj_type,&vm);
for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) {
if (p_symbol==E->get().name) {
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index 094e21bb4f..6659988602 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -119,9 +119,9 @@ static String _get_var_type(const Variant* p_type) {
#ifdef DEBUG_ENABLED
if (ObjectDB::instance_validate(bobj)) {
if (bobj->get_script_instance())
- basestr= bobj->get_type()+" ("+bobj->get_script_instance()->get_script()->get_path().get_file()+")";
+ basestr= bobj->get_class()+" ("+bobj->get_script_instance()->get_script()->get_path().get_file()+")";
else
- basestr = bobj->get_type();
+ basestr = bobj->get_class();
} else {
basestr="previously freed instance";
}
@@ -395,11 +395,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!nc) {
- err_text="Right operand of 'extends' is not a class (type: '"+obj_B->get_type()+"').";
+ err_text="Right operand of 'extends' is not a class (type: '"+obj_B->get_class()+"').";
break;
}
- extends_ok=ObjectTypeDB::is_type(obj_A->get_type_name(),nc->get_name());
+ extends_ok=ClassDB::is_parent_class(obj_A->get_class_name(),nc->get_name());
}
*dst=extends_ok;
@@ -487,7 +487,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
case OPCODE_GET_NAMED: {
- CHECK_SPACE(3);
+ CHECK_SPACE(4);
GET_VARIANT_PTR(src,1);
GET_VARIANT_PTR(dst,3);
@@ -519,6 +519,46 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#endif
ip+=4;
} continue;
+ case OPCODE_SET_MEMBER: {
+
+ CHECK_SPACE(3);
+ int indexname = _code_ptr[ip+1];
+ ERR_BREAK(indexname<0 || indexname>=_global_names_count);
+ const StringName *index = &_global_names_ptr[indexname];
+ GET_VARIANT_PTR(src,2);
+
+ bool valid;
+ bool ok = ClassDB::set_property(p_instance->owner,*index,*src,&valid);
+#ifdef DEBUG_ENABLED
+ if (!ok) {
+ err_text="Internal error setting property: "+String(*index);
+ break;
+ } else if (!valid) {
+ err_text="Error setting property '"+String(*index)+"' with value of type "+Variant::get_type_name(src->get_type())+".";
+ break;
+
+ }
+#endif
+ ip+=3;
+ } continue;
+ case OPCODE_GET_MEMBER: {
+
+ CHECK_SPACE(3);
+ int indexname = _code_ptr[ip+1];
+ ERR_BREAK(indexname<0 || indexname>=_global_names_count);
+ const StringName *index = &_global_names_ptr[indexname];
+ GET_VARIANT_PTR(dst,2);
+ bool ok = ClassDB::get_property(p_instance->owner,*index,*dst);
+
+#ifdef DEBUG_ENABLED
+ if (!ok) {
+ err_text="Internal error getting property: "+String(*index);
+ break;
+ }
+#endif
+ ip+=3;
+
+ } continue;
case OPCODE_ASSIGN: {
CHECK_SPACE(3);
@@ -577,7 +617,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(1);
int argc=_code_ptr[ip+1];
- Array array(true); //arrays are always shared
+ Array array; //arrays are always shared
array.resize(argc);
CHECK_SPACE(argc+2);
@@ -598,7 +638,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(1);
int argc=_code_ptr[ip+1];
- Dictionary dict(true); //arrays are always shared
+ Dictionary dict; //arrays are always shared
CHECK_SPACE(argc*2+2);
@@ -788,7 +828,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (*methodname!=GDScriptLanguage::get_singleton()->strings._init) {
- MethodBind *mb = ObjectTypeDB::get_method(gds->native->get_name(),*methodname);
+ MethodBind *mb = ClassDB::get_method(gds->native->get_name(),*methodname);
if (!mb) {
err.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
} else {
@@ -1435,9 +1475,9 @@ Variant GDFunctionState::resume(const Variant& p_arg) {
void GDFunctionState::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant()));
- ObjectTypeDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid);
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback"));
+ ClassDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant()));
+ ClassDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid);
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback"));
}
diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h
index f1c5b13ca1..e5262e8ad7 100644
--- a/modules/gdscript/gd_function.h
+++ b/modules/gdscript/gd_function.h
@@ -23,6 +23,8 @@ public:
OPCODE_GET,
OPCODE_SET_NAMED,
OPCODE_GET_NAMED,
+ OPCODE_SET_MEMBER,
+ OPCODE_GET_MEMBER,
OPCODE_ASSIGN,
OPCODE_ASSIGN_TRUE,
OPCODE_ASSIGN_FALSE,
@@ -204,7 +206,7 @@ public:
class GDFunctionState : public Reference {
- OBJ_TYPE(GDFunctionState,Reference);
+ GDCLASS(GDFunctionState,Reference);
friend class GDFunction;
GDFunction *function;
GDFunction::CallState state;
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index d3f7dcd35f..1c41b2e73b 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -35,6 +35,7 @@
#include "os/os.h"
#include "variant_parser.h"
#include "io/marshalls.h"
+#include "io/json.h"
const char *GDFunctions::get_func_name(Function p_func) {
@@ -103,8 +104,12 @@ const char *GDFunctions::get_func_name(Function p_func) {
"load",
"inst2dict",
"dict2inst",
+ "validate_json",
+ "parse_json",
+ "to_json",
"hash",
"Color8",
+ "ColorN",
"print_stack",
"instance_from_id",
};
@@ -536,7 +541,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case TYPE_EXISTS: {
VALIDATE_ARG_COUNT(1);
- r_ret = ObjectTypeDB::type_exists(*p_args[0]);
+ r_ret = ClassDB::class_exists(*p_args[0]);
} break;
case TEXT_CHAR: {
@@ -668,7 +673,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case VAR_TO_BYTES: {
VALIDATE_ARG_COUNT(1);
- ByteArray barr;
+ PoolByteArray barr;
int len;
Error err = encode_variant(*p_args[0],NULL,len);
if (err) {
@@ -681,7 +686,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
barr.resize(len);
{
- ByteArray::Write w = barr.write();
+ PoolByteArray::Write w = barr.write();
encode_variant(*p_args[0],w.ptr(),len);
}
@@ -689,24 +694,24 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
} break;
case BYTES_TO_VAR: {
VALIDATE_ARG_COUNT(1);
- if (p_args[0]->get_type()!=Variant::RAW_ARRAY) {
+ if (p_args[0]->get_type()!=Variant::POOL_BYTE_ARRAY) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
r_ret=Variant();
return;
}
- ByteArray varr=*p_args[0];
+ PoolByteArray varr=*p_args[0];
Variant ret;
{
- ByteArray::Read r=varr.read();
+ PoolByteArray::Read r=varr.read();
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
if (err!=OK) {
r_ret=RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
@@ -730,7 +735,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
VALIDATE_ARG_NUM(0);
int count=*p_args[0];
- Array arr(true);
+ Array arr;
if (count<=0) {
r_ret=arr;
return;
@@ -756,7 +761,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
int from=*p_args[0];
int to=*p_args[1];
- Array arr(true);
+ Array arr;
if (from>=to) {
r_ret=arr;
return;
@@ -787,7 +792,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
return;
}
- Array arr(true);
+ Array arr;
if (from>=to && incr>0) {
r_ret=arr;
return;
@@ -846,6 +851,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
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;
r_ret=Variant();
} else {
r_ret=ResourceLoader::load(*p_args[0]);
@@ -915,7 +921,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
NodePath cp(sname,Vector<StringName>(),false);
- Dictionary d(true);
+ Dictionary d;
d["@subpath"]=cp;
d["@path"]=p->path;
@@ -1024,6 +1030,57 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
}
} break;
+ case VALIDATE_JSON: {
+
+ VALIDATE_ARG_COUNT(1);
+
+ 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;
+ r_ret=Variant();
+ return;
+ }
+
+ String errs;
+ int errl;
+
+ Error err = JSON::parse(*p_args[0],r_ret,errs,errl);
+
+ if (err!=OK) {
+ r_ret=itos(errl)+":"+errs;
+ } else {
+ r_ret="";
+ }
+
+ } break;
+ case PARSE_JSON: {
+
+ VALIDATE_ARG_COUNT(1);
+
+ 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;
+ r_ret=Variant();
+ return;
+ }
+
+ String errs;
+ int errl;
+
+ Error err = JSON::parse(*p_args[0],r_ret,errs,errl);
+
+ if (err!=OK) {
+ r_ret=Variant();
+ }
+
+ } break;
+ case TO_JSON: {
+ VALIDATE_ARG_COUNT(1);
+
+ r_ret = JSON::print(*p_args[0]);
+ } break;
case HASH: {
VALIDATE_ARG_COUNT(1);
@@ -1061,6 +1118,36 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_ret=color;
} break;
+ case COLORN: {
+
+ if (p_arg_count<1) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=1;
+ r_ret=Variant();
+ return;
+ }
+
+ if (p_arg_count>2) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
+ r_error.argument=2;
+ r_ret=Variant();
+ return;
+ }
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_ret=Variant();
+ } else {
+ Color color = Color::named(*p_args[0]);
+ if (p_arg_count==2) {
+ VALIDATE_ARG_NUM(1);
+ color.a=*p_args[1];
+ }
+ r_ret=color;
+ }
+
+ } break;
case PRINT_STACK: {
@@ -1475,13 +1562,13 @@ MethodInfo GDFunctions::get_info(Function p_func) {
} break;
case VAR_TO_BYTES: {
MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var"));
- mi.return_val.type=Variant::RAW_ARRAY;
+ mi.return_val.type=Variant::POOL_BYTE_ARRAY;
return mi;
} break;
case BYTES_TO_VAR: {
- MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::RAW_ARRAY,"bytes"));
+ MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes"));
mi.return_val.type=Variant::NIL;
return mi;
} break;
@@ -1510,6 +1597,24 @@ MethodInfo GDFunctions::get_info(Function p_func) {
mi.return_val.type=Variant::OBJECT;
return mi;
} break;
+ case VALIDATE_JSON: {
+
+ MethodInfo mi("validate_json:Variant",PropertyInfo(Variant::STRING,"json"));
+ mi.return_val.type=Variant::STRING;
+ return mi;
+ } break;
+ case PARSE_JSON: {
+
+ MethodInfo mi("parse_json:Variant",PropertyInfo(Variant::STRING,"json"));
+ mi.return_val.type=Variant::NIL;
+ return mi;
+ } break;
+ case TO_JSON: {
+
+ MethodInfo mi("to_json",PropertyInfo(Variant::NIL,"var:Variant"));
+ mi.return_val.type=Variant::STRING;
+ return mi;
+ } break;
case HASH: {
MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:Variant"));
@@ -1522,6 +1627,12 @@ MethodInfo GDFunctions::get_info(Function p_func) {
mi.return_val.type=Variant::COLOR;
return mi;
} break;
+ case COLORN: {
+
+ MethodInfo mi("ColorN",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::REAL,"alpha"));
+ mi.return_val.type=Variant::COLOR;
+ return mi;
+ } break;
case PRINT_STACK: {
MethodInfo mi("print_stack");
diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h
index f444bb3b5b..6e30b4dbb5 100644
--- a/modules/gdscript/gd_functions.h
+++ b/modules/gdscript/gd_functions.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -97,8 +97,12 @@ public:
RESOURCE_LOAD,
INST2DICT,
DICT2INST,
+ VALIDATE_JSON,
+ PARSE_JSON,
+ TO_JSON,
HASH,
COLOR8,
+ COLORN,
PRINT_STACK,
INSTANCE_FROM_ID,
FUNC_MAX
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 1f2b7291e5..4a36fbb4f1 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -225,8 +225,8 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide
GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_allow_assign,bool p_parsing_constant) {
-// Vector<Node*> expressions;
-// Vector<OperatorNode::Operator> operators;
+ //Vector<Node*> expressions;
+ //Vector<OperatorNode::Operator> operators;
Vector<Expression> expression;
@@ -265,6 +265,98 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
tokenizer->advance();
expr=subexpr;
+ } else if (tokenizer->get_token()==GDTokenizer::TK_DOLLAR) {
+ tokenizer->advance();
+
+ String path;
+
+ bool need_identifier=true;
+ bool done=false;
+
+ while(!done) {
+
+ switch(tokenizer->get_token()) {
+ case GDTokenizer::TK_CURSOR: {
+ completion_cursor=StringName();
+ completion_type=COMPLETION_GET_NODE;
+ completion_class=current_class;
+ completion_function=current_function;
+ completion_line=tokenizer->get_token_line();
+ completion_cursor=path;
+ completion_argument=0;
+ completion_block=current_block;
+ completion_found=true;
+ tokenizer->advance();
+ } break;
+ case GDTokenizer::TK_CONSTANT: {
+
+ if (!need_identifier) {
+ done=true;
+ break;
+ }
+
+ if (tokenizer->get_token_constant().get_type()!=Variant::STRING) {
+ _set_error("Expected string constant or identifier after '$' or '/'.");
+ return NULL;
+ }
+
+ path+=String(tokenizer->get_token_constant());
+ tokenizer->advance();
+ need_identifier=false;
+
+ } break;
+ case GDTokenizer::TK_IDENTIFIER: {
+ if (!need_identifier) {
+ done=true;
+ break;
+ }
+
+ path+=String(tokenizer->get_token_identifier());
+ tokenizer->advance();
+ need_identifier=false;
+
+ } break;
+ case GDTokenizer::TK_OP_DIV: {
+
+ if (need_identifier) {
+ done=true;
+ break;
+ }
+
+ path+="/";
+ tokenizer->advance();
+ need_identifier=true;
+
+ } break;
+ default: {
+ done=true;
+ break;
+ }
+ }
+ }
+
+ if (path=="") {
+ _set_error("Path expected after $.");
+ return NULL;
+
+ }
+
+ OperatorNode *op = alloc_node<OperatorNode>();
+ op->op=OperatorNode::OP_CALL;
+
+ op->arguments.push_back(alloc_node<SelfNode>());
+
+ IdentifierNode *funcname = alloc_node<IdentifierNode>();
+ funcname->name="get_node";
+
+ op->arguments.push_back(funcname);
+
+ ConstantNode *nodepath = alloc_node<ConstantNode>();
+ nodepath->value = NodePath(StringName(path));
+ op->arguments.push_back(nodepath);
+
+ expr=op;
+
} else if (tokenizer->get_token()==GDTokenizer::TK_CURSOR) {
tokenizer->advance();
continue; //no point in cursor in the middle of expression
@@ -632,6 +724,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
};
Node *key=NULL;
+ Set<Variant> keys;
DictExpect expecting=DICT_EXPECT_KEY;
@@ -727,6 +820,16 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
return NULL;
expecting=DICT_EXPECT_COMMA;
+ if (key->type == GDParser::Node::TYPE_CONSTANT) {
+ Variant const& keyName = static_cast<const GDParser::ConstantNode*>(key)->value;
+
+ if (keys.has(keyName)) {
+ _set_error("Duplicate key found in Dictionary literal");
+ return NULL;
+ }
+ keys.insert(keyName);
+ }
+
DictionaryNode::Pair pair;
pair.key=key;
pair.value=value;
@@ -1225,7 +1328,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
//reduce constant array expression
ConstantNode *cn = alloc_node<ConstantNode>();
- Array arr(!p_to_const);
+ Array arr;
//print_line("mk array "+itos(!p_to_const));
arr.resize(an->elements.size());
for(int i=0;i<an->elements.size();i++) {
@@ -1260,7 +1363,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
//reduce constant array expression
ConstantNode *cn = alloc_node<ConstantNode>();
- Dictionary dict(!p_to_const);
+ Dictionary dict;
for(int i=0;i<dn->elements.size();i++) {
ConstantNode *key_c = static_cast<ConstantNode*>(dn->elements[i].key);
ConstantNode *value_c = static_cast<ConstantNode*>(dn->elements[i].value);
@@ -1478,6 +1581,15 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
return op;
}
+ if (op->arguments[0]->type==Node::TYPE_OPERATOR) {
+ OperatorNode *on = static_cast<OperatorNode*>(op->arguments[0]);
+ if (on->op != OperatorNode::OP_INDEX && on->op != OperatorNode::OP_INDEX_NAMED) {
+ _set_error("Can't assign to an expression",tokenizer->get_token_line()-1);
+ error_line=op->line;
+ return op;
+ }
+ }
+
} break;
default: { break; }
}
@@ -1578,6 +1690,542 @@ bool GDParser::_recover_from_completion() {
return true;
}
+GDParser::PatternNode *GDParser::_parse_pattern(bool p_static)
+{
+
+ PatternNode *pattern = alloc_node<PatternNode>();
+
+ GDTokenizer::Token token = tokenizer->get_token();
+ if (error_set)
+ return NULL;
+
+ if (token == GDTokenizer::TK_EOF) {
+ return NULL;
+ }
+
+ switch (token) {
+ // dictionary
+ case GDTokenizer::TK_BRACKET_OPEN: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_ARRAY;
+ while (true) {
+
+ if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) {
+ // match everything
+ tokenizer->advance(2);
+ PatternNode *sub_pattern = alloc_node<PatternNode>();
+ sub_pattern->pt_type = GDParser::PatternNode::PT_IGNORE_REST;
+ pattern->array.push_back(sub_pattern);
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance(2);
+ break;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance(1);
+ break;
+ } else {
+ _set_error("'..' pattern only allowed at the end of an array pattern");
+ return NULL;
+ }
+ }
+
+ PatternNode *sub_pattern = _parse_pattern(p_static);
+ if (!sub_pattern) {
+ return NULL;
+ }
+
+ pattern->array.push_back(sub_pattern);
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ continue;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ } else {
+ _set_error("Not a valid pattern");
+ return NULL;
+ }
+ }
+ } break;
+ // bind
+ case GDTokenizer::TK_PR_VAR: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_BIND;
+ pattern->bind = tokenizer->get_token_identifier();
+ tokenizer->advance();
+ } break;
+ // array
+ case GDTokenizer::TK_CURLY_BRACKET_OPEN: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_DICTIONARY;
+ while (true) {
+
+ if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) {
+ // match everything
+ tokenizer->advance(2);
+ PatternNode *sub_pattern = alloc_node<PatternNode>();
+ sub_pattern->pt_type = PatternNode::PT_IGNORE_REST;
+ pattern->array.push_back(sub_pattern);
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance(2);
+ break;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance(1);
+ break;
+ } else {
+ _set_error("'..' pattern only allowed at the end of an dictionary pattern");
+ return NULL;
+ }
+ }
+
+ Node *key = _parse_and_reduce_expression(pattern, p_static);
+ if (!key) {
+ _set_error("Not a valid key in pattern");
+ return NULL;
+ }
+
+ if (key->type != GDParser::Node::TYPE_CONSTANT) {
+ _set_error("Not a constant expression as key");
+ return NULL;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COLON) {
+ tokenizer->advance();
+
+ PatternNode *value = _parse_pattern(p_static);
+ if (!value) {
+ _set_error("Expected pattern in dictionary value");
+ return NULL;
+ }
+
+ pattern->dictionary.insert(static_cast<ConstantNode*>(key), value);
+ } else {
+ pattern->dictionary.insert(static_cast<ConstantNode*>(key), NULL);
+ }
+
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ continue;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ } else {
+ _set_error("Not a valid pattern");
+ return NULL;
+ }
+ }
+ } break;
+ // all the constants like strings and numbers
+ default: {
+ Node *value = _parse_and_reduce_expression(pattern, p_static);
+ if (error_set) {
+ return NULL;
+ }
+ if (value->type == Node::TYPE_IDENTIFIER && static_cast<IdentifierNode*>(value)->name == "_") {
+ // wildcard pattern
+ pattern->pt_type = PatternNode::PT_WILDCARD;
+ break;
+ }
+
+ if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
+ _set_error("Only constant expressions or variables allowed in a pattern");
+ return NULL;
+ }
+
+ pattern->pt_type = PatternNode::PT_CONSTANT;
+ pattern->constant = value;
+ } break;
+ }
+
+ return pattern;
+}
+
+void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static)
+{
+ int indent_level = tab_level.back()->get();
+
+ while (true) {
+
+ while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline());
+
+ // GDTokenizer::Token token = tokenizer->get_token();
+ if (error_set)
+ return;
+
+ if (indent_level > tab_level.back()->get()) {
+ return; // go back a level
+ }
+
+ if (pending_newline!=-1) {
+ pending_newline=-1;
+ }
+
+ PatternBranchNode *branch = alloc_node<PatternBranchNode>();
+
+ branch->patterns.push_back(_parse_pattern(p_static));
+ if (!branch->patterns[0]) {
+ return;
+ }
+
+ while (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ branch->patterns.push_back(_parse_pattern(p_static));
+ if (!branch->patterns[branch->patterns.size() - 1]) {
+ return;
+ }
+ }
+
+ if(!_enter_indent_block()) {
+ _set_error("Expected block in pattern branch");
+ return;
+ }
+
+ branch->body = alloc_node<BlockNode>();
+ branch->body->parent_block = p_block;
+ p_block->sub_blocks.push_back(branch->body);
+ current_block = branch->body;
+
+ _parse_block(branch->body, p_static);
+
+ current_block = p_block;
+
+ p_branches.push_back(branch);
+ }
+}
+
+
+void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings)
+{
+ switch (p_pattern->pt_type) {
+ case PatternNode::PT_CONSTANT: {
+
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ OperatorNode *typeof_pattern_value = alloc_node<OperatorNode>();
+ typeof_pattern_value->op = OperatorNode::OP_CALL;
+ typeof_pattern_value->arguments.push_back(typeof_node);
+ typeof_pattern_value->arguments.push_back(p_pattern->constant);
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_pattern_value);
+
+
+ // comare the actual values
+ OperatorNode *value_comp = alloc_node<OperatorNode>();
+ value_comp->op = OperatorNode::OP_EQUAL;
+ value_comp->arguments.push_back(p_pattern->constant);
+ value_comp->arguments.push_back(p_node_to_match);
+
+
+ OperatorNode *comparison = alloc_node<OperatorNode>();
+ comparison->op = OperatorNode::OP_AND;
+ comparison->arguments.push_back(type_comp);
+ comparison->arguments.push_back(value_comp);
+
+ p_resulting_node = comparison;
+
+ } break;
+ case PatternNode::PT_BIND: {
+ p_bindings[p_pattern->bind] = p_node_to_match;
+
+ // a bind always matches
+ ConstantNode *true_value = alloc_node<ConstantNode>();
+ true_value->value = Variant(true);
+ p_resulting_node = true_value;
+ } break;
+ case PatternNode::PT_ARRAY: {
+
+ bool open_ended = false;
+
+ if (p_pattern->array.size() > 0) {
+ if (p_pattern->array[p_pattern->array.size() - 1]->pt_type == PatternNode::PT_IGNORE_REST) {
+ open_ended = true;
+ }
+ }
+
+ // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() >= length
+ // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() == length
+
+ {
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *typeof_array = alloc_node<IdentifierNode>();
+ typeof_array->name = "TYPE_ARRAY";
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_array);
+
+
+ // size
+ ConstantNode *length = alloc_node<ConstantNode>();
+ length->value = Variant(open_ended ? p_pattern->array.size() - 1 : p_pattern->array.size());
+
+ OperatorNode *call = alloc_node<OperatorNode>();
+ call->op = OperatorNode::OP_CALL;
+ call->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *size = alloc_node<IdentifierNode>();
+ size->name = "size";
+ call->arguments.push_back(size);
+
+ OperatorNode *length_comparison = alloc_node<OperatorNode>();
+ length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL;
+ length_comparison->arguments.push_back(call);
+ length_comparison->arguments.push_back(length);
+
+ OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>();
+ type_and_length_comparison->op = OperatorNode::OP_AND;
+ type_and_length_comparison->arguments.push_back(type_comp);
+ type_and_length_comparison->arguments.push_back(length_comparison);
+
+ p_resulting_node = type_and_length_comparison;
+ }
+
+
+
+ for (int i = 0; i < p_pattern->array.size(); i++) {
+ PatternNode *pattern = p_pattern->array[i];
+
+ Node *condition = NULL;
+
+ ConstantNode *index = alloc_node<ConstantNode>();
+ index->value = Variant(i);
+
+ OperatorNode *indexed_value = alloc_node<OperatorNode>();
+ indexed_value->op = OperatorNode::OP_INDEX;
+ indexed_value->arguments.push_back(p_node_to_match);
+ indexed_value->arguments.push_back(index);
+
+ _generate_pattern(pattern, indexed_value, condition, p_bindings);
+
+ // concatenate all the patterns with &&
+ OperatorNode *and_node = alloc_node<OperatorNode>();
+ and_node->op = OperatorNode::OP_AND;
+ and_node->arguments.push_back(p_resulting_node);
+ and_node->arguments.push_back(condition);
+
+ p_resulting_node = and_node;
+ }
+
+
+ } break;
+ case PatternNode::PT_DICTIONARY: {
+
+ bool open_ended = false;
+
+ if (p_pattern->array.size() > 0) {
+ open_ended = true;
+ }
+
+ // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() >= length
+ // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() == length
+
+
+ {
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *typeof_dictionary = alloc_node<IdentifierNode>();
+ typeof_dictionary->name = "TYPE_DICTIONARY";
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_dictionary);
+
+ // size
+ ConstantNode *length = alloc_node<ConstantNode>();
+ length->value = Variant(open_ended ? p_pattern->dictionary.size() - 1 : p_pattern->dictionary.size());
+
+ OperatorNode *call = alloc_node<OperatorNode>();
+ call->op = OperatorNode::OP_CALL;
+ call->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *size = alloc_node<IdentifierNode>();
+ size->name = "size";
+ call->arguments.push_back(size);
+
+ OperatorNode *length_comparison = alloc_node<OperatorNode>();
+ length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL;
+ length_comparison->arguments.push_back(call);
+ length_comparison->arguments.push_back(length);
+
+ OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>();
+ type_and_length_comparison->op = OperatorNode::OP_AND;
+ type_and_length_comparison->arguments.push_back(type_comp);
+ type_and_length_comparison->arguments.push_back(length_comparison);
+
+ p_resulting_node = type_and_length_comparison;
+ }
+
+
+
+ for (Map<ConstantNode*, PatternNode*>::Element *e = p_pattern->dictionary.front(); e; e = e->next()) {
+
+ Node *condition = NULL;
+
+ // chech for has, then for pattern
+
+ IdentifierNode *has = alloc_node<IdentifierNode>();
+ has->name = "has";
+
+ OperatorNode *has_call = alloc_node<OperatorNode>();
+ has_call->op = OperatorNode::OP_CALL;
+ has_call->arguments.push_back(p_node_to_match);
+ has_call->arguments.push_back(has);
+ has_call->arguments.push_back(e->key());
+
+
+ if (e->value()) {
+
+ OperatorNode *indexed_value = alloc_node<OperatorNode>();
+ indexed_value->op = OperatorNode::OP_INDEX;
+ indexed_value->arguments.push_back(p_node_to_match);
+ indexed_value->arguments.push_back(e->key());
+
+ _generate_pattern(e->value(), indexed_value, condition, p_bindings);
+
+ OperatorNode *has_and_pattern = alloc_node<OperatorNode>();
+ has_and_pattern->op = OperatorNode::OP_AND;
+ has_and_pattern->arguments.push_back(has_call);
+ has_and_pattern->arguments.push_back(condition);
+
+ condition = has_and_pattern;
+
+ } else {
+ condition = has_call;
+ }
+
+
+
+ // concatenate all the patterns with &&
+ OperatorNode *and_node = alloc_node<OperatorNode>();
+ and_node->op = OperatorNode::OP_AND;
+ and_node->arguments.push_back(p_resulting_node);
+ and_node->arguments.push_back(condition);
+
+ p_resulting_node = and_node;
+ }
+
+ } break;
+ case PatternNode::PT_IGNORE_REST:
+ case PatternNode::PT_WILDCARD: {
+ // simply generate a `true`
+ ConstantNode *true_value = alloc_node<ConstantNode>();
+ true_value->value = Variant(true);
+ p_resulting_node = true_value;
+ } break;
+ default: {
+
+ } break;
+ }
+}
+
+void GDParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement)
+{
+ IdentifierNode *id = alloc_node<IdentifierNode>();
+ id->name = "#match_value";
+
+ for (int i = 0; i < p_match_statement->branches.size(); i++) {
+
+ PatternBranchNode *branch = p_match_statement->branches[i];
+
+ MatchNode::CompiledPatternBranch compiled_branch;
+ compiled_branch.compiled_pattern = NULL;
+
+ Map<StringName, Node*> binding;
+
+ for (int j = 0; j < branch->patterns.size(); j++) {
+ PatternNode *pattern = branch->patterns[j];
+
+ Map<StringName, Node*> bindings;
+ Node *resulting_node;
+ _generate_pattern(pattern, id, resulting_node, bindings);
+
+ if (!binding.empty() && !bindings.empty()) {
+ _set_error("Multipatterns can't contain bindings");
+ return;
+ } else {
+ binding = bindings;
+ }
+
+ if (compiled_branch.compiled_pattern) {
+ OperatorNode *or_node = alloc_node<OperatorNode>();
+ or_node->op = OperatorNode::OP_OR;
+ or_node->arguments.push_back(compiled_branch.compiled_pattern);
+ or_node->arguments.push_back(resulting_node);
+
+ compiled_branch.compiled_pattern = or_node;
+ } else {
+ // single pattern | first one
+ compiled_branch.compiled_pattern = resulting_node;
+ }
+
+ }
+
+
+ // prepare the body ...hehe
+ for (Map<StringName, Node*>::Element *e = binding.front(); e; e = e->next()) {
+ LocalVarNode *local_var = alloc_node<LocalVarNode>();
+ local_var->name = e->key();
+ local_var->assign = e->value();
+
+
+ IdentifierNode *id = alloc_node<IdentifierNode>();
+ id->name = local_var->name;
+
+ OperatorNode *op = alloc_node<OperatorNode>();
+ op->op=OperatorNode::OP_ASSIGN;
+ op->arguments.push_back(id);
+ op->arguments.push_back(local_var->assign);
+
+ branch->body->statements.push_front(op);
+ branch->body->statements.push_front(local_var);
+ }
+
+ compiled_branch.body = branch->body;
+
+
+ p_match_statement->compiled_pattern_branches.push_back(compiled_branch);
+ }
+
+}
+
void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
int indent_level = tab_level.back()->get();
@@ -1661,6 +2309,24 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
}
StringName n = tokenizer->get_token_identifier();
tokenizer->advance();
+ if (current_function){
+ for (int i=0;i<current_function->arguments.size();i++){
+ if (n == current_function->arguments[i]){
+ _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(current_function->line)+").");
+ return;
+ }
+ }
+ }
+ BlockNode *check_block = p_block;
+ while (check_block){
+ for (int i=0;i<check_block->variables.size();i++){
+ if (n == check_block->variables[i]){
+ _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(check_block->variable_lines[i])+").");
+ return;
+ }
+ }
+ check_block = check_block->parent_block;
+ }
p_block->variables.push_back(n); //line?
p_block->variable_lines.push_back(tokenizer->get_token_line());
@@ -1903,6 +2569,64 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
return;
}
+ if (container->type==Node::TYPE_OPERATOR) {
+
+ OperatorNode* op = static_cast<OperatorNode*>(container);
+ if (op->op==OperatorNode::OP_CALL && op->arguments[0]->type==Node::TYPE_BUILT_IN_FUNCTION && static_cast<BuiltInFunctionNode*>(op->arguments[0])->function==GDFunctions::GEN_RANGE) {
+ //iterating a range, so see if range() can be optimized without allocating memory, by replacing it by vectors (which can work as iterable too!)
+
+ Vector<Node*> args;
+ Vector<double> constants;
+
+ bool constant=true;
+
+ for(int i=1;i<op->arguments.size();i++) {
+ args.push_back(op->arguments[i]);
+ if (constant && op->arguments[i]->type==Node::TYPE_CONSTANT) {
+ ConstantNode *c = static_cast<ConstantNode*>(op->arguments[i]);
+ if (c->value.get_type()==Variant::REAL || c->value.get_type()==Variant::INT) {
+ constants.push_back(c->value);
+ } else {
+ constant=false;
+ }
+ }
+ }
+
+ if (args.size()>0 || args.size()<4) {
+
+ if (constant) {
+
+ ConstantNode *cn = alloc_node<ConstantNode>();
+ switch(args.size()) {
+ case 1: cn->value=constants[0]; break;
+ case 2: cn->value=Vector2(constants[0],constants[1]); break;
+ case 3: cn->value=Vector3(constants[0],constants[1],constants[2]); break;
+ }
+ container=cn;
+ } else {
+ OperatorNode *on = alloc_node<OperatorNode>();
+ on->op=OperatorNode::OP_CALL;
+
+ TypeNode *tn = alloc_node<TypeNode>();
+ on->arguments.push_back(tn);
+
+ switch(args.size()) {
+ case 1: tn->vtype=Variant::REAL; break;
+ case 2: tn->vtype=Variant::VECTOR2; break;
+ case 3: tn->vtype=Variant::VECTOR3; break;
+ }
+
+ for(int i=0;i<args.size();i++) {
+ on->arguments.push_back(args[i]);
+ }
+
+ container=on;
+ }
+ }
+ }
+
+ }
+
ControlFlowNode *cf_for = alloc_node<ControlFlowNode>();
cf_for->cf_type=ControlFlowNode::CF_FOR;
@@ -1920,7 +2644,14 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
}
current_block=cf_for->body;
+
+ // this is for checking variable for redefining
+ // inside this _parse_block
+ cf_for->body->variables.push_back(id->name);
+ cf_for->body->variable_lines.push_back(id->line);
_parse_block(cf_for->body,p_static);
+ cf_for->body->variables.remove(0);
+ cf_for->body->variable_lines.remove(0);
current_block=p_block;
if (error_set)
@@ -1982,6 +2713,46 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
} break;
+ case GDTokenizer::TK_CF_MATCH: {
+
+ tokenizer->advance();
+
+ MatchNode *match_node = alloc_node<MatchNode>();
+
+ Node *val_to_match = _parse_and_reduce_expression(p_block, p_static);
+
+ if (!val_to_match) {
+ if (_recover_from_completion()) {
+ break;
+ }
+ return;
+ }
+
+ match_node->val_to_match = val_to_match;
+
+ if (!_enter_indent_block()) {
+ _set_error("Expected indented pattern matching block after 'match'");
+ return;
+ }
+
+ BlockNode *compiled_branches = alloc_node<BlockNode>();
+ compiled_branches->parent_block = p_block;
+ compiled_branches->parent_class = p_block->parent_class;
+
+ p_block->sub_blocks.push_back(compiled_branches);
+
+ _parse_pattern_block(compiled_branches, match_node->branches, p_static);
+
+ _transform_match_statment(compiled_branches, match_node);
+
+ ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>();
+ match_cf_node->cf_type = ControlFlowNode::CF_MATCH;
+ match_cf_node->match = match_node;
+
+ p_block->statements.push_back(match_cf_node);
+
+ _end_statement();
+ } break;
case GDTokenizer::TK_PR_ASSERT: {
tokenizer->advance();
@@ -2557,17 +3328,41 @@ void GDParser::_parse_class(ClassNode *p_class) {
current_export.type=type;
current_export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
+
+ String hint_prefix ="";
+
+ if(type == Variant::ARRAY && tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+
+ while(tokenizer->get_token()==GDTokenizer::TK_BUILT_IN_TYPE) {
+ type = tokenizer->get_token_type();
+
+ tokenizer->advance();
+
+ if(type == Variant::ARRAY) {
+ hint_prefix += itos(Variant::ARRAY)+":";
+ if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ }
+ } else {
+ hint_prefix += itos(type);
+ break;
+ }
+ }
+ }
+
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
// hint expected next!
tokenizer->advance();
- switch(current_export.type) {
+
+ switch(type) {
case Variant::INT: {
if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") {
- current_export.hint=PROPERTY_HINT_ALL_FLAGS;
+ //current_export.hint=PROPERTY_HINT_ALL_FLAGS;
tokenizer->advance();
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
@@ -2916,13 +3711,20 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
} break;
}
-
+
+ }
+ if(current_export.type == Variant::ARRAY && !hint_prefix.empty()) {
+ if(current_export.hint) {
+ hint_prefix += "/"+itos(current_export.hint);
+ }
+ current_export.hint_string=hint_prefix+":"+current_export.hint_string;
+ current_export.hint=PROPERTY_HINT_NONE;
}
} else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {
String identifier = tokenizer->get_token_identifier();
- if (!ObjectTypeDB::is_type(identifier,"Resource")) {
+ if (!ClassDB::is_parent_class(identifier,"Resource")) {
current_export=PropertyInfo();
_set_error("Export hint not a type or resource.");
@@ -3140,7 +3942,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
}
member._export.hint=PROPERTY_HINT_RESOURCE_TYPE;
- member._export.hint_string=res->get_type();
+ member._export.hint_string=res->get_class();
}
}
}
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 000fb70295..7968bf85df 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -258,6 +258,44 @@ public:
Vector<Node*> arguments;
OperatorNode() { type=TYPE_OPERATOR; }
};
+
+
+ struct PatternNode : public Node {
+
+ enum PatternType {
+ PT_CONSTANT,
+ PT_BIND,
+ PT_DICTIONARY,
+ PT_ARRAY,
+ PT_IGNORE_REST,
+ PT_WILDCARD
+ };
+
+ PatternType pt_type;
+
+ Node *constant;
+ StringName bind;
+ Map<ConstantNode*, PatternNode*> dictionary;
+ Vector<PatternNode*> array;
+
+ };
+
+ struct PatternBranchNode : public Node {
+ Vector<PatternNode*> patterns;
+ BlockNode *body;
+ };
+
+ struct MatchNode : public Node {
+ Node *val_to_match;
+ Vector<PatternBranchNode*> branches;
+
+ struct CompiledPatternBranch {
+ Node *compiled_pattern;
+ BlockNode *body;
+ };
+
+ Vector<CompiledPatternBranch> compiled_pattern_branches;
+ };
struct ControlFlowNode : public Node {
enum CFType {
@@ -267,13 +305,16 @@ public:
CF_SWITCH,
CF_BREAK,
CF_CONTINUE,
- CF_RETURN
+ CF_RETURN,
+ CF_MATCH
};
CFType cf_type;
Vector<Node*> arguments;
BlockNode *body;
BlockNode *body_else;
+
+ MatchNode *match;
ControlFlowNode *_else; //used for if
ControlFlowNode() { type=TYPE_CONTROL_FLOW; cf_type=CF_IF; body=NULL; body_else=NULL;}
@@ -376,6 +417,7 @@ public:
enum CompletionType {
COMPLETION_NONE,
COMPLETION_BUILT_IN_TYPE_CONSTANT,
+ COMPLETION_GET_NODE,
COMPLETION_FUNCTION,
COMPLETION_IDENTIFIER,
COMPLETION_PARENT_FUNCTION,
@@ -451,6 +493,15 @@ private:
Node* _reduce_expression(Node *p_node,bool p_to_const=false);
Node* _parse_and_reduce_expression(Node *p_parent,bool p_static,bool p_reduce_const=false,bool p_allow_assign=false);
+
+
+
+ PatternNode *_parse_pattern(bool p_static);
+ void _parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static);
+ void _transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement);
+ void _generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings);
+
+
void _parse_block(BlockNode *p_block,bool p_static);
void _parse_extends(ClassNode *p_class);
void _parse_class(ClassNode *p_class);
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 0ea10950df..d9a3dd13f0 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -50,7 +50,7 @@ GDNativeClass::GDNativeClass(const StringName& p_name) {
bool GDNativeClass::_get(const StringName& p_name,Variant &r_ret) const {
bool ok;
- int v = ObjectTypeDB::get_integer_constant(name, p_name, &ok);
+ int v = ClassDB::get_integer_constant(name, p_name, &ok);
if (ok) {
r_ret=v;
@@ -63,7 +63,7 @@ bool GDNativeClass::_get(const StringName& p_name,Variant &r_ret) const {
void GDNativeClass::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("new"),&GDNativeClass::_new);
+ ClassDB::bind_method(_MD("new"),&GDNativeClass::_new);
}
@@ -86,7 +86,7 @@ Variant GDNativeClass::_new() {
Object *GDNativeClass::instance() {
- return ObjectTypeDB::instance(name);
+ return ClassDB::instance(name);
}
@@ -111,14 +111,29 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj
/* STEP 2, INITIALIZE AND CONSRTUCT */
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+
instances.insert(instance->owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
initializer->call(instance,p_args,p_argcount,r_error);
if (r_error.error!=Variant::CallError::CALL_OK) {
instance->script=Ref<GDScript>();
instance->owner->set_script_instance(NULL);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
instances.erase(p_owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
ERR_FAIL_COND_V(r_error.error!=Variant::CallError::CALL_OK, NULL); //error constructing
}
@@ -145,6 +160,8 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
_baseptr=_baseptr->_base;
}
+ ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant());
+
if (_baseptr->native.ptr()) {
owner=_baseptr->native->instance();
} else {
@@ -341,9 +358,11 @@ bool GDScript::get_property_default_value(const StringName& p_property, Variant
#ifdef TOOLS_ENABLED
- //for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
- // print_line("\t"+String(String(I->key())+":"+String(I->get())));
- //}
+ /*
+ for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
+ print_line("\t"+String(String(I->key())+":"+String(I->get())));
+ }
+ */
const Map<StringName,Variant>::Element *E=member_default_values_cache.find(p_property);
if (E) {
r_value=E->get();
@@ -388,12 +407,12 @@ ScriptInstance* GDScript::instance_create(Object *p_this) {
top=top->_base;
if (top->native.is_valid()) {
- if (!ObjectTypeDB::is_type(p_this->get_type_name(),top->native->get_name())) {
+ if (!ClassDB::is_parent_class(p_this->get_class_name(),top->native->get_name())) {
if (ScriptDebugger::get_singleton()) {
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),0,"Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_type()+"'");
+ GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),0,"Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_class()+"'");
}
- ERR_EXPLAIN("Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_type()+"'");
+ ERR_EXPLAIN("Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_class()+"'");
ERR_FAIL_V(NULL);
}
@@ -405,7 +424,16 @@ ScriptInstance* GDScript::instance_create(Object *p_this) {
}
bool GDScript::instance_has(const Object *p_this) const {
- return instances.has((Object*)p_this);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+ bool hasit = instances.has((Object*)p_this);
+
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
+ return hasit;
}
bool GDScript::has_source_code() const {
@@ -596,8 +624,16 @@ void GDScript::_set_subclass_path(Ref<GDScript>& p_sc,const String& p_path) {
Error GDScript::reload(bool p_keep_state) {
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+ bool has_instances = instances.size();
+
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
- ERR_FAIL_COND_V(!p_keep_state && instances.size(),ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(!p_keep_state && has_instances,ERR_ALREADY_IN_USE);
String basedir=path;
@@ -751,9 +787,9 @@ void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {
void GDScript::_bind_methods() {
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new"));
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new"));
- ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
+ ClassDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
}
@@ -830,7 +866,7 @@ Error GDScript::load_byte_code(const String& p_path) {
Error GDScript::load_source_code(const String& p_path) {
- DVector<uint8_t> sourcef;
+ PoolVector<uint8_t> sourcef;
Error err;
FileAccess *f=FileAccess::open(p_path,FileAccess::READ,&err);
if (err) {
@@ -840,7 +876,7 @@ Error GDScript::load_source_code(const String& p_path) {
int len = f->get_len();
sourcef.resize(len+1);
- DVector<uint8_t>::Write w = sourcef.write();
+ PoolVector<uint8_t>::Write w = sourcef.write();
int r = f->get_buffer(w.ptr(),len);
f->close();
memdelete(f);
@@ -1423,7 +1459,15 @@ GDInstance::GDInstance() {
GDInstance::~GDInstance() {
if (script.is_valid() && owner) {
- script->instances.erase(owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+
+ script->instances.erase(owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
}
}
@@ -1477,7 +1521,7 @@ void GDScriptLanguage::init() {
//populate native classes
List<StringName> class_list;
- ObjectTypeDB::get_type_list(&class_list);
+ ClassDB::get_class_list(&class_list);
for(List<StringName>::Element *E=class_list.front();E;E=E->next()) {
StringName n = E->get();
@@ -1493,9 +1537,9 @@ void GDScriptLanguage::init() {
//populate singletons
- List<Globals::Singleton> singletons;
- Globals::get_singleton()->get_singletons(&singletons);
- for(List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) {
+ List<GlobalConfig::Singleton> singletons;
+ GlobalConfig::get_singleton()->get_singletons(&singletons);
+ for(List<GlobalConfig::Singleton>::Element *E=singletons.front();E;E=E->next()) {
_add_global(E->get().name,E->get().ptr);
}
@@ -1820,7 +1864,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script>& p_script,bool p_sof
void GDScriptLanguage::frame() {
- // print_line("calls: "+itos(calls));
+ //print_line("calls: "+itos(calls));
calls=0;
#ifdef DEBUG_ENABLED
@@ -1894,6 +1938,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"for",
"pass",
"return",
+ "match",
"while",
"remote",
"sync",
@@ -1940,7 +1985,7 @@ GDScriptLanguage::GDScriptLanguage() {
script_frame_time=0;
_debug_call_stack_pos=0;
- int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024);
+ int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024);
if (ScriptDebugger::get_singleton()) {
//debugging enabled!
@@ -2026,7 +2071,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const {
String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
if (el=="gd" || el=="gdc" || el=="gde")
return "GDScript";
return "";
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 051e80634f..4d3baa5bc0 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -35,7 +35,7 @@
#include "gd_function.h"
class GDNativeClass : public Reference {
- OBJ_TYPE(GDNativeClass,Reference);
+ GDCLASS(GDNativeClass,Reference);
StringName name;
protected:
@@ -55,7 +55,7 @@ public:
class GDScript : public Script {
- OBJ_TYPE(GDScript,Script);
+ GDCLASS(GDScript,Script);
bool tool;
bool valid;
@@ -139,7 +139,7 @@ protected:
void _get_property_list(List<PropertyInfo> *p_properties) const;
Variant call(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error);
-// void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
+ //void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
static void _bind_methods();
public:
@@ -294,11 +294,13 @@ class GDScriptLanguage : public ScriptLanguage {
void _add_global(const StringName& p_name,const Variant& p_value);
+friend class GDInstance;
Mutex *lock;
+
friend class GDScript;
SelfList<GDScript>::List script_list;
@@ -406,7 +408,7 @@ public:
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual int find_function(const String& p_function,const String& p_code) const;
- virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const;
+ virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const;
virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint);
#ifdef TOOLS_ENABLED
virtual Error lookup_code(const String& p_code, const String& p_symbol, const String& p_base_path, Object*p_owner, LookupResult& r_result);
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 39c4530d96..70fc991bcc 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -85,6 +85,7 @@ const char* GDTokenizer::token_names[TK_MAX]={
"continue",
"pass",
"return",
+"match",
"func",
"class",
"extends",
@@ -460,6 +461,9 @@ void GDTokenizerText::_advance() {
case ':':
_make_token(TK_COLON); //for methods maybe but now useless.
break;
+ case '$':
+ _make_token(TK_DOLLAR); //for the get_node() shortener
+ break;
case '^': {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_BIT_XOR);
@@ -510,9 +514,11 @@ void GDTokenizerText::_advance() {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_ADD);
INCPOS(1);
- //} else if (GETCHAR(1)=='+') {
- // _make_token(TK_OP_PLUS_PLUS);
- // INCPOS(1);
+ /*
+ } else if (GETCHAR(1)=='+') {
+ _make_token(TK_OP_PLUS_PLUS);
+ INCPOS(1);
+ */
} else {
_make_token(TK_OP_ADD);
}
@@ -523,9 +529,11 @@ void GDTokenizerText::_advance() {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_SUB);
INCPOS(1);
- //} else if (GETCHAR(1)=='-') {
- // _make_token(TK_OP_MINUS_MINUS);
- // INCPOS(1);
+ /*
+ } else if (GETCHAR(1)=='-') {
+ _make_token(TK_OP_MINUS_MINUS);
+ INCPOS(1);
+ */
} else {
_make_token(TK_OP_SUB);
}
@@ -728,14 +736,14 @@ void GDTokenizerText::_advance() {
INCPOS(str.length());
if (hexa_found) {
- int val = str.hex_to_int();
+ int64_t val = str.hex_to_int64();
_make_constant(val);
} else if (period_found || exponent_found) {
- real_t val = str.to_double();
+ double val = str.to_double();
//print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val));
_make_constant(val);
} else {
- int val = str.to_int();
+ int64_t val = str.to_int64();
_make_constant(val);
}
@@ -785,13 +793,12 @@ void GDTokenizerText::_advance() {
{Variant::STRING,"String"},
{Variant::VECTOR2,"Vector2"},
{Variant::RECT2,"Rect2"},
- {Variant::MATRIX32,"Matrix32"},
+ {Variant::TRANSFORM2D,"Transform2D"},
{Variant::VECTOR3,"Vector3"},
- {Variant::_AABB,"AABB"},
- {Variant::_AABB,"Rect3"},
+ {Variant::RECT3,"Rect3"},
{Variant::PLANE,"Plane"},
{Variant::QUAT,"Quat"},
- {Variant::MATRIX3,"Matrix3"},
+ {Variant::BASIS,"Basis"},
{Variant::TRANSFORM,"Transform"},
{Variant::COLOR,"Color"},
{Variant::IMAGE,"Image"},
@@ -801,13 +808,13 @@ void GDTokenizerText::_advance() {
{Variant::NODE_PATH,"NodePath"},
{Variant::DICTIONARY,"Dictionary"},
{Variant::ARRAY,"Array"},
- {Variant::RAW_ARRAY,"RawArray"},
- {Variant::INT_ARRAY,"IntArray"},
- {Variant::REAL_ARRAY,"FloatArray"},
- {Variant::STRING_ARRAY,"StringArray"},
- {Variant::VECTOR2_ARRAY,"Vector2Array"},
- {Variant::VECTOR3_ARRAY,"Vector3Array"},
- {Variant::COLOR_ARRAY,"ColorArray"},
+ {Variant::POOL_BYTE_ARRAY,"PoolByteArray"},
+ {Variant::POOL_INT_ARRAY,"PoolIntArray"},
+ {Variant::POOL_REAL_ARRAY,"PoolFloatArray"},
+ {Variant::POOL_STRING_ARRAY,"PoolStringArray"},
+ {Variant::POOL_VECTOR2_ARRAY,"PoolVector2Array"},
+ {Variant::POOL_VECTOR3_ARRAY,"PoolVector3Array"},
+ {Variant::POOL_COLOR_ARRAY,"PoolColorArray"},
{Variant::VARIANT_MAX,NULL},
};
@@ -888,6 +895,7 @@ void GDTokenizerText::_advance() {
{TK_CF_BREAK,"break"},
{TK_CF_CONTINUE,"continue"},
{TK_CF_RETURN,"return"},
+ {TK_CF_MATCH, "match"},
{TK_CF_PASS,"pass"},
{TK_SELF,"self"},
{TK_CONST_PI,"PI"},
@@ -1057,7 +1065,7 @@ void GDTokenizerText::advance(int p_amount) {
//////////////////////////////////////////////////////////////////////////////////////////////////////
-#define BYTECODE_VERSION 11
+#define BYTECODE_VERSION 12
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 b91229ab1e..9a6f4df9c4 100644
--- a/modules/gdscript/gd_tokenizer.h
+++ b/modules/gdscript/gd_tokenizer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -92,6 +92,7 @@ public:
TK_CF_CONTINUE,
TK_CF_PASS,
TK_CF_RETURN,
+ TK_CF_MATCH,
TK_PR_FUNCTION,
TK_PR_CLASS,
TK_PR_EXTENDS,
@@ -123,6 +124,7 @@ public:
TK_PERIOD,
TK_QUESTION_MARK,
TK_COLON,
+ TK_DOLLAR,
TK_NEWLINE,
TK_CONST_PI,
TK_ERROR,
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 95b18cae4d..051d1d85cd 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -48,7 +48,7 @@ ResourceFormatSaverGDScript *resource_saver_gd=NULL;
class EditorExportGDScript : public EditorExportPlugin {
- OBJ_TYPE(EditorExportGDScript,EditorExportPlugin);
+ GDCLASS(EditorExportGDScript,EditorExportPlugin);
public:
@@ -100,7 +100,7 @@ public:
if (err==OK) {
fae->store_buffer(file.ptr(),file.size());
- p_path=p_path.basename()+".gde";
+ p_path=p_path.get_basename()+".gde";
}
memdelete(fae);
@@ -111,7 +111,7 @@ public:
} else {
- p_path=p_path.basename()+".gdc";
+ p_path=p_path.get_basename()+".gdc";
return file;
}
}
@@ -138,8 +138,8 @@ static void register_editor_plugin() {
void register_gdscript_types() {
- ObjectTypeDB::register_type<GDScript>();
- ObjectTypeDB::register_virtual_type<GDFunctionState>();
+ ClassDB::register_class<GDScript>();
+ ClassDB::register_virtual_class<GDFunctionState>();
script_language_gd=memnew( GDScriptLanguage );
//script_language_gd->init();
diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h
index aed11cd1d4..5778dfcadc 100644
--- a/modules/gdscript/register_types.h
+++ b/modules/gdscript/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py
index 5698a37295..1ab13c4aeb 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,7 +1,8 @@
def can_build(platform):
- return True
+ # FIXME: Disabled temporary for gles3 implementation
+ return False
def configure(env):
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 6e73244b57..271db4babc 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -61,9 +61,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
} else if (name=="theme/bake") {
set_bake(p_value);
/* } else if (name=="cells") {
- DVector<int> cells = p_value;
+ PoolVector<int> cells = p_value;
int amount=cells.size();
- DVector<int>::Read r = cells.read();
+ PoolVector<int>::Read r = cells.read();
ERR_FAIL_COND_V(amount&1,false); // not even
cell_map.clear();;
for(int i=0;i<amount/3;i++) {
@@ -86,9 +86,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
baked=d["baked"];
if (d.has("cells")) {
- DVector<int> cells = d["cells"];
+ PoolVector<int> cells = d["cells"];
int amount=cells.size();
- DVector<int>::Read r = cells.read();
+ PoolVector<int>::Read r = cells.read();
ERR_FAIL_COND_V(amount%3,false); // not even
cell_map.clear();;
for(int i=0;i<amount/3;i++) {
@@ -183,10 +183,10 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const {
Dictionary d;
- DVector<int> cells;
+ PoolVector<int> cells;
cells.resize(cell_map.size()*3);
{
- DVector<int>::Write w = cells.write();
+ PoolVector<int>::Write w = cells.write();
int i=0;
for (Map<IndexKey,Cell>::Element *E=cell_map.front();E;E=E->next(),i++) {
@@ -252,7 +252,7 @@ void GridMap::_get_property_list( List<PropertyInfo> *p_list) const {
for(const Map<int,Area*>::Element *E=area_map.front();E;E=E->next()) {
String base="areas/"+itos(E->key())+"/";
- p_list->push_back( PropertyInfo( Variant::_AABB, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
+ p_list->push_back( PropertyInfo( Variant::RECT3, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::STRING, base+"name", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::REAL, base+"disable_distance", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::COLOR, base+"disable_color", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
@@ -665,7 +665,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
VS::get_singleton()->mesh_clear(g.collision_debug);
}
- DVector<Vector3> col_debug;
+ PoolVector<Vector3> col_debug;
/*
* foreach item in this octant,
@@ -678,8 +678,8 @@ void GridMap::_octant_update(const OctantKey &p_key) {
ii.multimesh->set_instance_count(ii.cells.size());
- AABB aabb;
- AABB mesh_aabb = ii.mesh.is_null()?AABB():ii.mesh->get_aabb();
+ Rect3 aabb;
+ Rect3 mesh_aabb = ii.mesh.is_null()?Rect3():ii.mesh->get_aabb();
Vector3 ofs(cell_size*0.5*int(center_x),cell_size*0.5*int(center_y),cell_size*0.5*int(center_z));
@@ -731,7 +731,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
ii.shape->add_vertices_to_array(col_debug,xform);
}
- // print_line("PHIS x: "+xform);
+ //print_line("PHIS x: "+xform);
}
// add the item's navmesh at given xform to GridMap's Navigation ancestor
@@ -796,7 +796,7 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,RID());
- // VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
+ //VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
VS::get_singleton()->instance_set_room(E->get().multimesh_instance,RID());
}
@@ -863,15 +863,15 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES)
continue;
Array a = ii.mesh->surface_get_arrays(i);
- DVector<Vector3> av=a[VS::ARRAY_VERTEX];
+ PoolVector<Vector3> av=a[VS::ARRAY_VERTEX];
int avs = av.size();
- DVector<Vector3>::Read vr = av.read();
+ PoolVector<Vector3>::Read vr = av.read();
- DVector<int> ai=a[VS::ARRAY_INDEX];
+ PoolVector<int> ai=a[VS::ARRAY_INDEX];
int ais=ai.size();
if (ais) {
- DVector<int>::Read ir=ai.read();
+ PoolVector<int>::Read ir=ai.read();
for(int j=0;j<ais;j++) {
p_prebake->push_back(xform.xform(vr[ir[j]]));
@@ -920,7 +920,7 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
Vector3 vertex = v.vertex + octant_ofs;
//print_line("V GET: "+vertex);
- Vector3 normal = tm->get_area_normal( AABB( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0));
+ Vector3 normal = tm->get_area_normal( Rect3( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0));
if (normal==Vector3()) {
print_line("couldn't find for vertex: "+vertex);
}
@@ -960,9 +960,9 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
st->add_to_format(VS::ARRAY_FORMAT_COLOR);
if (m.is_valid()) {
- Ref<FixedMaterial> fm = m;
+ Ref<FixedSpatialMaterial> fm = m;
if (fm.is_valid())
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
}
}
}
@@ -1001,8 +1001,8 @@ void GridMap::_notification(int p_what) {
_update_area_instances();
for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
-// IndexKey ik;
-// ik.key = E->key().indexkey;
+ //IndexKey ik;
+ //ik.key = E->key().indexkey;
_octant_enter_world(E->key());
_octant_update(E->key());
}
@@ -1185,60 +1185,60 @@ void GridMap::_update_dirty_map_callback() {
void GridMap::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_theme","theme:MeshLibrary"),&GridMap::set_theme);
- ObjectTypeDB::bind_method(_MD("get_theme:MeshLibrary"),&GridMap::get_theme);
+ ClassDB::bind_method(_MD("set_theme","theme:MeshLibrary"),&GridMap::set_theme);
+ ClassDB::bind_method(_MD("get_theme:MeshLibrary"),&GridMap::get_theme);
- ObjectTypeDB::bind_method(_MD("set_bake","enable"),&GridMap::set_bake);
- ObjectTypeDB::bind_method(_MD("is_baking_enabled"),&GridMap::is_baking_enabled);
+ ClassDB::bind_method(_MD("set_bake","enable"),&GridMap::set_bake);
+ ClassDB::bind_method(_MD("is_baking_enabled"),&GridMap::is_baking_enabled);
- ObjectTypeDB::bind_method(_MD("set_cell_size","size"),&GridMap::set_cell_size);
- ObjectTypeDB::bind_method(_MD("get_cell_size"),&GridMap::get_cell_size);
+ ClassDB::bind_method(_MD("set_cell_size","size"),&GridMap::set_cell_size);
+ ClassDB::bind_method(_MD("get_cell_size"),&GridMap::get_cell_size);
- ObjectTypeDB::bind_method(_MD("set_octant_size","size"),&GridMap::set_octant_size);
- ObjectTypeDB::bind_method(_MD("get_octant_size"),&GridMap::get_octant_size);
+ ClassDB::bind_method(_MD("set_octant_size","size"),&GridMap::set_octant_size);
+ ClassDB::bind_method(_MD("get_octant_size"),&GridMap::get_octant_size);
- ObjectTypeDB::bind_method(_MD("set_cell_item","x","y","z","item","orientation"),&GridMap::set_cell_item,DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_cell_item","x","y","z"),&GridMap::get_cell_item);
- ObjectTypeDB::bind_method(_MD("get_cell_item_orientation","x","y","z"),&GridMap::get_cell_item_orientation);
+ ClassDB::bind_method(_MD("set_cell_item","x","y","z","item","orientation"),&GridMap::set_cell_item,DEFVAL(0));
+ ClassDB::bind_method(_MD("get_cell_item","x","y","z"),&GridMap::get_cell_item);
+ ClassDB::bind_method(_MD("get_cell_item_orientation","x","y","z"),&GridMap::get_cell_item_orientation);
-// ObjectTypeDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants);
- ObjectTypeDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback);
- ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed);
+ //ClassDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants);
+ ClassDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback);
+ ClassDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed);
- ObjectTypeDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x);
- ObjectTypeDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x);
- ObjectTypeDB::bind_method(_MD("set_center_y","enable"),&GridMap::set_center_y);
- ObjectTypeDB::bind_method(_MD("get_center_y"),&GridMap::get_center_y);
- ObjectTypeDB::bind_method(_MD("set_center_z","enable"),&GridMap::set_center_z);
- ObjectTypeDB::bind_method(_MD("get_center_z"),&GridMap::get_center_z);
+ ClassDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x);
+ ClassDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x);
+ ClassDB::bind_method(_MD("set_center_y","enable"),&GridMap::set_center_y);
+ ClassDB::bind_method(_MD("get_center_y"),&GridMap::get_center_y);
+ ClassDB::bind_method(_MD("set_center_z","enable"),&GridMap::set_center_z);
+ ClassDB::bind_method(_MD("get_center_z"),&GridMap::get_center_z);
- ObjectTypeDB::bind_method(_MD("set_clip","enabled","clipabove","floor","axis"),&GridMap::set_clip,DEFVAL(true),DEFVAL(0),DEFVAL(Vector3::AXIS_X));
+ ClassDB::bind_method(_MD("set_clip","enabled","clipabove","floor","axis"),&GridMap::set_clip,DEFVAL(true),DEFVAL(0),DEFVAL(Vector3::AXIS_X));
- ObjectTypeDB::bind_method(_MD("create_area","id","area"),&GridMap::create_area);
- ObjectTypeDB::bind_method(_MD("area_get_bounds","area","bounds"),&GridMap::area_get_bounds);
- ObjectTypeDB::bind_method(_MD("area_set_exterior_portal","area","enable"),&GridMap::area_set_exterior_portal);
- ObjectTypeDB::bind_method(_MD("area_set_name","area","name"),&GridMap::area_set_name);
- ObjectTypeDB::bind_method(_MD("area_get_name","area"),&GridMap::area_get_name);
- ObjectTypeDB::bind_method(_MD("area_is_exterior_portal","area"),&GridMap::area_is_exterior_portal);
- ObjectTypeDB::bind_method(_MD("area_set_portal_disable_distance","area","distance"),&GridMap::area_set_portal_disable_distance);
- ObjectTypeDB::bind_method(_MD("area_get_portal_disable_distance","area"),&GridMap::area_get_portal_disable_distance);
- ObjectTypeDB::bind_method(_MD("area_set_portal_disable_color","area","color"),&GridMap::area_set_portal_disable_color);
- ObjectTypeDB::bind_method(_MD("area_get_portal_disable_color","area"),&GridMap::area_get_portal_disable_color);
- ObjectTypeDB::bind_method(_MD("erase_area","area"),&GridMap::erase_area);
- ObjectTypeDB::bind_method(_MD("get_unused_area_id","area"),&GridMap::get_unused_area_id);
- ObjectTypeDB::bind_method(_MD("bake_geometry"),&GridMap::bake_geometry);
+ ClassDB::bind_method(_MD("create_area","id","area"),&GridMap::create_area);
+ ClassDB::bind_method(_MD("area_get_bounds","area","bounds"),&GridMap::area_get_bounds);
+ ClassDB::bind_method(_MD("area_set_exterior_portal","area","enable"),&GridMap::area_set_exterior_portal);
+ ClassDB::bind_method(_MD("area_set_name","area","name"),&GridMap::area_set_name);
+ ClassDB::bind_method(_MD("area_get_name","area"),&GridMap::area_get_name);
+ ClassDB::bind_method(_MD("area_is_exterior_portal","area"),&GridMap::area_is_exterior_portal);
+ ClassDB::bind_method(_MD("area_set_portal_disable_distance","area","distance"),&GridMap::area_set_portal_disable_distance);
+ ClassDB::bind_method(_MD("area_get_portal_disable_distance","area"),&GridMap::area_get_portal_disable_distance);
+ ClassDB::bind_method(_MD("area_set_portal_disable_color","area","color"),&GridMap::area_set_portal_disable_color);
+ ClassDB::bind_method(_MD("area_get_portal_disable_color","area"),&GridMap::area_get_portal_disable_color);
+ ClassDB::bind_method(_MD("erase_area","area"),&GridMap::erase_area);
+ ClassDB::bind_method(_MD("get_unused_area_id","area"),&GridMap::get_unused_area_id);
+ ClassDB::bind_method(_MD("bake_geometry"),&GridMap::bake_geometry);
- ObjectTypeDB::bind_method(_MD("_baked_light_changed"),&GridMap::_baked_light_changed);
- ObjectTypeDB::bind_method(_MD("set_use_baked_light","use"),&GridMap::set_use_baked_light);
- ObjectTypeDB::bind_method(_MD("is_using_baked_light","use"),&GridMap::is_using_baked_light);
+ ClassDB::bind_method(_MD("_baked_light_changed"),&GridMap::_baked_light_changed);
+ ClassDB::bind_method(_MD("set_use_baked_light","use"),&GridMap::set_use_baked_light);
+ ClassDB::bind_method(_MD("is_using_baked_light","use"),&GridMap::is_using_baked_light);
- ObjectTypeDB::bind_method(_MD("_get_baked_light_meshes"),&GridMap::_get_baked_light_meshes);
+ ClassDB::bind_method(_MD("_get_baked_light_meshes"),&GridMap::_get_baked_light_meshes);
- ObjectTypeDB::set_method_flags("GridMap","bake_geometry",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::set_method_flags("GridMap","bake_geometry",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ObjectTypeDB::bind_method(_MD("clear"),&GridMap::clear);
+ ClassDB::bind_method(_MD("clear"),&GridMap::clear);
BIND_CONSTANT( INVALID_CELL_ITEM );
@@ -1435,7 +1435,7 @@ void GridMap::_update_area_instances() {
}
-Error GridMap::create_area(int p_id,const AABB& p_bounds) {
+Error GridMap::create_area(int p_id,const Rect3& p_bounds) {
ERR_FAIL_COND_V(area_map.has(p_id),ERR_ALREADY_EXISTS);
ERR_EXPLAIN("ID 0 is taken as global area, start from 1");
@@ -1484,12 +1484,12 @@ Error GridMap::create_area(int p_id,const AABB& p_bounds) {
return OK;
}
-AABB GridMap::area_get_bounds(int p_area) const {
+Rect3 GridMap::area_get_bounds(int p_area) const {
- ERR_FAIL_COND_V(!area_map.has(p_area),AABB());
+ ERR_FAIL_COND_V(!area_map.has(p_area),Rect3());
const Area *a = area_map[p_area];
- AABB aabb;
+ Rect3 aabb;
aabb.pos=Vector3(a->from.x,a->from.y,a->from.z);
aabb.size=Vector3(a->to.x,a->to.y,a->to.z)-aabb.pos;
@@ -1667,7 +1667,7 @@ void GridMap::bake_geometry() {
}
- DVector<Vector3> vv;
+ PoolVector<Vector3> vv;
vv.fill_with(vertices);
//print_line("TOTAL VERTICES: "+itos(vv.size()));
tmesh = Ref<TriangleMesh>( memnew( TriangleMesh ));
@@ -1706,10 +1706,12 @@ void GridMap::bake_geometry() {
void GridMap::_baked_light_changed() {
-// if (!baked_light_instance)
-// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID());
-// else
-// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance());
+ /*
+ if (!baked_light_instance)
+ VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID());
+ else
+ VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance());
+ */
for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
for(Map<int,Octant::ItemInstances>::Element *F=E->get()->items.front();F;F=F->next()) {
@@ -1831,6 +1833,7 @@ GridMap::GridMap() {
use_baked_light=false;
navigation = NULL;
+ set_notify_transform(true);
}
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 0116ea094f..04d140cdc6 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -44,7 +44,7 @@ class BakedLightInstance;
class GridMap : public Spatial {
- OBJ_TYPE( GridMap, Spatial );
+ GDCLASS( GridMap, Spatial );
enum {
MAP_DIRTY_TRANSFORMS=1,
@@ -268,8 +268,8 @@ public:
void set_clip(bool p_enabled, bool p_clip_above=true, int p_floor=0, Vector3::Axis p_axis=Vector3::AXIS_X);
- Error create_area(int p_id,const AABB& p_area);
- AABB area_get_bounds(int p_area) const;
+ Error create_area(int p_id,const Rect3& p_area);
+ Rect3 area_get_bounds(int p_area) const;
void area_set_exterior_portal(int p_area,bool p_enable);
void area_set_name(int p_area,const String& p_name);
String area_get_name(int p_area) const;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 9bdad6713d..109f6338db 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -99,70 +99,70 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CURSOR_ROTATE_Y: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(0,1,0),Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,1,0),Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_X: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(1,0,0),Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(1,0,0),Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_Z: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(0,0,1),Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,0,1),Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,1,0),-Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(1,0,0),-Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,0,1),-Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
@@ -191,7 +191,7 @@ void GridMapEditor::_menu_option(int p_option) {
if (!selection.active)
break;
int area = node->get_unused_area_id();
- Error err = node->create_area(area,AABB(selection.begin,selection.end-selection.begin+Vector3(1,1,1)));
+ Error err = node->create_area(area,Rect3(selection.begin,selection.end-selection.begin+Vector3(1,1,1)));
if (err!=OK) {
@@ -318,7 +318,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
p.d=edit_floor[edit_axis]*node->get_cell_size();
Vector3 inters;
- if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_val(), &inters))
+ if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_value(), &inters))
return false;
@@ -358,7 +358,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
}
last_mouseover=Vector3(cell[0],cell[1],cell[2]);
- VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Matrix3(),grid_ofs));
+ VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Basis(),grid_ofs));
if (cursor_instance.is_valid()) {
@@ -459,7 +459,7 @@ void GridMapEditor::_update_duplicate_indicator() {
Transform xf;
xf.scale(Vector3(1,1,1)*(Vector3(1,1,1)+(selection.end-selection.begin))*node->get_cell_size());
xf.origin=(selection.begin+(selection.current-selection.click))*node->get_cell_size();
- Matrix3 rot;
+ Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
xf.basis = rot * xf.basis;
@@ -481,7 +481,7 @@ void GridMapEditor::_duplicate_paste() {
List< __Item > items;
- Matrix3 rot;
+ Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
for(int i=selection.begin.x;i<=selection.end.x;i++) {
@@ -498,7 +498,7 @@ void GridMapEditor::_duplicate_paste() {
Vector3 rel=Vector3(i,j,k)-selection.begin;
rel = rot.xform(rel);
- Matrix3 orm;
+ Basis orm;
orm.set_orthogonal_index(orientation);
orm = rot * orm;
@@ -548,12 +548,12 @@ bool GridMapEditor::forward_spatial_input_event(Camera* p_camera,const InputEven
if (p_event.mouse_button.button_index==BUTTON_WHEEL_UP && (p_event.mouse_button.mod.command || p_event.mouse_button.mod.shift)) {
if (p_event.mouse_button.pressed)
- floor->set_val( floor->get_val() +1);
+ floor->set_value( floor->get_value() +1);
return true; //eaten
} else if (p_event.mouse_button.button_index==BUTTON_WHEEL_DOWN && (p_event.mouse_button.mod.command || p_event.mouse_button.mod.shift)) {
if (p_event.mouse_button.pressed)
- floor->set_val( floor->get_val() -1);
+ floor->set_value( floor->get_value() -1);
return true;
}
@@ -664,7 +664,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera* p_camera,const InputEven
for(List<int>::Element *E=areas.front();E;E=E->next()) {
int area = E->get();
- AABB aabb = node->area_get_bounds(area);
+ Rect3 aabb = node->area_get_bounds(area);
aabb.pos*=node->get_cell_size();
aabb.size*=node->get_cell_size();
@@ -731,7 +731,7 @@ void GridMapEditor::update_pallete() {
theme_pallete->set_icon_mode(ItemList::ICON_MODE_LEFT);
}
- float min_size = EDITOR_DEF("grid_map/preview_size",64);
+ float min_size = EDITOR_DEF("editors/grid_map/preview_size",64);
theme_pallete->set_fixed_icon_size(Size2(min_size, min_size));
theme_pallete->set_fixed_column_width(min_size*3/2);
theme_pallete->set_max_text_lines(2);
@@ -972,7 +972,7 @@ void GridMapEditor::update_grid() {
grid_ofs[edit_axis]=edit_floor[edit_axis]*node->get_cell_size();
edit_grid_xform.origin=grid_ofs;
- edit_grid_xform.basis=Matrix3();
+ edit_grid_xform.basis=Basis();
for(int i=0;i<3;i++) {
@@ -981,7 +981,7 @@ void GridMapEditor::update_grid() {
}
updating=true;
- floor->set_val(edit_floor[edit_axis]);
+ floor->set_value(edit_floor[edit_axis]);
updating=false;
}
@@ -1126,7 +1126,7 @@ void GridMapEditor::_update_areas_display() {
RID mesh = VisualServer::get_singleton()->mesh_create();
- DVector<Plane> planes;
+ PoolVector<Plane> planes;
for(int i=0;i<3;i++) {
Vector3 axis;
@@ -1142,7 +1142,7 @@ void GridMapEditor::_update_areas_display() {
ad.mesh=mesh;
ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario());
Transform xform;
- AABB aabb = node->area_get_bounds(area);
+ Rect3 aabb = node->area_get_bounds(area);
xform.origin=aabb.pos * node->get_cell_size();
xform.basis.scale(aabb.size * node->get_cell_size());
VisualServer::get_singleton()->instance_set_transform(ad.instance,global_xf * xform);
@@ -1181,15 +1181,15 @@ void GridMapEditor::_floor_changed(float p_value) {
void GridMapEditor::_bind_methods() {
- ObjectTypeDB::bind_method("_menu_option",&GridMapEditor::_menu_option);
- ObjectTypeDB::bind_method("_configure",&GridMapEditor::_configure);
- ObjectTypeDB::bind_method("_item_selected_cbk",&GridMapEditor::_item_selected_cbk);
- ObjectTypeDB::bind_method("_edit_mode_changed",&GridMapEditor::_edit_mode_changed);
- ObjectTypeDB::bind_method("_area_renamed",&GridMapEditor::_area_renamed);
- ObjectTypeDB::bind_method("_area_selected",&GridMapEditor::_area_selected);
- ObjectTypeDB::bind_method("_floor_changed",&GridMapEditor::_floor_changed);
+ ClassDB::bind_method("_menu_option",&GridMapEditor::_menu_option);
+ ClassDB::bind_method("_configure",&GridMapEditor::_configure);
+ ClassDB::bind_method("_item_selected_cbk",&GridMapEditor::_item_selected_cbk);
+ ClassDB::bind_method("_edit_mode_changed",&GridMapEditor::_edit_mode_changed);
+ ClassDB::bind_method("_area_renamed",&GridMapEditor::_area_renamed);
+ ClassDB::bind_method("_area_selected",&GridMapEditor::_area_selected);
+ ClassDB::bind_method("_floor_changed",&GridMapEditor::_floor_changed);
- ObjectTypeDB::bind_method(_MD("_set_display_mode","mode"), &GridMapEditor::_set_display_mode);
+ ClassDB::bind_method(_MD("_set_display_mode","mode"), &GridMapEditor::_set_display_mode);
}
@@ -1201,7 +1201,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
editor=p_editor;
undo_redo=p_editor->get_undo_redo();
- int mw = EDITOR_DEF("grid_map/palette_min_width",230);
+ int mw = EDITOR_DEF("editors/grid_map/palette_min_width",230);
Control *ec = memnew( Control);
ec->set_custom_minimum_size(Size2(mw,0));
add_child(ec);
@@ -1257,17 +1257,16 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
settings_vbc = memnew(VBoxContainer);
settings_vbc->set_custom_minimum_size(Size2(200, 0));
settings_dialog->add_child(settings_vbc);
- settings_dialog->set_child_rect(settings_vbc);
settings_pick_distance = memnew(SpinBox);
settings_pick_distance->set_max(10000.0f);
settings_pick_distance->set_min(500.0f);
settings_pick_distance->set_step(1.0f);
- settings_pick_distance->set_val(EDITOR_DEF("grid_map/pick_distance", 5000.0));
+ settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance);
clip_mode=CLIP_DISABLED;
- options->get_popup()->connect("item_pressed", this,"_menu_option");
+ options->get_popup()->connect("id_pressed", this,"_menu_option");
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
@@ -1296,6 +1295,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
hb->add_child(mode_list);
mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST));
+ EDITOR_DEF("editors/grid_map/preview_size",64)
+
display_mode = DISPLAY_THUMBNAIL;
selected_area=-1;
@@ -1341,8 +1342,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
//selection mesh create
- DVector<Vector3> lines;
- DVector<Vector3> triangles;
+ PoolVector<Vector3> lines;
+ PoolVector<Vector3> triangles;
for (int i=0;i<6;i++) {
@@ -1376,7 +1377,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for(int i=0;i<12;i++) {
- AABB base(Vector3(0,0,0),Vector3(1,1,1));
+ Rect3 base(Vector3(0,0,0),Vector3(1,1,1));
Vector3 a,b;
base.get_edge(i,a,b);
lines.push_back(a);
@@ -1480,7 +1481,7 @@ void GridMapEditorPlugin::edit(Object *p_object) {
bool GridMapEditorPlugin::handles(Object *p_object) const {
- return p_object->is_type("GridMap");
+ return p_object->is_class("GridMap");
}
void GridMapEditorPlugin::make_visible(bool p_visible) {
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 535c51bcbf..2c0ff99dc6 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -40,7 +40,7 @@
class SpatialEditorPlugin;
class GridMapEditor : public VBoxContainer {
- OBJ_TYPE(GridMapEditor, VBoxContainer );
+ GDCLASS(GridMapEditor, VBoxContainer );
enum {
@@ -238,7 +238,7 @@ public:
class GridMapEditorPlugin : public EditorPlugin {
- OBJ_TYPE( GridMapEditorPlugin, EditorPlugin );
+ GDCLASS( GridMapEditorPlugin, EditorPlugin );
GridMapEditor *gridmap_editor;
EditorNode *editor;
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index 9dcc04b22a..b4a0d3b0b7 100644
--- a/modules/gridmap/register_types.cpp
+++ b/modules/gridmap/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@
void register_gridmap_types() {
#ifndef _3D_DISABLED
- ObjectTypeDB::register_type<GridMap>();
+ ClassDB::register_class<GridMap>();
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<GridMapEditorPlugin>();
#endif
diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h
index 7b5c10f9e5..cc7c13961a 100644
--- a/modules/gridmap/register_types.h
+++ b/modules/gridmap/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 03c3b19fc0..1152d42e1b 100644
--- a/modules/jpg/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -56,11 +56,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
const int dst_bpl = image_width * comps;
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(dst_bpl * image_height);
- DVector<uint8_t>::Write dw = data.write();
+ PoolVector<uint8_t>::Write dw = data.write();
jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr();
@@ -84,11 +84,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
Image::Format fmt;
if (comps==1)
- fmt=Image::FORMAT_GRAYSCALE;
+ fmt=Image::FORMAT_L8;
else
- fmt=Image::FORMAT_RGBA;
+ fmt=Image::FORMAT_RGBA8;
- dw = DVector<uint8_t>::Write();
+ dw = PoolVector<uint8_t>::Write();
p_image->create(image_width,image_height,0,fmt,data);
return OK;
@@ -99,12 +99,12 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) {
- DVector<uint8_t> src_image;
+ PoolVector<uint8_t> src_image;
int src_image_len = f->get_len();
ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
src_image.resize(src_image_len);
- DVector<uint8_t>::Write w = src_image.write();
+ PoolVector<uint8_t>::Write w = src_image.write();
f->get_buffer(&w[0],src_image_len);
@@ -113,7 +113,7 @@ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) {
Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len);
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
return err;
diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index 2c52309ab1..aeb219aa5d 100644
--- a/modules/jpg/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp
index a648423cdf..bcd467f5fc 100644
--- a/modules/jpg/register_types.cpp
+++ b/modules/jpg/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h
index 0e06c4ff81..62132bf461 100644
--- a/modules/jpg/register_types.h
+++ b/modules/jpg/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub
deleted file mode 100644
index 76b7cbea7a..0000000000
--- a/modules/mpc/SCsub
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-Import('env_modules')
-
-env_mpc = env_modules.Clone()
-
-# Thirdparty source files
-if (env['builtin_libmpcdec'] != 'no'):
- thirdparty_dir = "#thirdparty/libmpcdec/"
- thirdparty_sources = [
- "huffman.c",
- "mpc_bits_reader.c",
- "mpc_decoder.c",
- "mpc_demux.c",
- "mpc_reader.c",
- "requant.c",
- "streaminfo.c",
- "synth_filter.c",
- ]
-
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
- env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
- env_mpc.Append(CPPPATH=[thirdparty_dir])
-
-# Godot source files
-env_mpc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp
deleted file mode 100644
index 9713eb3c77..0000000000
--- a/modules/mpc/audio_stream_mpc.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/*************************************************************************/
-/* audio_stream_mpc.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 "audio_stream_mpc.h"
-
-
-Error AudioStreamPlaybackMPC::_open_file() {
-
- if (f) {
- memdelete(f);
- f=NULL;
- }
- Error err;
- //printf("mpc open file %ls\n", file.c_str());
- f=FileAccess::open(file,FileAccess::READ,&err);
-
- if (err) {
- f=NULL;
- ERR_FAIL_V(err);
- return err;
- }
-
- //printf("file size is %i\n", f->get_len());
- //f->seek_end(0);
- streamlen=f->get_len();
- //f->seek(0);
- if (streamlen<=0) {
- memdelete(f);
- f=NULL;
- ERR_FAIL_V(ERR_INVALID_DATA);
- }
-
- data_ofs=0;
- if (preload) {
-
- data.resize(streamlen);
- DVector<uint8_t>::Write w = data.write();
- f->get_buffer(&w[0],streamlen);
- memdelete(f);
- f=NULL;
-
- }
-
- return OK;
-}
-
-void AudioStreamPlaybackMPC::_close_file() {
-
- if (f) {
- memdelete(f);
- f=NULL;
- }
- data.resize(0);
- streamlen=0;
- data_ofs=0;
-}
-
-int AudioStreamPlaybackMPC::_read_file(void *p_dst,int p_bytes) {
-
- if (f)
- return f->get_buffer((uint8_t*)p_dst,p_bytes);
-
- DVector<uint8_t>::Read r = data.read();
- if (p_bytes+data_ofs > streamlen) {
- p_bytes=streamlen-data_ofs;
- }
-
- copymem(p_dst,&r[data_ofs],p_bytes);
- //print_line("read file: "+itos(p_bytes));
- data_ofs+=p_bytes;
- return p_bytes;
-}
-
-bool AudioStreamPlaybackMPC::_seek_file(int p_pos){
-
- if (p_pos<0 || p_pos>streamlen)
- return false;
-
- if (f) {
- f->seek(p_pos);
- return true;
- }
-
- //print_line("read file to: "+itos(p_pos));
- data_ofs=p_pos;
- return true;
-
-}
-int AudioStreamPlaybackMPC::_tell_file() const{
-
- if (f)
- return f->get_pos();
-
- //print_line("tell file, get: "+itos(data_ofs));
- return data_ofs;
-
-}
-
-int AudioStreamPlaybackMPC::_sizeof_file() const{
-
- //print_line("sizeof file, get: "+itos(streamlen));
- return streamlen;
-}
-
-bool AudioStreamPlaybackMPC::_canseek_file() const{
-
- //print_line("canseek file, get true");
- return true;
-}
-
-/////////////////////
-
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_read_file(p_dst,p_bytes);
-}
-
-mpc_bool_t AudioStreamPlaybackMPC::_mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_seek_file(p_offset);
-
-}
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_tell(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_tell_file();
-
-}
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_get_size(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_sizeof_file();
-
-
-}
-mpc_bool_t AudioStreamPlaybackMPC::_mpc_canseek(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_canseek_file();
-}
-
-
-
-
-int AudioStreamPlaybackMPC::mix(int16_t* p_bufer,int p_frames) {
-
- if (!active || paused)
- return 0;
-
- int todo=p_frames;
-
- while(todo>MPC_DECODER_BUFFER_LENGTH/si.channels) {
-
- mpc_frame_info frame;
-
- frame.buffer=sample_buffer;
-
- mpc_status err = mpc_demux_decode(demux, &frame);
- if (frame.bits!=-1) {
-
- int16_t *dst_buff = p_bufer;
-
-#ifdef MPC_FIXED_POINT
-
- for( int i = 0; i < frame.samples * si.channels; i++) {
- int tmp = sample_buffer[i] >> MPC_FIXED_POINT_FRACTPART;
- if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1);
- if (tmp < -(1 << 15)) tmp = -(1 << 15);
- dst_buff[i] = tmp;
- }
-#else
- for( int i = 0; i < frame.samples * si.channels; i++) {
-
- int tmp = Math::fast_ftoi(sample_buffer[i]*32767.0);
- if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1);
- if (tmp < -(1 << 15)) tmp = -(1 << 15);
- dst_buff[i] = tmp;
-
- }
-
-#endif
-
- int frames = frame.samples;
- p_bufer+=si.channels*frames;
- todo-=frames;
- } else {
-
- if (err != MPC_STATUS_OK) {
-
- stop();
- ERR_PRINT("Error decoding MPC");
- break;
- } else {
-
- //finished
- if (!loop) {
- stop();
- break;
- } else {
-
-
- loops++;
- mpc_demux_exit(demux);
- _seek_file(0);
- demux = mpc_demux_init(&reader);
- //do loop somehow
-
- }
- }
- }
- }
-
- return p_frames-todo;
-}
-
-Error AudioStreamPlaybackMPC::_reload() {
-
- ERR_FAIL_COND_V(demux!=NULL, ERR_FILE_ALREADY_IN_USE);
-
- Error err = _open_file();
- ERR_FAIL_COND_V(err!=OK,ERR_CANT_OPEN);
-
- demux = mpc_demux_init(&reader);
- ERR_FAIL_COND_V(!demux,ERR_CANT_CREATE);
- mpc_demux_get_info(demux, &si);
-
- return OK;
-}
-
-void AudioStreamPlaybackMPC::set_file(const String& p_file) {
-
- file=p_file;
-
- Error err = _open_file();
- ERR_FAIL_COND(err!=OK);
- demux = mpc_demux_init(&reader);
- ERR_FAIL_COND(!demux);
- mpc_demux_get_info(demux, &si);
- stream_min_size=MPC_DECODER_BUFFER_LENGTH*2/si.channels;
- stream_rate=si.sample_freq;
- stream_channels=si.channels;
-
- mpc_demux_exit(demux);
- demux=NULL;
- _close_file();
-
-}
-
-
-String AudioStreamPlaybackMPC::get_file() const {
-
- return file;
-}
-
-
-void AudioStreamPlaybackMPC::play(float p_offset) {
-
-
- if (active)
- stop();
- active=false;
-
- Error err = _open_file();
- ERR_FAIL_COND(err!=OK);
- if (_reload()!=OK)
- return;
- active=true;
- loops=0;
-
-}
-
-void AudioStreamPlaybackMPC::stop() {
-
-
- if (!active)
- return;
- if (demux) {
- mpc_demux_exit(demux);
- demux=NULL;
- }
- _close_file();
- active=false;
-
-}
-bool AudioStreamPlaybackMPC::is_playing() const {
-
- return active;
-}
-
-
-void AudioStreamPlaybackMPC::set_loop(bool p_enable) {
-
- loop=p_enable;
-}
-bool AudioStreamPlaybackMPC::has_loop() const {
-
- return loop;
-}
-
-float AudioStreamPlaybackMPC::get_length() const {
-
- return 0;
-}
-
-String AudioStreamPlaybackMPC::get_stream_name() const {
-
- return "";
-}
-
-int AudioStreamPlaybackMPC::get_loop_count() const {
-
- return 0;
-}
-
-float AudioStreamPlaybackMPC::get_pos() const {
-
- return 0;
-}
-void AudioStreamPlaybackMPC::seek_pos(float p_time) {
-
-
-}
-
-
-void AudioStreamPlaybackMPC::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("set_file","name"),&AudioStreamPlaybackMPC::set_file);
- ObjectTypeDB::bind_method(_MD("get_file"),&AudioStreamPlaybackMPC::get_file);
-
- ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"file",PROPERTY_HINT_FILE,"mpc"), _SCS("set_file"), _SCS("get_file"));
-
-}
-
-AudioStreamPlaybackMPC::AudioStreamPlaybackMPC() {
-
- preload=false;
- f=NULL;
- streamlen=0;
- data_ofs=0;
- active=false;
- paused=false;
- loop=false;
- demux=NULL;
- reader.data=this;
- reader.read=_mpc_read;
- reader.seek=_mpc_seek;
- reader.tell=_mpc_tell;
- reader.get_size=_mpc_get_size;
- reader.canseek=_mpc_canseek;
- loops=0;
-
-}
-
-AudioStreamPlaybackMPC::~AudioStreamPlaybackMPC() {
-
- stop();
-
- if (f)
- memdelete(f);
-}
-
-
-
-RES ResourceFormatLoaderAudioStreamMPC::load(const String &p_path, const String& p_original_path, Error *r_error) {
- if (r_error)
- *r_error=OK; //streamed so it will always work..
- AudioStreamMPC *mpc_stream = memnew(AudioStreamMPC);
- mpc_stream->set_file(p_path);
- return Ref<AudioStreamMPC>(mpc_stream);
-}
-
-void ResourceFormatLoaderAudioStreamMPC::get_recognized_extensions(List<String> *p_extensions) const {
-
- p_extensions->push_back("mpc");
-}
-bool ResourceFormatLoaderAudioStreamMPC::handles_type(const String& p_type) const {
-
- return (p_type=="AudioStream") || (p_type=="AudioStreamMPC");
-}
-
-String ResourceFormatLoaderAudioStreamMPC::get_resource_type(const String &p_path) const {
-
- if (p_path.extension().to_lower()=="mpc")
- return "AudioStreamMPC";
- return "";
-}
-
diff --git a/modules/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h
deleted file mode 100644
index c982bdc358..0000000000
--- a/modules/mpc/audio_stream_mpc.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************/
-/* audio_stream_mpc.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef AUDIO_STREAM_MPC_H
-#define AUDIO_STREAM_MPC_H
-
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "os/thread_safe.h"
-#include "scene/resources/audio_stream.h"
-
-#include <mpc/mpcdec.h>
-
-class AudioStreamPlaybackMPC : public AudioStreamPlayback {
-
- OBJ_TYPE( AudioStreamPlaybackMPC, AudioStreamPlayback );
-
- bool preload;
- FileAccess *f;
- String file;
- DVector<uint8_t> data;
- int data_ofs;
- int streamlen;
-
-
- bool active;
- bool paused;
- bool loop;
- int loops;
-
- // mpc
- mpc_reader reader;
- mpc_demux* demux;
- mpc_streaminfo si;
- MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];
-
- static mpc_int32_t _mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes);
- static mpc_bool_t _mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset);
- static mpc_int32_t _mpc_tell(mpc_reader *p_reader);
- static mpc_int32_t _mpc_get_size(mpc_reader *p_reader);
- static mpc_bool_t _mpc_canseek(mpc_reader *p_reader);
-
- int stream_min_size;
- int stream_rate;
- int stream_channels;
-
-protected:
- Error _open_file();
- void _close_file();
- int _read_file(void *p_dst,int p_bytes);
- bool _seek_file(int p_pos);
- int _tell_file() const;
- int _sizeof_file() const;
- bool _canseek_file() const;
-
-
- Error _reload();
- static void _bind_methods();
-
-public:
-
- void set_file(const String& p_file);
- String get_file() const;
-
- virtual void play(float p_offset=0);
- virtual void stop();
- virtual bool is_playing() const;
-
-
- virtual void set_loop(bool p_enable);
- virtual bool has_loop() const;
-
- virtual float get_length() const;
-
- virtual String get_stream_name() const;
-
- virtual int get_loop_count() const;
-
- virtual float get_pos() const;
- virtual void seek_pos(float p_time);
-
- virtual int get_channels() const { return stream_channels; }
- virtual int get_mix_rate() const { return stream_rate; }
-
- virtual int get_minimum_buffer_size() const { return stream_min_size; }
- virtual int mix(int16_t* p_bufer,int p_frames);
-
- virtual void set_loop_restart_time(float p_time) { }
-
- AudioStreamPlaybackMPC();
- ~AudioStreamPlaybackMPC();
-};
-
-class AudioStreamMPC : public AudioStream {
-
- OBJ_TYPE( AudioStreamMPC, AudioStream );
-
- String file;
-public:
-
- Ref<AudioStreamPlayback> instance_playback() {
- Ref<AudioStreamPlaybackMPC> pb = memnew( AudioStreamPlaybackMPC );
- pb->set_file(file);
- return pb;
- }
-
- void set_file(const String& p_file) { file=p_file; }
-
-
-};
-
-class ResourceFormatLoaderAudioStreamMPC : public ResourceFormatLoader {
-public:
- virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String& p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-
-};
-
-#endif // AUDIO_STREAM_MPC_H
diff --git a/modules/mpc/config.py b/modules/mpc/config.py
deleted file mode 100644
index fb920482f5..0000000000
--- a/modules/mpc/config.py
+++ /dev/null
@@ -1,7 +0,0 @@
-
-def can_build(platform):
- return True
-
-
-def configure(env):
- pass
diff --git a/modules/mpc/register_types.cpp b/modules/mpc/register_types.cpp
deleted file mode 100644
index f6a1f59dca..0000000000
--- a/modules/mpc/register_types.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*************************************************************************/
-/* 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 "audio_stream_mpc.h"
-
-static ResourceFormatLoaderAudioStreamMPC* mpc_stream_loader = NULL;
-
-void register_mpc_types() {
-
- mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC );
- ResourceLoader::add_resource_format_loader(mpc_stream_loader);
- ObjectTypeDB::register_type<AudioStreamMPC>();
-}
-
-void unregister_mpc_types() {
-
- memdelete( mpc_stream_loader );
-}
diff --git a/modules/mpc/register_types.h b/modules/mpc/register_types.h
deleted file mode 100644
index 3d0661ed62..0000000000
--- a/modules/mpc/register_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************************************/
-/* 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_mpc_types();
-void unregister_mpc_types();
diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp
index 823ca510ca..ed796ec092 100644
--- a/modules/ogg/register_types.cpp
+++ b/modules/ogg/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h
index b5268a1df4..cc67b4d2f0 100644
--- a/modules/ogg/register_types.h
+++ b/modules/ogg/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/openssl/register_types.cpp b/modules/openssl/register_types.cpp
index 4aba9f530e..6cc9fa3669 100644
--- a/modules/openssl/register_types.cpp
+++ b/modules/openssl/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -32,7 +32,7 @@
void register_openssl_types() {
- ObjectTypeDB::register_type<StreamPeerOpenSSL>();
+ ClassDB::register_class<StreamPeerOpenSSL>();
StreamPeerOpenSSL::initialize_ssl();
}
diff --git a/modules/openssl/register_types.h b/modules/openssl/register_types.h
index 2db140cc80..3bcee59bfd 100644
--- a/modules/openssl/register_types.h
+++ b/modules/openssl/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index b9bec4ca0b..43a1f610d8 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -35,8 +35,8 @@
bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) {
return Tool_Curl_cert_hostcheck(name,hostname)==CURL_HOST_MATCH;
-// print_line("MATCH: "+String(name)+" vs "+String(hostname));
-// return true;
+ //print_line("MATCH: "+String(name)+" vs "+String(hostname));
+ //return true;
}
Error StreamPeerOpenSSL::_match_common_name(const char *hostname, const X509 *server_cert) {
@@ -293,10 +293,10 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = {
_bio_destroy
};
-Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) {
+Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) {
if (connected)
- disconnect();
+ disconnect_from_stream();
hostname=p_for_hostname;
@@ -415,7 +415,7 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs,
return OK;
}
-Error StreamPeerOpenSSL::accept(Ref<StreamPeer> p_base) {
+Error StreamPeerOpenSSL::accept_stream(Ref<StreamPeer> p_base) {
return ERR_UNAVAILABLE;
@@ -451,7 +451,7 @@ Error StreamPeerOpenSSL::put_data(const uint8_t* p_data,int p_bytes) {
int ret = SSL_write(ssl,p_data,p_bytes);
if (ret<=0) {
_print_error(ret);
- disconnect();
+ disconnect_from_stream();
return ERR_CONNECTION_ERROR;
}
p_data+=ret;
@@ -486,7 +486,7 @@ Error StreamPeerOpenSSL::get_data(uint8_t* p_buffer, int p_bytes){
int ret = SSL_read(ssl,p_buffer,p_bytes);
if (ret<=0) {
_print_error(ret);
- disconnect();
+ disconnect_from_stream();
return ERR_CONNECTION_ERROR;
}
p_buffer+=ret;
@@ -529,7 +529,7 @@ StreamPeerOpenSSL::StreamPeerOpenSSL() {
flags=0;
}
-void StreamPeerOpenSSL::disconnect() {
+void StreamPeerOpenSSL::disconnect_from_stream() {
if (!connected)
return;
@@ -552,7 +552,7 @@ StreamPeerOpenSSL::Status StreamPeerOpenSSL::get_status() const {
StreamPeerOpenSSL::~StreamPeerOpenSSL() {
- disconnect();
+ disconnect_from_stream();
}
StreamPeerSSL* StreamPeerOpenSSL::_create_func() {
@@ -564,9 +564,9 @@ StreamPeerSSL* StreamPeerOpenSSL::_create_func() {
Vector<X509*> StreamPeerOpenSSL::certs;
-void StreamPeerOpenSSL::_load_certs(const ByteArray& p_array) {
+void StreamPeerOpenSSL::_load_certs(const PoolByteArray& p_array) {
- ByteArray::Read r = p_array.read();
+ PoolByteArray::Read r = p_array.read();
BIO* mem = BIO_new(BIO_s_mem());
BIO_puts(mem,(const char*)r.ptr());
while(true) {
@@ -590,19 +590,19 @@ void StreamPeerOpenSSL::initialize_ssl() {
SSL_load_error_strings(); // Load SSL error strings
ERR_load_BIO_strings(); // Load BIO error strings
OpenSSL_add_all_algorithms(); // Load all available encryption algorithms
- String certs_path =GLOBAL_DEF("ssl/certificates","");
- Globals::get_singleton()->set_custom_property_info("ssl/certificates",PropertyInfo(Variant::STRING,"ssl/certificates",PROPERTY_HINT_FILE,"*.crt"));
+ String certs_path =GLOBAL_DEF("network/ssl/certificates","");
+ GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/certificates",PropertyInfo(Variant::STRING,"network/ssl/certificates",PROPERTY_HINT_FILE,"*.crt"));
if (certs_path!="") {
FileAccess *f=FileAccess::open(certs_path,FileAccess::READ);
if (f) {
- ByteArray arr;
+ PoolByteArray arr;
int flen = f->get_len();
arr.resize(flen+1);
{
- ByteArray::Write w = arr.write();
+ PoolByteArray::Write w = arr.write();
f->get_buffer(w.ptr(),flen);
w[flen]=0; //end f string
}
@@ -613,8 +613,8 @@ void StreamPeerOpenSSL::initialize_ssl() {
print_line("Loaded certs from '"+certs_path+"': "+itos(certs.size()));
}
}
- String config_path =GLOBAL_DEF("ssl/config","");
- Globals::get_singleton()->set_custom_property_info("ssl/config",PropertyInfo(Variant::STRING,"ssl/config",PROPERTY_HINT_FILE,"*.cnf"));
+ String config_path =GLOBAL_DEF("network/ssl/config","");
+ GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/config",PropertyInfo(Variant::STRING,"network/ssl/config",PROPERTY_HINT_FILE,"*.cnf"));
if (config_path!="") {
Vector<uint8_t> data = FileAccess::get_file_as_array(config_path);
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 853ede2036..3d6875698c 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -79,17 +79,17 @@ private:
static Vector<X509*> certs;
- static void _load_certs(const ByteArray& p_array);
+ static void _load_certs(const PoolByteArray& p_array);
protected:
static void _bind_methods();
public:
- virtual Error accept(Ref<StreamPeer> p_base);
- virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String());
+ virtual Error accept_stream(Ref<StreamPeer> p_base);
+ virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String());
virtual Status get_status() const;
- virtual void disconnect();
+ virtual void disconnect_from_stream();
virtual Error put_data(const uint8_t* p_data,int p_bytes);
virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent);
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index ab53fee0c9..4a6b2e224c 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Author: George Marques <george@gmarqu.es> */
/* */
@@ -366,7 +366,7 @@ void ResourceFormatLoaderAudioStreamOpus::get_recognized_extensions(List<String>
}
String ResourceFormatLoaderAudioStreamOpus::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="opus")
+ if (p_path.get_extension().to_lower()=="opus")
return "AudioStreamOpus";
return "";
}
diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index abf0b5c150..5093456ccd 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Author: George Marques <george@gmarqu.es> */
/* */
@@ -40,7 +40,7 @@
class AudioStreamPlaybackOpus : public AudioStreamPlayback {
- OBJ_TYPE(AudioStreamPlaybackOpus,AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackOpus,AudioStreamPlayback)
enum {
MIN_MIX=1024
@@ -115,7 +115,7 @@ public:
class AudioStreamOpus: public AudioStream {
- OBJ_TYPE(AudioStreamOpus,AudioStream)
+ GDCLASS(AudioStreamOpus,AudioStream)
String file;
public:
diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp
index a4d71a52c7..a177bc9463 100644
--- a/modules/opus/register_types.cpp
+++ b/modules/opus/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@ void register_opus_types() {
opus_stream_loader = memnew( ResourceFormatLoaderAudioStreamOpus );
ResourceLoader::add_resource_format_loader(opus_stream_loader);
- ObjectTypeDB::register_type<AudioStreamOpus>();
+ ClassDB::register_class<AudioStreamOpus>();
}
void unregister_opus_types() {
diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h
index f4386c373a..09181b4f03 100644
--- a/modules/opus/register_types.h
+++ b/modules/opus/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp
index 1d08b10824..ab0805a6b0 100644
--- a/modules/pbm/bitmap_loader_pbm.cpp
+++ b/modules/pbm/bitmap_loader_pbm.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -31,11 +31,11 @@
#include "scene/resources/bit_mask.h"
-static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) {
+static bool _get_token(FileAccessRef& f,uint8_t &saved,PoolVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) {
int token_max = r_token.size();
- DVector<uint8_t>::Write w;
+ PoolVector<uint8_t>::Write w;
if (token_max)
w=r_token.write();
int ofs=0;
@@ -53,7 +53,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
}
if (f->eof_reached()) {
if (ofs) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(ofs);
return true;
} else {
@@ -81,7 +81,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
if (ofs && !p_single_chunk) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(ofs);
saved=b;
@@ -98,7 +98,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
resized=true;
}
if (resized) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(token_max);
w=r_token.write();
}
@@ -109,10 +109,10 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
return false;
}
-static int _get_number_from_token(DVector<uint8_t>& r_token) {
+static int _get_number_from_token(PoolVector<uint8_t>& r_token) {
int len = r_token.size();
- DVector<uint8_t>::Read r = r_token.read();
+ PoolVector<uint8_t>::Read r = r_token.read();
return String::to_int((const char*)r.ptr(),len);
}
@@ -133,7 +133,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
if (!f)
_RETURN(ERR_CANT_OPEN);
- DVector<uint8_t> token;
+ PoolVector<uint8_t> token;
if (!_get_token(f,saved,token)) {
_RETURN(ERR_PARSE_ERROR);
@@ -186,7 +186,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
_RETURN(ERR_FILE_CORRUPT);
}
- DVector<uint8_t>::Read r=token.read();
+ PoolVector<uint8_t>::Read r=token.read();
for(int i=0;i<height;i++) {
for(int j=0;j<width;j++) {
@@ -210,7 +210,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
_RETURN(ERR_FILE_CORRUPT);
}
- DVector<uint8_t>::Read r=token.read();
+ PoolVector<uint8_t>::Read r=token.read();
int bitwidth = width;
if (bitwidth % 8)
bitwidth+=8-(bitwidth%8);
@@ -244,7 +244,7 @@ bool ResourceFormatPBM::handles_type(const String& p_type) const {
}
String ResourceFormatPBM::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pbm")
+ if (p_path.get_extension().to_lower()=="pbm")
return "BitMap";
return "";
}
diff --git a/modules/pbm/bitmap_loader_pbm.h b/modules/pbm/bitmap_loader_pbm.h
index 4f7144b3e0..b60b38fcca 100644
--- a/modules/pbm/bitmap_loader_pbm.h
+++ b/modules/pbm/bitmap_loader_pbm.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pbm/register_types.cpp b/modules/pbm/register_types.cpp
index 181083773a..0dd39ce1e4 100644
--- a/modules/pbm/register_types.cpp
+++ b/modules/pbm/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h
index 20c8133c2c..c9a125083d 100644
--- a/modules/pbm/register_types.h
+++ b/modules/pbm/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp
index e5e18fb3d1..2464e78984 100644
--- a/modules/pvr/register_types.cpp
+++ b/modules/pvr/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h
index d600f54d51..ac2ab748df 100644
--- a/modules/pvr/register_types.h
+++ b/modules/pvr/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 3ab3240512..0d8cabb331 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -99,13 +99,13 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
print_line("surfcount: "+itos(surfcount));
*/
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(surfsize);
ERR_FAIL_COND_V(data.size()==0,RES());
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
f->get_buffer(&w[0],surfsize);
err = f->get_error();
ERR_FAIL_COND_V(err!=OK,RES());
@@ -116,33 +116,33 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
switch(flags&0xFF) {
case 0x18:
- case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2_ALPHA:Image::FORMAT_PVRTC2; break;
+ case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2A:Image::FORMAT_PVRTC2; break;
case 0x19:
- case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4; break;
+ case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4; break;
case 0x16:
- format=Image::FORMAT_GRAYSCALE; break;
+ format=Image::FORMAT_L8; break;
case 0x17:
- format=Image::FORMAT_GRAYSCALE_ALPHA; break;
+ format=Image::FORMAT_LA8; break;
case 0x20:
case 0x80:
case 0x81:
- format=Image::FORMAT_BC1; break;
+ format=Image::FORMAT_DXT1; break;
case 0x21:
case 0x22:
case 0x82:
case 0x83:
- format=Image::FORMAT_BC2; break;
+ format=Image::FORMAT_DXT3; break;
case 0x23:
case 0x24:
case 0x84:
case 0x85:
- format=Image::FORMAT_BC3; break;
+ format=Image::FORMAT_DXT5; break;
case 0x4:
case 0x15:
- format=Image::FORMAT_RGB; break;
+ format=Image::FORMAT_RGB8; break;
case 0x5:
case 0x12:
- format=Image::FORMAT_RGBA; break;
+ format=Image::FORMAT_RGBA8; break;
case 0x36:
format=Image::FORMAT_ETC; break;
default:
@@ -151,7 +151,7 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
}
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
int tex_flags=Texture::FLAG_FILTER|Texture::FLAG_REPEAT;
@@ -180,12 +180,12 @@ void ResourceFormatPVR::get_recognized_extensions(List<String> *p_extensions) co
}
bool ResourceFormatPVR::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatPVR::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pvr")
+ if (p_path.get_extension().to_lower()=="pvr")
return "Texture";
return "";
}
@@ -198,24 +198,24 @@ static void _compress_pvrtc4(Image * p_img) {
bool make_mipmaps=false;
if (img.get_width()%8 || img.get_height()%8) {
- make_mipmaps=img.get_mipmaps()>0;
+ make_mipmaps=img.has_mipmaps();
img.resize(img.get_width()+(8-(img.get_width()%8)),img.get_height()+(8-(img.get_height()%8)));
}
- img.convert(Image::FORMAT_RGBA);
- if (img.get_mipmaps()==0 && make_mipmaps)
+ img.convert(Image::FORMAT_RGBA8);
+ if (!img.has_mipmaps() && make_mipmaps)
img.generate_mipmaps();
bool use_alpha=img.detect_alpha();
Image new_img;
- new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4);
- DVector<uint8_t> data=new_img.get_data();
+ new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4);
+ PoolVector<uint8_t> data=new_img.get_data();
{
- DVector<uint8_t>::Write wr=data.write();
- DVector<uint8_t>::Read r=img.get_data().read();
+ PoolVector<uint8_t>::Write wr=data.write();
+ PoolVector<uint8_t>::Read r=img.get_data().read();
- for(int i=0;i<=new_img.get_mipmaps();i++) {
+ for(int i=0;i<=new_img.get_mipmap_count();i++) {
int ofs,size,w,h;
img.get_mipmap_offset_size_and_dimensions(i,ofs,size,w,h);
@@ -234,7 +234,7 @@ static void _compress_pvrtc4(Image * p_img) {
}
- *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.get_mipmaps(),new_img.get_format(),data);
+ *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.has_mipmaps(),new_img.get_format(),data);
}
@@ -669,33 +669,37 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
static void _pvrtc_decompress(Image* p_img) {
-// static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) {
-// decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst);
-// }
+ /*
+ static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) {
+ decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst);
+ }
+ */
- ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2_ALPHA && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4_ALPHA);
+ ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2A && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4A);
- bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2_ALPHA );
+ bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A );
- DVector<uint8_t> data = p_img->get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = p_img->get_data();
+ PoolVector<uint8_t>::Read r = data.read();
- DVector<uint8_t> newdata;
+ PoolVector<uint8_t> newdata;
newdata.resize( p_img->get_width() * p_img->get_height() * 4);
- DVector<uint8_t>::Write w=newdata.write();
+ PoolVector<uint8_t>::Write w=newdata.write();
decompress_pvrtc((PVRTCBlock*)r.ptr(),_2bit,p_img->get_width(),p_img->get_height(),0,(unsigned char*)w.ptr());
- //for(int i=0;i<newdata.size();i++) {
- // print_line(itos(w[i]));
- //}
+ /*
+ for(int i=0;i<newdata.size();i++) {
+ print_line(itos(w[i]));
+ }
+ */
- w=DVector<uint8_t>::Write();
- r=DVector<uint8_t>::Read();
+ w=PoolVector<uint8_t>::Write();
+ r=PoolVector<uint8_t>::Read();
- bool make_mipmaps=p_img->get_mipmaps()>0;
- Image newimg(p_img->get_width(),p_img->get_height(),0,Image::FORMAT_RGBA,newdata);
+ bool make_mipmaps=p_img->has_mipmaps();
+ Image newimg(p_img->get_width(),p_img->get_height(),false,Image::FORMAT_RGBA8,newdata);
if (make_mipmaps)
newimg.generate_mipmaps();
*p_img=newimg;
diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index 5efb3b2507..bad48b4569 100644
--- a/modules/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index 0197da46fb..e67040b5a3 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -1481,26 +1481,26 @@ RegEx::~RegEx() {
void RegExMatch::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("expand","template"),&RegExMatch::expand);
- ObjectTypeDB::bind_method(_MD("get_group_count"),&RegExMatch::get_group_count);
- ObjectTypeDB::bind_method(_MD("get_group_array"),&RegExMatch::get_group_array);
- ObjectTypeDB::bind_method(_MD("get_names"),&RegExMatch::get_names);
- ObjectTypeDB::bind_method(_MD("get_name_dict"),&RegExMatch::get_name_dict);
- ObjectTypeDB::bind_method(_MD("get_string","name"),&RegExMatch::get_string, DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_start","name"),&RegExMatch::get_start, DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_end","name"),&RegExMatch::get_end, DEFVAL(0));
+ ClassDB::bind_method(_MD("expand","template"),&RegExMatch::expand);
+ ClassDB::bind_method(_MD("get_group_count"),&RegExMatch::get_group_count);
+ ClassDB::bind_method(_MD("get_group_array"),&RegExMatch::get_group_array);
+ ClassDB::bind_method(_MD("get_names"),&RegExMatch::get_names);
+ ClassDB::bind_method(_MD("get_name_dict"),&RegExMatch::get_name_dict);
+ ClassDB::bind_method(_MD("get_string","name"),&RegExMatch::get_string, DEFVAL(0));
+ ClassDB::bind_method(_MD("get_start","name"),&RegExMatch::get_start, DEFVAL(0));
+ ClassDB::bind_method(_MD("get_end","name"),&RegExMatch::get_end, DEFVAL(0));
}
void RegEx::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("clear"),&RegEx::clear);
- ObjectTypeDB::bind_method(_MD("compile","pattern"),&RegEx::compile);
- ObjectTypeDB::bind_method(_MD("search","text","start","end"),&RegEx::search, DEFVAL(0), DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("sub","text","replacement","all","start","end"),&RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
- ObjectTypeDB::bind_method(_MD("get_pattern"),&RegEx::get_pattern);
- ObjectTypeDB::bind_method(_MD("get_group_count"),&RegEx::get_group_count);
- ObjectTypeDB::bind_method(_MD("get_names"),&RegEx::get_names);
+ ClassDB::bind_method(_MD("clear"),&RegEx::clear);
+ ClassDB::bind_method(_MD("compile","pattern"),&RegEx::compile);
+ ClassDB::bind_method(_MD("search","text","start","end"),&RegEx::search, DEFVAL(0), DEFVAL(-1));
+ ClassDB::bind_method(_MD("sub","text","replacement","all","start","end"),&RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1));
+ ClassDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
+ ClassDB::bind_method(_MD("get_pattern"),&RegEx::get_pattern);
+ ClassDB::bind_method(_MD("get_group_count"),&RegEx::get_group_count);
+ ClassDB::bind_method(_MD("get_names"),&RegEx::get_names);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "pattern"), _SCS("compile"), _SCS("get_pattern"));
}
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index 803aa72b3f..193d818da3 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -40,7 +40,7 @@ class RegExNode;
class RegExMatch : public Reference {
- OBJ_TYPE(RegExMatch, Reference);
+ GDCLASS(RegExMatch, Reference);
struct Group {
Variant name;
@@ -80,7 +80,7 @@ public:
class RegEx : public Resource {
- OBJ_TYPE(RegEx, Resource);
+ GDCLASS(RegEx, Resource);
RegExNode* root;
Vector<Variant> group_names;
diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp
index 050cf3efff..d44c7e563c 100644
--- a/modules/regex/register_types.cpp
+++ b/modules/regex/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -33,8 +33,8 @@
void register_regex_types() {
- ObjectTypeDB::register_type<RegExMatch>();
- ObjectTypeDB::register_type<RegEx>();
+ ClassDB::register_class<RegExMatch>();
+ ClassDB::register_class<RegEx>();
}
void unregister_regex_types() {
diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h
index df3b508e14..5d676b6daa 100644
--- a/modules/regex/register_types.h
+++ b/modules/regex/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/register_module_types.h b/modules/register_module_types.h
index 683ce7c6b8..7d9a130ea1 100644
--- a/modules/register_module_types.h
+++ b/modules/register_module_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index ac7c935ceb..7410658603 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -37,7 +37,7 @@ void image_compress_squish(Image *p_image) {
int w=p_image->get_width();
int h=p_image->get_height();
- if (p_image->get_mipmaps() == 0) {
+ if (!p_image->has_mipmaps() ) {
ERR_FAIL_COND( !w || w % 4 != 0);
ERR_FAIL_COND( !h || h % 4 != 0);
} else {
@@ -45,33 +45,33 @@ void image_compress_squish(Image *p_image) {
ERR_FAIL_COND( !h || h !=nearest_power_of_2(h) );
};
- if (p_image->get_format()>=Image::FORMAT_BC1)
+ if (p_image->get_format()>=Image::FORMAT_DXT1)
return; //do not compress, already compressed
int shift=0;
int squish_comp=squish::kColourRangeFit;
Image::Format target_format;
- if (p_image->get_format()==Image::FORMAT_GRAYSCALE_ALPHA) {
+ if (p_image->get_format()==Image::FORMAT_LA8) {
//compressed normalmap
- target_format = Image::FORMAT_BC3; squish_comp|=squish::kDxt5;;
+ target_format = Image::FORMAT_DXT5; squish_comp|=squish::kDxt5;;
} else if (p_image->detect_alpha()!=Image::ALPHA_NONE) {
- target_format = Image::FORMAT_BC2; squish_comp|=squish::kDxt3;;
+ target_format = Image::FORMAT_DXT3; squish_comp|=squish::kDxt3;;
} else {
- target_format = Image::FORMAT_BC1; shift=1; squish_comp|=squish::kDxt1;;
+ target_format = Image::FORMAT_DXT1; shift=1; squish_comp|=squish::kDxt1;;
}
- p_image->convert(Image::FORMAT_RGBA); //always expects rgba
+ p_image->convert(Image::FORMAT_RGBA8); //always expects rgba
- int mm_count = p_image->get_mipmaps();
+ int mm_count = p_image->get_mipmap_count();
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
int target_size = Image::get_image_data_size(w,h,target_format,mm_count);
data.resize(target_size);
- DVector<uint8_t>::Read rb = p_image->get_data().read();
- DVector<uint8_t>::Write wb = data.write();
+ PoolVector<uint8_t>::Read rb = p_image->get_data().read();
+ PoolVector<uint8_t>::Write wb = data.write();
int dst_ofs=0;
@@ -84,9 +84,9 @@ void image_compress_squish(Image *p_image) {
h>>=1;
}
- rb = DVector<uint8_t>::Read();
- wb = DVector<uint8_t>::Write();
+ rb = PoolVector<uint8_t>::Read();
+ wb = PoolVector<uint8_t>::Write();
- p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data);
+ p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data);
}
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 19dd900674..198889402a 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp
index 9e9621eb64..995711c758 100644
--- a/modules/squish/register_types.cpp
+++ b/modules/squish/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h
index bbde6a44bf..0db4301997 100644
--- a/modules/squish/register_types.h
+++ b/modules/squish/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp
index 282b59b0ec..58f63465c9 100644
--- a/modules/theora/register_types.cpp
+++ b/modules/theora/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@ void register_theora_types() {
theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
ResourceLoader::add_resource_format_loader(theora_stream_loader);
- ObjectTypeDB::register_type<VideoStreamTheora>();
+ ClassDB::register_class<VideoStreamTheora>();
}
void unregister_theora_types() {
diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h
index 18bdbf0c4c..582aa785c7 100644
--- a/modules/theora/register_types.h
+++ b/modules/theora/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 3ddfee3a1d..9d2dfc7f56 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -81,6 +81,9 @@ void VideoStreamPlaybackTheora::video_write(void){
th_ycbcr_buffer yuv;
th_decode_ycbcr_out(td,yuv);
+ // FIXME: The way stuff is commented out with `//*/` closing comments
+ // sounds very fishy...
+
/*
int y_offset, uv_offset;
y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1);
@@ -88,7 +91,7 @@ void VideoStreamPlaybackTheora::video_write(void){
{
int pixels = size.x * size.y;
frame_data.resize(pixels * 4);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
int p = 0;
for (int i=0; i<size.y; i++) {
@@ -103,16 +106,16 @@ void VideoStreamPlaybackTheora::video_write(void){
dst[p++] = 255;
};
}
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
}
- // */
+ //*/
//*
int pitch = 4;
frame_data.resize(size.x * size.y * pitch);
{
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
//uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
@@ -130,10 +133,10 @@ void VideoStreamPlaybackTheora::video_write(void){
yuv420_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[2].data, (uint8_t*)yuv[1].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
};
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
}
- Image img(size.x,size.y,0,Image::FORMAT_RGBA,frame_data); //zero copy image creation
+ Image img(size.x,size.y,0,Image::FORMAT_RGBA8,frame_data); //zero copy image creation
texture->set_data(img); //zero copy send to visual server
@@ -143,7 +146,7 @@ void VideoStreamPlaybackTheora::video_write(void){
int pitch = 3;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
for(int i=0;i<size.y;i++) {
@@ -174,7 +177,7 @@ void VideoStreamPlaybackTheora::video_write(void){
int pitch = 4;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
@@ -202,13 +205,13 @@ void VideoStreamPlaybackTheora::video_write(void){
}
}
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
} else {
int pitch = 2;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
@@ -228,7 +231,7 @@ void VideoStreamPlaybackTheora::video_write(void){
format = Image::FORMAT_YUV_422;
};
};
- // */
+ //*/
frames_pending = 1;
}
@@ -470,7 +473,7 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
size.x = w;
size.y = h;
- texture->create(w,h,Image::FORMAT_RGBA,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE);
+ texture->create(w,h,Image::FORMAT_RGBA8,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE);
}else{
/* tear down the partial theora setup */
@@ -598,7 +601,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
if (vd.granulepos>=0) {
- // print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
+ //print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
}
//print_line("mix audio!");
@@ -747,7 +750,7 @@ void VideoStreamPlaybackTheora::play() {
}
playing = true;
- delay_compensation=Globals::get_singleton()->get("audio/video_delay_compensation_ms");
+ delay_compensation=GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms");
delay_compensation/=1000.0;
@@ -933,7 +936,7 @@ bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String& p_type) c
String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const {
- String exl=p_path.extension().to_lower();
+ String exl=p_path.get_extension().to_lower();
if (exl=="ogm" || exl=="ogv")
return "VideoStreamTheora";
return "";
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 04a5c56ee5..0e1f5fa864 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -43,7 +43,7 @@
class VideoStreamPlaybackTheora : public VideoStreamPlayback {
- OBJ_TYPE(VideoStreamPlaybackTheora, VideoStreamPlayback);
+ GDCLASS(VideoStreamPlaybackTheora, VideoStreamPlayback);
enum {
MAX_FRAMES = 4,
@@ -51,7 +51,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
//Image frames[MAX_FRAMES];
Image::Format format;
- DVector<uint8_t> frame_data;
+ PoolVector<uint8_t> frame_data;
int frames_pending;
FileAccess* file;
String file_name;
@@ -165,7 +165,7 @@ public:
class VideoStreamTheora : public VideoStream {
- OBJ_TYPE(VideoStreamTheora,VideoStream);
+ GDCLASS(VideoStreamTheora,VideoStream);
String file;
int audio_track;
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index ad54149b51..5fe87a4956 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -48,58 +48,58 @@ void register_visual_script_types() {
//script_language_gd->init();
ScriptServer::register_language(visual_script_language);
- ObjectTypeDB::register_type<VisualScript>();
- ObjectTypeDB::register_virtual_type<VisualScriptNode>();
- ObjectTypeDB::register_virtual_type<VisualScriptFunctionState>();
- ObjectTypeDB::register_type<VisualScriptFunction>();
- ObjectTypeDB::register_type<VisualScriptOperator>();
- ObjectTypeDB::register_type<VisualScriptVariableSet>();
- ObjectTypeDB::register_type<VisualScriptVariableGet>();
- ObjectTypeDB::register_type<VisualScriptConstant>();
- ObjectTypeDB::register_type<VisualScriptIndexGet>();
- ObjectTypeDB::register_type<VisualScriptIndexSet>();
- ObjectTypeDB::register_type<VisualScriptGlobalConstant>();
- ObjectTypeDB::register_type<VisualScriptClassConstant>();
- ObjectTypeDB::register_type<VisualScriptMathConstant>();
- ObjectTypeDB::register_type<VisualScriptBasicTypeConstant>();
- ObjectTypeDB::register_type<VisualScriptEngineSingleton>();
- ObjectTypeDB::register_type<VisualScriptSceneNode>();
- ObjectTypeDB::register_type<VisualScriptSceneTree>();
- ObjectTypeDB::register_type<VisualScriptResourcePath>();
- 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<VisualScriptLocalVarSet>();
- ObjectTypeDB::register_type<VisualScriptInputAction>();
- ObjectTypeDB::register_type<VisualScriptDeconstruct>();
- ObjectTypeDB::register_type<VisualScriptPreload>();
- ObjectTypeDB::register_type<VisualScriptTypeCast>();
-
-
- ObjectTypeDB::register_type<VisualScriptFunctionCall>();
- ObjectTypeDB::register_type<VisualScriptPropertySet>();
- ObjectTypeDB::register_type<VisualScriptPropertyGet>();
-// ObjectTypeDB::register_type<VisualScriptScriptCall>();
- ObjectTypeDB::register_type<VisualScriptEmitSignal>();
-
- ObjectTypeDB::register_type<VisualScriptReturn>();
- ObjectTypeDB::register_type<VisualScriptCondition>();
- ObjectTypeDB::register_type<VisualScriptWhile>();
- ObjectTypeDB::register_type<VisualScriptIterator>();
- ObjectTypeDB::register_type<VisualScriptSequence>();
- ObjectTypeDB::register_type<VisualScriptInputFilter>();
- ObjectTypeDB::register_type<VisualScriptSwitch >();
-
- ObjectTypeDB::register_type<VisualScriptYield>();
- ObjectTypeDB::register_type<VisualScriptYieldSignal>();
-
- ObjectTypeDB::register_type<VisualScriptBuiltinFunc>();
-
-
- ObjectTypeDB::register_type<VisualScriptExpression>();
+ ClassDB::register_class<VisualScript>();
+ ClassDB::register_virtual_class<VisualScriptNode>();
+ ClassDB::register_virtual_class<VisualScriptFunctionState>();
+ ClassDB::register_class<VisualScriptFunction>();
+ ClassDB::register_class<VisualScriptOperator>();
+ ClassDB::register_class<VisualScriptVariableSet>();
+ ClassDB::register_class<VisualScriptVariableGet>();
+ ClassDB::register_class<VisualScriptConstant>();
+ ClassDB::register_class<VisualScriptIndexGet>();
+ ClassDB::register_class<VisualScriptIndexSet>();
+ ClassDB::register_class<VisualScriptGlobalConstant>();
+ ClassDB::register_class<VisualScriptClassConstant>();
+ ClassDB::register_class<VisualScriptMathConstant>();
+ ClassDB::register_class<VisualScriptBasicTypeConstant>();
+ ClassDB::register_class<VisualScriptEngineSingleton>();
+ ClassDB::register_class<VisualScriptSceneNode>();
+ ClassDB::register_class<VisualScriptSceneTree>();
+ ClassDB::register_class<VisualScriptResourcePath>();
+ ClassDB::register_class<VisualScriptSelf>();
+ ClassDB::register_class<VisualScriptCustomNode>();
+ ClassDB::register_class<VisualScriptSubCall>();
+ ClassDB::register_class<VisualScriptComment>();
+ ClassDB::register_class<VisualScriptConstructor>();
+ ClassDB::register_class<VisualScriptLocalVar>();
+ ClassDB::register_class<VisualScriptLocalVarSet>();
+ ClassDB::register_class<VisualScriptInputAction>();
+ ClassDB::register_class<VisualScriptDeconstruct>();
+ ClassDB::register_class<VisualScriptPreload>();
+ ClassDB::register_class<VisualScriptTypeCast>();
+
+
+ ClassDB::register_class<VisualScriptFunctionCall>();
+ ClassDB::register_class<VisualScriptPropertySet>();
+ ClassDB::register_class<VisualScriptPropertyGet>();
+ //ClassDB::register_type<VisualScriptScriptCall>();
+ ClassDB::register_class<VisualScriptEmitSignal>();
+
+ ClassDB::register_class<VisualScriptReturn>();
+ ClassDB::register_class<VisualScriptCondition>();
+ ClassDB::register_class<VisualScriptWhile>();
+ ClassDB::register_class<VisualScriptIterator>();
+ ClassDB::register_class<VisualScriptSequence>();
+ ClassDB::register_class<VisualScriptInputFilter>();
+ ClassDB::register_class<VisualScriptSwitch >();
+
+ ClassDB::register_class<VisualScriptYield>();
+ ClassDB::register_class<VisualScriptYieldSignal>();
+
+ ClassDB::register_class<VisualScriptBuiltinFunc>();
+
+
+ ClassDB::register_class<VisualScriptExpression>();
register_visual_script_nodes();
register_visual_script_func_nodes();
diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h
index 0a5805eb0b..f6904420bd 100644
--- a/modules/visual_script/register_types.h
+++ b/modules/visual_script/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index bd042c8989..e1e180432a 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -104,11 +104,11 @@ Array VisualScriptNode::_get_default_input_values() const {
void VisualScriptNode::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("get_visual_script:VisualScript"),&VisualScriptNode::get_visual_script);
- ObjectTypeDB::bind_method(_MD("set_default_input_value","port_idx","value:Variant"),&VisualScriptNode::set_default_input_value);
- ObjectTypeDB::bind_method(_MD("get_default_input_value:Variant","port_idx"),&VisualScriptNode::get_default_input_value);
- ObjectTypeDB::bind_method(_MD("_set_default_input_values","values"),&VisualScriptNode::_set_default_input_values);
- ObjectTypeDB::bind_method(_MD("_get_default_input_values"),&VisualScriptNode::_get_default_input_values);
+ ClassDB::bind_method(_MD("get_visual_script:VisualScript"),&VisualScriptNode::get_visual_script);
+ ClassDB::bind_method(_MD("set_default_input_value","port_idx","value:Variant"),&VisualScriptNode::set_default_input_value);
+ ClassDB::bind_method(_MD("get_default_input_value:Variant","port_idx"),&VisualScriptNode::get_default_input_value);
+ ClassDB::bind_method(_MD("_set_default_input_values","values"),&VisualScriptNode::_set_default_input_values);
+ ClassDB::bind_method(_MD("_get_default_input_values"),&VisualScriptNode::_get_default_input_values);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"_default_input_values",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_default_input_values"),_SCS("_get_default_input_values"));
ADD_SIGNAL(MethodInfo("ports_changed"));
@@ -122,7 +122,7 @@ VisualScriptNode::TypeGuess VisualScriptNode::guess_output_type(TypeGuess* p_inp
tg.type=pinfo.type;
if (pinfo.hint==PROPERTY_HINT_RESOURCE_TYPE) {
- tg.obj_type=pinfo.hint_string;
+ tg.GDCLASS=pinfo.hint_string;
}
return tg;
@@ -1317,63 +1317,63 @@ void VisualScript::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_node_ports_changed"),&VisualScript::_node_ports_changed);
-
- ObjectTypeDB::bind_method(_MD("add_function","name"),&VisualScript::add_function);
- ObjectTypeDB::bind_method(_MD("has_function","name"),&VisualScript::has_function);
- ObjectTypeDB::bind_method(_MD("remove_function","name"),&VisualScript::remove_function);
- ObjectTypeDB::bind_method(_MD("rename_function","name","new_name"),&VisualScript::rename_function);
- ObjectTypeDB::bind_method(_MD("set_function_scroll","ofs"),&VisualScript::set_function_scroll);
- ObjectTypeDB::bind_method(_MD("get_function_scroll"),&VisualScript::get_function_scroll);
-
- ObjectTypeDB::bind_method(_MD("add_node","func","id","node","pos"),&VisualScript::add_node,DEFVAL(Point2()));
- ObjectTypeDB::bind_method(_MD("remove_node","func","id"),&VisualScript::remove_node);
- ObjectTypeDB::bind_method(_MD("get_function_node_id","name"),&VisualScript::get_function_node_id);
-
- ObjectTypeDB::bind_method(_MD("get_node","func","id"),&VisualScript::get_node);
- ObjectTypeDB::bind_method(_MD("has_node","func","id"),&VisualScript::has_node);
- ObjectTypeDB::bind_method(_MD("set_node_pos","func","id","pos"),&VisualScript::set_node_pos);
- ObjectTypeDB::bind_method(_MD("get_node_pos","func","id"),&VisualScript::get_node_pos);
-
- ObjectTypeDB::bind_method(_MD("sequence_connect","func","from_node","from_output","to_node"),&VisualScript::sequence_connect);
- ObjectTypeDB::bind_method(_MD("sequence_disconnect","func","from_node","from_output","to_node"),&VisualScript::sequence_disconnect);
- ObjectTypeDB::bind_method(_MD("has_sequence_connection","func","from_node","from_output","to_node"),&VisualScript::has_sequence_connection);
-
- ObjectTypeDB::bind_method(_MD("data_connect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_connect);
- ObjectTypeDB::bind_method(_MD("data_disconnect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_disconnect);
- ObjectTypeDB::bind_method(_MD("has_data_connection","func","from_node","from_port","to_node","to_port"),&VisualScript::has_data_connection);
-
- ObjectTypeDB::bind_method(_MD("add_variable","name","default_value","export"),&VisualScript::add_variable,DEFVAL(Variant()),DEFVAL(false));
- ObjectTypeDB::bind_method(_MD("has_variable","name"),&VisualScript::has_variable);
- ObjectTypeDB::bind_method(_MD("remove_variable","name"),&VisualScript::remove_variable);
- ObjectTypeDB::bind_method(_MD("set_variable_default_value","name","value"),&VisualScript::set_variable_default_value);
- ObjectTypeDB::bind_method(_MD("get_variable_default_value","name"),&VisualScript::get_variable_default_value);
- ObjectTypeDB::bind_method(_MD("set_variable_info","name","value"),&VisualScript::_set_variable_info);
- ObjectTypeDB::bind_method(_MD("get_variable_info","name"),&VisualScript::_get_variable_info);
- ObjectTypeDB::bind_method(_MD("set_variable_export","name","enable"),&VisualScript::set_variable_export);
- ObjectTypeDB::bind_method(_MD("get_variable_export","name"),&VisualScript::get_variable_export);
- ObjectTypeDB::bind_method(_MD("rename_variable","name","new_name"),&VisualScript::rename_variable);
-
- ObjectTypeDB::bind_method(_MD("add_custom_signal","name"),&VisualScript::add_custom_signal);
- ObjectTypeDB::bind_method(_MD("has_custom_signal","name"),&VisualScript::has_custom_signal);
- ObjectTypeDB::bind_method(_MD("custom_signal_add_argument","name","type","argname","index"),&VisualScript::custom_signal_add_argument,DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("custom_signal_set_argument_type","name","argidx","type"),&VisualScript::custom_signal_set_argument_type);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_type","name","argidx"),&VisualScript::custom_signal_get_argument_type);
- ObjectTypeDB::bind_method(_MD("custom_signal_set_argument_name","name","argidx","argname"),&VisualScript::custom_signal_set_argument_name);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_name","name","argidx"),&VisualScript::custom_signal_get_argument_name);
- ObjectTypeDB::bind_method(_MD("custom_signal_remove_argument","argidx"),&VisualScript::custom_signal_remove_argument);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_count","name"),&VisualScript::custom_signal_get_argument_count);
- ObjectTypeDB::bind_method(_MD("custom_signal_swap_argument","name","argidx","withidx"),&VisualScript::custom_signal_swap_argument);
- ObjectTypeDB::bind_method(_MD("remove_custom_signal","name"),&VisualScript::remove_custom_signal);
- ObjectTypeDB::bind_method(_MD("rename_custom_signal","name","new_name"),&VisualScript::rename_custom_signal);
-
- //ObjectTypeDB::bind_method(_MD("set_variable_info","name","info"),&VScript::set_variable_info);
- //ObjectTypeDB::bind_method(_MD("get_variable_info","name"),&VScript::set_variable_info);
-
- ObjectTypeDB::bind_method(_MD("set_instance_base_type","type"),&VisualScript::set_instance_base_type);
-
- ObjectTypeDB::bind_method(_MD("_set_data","data"),&VisualScript::_set_data);
- ObjectTypeDB::bind_method(_MD("_get_data"),&VisualScript::_get_data);
+ ClassDB::bind_method(_MD("_node_ports_changed"),&VisualScript::_node_ports_changed);
+
+ ClassDB::bind_method(_MD("add_function","name"),&VisualScript::add_function);
+ ClassDB::bind_method(_MD("has_function","name"),&VisualScript::has_function);
+ ClassDB::bind_method(_MD("remove_function","name"),&VisualScript::remove_function);
+ ClassDB::bind_method(_MD("rename_function","name","new_name"),&VisualScript::rename_function);
+ ClassDB::bind_method(_MD("set_function_scroll","ofs"),&VisualScript::set_function_scroll);
+ ClassDB::bind_method(_MD("get_function_scroll"),&VisualScript::get_function_scroll);
+
+ ClassDB::bind_method(_MD("add_node","func","id","node","pos"),&VisualScript::add_node,DEFVAL(Point2()));
+ ClassDB::bind_method(_MD("remove_node","func","id"),&VisualScript::remove_node);
+ ClassDB::bind_method(_MD("get_function_node_id","name"),&VisualScript::get_function_node_id);
+
+ ClassDB::bind_method(_MD("get_node","func","id"),&VisualScript::get_node);
+ ClassDB::bind_method(_MD("has_node","func","id"),&VisualScript::has_node);
+ ClassDB::bind_method(_MD("set_node_pos","func","id","pos"),&VisualScript::set_node_pos);
+ ClassDB::bind_method(_MD("get_node_pos","func","id"),&VisualScript::get_node_pos);
+
+ ClassDB::bind_method(_MD("sequence_connect","func","from_node","from_output","to_node"),&VisualScript::sequence_connect);
+ ClassDB::bind_method(_MD("sequence_disconnect","func","from_node","from_output","to_node"),&VisualScript::sequence_disconnect);
+ ClassDB::bind_method(_MD("has_sequence_connection","func","from_node","from_output","to_node"),&VisualScript::has_sequence_connection);
+
+ ClassDB::bind_method(_MD("data_connect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_connect);
+ ClassDB::bind_method(_MD("data_disconnect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_disconnect);
+ ClassDB::bind_method(_MD("has_data_connection","func","from_node","from_port","to_node","to_port"),&VisualScript::has_data_connection);
+
+ ClassDB::bind_method(_MD("add_variable","name","default_value","export"),&VisualScript::add_variable,DEFVAL(Variant()),DEFVAL(false));
+ ClassDB::bind_method(_MD("has_variable","name"),&VisualScript::has_variable);
+ ClassDB::bind_method(_MD("remove_variable","name"),&VisualScript::remove_variable);
+ ClassDB::bind_method(_MD("set_variable_default_value","name","value"),&VisualScript::set_variable_default_value);
+ ClassDB::bind_method(_MD("get_variable_default_value","name"),&VisualScript::get_variable_default_value);
+ ClassDB::bind_method(_MD("set_variable_info","name","value"),&VisualScript::_set_variable_info);
+ ClassDB::bind_method(_MD("get_variable_info","name"),&VisualScript::_get_variable_info);
+ ClassDB::bind_method(_MD("set_variable_export","name","enable"),&VisualScript::set_variable_export);
+ ClassDB::bind_method(_MD("get_variable_export","name"),&VisualScript::get_variable_export);
+ ClassDB::bind_method(_MD("rename_variable","name","new_name"),&VisualScript::rename_variable);
+
+ ClassDB::bind_method(_MD("add_custom_signal","name"),&VisualScript::add_custom_signal);
+ ClassDB::bind_method(_MD("has_custom_signal","name"),&VisualScript::has_custom_signal);
+ ClassDB::bind_method(_MD("custom_signal_add_argument","name","type","argname","index"),&VisualScript::custom_signal_add_argument,DEFVAL(-1));
+ ClassDB::bind_method(_MD("custom_signal_set_argument_type","name","argidx","type"),&VisualScript::custom_signal_set_argument_type);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_type","name","argidx"),&VisualScript::custom_signal_get_argument_type);
+ ClassDB::bind_method(_MD("custom_signal_set_argument_name","name","argidx","argname"),&VisualScript::custom_signal_set_argument_name);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_name","name","argidx"),&VisualScript::custom_signal_get_argument_name);
+ ClassDB::bind_method(_MD("custom_signal_remove_argument","argidx"),&VisualScript::custom_signal_remove_argument);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_count","name"),&VisualScript::custom_signal_get_argument_count);
+ ClassDB::bind_method(_MD("custom_signal_swap_argument","name","argidx","withidx"),&VisualScript::custom_signal_swap_argument);
+ ClassDB::bind_method(_MD("remove_custom_signal","name"),&VisualScript::remove_custom_signal);
+ ClassDB::bind_method(_MD("rename_custom_signal","name","new_name"),&VisualScript::rename_custom_signal);
+
+ //ClassDB::bind_method(_MD("set_variable_info","name","info"),&VScript::set_variable_info);
+ //ClassDB::bind_method(_MD("get_variable_info","name"),&VScript::set_variable_info);
+
+ ClassDB::bind_method(_MD("set_instance_base_type","type"),&VisualScript::set_instance_base_type);
+
+ ClassDB::bind_method(_MD("_set_data","data"),&VisualScript::_set_data);
+ ClassDB::bind_method(_MD("_get_data"),&VisualScript::_get_data);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY,"data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_data"),_SCS("_get_data"));
@@ -1573,7 +1573,7 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
p_pass++; //increment pass
current_node_id=node->get_id();
- VSDEBUG("==========AT NODE: "+itos(current_node_id)+" base: "+node->get_base_node()->get_type());
+ VSDEBUG("==========AT NODE: "+itos(current_node_id)+" base: "+node->get_base_node()->get_class_name());
VSDEBUG("AT STACK POS: "+itos(flow_stack_pos));
@@ -2436,10 +2436,10 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
void VisualScriptFunctionState::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("connect_to_signal","obj","signals","args"),&VisualScriptFunctionState::connect_to_signal);
- ObjectTypeDB::bind_method(_MD("resume:Array","args"),&VisualScriptFunctionState::resume,DEFVAL(Variant()));
- ObjectTypeDB::bind_method(_MD("is_valid"),&VisualScriptFunctionState::is_valid);
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback"));
+ ClassDB::bind_method(_MD("connect_to_signal","obj","signals","args"),&VisualScriptFunctionState::connect_to_signal);
+ ClassDB::bind_method(_MD("resume:Array","args"),&VisualScriptFunctionState::resume,DEFVAL(Variant()));
+ ClassDB::bind_method(_MD("is_valid"),&VisualScriptFunctionState::is_valid);
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback"));
}
VisualScriptFunctionState::VisualScriptFunctionState() {
@@ -2525,7 +2525,7 @@ int VisualScriptLanguage::find_function(const String& p_function,const String& p
return -1;
}
-String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const {
+String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const {
return String();
}
@@ -2631,7 +2631,7 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level,List<String>
const StringName *f = _call_stack[l].function;
ERR_FAIL_COND(!_call_stack[l].instance->functions.has(*f));
-// VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f];
+ //VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f];
VisualScriptNodeInstance *node =_call_stack[l].instance->instances[*_call_stack[l].current_id];
ERR_FAIL_COND(!node);
@@ -2815,7 +2815,7 @@ VisualScriptLanguage::VisualScriptLanguage() {
_debug_parse_err_node=-1;
_debug_parse_err_file="";
_debug_call_stack_pos=0;
- int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024);
+ int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024);
if (ScriptDebugger::get_singleton()) {
//debugging enabled!
_debug_max_call_stack = dmcs;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 63b018b0c2..acd1c3a670 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -9,7 +9,7 @@ class VisualScriptNodeInstance;
class VisualScript;
class VisualScriptNode : public Resource {
- OBJ_TYPE(VisualScriptNode,Resource)
+ GDCLASS(VisualScriptNode,Resource)
friend class VisualScript;
@@ -24,8 +24,6 @@ friend class VisualScript;
void validate_input_default_values();
protected:
- virtual bool _use_builtin_script() const { return false; }
-
void _notification(int p_what);
void ports_changed_notify();
static void _bind_methods();
@@ -64,7 +62,7 @@ public:
Variant::Type type;
InputEvent::Type ev_type;
- StringName obj_type;
+ StringName GDCLASS;
Ref<Script> script;
TypeGuess() { type=Variant::NIL; ev_type=InputEvent::NONE; }
@@ -143,7 +141,7 @@ public:
class VisualScript : public Script {
- OBJ_TYPE( VisualScript, Script )
+ GDCLASS( VisualScript, Script )
RES_BASE_EXTENSION("vs");
@@ -437,7 +435,7 @@ public:
class VisualScriptFunctionState : public Reference {
- OBJ_TYPE(VisualScriptFunctionState,Reference);
+ GDCLASS(VisualScriptFunctionState,Reference);
friend class VisualScriptInstance;
ObjectID instance_id;
@@ -562,7 +560,7 @@ public:
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual int find_function(const String& p_function,const String& p_code) const;
- virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const;
+ virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const;
virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const;
virtual void add_global_constant(const StringName& p_variable,const Variant& p_value);
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 2bfb6bc9ea..27242384ac 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -64,6 +64,7 @@ const char* VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"str2var",
"var2bytes",
"bytes2var",
+ "color_named",
};
VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::find_function(const String& p_string) {
@@ -164,6 +165,7 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case LOGIC_MIN:
case FUNC_FUNCREF:
case TYPE_CONVERT:
+ case COLORN:
return 2;
case MATH_LERP:
case MATH_DECTIME:
@@ -368,13 +370,11 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
return PropertyInfo(Variant::INT,"ascii");
-
} break;
case TEXT_STR: {
return PropertyInfo(Variant::NIL,"value");
-
} break;
case TEXT_PRINT: {
@@ -404,7 +404,15 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
} break;
case BYTES_TO_VAR: {
- return PropertyInfo(Variant::RAW_ARRAY,"bytes");
+ return PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes");
+ } break;
+ case COLORN: {
+
+ if (p_idx==0)
+ return PropertyInfo(Variant::STRING,"name");
+ else
+ return PropertyInfo(Variant::REAL,"alpha");
+
} break;
case FUNC_MAX:{}
}
@@ -548,13 +556,16 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
} break;
case VAR_TO_BYTES: {
- t=Variant::RAW_ARRAY;
+ t=Variant::POOL_BYTE_ARRAY;
} break;
case BYTES_TO_VAR: {
} break;
+ case COLORN: {
+ t=Variant::COLOR;
+ } break;
case FUNC_MAX:{}
}
@@ -981,7 +992,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::TYPE_EXISTS: {
- *r_return = ObjectTypeDB::type_exists(*p_inputs[0]);
+ *r_return = ClassDB::class_exists(*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::TEXT_CHAR: {
@@ -1058,7 +1069,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
- ByteArray barr;
+ PoolByteArray barr;
int len;
Error err = encode_variant(*p_inputs[0],NULL,len);
if (err) {
@@ -1071,7 +1082,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
barr.resize(len);
{
- ByteArray::Write w = barr.write();
+ PoolByteArray::Write w = barr.write();
encode_variant(*p_inputs[0],w.ptr(),len);
}
@@ -1079,24 +1090,24 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
} break;
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
- if (p_inputs[0]->get_type()!=Variant::RAW_ARRAY) {
+ if (p_inputs[0]->get_type()!=Variant::POOL_BYTE_ARRAY) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
- ByteArray varr=*p_inputs[0];
+ PoolByteArray varr=*p_inputs[0];
Variant ret;
{
- ByteArray::Read r=varr.read();
+ PoolByteArray::Read r=varr.read();
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
if (err!=OK) {
r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
@@ -1105,6 +1116,16 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
*r_return=ret;
} break;
+ case VisualScriptBuiltinFunc::COLORN: {
+
+ VALIDATE_ARG_NUM(1);
+
+ Color color = Color::named(*p_inputs[0]);
+ color.a=*p_inputs[1];
+
+ *r_return=String(color);
+
+ } break;
default: {}
}
@@ -1145,8 +1166,8 @@ VisualScriptNodeInstance* VisualScriptBuiltinFunc::instance(VisualScriptInstance
void VisualScriptBuiltinFunc::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_func","which"),&VisualScriptBuiltinFunc::set_func);
- ObjectTypeDB::bind_method(_MD("get_func"),&VisualScriptBuiltinFunc::get_func);
+ ClassDB::bind_method(_MD("set_func","which"),&VisualScriptBuiltinFunc::set_func);
+ ClassDB::bind_method(_MD("get_func"),&VisualScriptBuiltinFunc::get_func);
String cc;
@@ -1238,5 +1259,6 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/str2var",create_builtin_func_node<VisualScriptBuiltinFunc::STR_TO_VAR>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/var2bytes",create_builtin_func_node<VisualScriptBuiltinFunc::VAR_TO_BYTES>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/bytes2var",create_builtin_func_node<VisualScriptBuiltinFunc::BYTES_TO_VAR>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/color_named",create_builtin_func_node<VisualScriptBuiltinFunc::COLORN>);
}
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 8b0d70c1ea..a285517c7e 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -6,7 +6,7 @@
class VisualScriptBuiltinFunc : public VisualScriptNode {
- OBJ_TYPE(VisualScriptBuiltinFunc,VisualScriptNode)
+ GDCLASS(VisualScriptBuiltinFunc,VisualScriptNode)
public:
enum BuiltinFunc {
@@ -66,6 +66,7 @@ public:
STR_TO_VAR,
VAR_TO_BYTES,
BYTES_TO_VAR,
+ COLORN,
FUNC_MAX
};
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 02d3c453c4..37ee225aeb 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -11,7 +11,7 @@
#ifdef TOOLS_ENABLED
class VisualScriptEditorSignalEdit : public Object {
- OBJ_TYPE(VisualScriptEditorSignalEdit,Object)
+ GDCLASS(VisualScriptEditorSignalEdit,Object)
StringName sig;
public:
@@ -22,7 +22,7 @@ public:
protected:
static void _bind_methods() {
- ObjectTypeDB::bind_method("_sig_changed",&VisualScriptEditorSignalEdit::_sig_changed);
+ ClassDB::bind_method("_sig_changed",&VisualScriptEditorSignalEdit::_sig_changed);
}
void _sig_changed() {
@@ -160,7 +160,7 @@ public:
class VisualScriptEditorVariableEdit : public Object {
- OBJ_TYPE(VisualScriptEditorVariableEdit,Object)
+ GDCLASS(VisualScriptEditorVariableEdit,Object)
StringName var;
public:
@@ -171,8 +171,8 @@ public:
protected:
static void _bind_methods() {
- ObjectTypeDB::bind_method("_var_changed",&VisualScriptEditorVariableEdit::_var_changed);
- ObjectTypeDB::bind_method("_var_value_changed",&VisualScriptEditorVariableEdit::_var_value_changed);
+ ClassDB::bind_method("_var_changed",&VisualScriptEditorVariableEdit::_var_changed);
+ ClassDB::bind_method("_var_value_changed",&VisualScriptEditorVariableEdit::_var_value_changed);
}
void _var_changed() {
@@ -326,11 +326,11 @@ static Color _color_from_type(Variant::Type p_type) {
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::TRANSFORM2D: 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::RECT3: color = Color::html("ee7991"); break;
+ case Variant::BASIS: color = Color::html("e3ec69"); break;
case Variant::TRANSFORM: color = Color::html("f6a86e"); break;
case Variant::COLOR: color = Color::html("9dff70"); break;
@@ -342,13 +342,13 @@ static Color _color_from_type(Variant::Type p_type) {
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;
+ case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break;
+ case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break;
+ case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break;
+ case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break;
+ case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
+ case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
+ case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break;
default:
color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7);
@@ -438,11 +438,11 @@ 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("MiniMatrix32","EditorIcons"),
+ Control::get_icon("MiniTransform2D","EditorIcons"),
Control::get_icon("MiniPlane","EditorIcons"),
Control::get_icon("MiniQuat","EditorIcons"),
Control::get_icon("MiniAabb","EditorIcons"),
- Control::get_icon("MiniMatrix3","EditorIcons"),
+ Control::get_icon("MiniBasis","EditorIcons"),
Control::get_icon("MiniTransform","EditorIcons"),
Control::get_icon("MiniColor","EditorIcons"),
Control::get_icon("MiniImage","EditorIcons"),
@@ -485,8 +485,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
- if (EditorSettings::get_singleton()->has("visual_script_editor/color_"+node->get_category())) {
- gnode->set_modulate(EditorSettings::get_singleton()->get("visual_script_editor/color_"+node->get_category()));
+ if (EditorSettings::get_singleton()->has("editors/visual_script/color_"+node->get_category())) {
+ gnode->set_modulate(EditorSettings::get_singleton()->get("editors/visual_script/color_"+node->get_category()));
}
@@ -590,9 +590,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
t=type_icons[left_type];
}
if (t.is_valid()) {
- TextureFrame *tf = memnew(TextureFrame);
+ TextureRect *tf = memnew(TextureRect);
tf->set_texture(t);
- tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc->add_child(tf);
}
@@ -657,9 +657,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
t=type_icons[right_type];
}
if (t.is_valid()) {
- TextureFrame *tf = memnew(TextureFrame);
+ TextureRect *tf = memnew(TextureRect);
tf->set_texture(t);
- tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc->add_child(tf);
}
@@ -822,7 +822,7 @@ void VisualScriptEditor::_member_selected() {
selected=ti->get_metadata(0);
-// print_line("selected: "+String(selected));
+ //print_line("selected: "+String(selected));
if (ti->get_parent()==members->get_root()->get_children()) {
@@ -990,7 +990,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
virtuals_in_menu.clear();
List<MethodInfo> mi;
- ObjectTypeDB::get_method_list(script->get_instance_base_type(),&mi);
+ ClassDB::get_method_list(script->get_instance_base_type(),&mi);
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
MethodInfo mi=E->get();
if (mi.flags&METHOD_FLAG_VIRTUAL) {
@@ -1136,9 +1136,11 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
undo_redo->add_undo_method(script.ptr(),"data_connect",name,E->get().from_node,E->get().from_port,E->get().to_node,E->get().to_port);
}
- //for(int i=0;i<script->function_get_argument_count(name);i++) {
- //// undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i));
- //}
+ /*
+ for(int i=0;i<script->function_get_argument_count(name);i++) {
+ undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i));
+ }
+ */
undo_redo->add_do_method(this,"_update_members");
undo_redo->add_undo_method(this,"_update_members");
undo_redo->add_do_method(this,"_update_graph");
@@ -1776,7 +1778,7 @@ 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") {
@@ -1917,7 +1919,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
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());
+ call->set_base_type(node->get_class());
n=call;
method_select->select_method_from_instance(node);
@@ -1986,7 +1988,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Ref<VisualScriptPropertySet> pset;
pset.instance();
pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- pset->set_base_type(obj->get_type());
+ pset->set_base_type(obj->get_class());
/*if (use_value) {
pset->set_use_builtin_value(true);
pset->set_builtin_value(d["value"]);
@@ -1997,7 +1999,7 @@ 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_INSTANCE);
- pget->set_base_type(obj->get_type());
+ pget->set_base_type(obj->get_class());
vnode=pget;
@@ -2171,7 +2173,7 @@ String VisualScriptEditor::get_name(){
} else if (script->get_name()!="")
name=script->get_name();
else
- name=script->get_type()+"("+itos(script->get_instance_ID())+")";
+ name=script->get_class()+"("+itos(script->get_instance_ID())+")";
return name;
@@ -2321,7 +2323,7 @@ bool VisualScriptEditor::goto_method(const String& p_method){
return true;
}
-void VisualScriptEditor::add_callback(const String& p_function,StringArray p_args){
+void VisualScriptEditor::add_callback(const String& p_function,PoolStringArray p_args){
if (script->has_function(p_function)) {
edited_func=p_function;
@@ -2704,7 +2706,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node,i
if (obj) {
g.type=Variant::OBJECT;
- g.obj_type=obj->get_type();
+ g.GDCLASS=obj->get_class();
g.script=obj->get_script();
}
}
@@ -2745,8 +2747,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -2780,8 +2782,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -2811,8 +2813,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -3082,7 +3084,7 @@ 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;
+ } break;
case EDIT_COPY_NODES:
case EDIT_CUT_NODES: {
@@ -3232,55 +3234,55 @@ void VisualScriptEditor::_menu_option(int p_what) {
void VisualScriptEditor::_bind_methods() {
- ObjectTypeDB::bind_method("_member_button",&VisualScriptEditor::_member_button);
- ObjectTypeDB::bind_method("_member_edited",&VisualScriptEditor::_member_edited);
- ObjectTypeDB::bind_method("_member_selected",&VisualScriptEditor::_member_selected);
- ObjectTypeDB::bind_method("_update_members",&VisualScriptEditor::_update_members);
- ObjectTypeDB::bind_method("_change_base_type",&VisualScriptEditor::_change_base_type);
- ObjectTypeDB::bind_method("_change_base_type_callback",&VisualScriptEditor::_change_base_type_callback);
- ObjectTypeDB::bind_method("_override_pressed",&VisualScriptEditor::_override_pressed);
- ObjectTypeDB::bind_method("_node_selected",&VisualScriptEditor::_node_selected);
- ObjectTypeDB::bind_method("_node_moved",&VisualScriptEditor::_node_moved);
- ObjectTypeDB::bind_method("_move_node",&VisualScriptEditor::_move_node);
- ObjectTypeDB::bind_method("_begin_node_move",&VisualScriptEditor::_begin_node_move);
- ObjectTypeDB::bind_method("_end_node_move",&VisualScriptEditor::_end_node_move);
- ObjectTypeDB::bind_method("_remove_node",&VisualScriptEditor::_remove_node);
- ObjectTypeDB::bind_method("_update_graph",&VisualScriptEditor::_update_graph,DEFVAL(-1));
- ObjectTypeDB::bind_method("_node_ports_changed",&VisualScriptEditor::_node_ports_changed);
- ObjectTypeDB::bind_method("_available_node_doubleclicked",&VisualScriptEditor::_available_node_doubleclicked);
- ObjectTypeDB::bind_method("_default_value_edited",&VisualScriptEditor::_default_value_edited);
- ObjectTypeDB::bind_method("_default_value_changed",&VisualScriptEditor::_default_value_changed);
- 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);
- ObjectTypeDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu);
- ObjectTypeDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget);
- ObjectTypeDB::bind_method("_expression_text_changed",&VisualScriptEditor::_expression_text_changed);
+ ClassDB::bind_method("_member_button",&VisualScriptEditor::_member_button);
+ ClassDB::bind_method("_member_edited",&VisualScriptEditor::_member_edited);
+ ClassDB::bind_method("_member_selected",&VisualScriptEditor::_member_selected);
+ ClassDB::bind_method("_update_members",&VisualScriptEditor::_update_members);
+ ClassDB::bind_method("_change_base_type",&VisualScriptEditor::_change_base_type);
+ ClassDB::bind_method("_change_base_type_callback",&VisualScriptEditor::_change_base_type_callback);
+ ClassDB::bind_method("_override_pressed",&VisualScriptEditor::_override_pressed);
+ ClassDB::bind_method("_node_selected",&VisualScriptEditor::_node_selected);
+ ClassDB::bind_method("_node_moved",&VisualScriptEditor::_node_moved);
+ ClassDB::bind_method("_move_node",&VisualScriptEditor::_move_node);
+ ClassDB::bind_method("_begin_node_move",&VisualScriptEditor::_begin_node_move);
+ ClassDB::bind_method("_end_node_move",&VisualScriptEditor::_end_node_move);
+ ClassDB::bind_method("_remove_node",&VisualScriptEditor::_remove_node);
+ ClassDB::bind_method("_update_graph",&VisualScriptEditor::_update_graph,DEFVAL(-1));
+ ClassDB::bind_method("_node_ports_changed",&VisualScriptEditor::_node_ports_changed);
+ ClassDB::bind_method("_available_node_doubleclicked",&VisualScriptEditor::_available_node_doubleclicked);
+ ClassDB::bind_method("_default_value_edited",&VisualScriptEditor::_default_value_edited);
+ ClassDB::bind_method("_default_value_changed",&VisualScriptEditor::_default_value_changed);
+ ClassDB::bind_method("_menu_option",&VisualScriptEditor::_menu_option);
+ ClassDB::bind_method("_graph_ofs_changed",&VisualScriptEditor::_graph_ofs_changed);
+ ClassDB::bind_method("_center_on_node",&VisualScriptEditor::_center_on_node);
+ ClassDB::bind_method("_comment_node_resized",&VisualScriptEditor::_comment_node_resized);
+ ClassDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed);
+ ClassDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu);
+ ClassDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget);
+ ClassDB::bind_method("_expression_text_changed",&VisualScriptEditor::_expression_text_changed);
- ObjectTypeDB::bind_method("get_drag_data_fw",&VisualScriptEditor::get_drag_data_fw);
- ObjectTypeDB::bind_method("can_drop_data_fw",&VisualScriptEditor::can_drop_data_fw);
- ObjectTypeDB::bind_method("drop_data_fw",&VisualScriptEditor::drop_data_fw);
+ ClassDB::bind_method("get_drag_data_fw",&VisualScriptEditor::get_drag_data_fw);
+ ClassDB::bind_method("can_drop_data_fw",&VisualScriptEditor::can_drop_data_fw);
+ ClassDB::bind_method("drop_data_fw",&VisualScriptEditor::drop_data_fw);
- ObjectTypeDB::bind_method("_input",&VisualScriptEditor::_input);
- ObjectTypeDB::bind_method("_on_nodes_delete",&VisualScriptEditor::_on_nodes_delete);
- ObjectTypeDB::bind_method("_on_nodes_duplicate",&VisualScriptEditor::_on_nodes_duplicate);
+ ClassDB::bind_method("_input",&VisualScriptEditor::_input);
+ ClassDB::bind_method("_on_nodes_delete",&VisualScriptEditor::_on_nodes_delete);
+ ClassDB::bind_method("_on_nodes_duplicate",&VisualScriptEditor::_on_nodes_duplicate);
- ObjectTypeDB::bind_method("_hide_timer",&VisualScriptEditor::_hide_timer);
+ ClassDB::bind_method("_hide_timer",&VisualScriptEditor::_hide_timer);
- 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);
+ ClassDB::bind_method("_graph_connected",&VisualScriptEditor::_graph_connected);
+ ClassDB::bind_method("_graph_disconnected",&VisualScriptEditor::_graph_disconnected);
+ ClassDB::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);
+ ClassDB::bind_method("_update_graph_connections",&VisualScriptEditor::_update_graph_connections);
+ ClassDB::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);
+ ClassDB::bind_method("_selected_method",&VisualScriptEditor::_selected_method);
+ ClassDB::bind_method("_draw_color_over_button",&VisualScriptEditor::_draw_color_over_button);
@@ -3306,7 +3308,7 @@ VisualScriptEditor::VisualScriptEditor() {
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");
+ edit_menu->get_popup()->connect("id_pressed",this,"_menu_option");
main_hsplit = memnew( HSplitContainer );
add_child(main_hsplit);
@@ -3346,8 +3348,8 @@ VisualScriptEditor::VisualScriptEditor() {
node_filter->connect("text_changed",this,"_node_filter_changed");
hbc_nodes->add_child(node_filter);
node_filter->set_h_size_flags(SIZE_EXPAND_FILL);
- node_filter_icon = memnew( TextureFrame );
- node_filter_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ node_filter_icon = memnew( TextureRect );
+ node_filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc_nodes->add_child(node_filter_icon);
vbc_nodes->add_child(hbc_nodes);
@@ -3422,7 +3424,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_signal_edit = memnew( PropertyEditor );
edit_signal_edit->hide_top_label();
edit_signal_dialog->add_child(edit_signal_edit);
- edit_signal_dialog->set_child_rect(edit_signal_edit);
+
edit_signal_edit->edit(signal_editor);
edit_variable_dialog = memnew( AcceptDialog );
@@ -3434,7 +3436,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_variable_edit = memnew( PropertyEditor );
edit_variable_edit->hide_top_label();
edit_variable_dialog->add_child(edit_variable_edit);
- edit_variable_dialog->set_child_rect(edit_variable_edit);
+
edit_variable_edit->edit(variable_editor);
select_base_type=memnew(CreateDialog);
@@ -3446,7 +3448,7 @@ VisualScriptEditor::VisualScriptEditor() {
undo_redo = EditorNode::get_singleton()->get_undo_redo();
new_function_menu = memnew( PopupMenu );
- new_function_menu->connect("item_pressed",this,"_override_pressed");
+ new_function_menu->connect("id_pressed",this,"_override_pressed");
add_child(new_function_menu);
updating_members=false;
@@ -3468,7 +3470,7 @@ VisualScriptEditor::VisualScriptEditor() {
port_action_popup = memnew( PopupMenu );
add_child(port_action_popup);
- port_action_popup->connect("item_pressed",this,"_port_action_menu");
+ port_action_popup->connect("id_pressed",this,"_port_action_menu");
}
@@ -3500,12 +3502,12 @@ void VisualScriptEditor::free_clipboard() {
static void register_editor_callback() {
ScriptEditor::register_create_script_editor_function(create_editor);
- EditorSettings::get_singleton()->set("visual_script_editor/color_functions",Color(1,0.9,0.9));
- EditorSettings::get_singleton()->set("visual_script_editor/color_data",Color(0.9,1.0,0.9));
- EditorSettings::get_singleton()->set("visual_script_editor/color_operators",Color(0.9,0.9,1.0));
- EditorSettings::get_singleton()->set("visual_script_editor/color_flow_control",Color(1.0,1.0,0.8));
- EditorSettings::get_singleton()->set("visual_script_editor/color_custom",Color(0.8,1.0,1.0));
- EditorSettings::get_singleton()->set("visual_script_editor/color_constants",Color(1.0,0.8,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_functions",Color(1,0.9,0.9));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_data",Color(0.9,1.0,0.9));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_operators",Color(0.9,0.9,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_flow_control",Color(1.0,1.0,0.8));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_custom",Color(0.8,1.0,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_constants",Color(1.0,0.8,1.0));
ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"));
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 483ae1644c..1dc62b3e69 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -15,7 +15,7 @@ class VisualScriptEditorVariableEdit;
class VisualScriptEditor : public ScriptEditorBase {
- OBJ_TYPE(VisualScriptEditor,ScriptEditorBase)
+ GDCLASS(VisualScriptEditor,ScriptEditorBase)
enum {
TYPE_SEQUENCE=1000,
@@ -58,7 +58,7 @@ class VisualScriptEditor : public ScriptEditorBase {
GraphEdit *graph;
LineEdit *node_filter;
- TextureFrame *node_filter_icon;
+ TextureRect *node_filter_icon;
VisualScriptEditorSignalEdit *signal_editor;
@@ -225,7 +225,7 @@ public:
virtual void reload(bool p_soft);
virtual void get_breakpoints(List<int> *p_breakpoints);
virtual bool goto_method(const String& p_method);
- virtual void add_callback(const String& p_function,StringArray p_args);
+ virtual void add_callback(const String& p_function,PoolStringArray p_args);
virtual void update_settings();
virtual void set_debugger_active(bool p_active);
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index 4edae133c7..a67656a4b1 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -6,7 +6,7 @@
class VisualScriptExpression : public VisualScriptNode {
- OBJ_TYPE(VisualScriptExpression,VisualScriptNode)
+ GDCLASS(VisualScriptExpression,VisualScriptNode)
friend class VisualScriptNodeInstanceExpression;
struct Input {
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 97338da187..0e526f8a42 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -81,10 +81,10 @@ bool VisualScriptReturn::is_return_value_enabled() const {
void VisualScriptReturn::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_return_type","type"),&VisualScriptReturn::set_return_type);
- ObjectTypeDB::bind_method(_MD("get_return_type"),&VisualScriptReturn::get_return_type);
- 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);
+ ClassDB::bind_method(_MD("set_return_type","type"),&VisualScriptReturn::set_return_type);
+ ClassDB::bind_method(_MD("get_return_type"),&VisualScriptReturn::get_return_type);
+ ClassDB::bind_method(_MD("set_enable_return_value","enable"),&VisualScriptReturn::set_enable_return_value);
+ ClassDB::bind_method(_MD("is_return_value_enabled"),&VisualScriptReturn::is_return_value_enabled);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -544,8 +544,8 @@ int VisualScriptSequence::get_steps() const {
void VisualScriptSequence::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_steps","steps"),&VisualScriptSequence::set_steps);
- ObjectTypeDB::bind_method(_MD("get_steps"),&VisualScriptSequence::get_steps);
+ ClassDB::bind_method(_MD("set_steps","steps"),&VisualScriptSequence::set_steps);
+ ClassDB::bind_method(_MD("get_steps"),&VisualScriptSequence::get_steps);
ADD_PROPERTY(PropertyInfo(Variant::INT,"steps",PROPERTY_HINT_RANGE,"1,64,1"),_SCS("set_steps"),_SCS("get_steps"));
@@ -871,9 +871,9 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = filters[p_port].joy_motion;
+ InputEventJoypadMotion jm = filters[p_port].joy_motion;
text="JoyMotion Axis "+itos(jm.axis>>1);
if (jm.axis&1)
@@ -882,8 +882,8 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
text+=" < "+rtos(-jm.axis_value);
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = filters[p_port].joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = filters[p_port].joy_button;
text="JoyButton "+itos(jb.button_index);
if (jb.pressed)
@@ -908,7 +908,7 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
text="No Action";
@@ -985,13 +985,13 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
if (what=="type") {
filters[idx]=InputEvent();
filters[idx].type=InputEvent::Type(int(p_value));
- if (filters[idx].type==InputEvent::JOYSTICK_MOTION) {
+ if (filters[idx].type==InputEvent::JOYPAD_MOTION) {
filters[idx].joy_motion.axis_value=0.5; //for treshold
} else if (filters[idx].type==InputEvent::KEY) {
filters[idx].key.pressed=true; //put these as true to make it more user friendly
} else if (filters[idx].type==InputEvent::MOUSE_BUTTON) {
filters[idx].mouse_button.pressed=true;
- } else if (filters[idx].type==InputEvent::JOYSTICK_BUTTON) {
+ } else if (filters[idx].type==InputEvent::JOYPAD_BUTTON) {
filters[idx].joy_button.pressed=true;
} else if (filters[idx].type==InputEvent::SCREEN_TOUCH) {
filters[idx].screen_touch.pressed=true;
@@ -1108,7 +1108,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis") {
filters[idx].joy_motion.axis=int(p_value)<<1|filters[idx].joy_motion.axis;
@@ -1124,7 +1124,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
filters[idx].joy_button.button_index=p_value;
@@ -1164,7 +1164,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
if (what=="action_name") {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1326,7 +1326,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis_index") {
r_ret=filters[idx].joy_motion.axis>>1;
@@ -1341,7 +1341,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
r_ret=filters[idx].joy_button.button_index;
@@ -1378,7 +1378,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
if (what=="action_name") {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1417,8 +1417,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
@@ -1489,13 +1489,13 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co
p_list->push_back(PropertyInfo(Variant::BOOL,base+"mod_meta"));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
p_list->push_back(PropertyInfo(Variant::INT,base+"axis_index"));
p_list->push_back(PropertyInfo(Variant::INT,base+"mode",PROPERTY_HINT_ENUM,"Min,Max"));
p_list->push_back(PropertyInfo(Variant::REAL,base+"treshold",PROPERTY_HINT_RANGE,"0,1,0.01"));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
p_list->push_back(PropertyInfo(Variant::INT,base+"button_index"));
p_list->push_back(PropertyInfo(Variant::BOOL,base+"pressed"));
@@ -1517,7 +1517,7 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co
actions="None";
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1632,10 +1632,10 @@ public:
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = ie.joy_motion;
- InputEventJoystickMotion jm2 = event.joy_motion;
+ InputEventJoypadMotion jm = ie.joy_motion;
+ InputEventJoypadMotion jm2 = event.joy_motion;
int axis = jm.axis>>1;
@@ -1656,9 +1656,9 @@ public:
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = ie.joy_button;
- InputEventJoystickButton jb2 = event.joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = ie.joy_button;
+ InputEventJoypadButton jb2 = event.joy_button;
if ( jb.button_index==jb2.button_index &&
jb.pressed == jb2.pressed
@@ -1869,7 +1869,7 @@ public:
return 1; //not found sorry
}
- if (ObjectTypeDB::is_type(obj->get_type_name(),base_type)) {
+ if (ClassDB::is_parent_class(obj->get_class_name(),base_type)) {
*p_outputs[0]=*p_inputs[0]; //copy
return 0;
} else
@@ -1893,11 +1893,11 @@ VisualScriptNodeInstance* VisualScriptTypeCast::instance(VisualScriptInstance* p
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);
+ ClassDB::bind_method(_MD("set_base_type","type"),&VisualScriptTypeCast::set_base_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_base_script","path"),&VisualScriptTypeCast::set_base_script);
+ ClassDB::bind_method(_MD("get_base_script"),&VisualScriptTypeCast::get_base_script);
List<String> script_extensions;
diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h
index e0da84a534..26e981cb1e 100644
--- a/modules/visual_script/visual_script_flow_control.h
+++ b/modules/visual_script/visual_script_flow_control.h
@@ -5,7 +5,7 @@
class VisualScriptReturn : public VisualScriptNode {
- OBJ_TYPE(VisualScriptReturn,VisualScriptNode)
+ GDCLASS(VisualScriptReturn,VisualScriptNode)
Variant::Type type;
@@ -48,7 +48,7 @@ public:
class VisualScriptCondition : public VisualScriptNode {
- OBJ_TYPE(VisualScriptCondition,VisualScriptNode)
+ GDCLASS(VisualScriptCondition,VisualScriptNode)
@@ -84,7 +84,7 @@ public:
class VisualScriptWhile : public VisualScriptNode {
- OBJ_TYPE(VisualScriptWhile,VisualScriptNode)
+ GDCLASS(VisualScriptWhile,VisualScriptNode)
@@ -121,7 +121,7 @@ public:
class VisualScriptIterator : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIterator,VisualScriptNode)
+ GDCLASS(VisualScriptIterator,VisualScriptNode)
@@ -158,7 +158,7 @@ public:
class VisualScriptSequence : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSequence,VisualScriptNode)
+ GDCLASS(VisualScriptSequence,VisualScriptNode)
int steps;
@@ -199,7 +199,7 @@ public:
class VisualScriptSwitch : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSwitch,VisualScriptNode)
+ GDCLASS(VisualScriptSwitch,VisualScriptNode)
struct Case {
Variant::Type type;
@@ -248,7 +248,7 @@ public:
class VisualScriptInputFilter : public VisualScriptNode {
- OBJ_TYPE(VisualScriptInputFilter,VisualScriptNode)
+ GDCLASS(VisualScriptInputFilter,VisualScriptNode)
Vector<InputEvent> filters;
@@ -290,7 +290,7 @@ public:
class VisualScriptTypeCast : public VisualScriptNode {
- OBJ_TYPE(VisualScriptTypeCast,VisualScriptNode)
+ GDCLASS(VisualScriptTypeCast,VisualScriptNode)
StringName base_type;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 5a21cb40e9..a8d78b9298 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -92,7 +92,7 @@ StringName VisualScriptFunctionCall::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -110,7 +110,7 @@ int VisualScriptFunctionCall::get_input_value_port_count() const{
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
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;
}
@@ -129,7 +129,7 @@ int VisualScriptFunctionCall::get_output_value_port_count() const{
} else {
int ret;
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
ret = mb->has_return() ? 1 : 0;
} else
@@ -182,7 +182,7 @@ PropertyInfo VisualScriptFunctionCall::get_input_value_port_info(int p_idx) cons
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
return mb->get_argument_info(p_idx);
}
@@ -220,7 +220,7 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con
PropertyInfo ret;
- /*MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ /*MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
ret = mb->get_argument_info(-1);
@@ -332,9 +332,9 @@ void VisualScriptFunctionCall::set_singleton(const StringName& p_path) {
return;
singleton=p_path;
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
- base_type=obj->get_type();
+ base_type=obj->get_class();
}
_change_notify();
@@ -356,7 +356,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
Node* node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -370,9 +370,9 @@ void VisualScriptFunctionCall::_update_method_cache() {
} else if (call_mode==CALL_MODE_SINGLETON) {
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
- type=obj->get_type();
+ type=obj->get_class();
script=obj->get_script();
}
@@ -396,8 +396,8 @@ void VisualScriptFunctionCall::_update_method_cache() {
}
-// print_line("BASE: "+String(type)+" FUNC: "+String(function));
- MethodBind *mb = ObjectTypeDB::get_method(type,function);
+ //print_line("BASE: "+String(type)+" FUNC: "+String(function));
+ MethodBind *mb = ClassDB::get_method(type,function);
if (mb) {
use_default_args=mb->get_default_argument_count();
method_cache = MethodInfo();
@@ -567,11 +567,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
if (call_mode!=CALL_MODE_SINGLETON) {
property.usage=0;
} else {
- List<Globals::Singleton> names;
- Globals::get_singleton()->get_singletons(&names);
+ List<GlobalConfig::Singleton> names;
+ GlobalConfig::get_singleton()->get_singletons(&names);
property.hint=PROPERTY_HINT_ENUM;
String sl;
- for (List<Globals::Singleton>::Element *E=names.front();E;E=E->next()) {
+ for (List<GlobalConfig::Singleton>::Element *E=names.front();E;E=E->next()) {
if (sl!=String())
sl+=",";
sl+=E->get().name;
@@ -607,7 +607,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
property.hint_string=itos(get_visual_script()->get_instance_ID());
} else if (call_mode==CALL_MODE_SINGLETON) {
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE;
property.hint_string=itos(obj->get_instance_ID());
@@ -661,7 +661,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
mc = Variant::get_method_default_arguments(basic_type,function).size();
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
mc=mb->get_default_argument_count();
@@ -687,38 +687,38 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
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);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptFunctionCall::set_base_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptFunctionCall::set_base_script);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptFunctionCall::set_basic_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_singleton","singleton"),&VisualScriptFunctionCall::set_singleton);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_function","function"),&VisualScriptFunctionCall::set_function);
+ ClassDB::bind_method(_MD("get_function"),&VisualScriptFunctionCall::get_function);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptFunctionCall::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptFunctionCall::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptFunctionCall::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptFunctionCall::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptFunctionCall::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptFunctionCall::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptFunctionCall::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptFunctionCall::get_base_path);
- 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);
+ ClassDB::bind_method(_MD("set_use_default_args","amount"),&VisualScriptFunctionCall::set_use_default_args);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("_set_argument_cache","argument_cache"),&VisualScriptFunctionCall::_set_argument_cache);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_rpc_call_mode","mode"),&VisualScriptFunctionCall::set_rpc_call_mode);
+ ClassDB::bind_method(_MD("get_rpc_call_mode"),&VisualScriptFunctionCall::get_rpc_call_mode);
- ObjectTypeDB::bind_method(_MD("set_validate","enable"),&VisualScriptFunctionCall::set_validate);
- ObjectTypeDB::bind_method(_MD("get_validate"),&VisualScriptFunctionCall::get_validate);
+ ClassDB::bind_method(_MD("set_validate","enable"),&VisualScriptFunctionCall::set_validate);
+ ClassDB::bind_method(_MD("get_validate"),&VisualScriptFunctionCall::get_validate);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -881,7 +881,7 @@ public:
} break;
case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
- Object *object=Globals::get_singleton()->get_singleton_object(singleton);
+ Object *object=GlobalConfig::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)+"'";
@@ -971,8 +971,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
@@ -1034,7 +1034,7 @@ StringName VisualScriptPropertySet::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -1122,7 +1122,7 @@ void VisualScriptPropertySet::_update_base_type() {
Node* node=_get_base_node();
if (node) {
- base_type=node->get_type();
+ base_type=node->get_class();
}
} else if (call_mode==CALL_MODE_SELF) {
@@ -1247,7 +1247,7 @@ void VisualScriptPropertySet::_update_cache() {
node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -1284,7 +1284,7 @@ void VisualScriptPropertySet::_update_cache() {
node->get_property_list(&pinfo);
} else {
- ObjectTypeDB::get_property_list(type,&pinfo);
+ ClassDB::get_property_list(type,&pinfo);
}
if (script.is_valid()) {
@@ -1453,29 +1453,29 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
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);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertySet::set_base_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertySet::set_base_script);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertySet::set_basic_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertySet::_set_type_cache);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertySet::set_event_type);
+ ClassDB::bind_method(_MD("get_event_type"),&VisualScriptPropertySet::get_event_type);
- ObjectTypeDB::bind_method(_MD("set_property","property"),&VisualScriptPropertySet::set_property);
- ObjectTypeDB::bind_method(_MD("get_property"),&VisualScriptPropertySet::get_property);
+ ClassDB::bind_method(_MD("set_property","property"),&VisualScriptPropertySet::set_property);
+ ClassDB::bind_method(_MD("get_property"),&VisualScriptPropertySet::get_property);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertySet::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertySet::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertySet::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertySet::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertySet::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptPropertySet::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertySet::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptPropertySet::get_base_path);
@@ -1554,7 +1554,7 @@ public:
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+object->get_type();
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+object->get_class();
}
} break;
case VisualScriptPropertySet::CALL_MODE_NODE_PATH: {
@@ -1579,7 +1579,7 @@ public:
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+another->get_type();
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+another->get_class();
}
} break;
@@ -1669,7 +1669,7 @@ void VisualScriptPropertyGet::_update_base_type() {
Node* node=_get_base_node();
if (node) {
- base_type=node->get_type();
+ base_type=node->get_class();
}
} else if (call_mode==CALL_MODE_SELF) {
@@ -1724,7 +1724,7 @@ StringName VisualScriptPropertyGet::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -1868,7 +1868,7 @@ void VisualScriptPropertyGet::_update_cache() {
node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -1903,7 +1903,7 @@ void VisualScriptPropertyGet::_update_cache() {
Variant::Type type_ret;
- type_ret=ObjectTypeDB::get_property_type(base_type,property,&valid);
+ type_ret=ClassDB::get_property_type(base_type,property,&valid);
if (valid) {
type_cache=type_ret;
@@ -2117,30 +2117,30 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
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);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertyGet::set_base_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertyGet::set_base_script);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertyGet::set_basic_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertyGet::_set_type_cache);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertyGet::set_event_type);
+ ClassDB::bind_method(_MD("get_event_type"),&VisualScriptPropertyGet::get_event_type);
- ObjectTypeDB::bind_method(_MD("set_property","property"),&VisualScriptPropertyGet::set_property);
- ObjectTypeDB::bind_method(_MD("get_property"),&VisualScriptPropertyGet::get_property);
+ ClassDB::bind_method(_MD("set_property","property"),&VisualScriptPropertyGet::set_property);
+ ClassDB::bind_method(_MD("get_property"),&VisualScriptPropertyGet::get_property);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertyGet::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertyGet::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertyGet::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertyGet::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertyGet::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptPropertyGet::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertyGet::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptPropertyGet::get_base_path);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -2420,8 +2420,8 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo& property) const {
void VisualScriptEmitSignal::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_signal","name"),&VisualScriptEmitSignal::set_signal);
- ObjectTypeDB::bind_method(_MD("get_signal"),&VisualScriptEmitSignal::get_signal);
+ ClassDB::bind_method(_MD("set_signal","name"),&VisualScriptEmitSignal::set_signal);
+ ClassDB::bind_method(_MD("get_signal"),&VisualScriptEmitSignal::get_signal);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"signal/signal"),_SCS("set_signal"),_SCS("get_signal"));
@@ -2508,7 +2508,7 @@ void register_visual_script_func_nodes() {
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/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
VisualScriptLanguage::singleton->add_register_func("functions/emit_signal",create_node_generic<VisualScriptEmitSignal>);
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 43ef276cf4..7d33549e21 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -6,7 +6,7 @@
class VisualScriptFunctionCall : public VisualScriptNode {
- OBJ_TYPE(VisualScriptFunctionCall,VisualScriptNode)
+ GDCLASS(VisualScriptFunctionCall,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -117,7 +117,7 @@ VARIANT_ENUM_CAST(VisualScriptFunctionCall::RPCCallMode );
class VisualScriptPropertySet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPropertySet,VisualScriptNode)
+ GDCLASS(VisualScriptPropertySet,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -208,7 +208,7 @@ VARIANT_ENUM_CAST(VisualScriptPropertySet::CallMode );
class VisualScriptPropertyGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPropertyGet,VisualScriptNode)
+ GDCLASS(VisualScriptPropertyGet,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -299,7 +299,7 @@ VARIANT_ENUM_CAST(VisualScriptPropertyGet::CallMode );
class VisualScriptEmitSignal : public VisualScriptNode {
- OBJ_TYPE(VisualScriptEmitSignal,VisualScriptNode)
+ GDCLASS(VisualScriptEmitSignal,VisualScriptNode)
private:
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 8ffbcc6e62..c9e24fc9dc 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -539,11 +539,11 @@ Variant::Type VisualScriptOperator::get_typed() const {
void VisualScriptOperator::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_operator","op"),&VisualScriptOperator::set_operator);
- ObjectTypeDB::bind_method(_MD("get_operator"),&VisualScriptOperator::get_operator);
+ ClassDB::bind_method(_MD("set_operator","op"),&VisualScriptOperator::set_operator);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_typed","type"),&VisualScriptOperator::set_typed);
+ ClassDB::bind_method(_MD("get_typed"),&VisualScriptOperator::get_typed);
String types;
for(int i=0;i<Variant::OP_MAX;i++) {
@@ -717,8 +717,8 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo& property) const {
void VisualScriptVariableGet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableGet::set_variable);
- ObjectTypeDB::bind_method(_MD("get_variable"),&VisualScriptVariableGet::get_variable);
+ ClassDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableGet::set_variable);
+ ClassDB::bind_method(_MD("get_variable"),&VisualScriptVariableGet::get_variable);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"variable/name"),_SCS("set_variable"),_SCS("get_variable"));
@@ -853,8 +853,8 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo& property) const {
void VisualScriptVariableSet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableSet::set_variable);
- ObjectTypeDB::bind_method(_MD("get_variable"),&VisualScriptVariableSet::get_variable);
+ ClassDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableSet::set_variable);
+ ClassDB::bind_method(_MD("get_variable"),&VisualScriptVariableSet::get_variable);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"variable/name"),_SCS("set_variable"),_SCS("get_variable"));
@@ -995,11 +995,11 @@ void VisualScriptConstant::_validate_property(PropertyInfo& property) const {
void VisualScriptConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_constant_type","type"),&VisualScriptConstant::set_constant_type);
- ObjectTypeDB::bind_method(_MD("get_constant_type"),&VisualScriptConstant::get_constant_type);
+ ClassDB::bind_method(_MD("set_constant_type","type"),&VisualScriptConstant::set_constant_type);
+ ClassDB::bind_method(_MD("get_constant_type"),&VisualScriptConstant::get_constant_type);
- ObjectTypeDB::bind_method(_MD("set_constant_value","value"),&VisualScriptConstant::set_constant_value);
- ObjectTypeDB::bind_method(_MD("get_constant_value"),&VisualScriptConstant::get_constant_value);
+ ClassDB::bind_method(_MD("set_constant_value","value"),&VisualScriptConstant::set_constant_value);
+ ClassDB::bind_method(_MD("get_constant_value"),&VisualScriptConstant::get_constant_value);
String argt="Null";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -1078,7 +1078,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const{
PropertyInfo pinfo=PropertyInfo(Variant::OBJECT,"res");
if (preload.is_valid()) {
pinfo.hint=PROPERTY_HINT_RESOURCE_TYPE;
- pinfo.hint_string=preload->get_type();
+ pinfo.hint_string=preload->get_class();
}
return pinfo;
@@ -1098,7 +1098,7 @@ String VisualScriptPreload::get_text() const {
} else if (preload->get_name()!=String()) {
return preload->get_name();
} else {
- return preload->get_type();
+ return preload->get_class();
}
} else {
return "<empty>";
@@ -1123,8 +1123,8 @@ Ref<Resource> VisualScriptPreload::get_preload() const{
void VisualScriptPreload::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_preload","resource"),&VisualScriptPreload::set_preload);
- ObjectTypeDB::bind_method(_MD("get_preload"),&VisualScriptPreload::get_preload);
+ ClassDB::bind_method(_MD("set_preload","resource"),&VisualScriptPreload::set_preload);
+ ClassDB::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"));
@@ -1425,8 +1425,8 @@ VisualScriptNodeInstance* VisualScriptGlobalConstant::instance(VisualScriptInsta
void VisualScriptGlobalConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_global_constant","index"),&VisualScriptGlobalConstant::set_global_constant);
- ObjectTypeDB::bind_method(_MD("get_global_constant"),&VisualScriptGlobalConstant::get_global_constant);
+ ClassDB::bind_method(_MD("set_global_constant","index"),&VisualScriptGlobalConstant::set_global_constant);
+ ClassDB::bind_method(_MD("get_global_constant"),&VisualScriptGlobalConstant::get_global_constant);
String cc;
@@ -1540,7 +1540,7 @@ public:
VisualScriptNodeInstance* VisualScriptClassConstant::instance(VisualScriptInstance* p_instance) {
VisualScriptNodeInstanceClassConstant * instance = memnew(VisualScriptNodeInstanceClassConstant );
- instance->value=ObjectTypeDB::get_integer_constant(base_type,name,&instance->valid);
+ instance->value=ClassDB::get_integer_constant(base_type,name,&instance->valid);
return instance;
}
@@ -1549,7 +1549,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo& property) const
if (property.name=="constant") {
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(base_type,&constants,true);
+ ClassDB::get_integer_constant_list(base_type,&constants,true);
property.hint_string="";
for(List<String>::Element *E=constants.front();E;E=E->next()) {
@@ -1563,11 +1563,11 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo& property) const
void VisualScriptClassConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_class_constant","name"),&VisualScriptClassConstant::set_class_constant);
- ObjectTypeDB::bind_method(_MD("get_class_constant"),&VisualScriptClassConstant::get_class_constant);
+ ClassDB::bind_method(_MD("set_class_constant","name"),&VisualScriptClassConstant::set_class_constant);
+ ClassDB::bind_method(_MD("get_class_constant"),&VisualScriptClassConstant::get_class_constant);
- ObjectTypeDB::bind_method(_MD("set_base_type","name"),&VisualScriptClassConstant::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptClassConstant::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","name"),&VisualScriptClassConstant::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptClassConstant::get_base_type);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"constant",PROPERTY_HINT_ENUM,""),_SCS("set_class_constant"),_SCS("get_class_constant"));
@@ -1703,11 +1703,11 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo& property) c
void VisualScriptBasicTypeConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_basic_type","name"),&VisualScriptBasicTypeConstant::set_basic_type);
- ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptBasicTypeConstant::get_basic_type);
+ ClassDB::bind_method(_MD("set_basic_type","name"),&VisualScriptBasicTypeConstant::set_basic_type);
+ ClassDB::bind_method(_MD("get_basic_type"),&VisualScriptBasicTypeConstant::get_basic_type);
- ObjectTypeDB::bind_method(_MD("set_basic_type_constant","name"),&VisualScriptBasicTypeConstant::set_basic_type_constant);
- ObjectTypeDB::bind_method(_MD("get_basic_type_constant"),&VisualScriptBasicTypeConstant::get_basic_type_constant);
+ ClassDB::bind_method(_MD("set_basic_type_constant","name"),&VisualScriptBasicTypeConstant::set_basic_type_constant);
+ ClassDB::bind_method(_MD("get_basic_type_constant"),&VisualScriptBasicTypeConstant::get_basic_type_constant);
String argt="Null";
@@ -1831,8 +1831,8 @@ VisualScriptNodeInstance* VisualScriptMathConstant::instance(VisualScriptInstanc
void VisualScriptMathConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_math_constant","which"),&VisualScriptMathConstant::set_math_constant);
- ObjectTypeDB::bind_method(_MD("get_math_constant"),&VisualScriptMathConstant::get_math_constant);
+ ClassDB::bind_method(_MD("set_math_constant","which"),&VisualScriptMathConstant::set_math_constant);
+ ClassDB::bind_method(_MD("get_math_constant"),&VisualScriptMathConstant::get_math_constant);
String cc;
@@ -1933,17 +1933,17 @@ public:
VisualScriptNodeInstance* VisualScriptEngineSingleton::instance(VisualScriptInstance* p_instance) {
VisualScriptNodeInstanceEngineSingleton * instance = memnew(VisualScriptNodeInstanceEngineSingleton );
- instance->singleton=Globals::get_singleton()->get_singleton_object(singleton);
+ instance->singleton=GlobalConfig::get_singleton()->get_singleton_object(singleton);
return instance;
}
VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess* p_inputs, int p_output) const {
- Object *obj=Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj=GlobalConfig::get_singleton()->get_singleton_object(singleton);
TypeGuess tg;
tg.type=Variant::OBJECT;
if (obj) {
- tg.obj_type=obj->get_type();
+ tg.GDCLASS=obj->get_class();
tg.script=obj->get_script();
}
@@ -1953,16 +1953,16 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output
void VisualScriptEngineSingleton::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_singleton","name"),&VisualScriptEngineSingleton::set_singleton);
- ObjectTypeDB::bind_method(_MD("get_singleton"),&VisualScriptEngineSingleton::get_singleton);
+ ClassDB::bind_method(_MD("set_singleton","name"),&VisualScriptEngineSingleton::set_singleton);
+ ClassDB::bind_method(_MD("get_singleton"),&VisualScriptEngineSingleton::get_singleton);
String cc;
- List<Globals::Singleton> singletons;
+ List<GlobalConfig::Singleton> singletons;
- Globals::get_singleton()->get_singletons(&singletons);
+ GlobalConfig::get_singleton()->get_singletons(&singletons);
- for (List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) {
+ for (List<GlobalConfig::Singleton>::Element *E=singletons.front();E;E=E->next()) {
if (E->get().name=="VS" || E->get().name=="PS" || E->get().name=="PS2D" || E->get().name=="AS" || E->get().name=="TS" || E->get().name=="SS" || E->get().name=="SS2D")
continue; //skip these, too simple named
@@ -2117,7 +2117,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu
VisualScriptSceneNode::TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="Node";
+ tg.GDCLASS="Node";
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
@@ -2146,7 +2146,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu
Node* another = script_node->get_node(path);
if (another) {
- tg.obj_type=another->get_type();
+ tg.GDCLASS=another->get_class();
tg.script=another->get_script();
}
#endif
@@ -2190,8 +2190,8 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo& property) const {
void VisualScriptSceneNode::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_node_path","path"),&VisualScriptSceneNode::set_node_path);
- ObjectTypeDB::bind_method(_MD("get_node_path"),&VisualScriptSceneNode::get_node_path);
+ ClassDB::bind_method(_MD("set_node_path","path"),&VisualScriptSceneNode::set_node_path);
+ ClassDB::bind_method(_MD("get_node_path"),&VisualScriptSceneNode::get_node_path);
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_node_path"),_SCS("get_node_path"));
}
@@ -2296,7 +2296,7 @@ VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGu
TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="SceneTree";
+ tg.GDCLASS="SceneTree";
return tg;
}
@@ -2401,8 +2401,8 @@ VisualScriptNodeInstance* VisualScriptResourcePath::instance(VisualScriptInstanc
void VisualScriptResourcePath::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_resource_path","path"),&VisualScriptResourcePath::set_resource_path);
- ObjectTypeDB::bind_method(_MD("get_resource_path"),&VisualScriptResourcePath::get_resource_path);
+ ClassDB::bind_method(_MD("set_resource_path","path"),&VisualScriptResourcePath::set_resource_path);
+ ClassDB::bind_method(_MD("get_resource_path"),&VisualScriptResourcePath::get_resource_path);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"path",PROPERTY_HINT_FILE),_SCS("set_resource_path"),_SCS("get_resource_path"));
}
@@ -2494,13 +2494,13 @@ VisualScriptSelf::TypeGuess VisualScriptSelf::guess_output_type(TypeGuess* p_inp
VisualScriptSceneNode::TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="Object";
+ tg.GDCLASS="Object";
Ref<Script> script = get_visual_script();
if (!script.is_valid())
return tg;
- tg.obj_type=script->get_instance_base_type();
+ tg.GDCLASS=script->get_instance_base_type();
tg.script=script;
return tg;
@@ -2631,9 +2631,9 @@ public:
return 0;
}
#endif
- Array in_values(true);
- Array out_values(true);
- Array work_mem(true);
+ Array in_values;
+ Array out_values;
+ Array work_mem;
in_values.resize(in_count);
@@ -2817,7 +2817,7 @@ String VisualScriptSubCall::get_text() const {
return script->get_name();
if (script->get_path().is_resource_file())
return script->get_path().get_file();
- return script->get_type();
+ return script->get_class();
}
return "";
}
@@ -3001,14 +3001,14 @@ VisualScriptNodeInstance* VisualScriptComment::instance(VisualScriptInstance* p_
void VisualScriptComment::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_title","title"),&VisualScriptComment::set_title);
- ObjectTypeDB::bind_method(_MD("get_title"),&VisualScriptComment::get_title);
+ ClassDB::bind_method(_MD("set_title","title"),&VisualScriptComment::set_title);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_description","description"),&VisualScriptComment::set_description);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_size","size"),&VisualScriptComment::set_size);
+ ClassDB::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"));
@@ -3140,11 +3140,11 @@ VisualScriptNodeInstance* VisualScriptConstructor::instance(VisualScriptInstance
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);
+ ClassDB::bind_method(_MD("set_constructor_type","type"),&VisualScriptConstructor::set_constructor_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_constructor","constructor"),&VisualScriptConstructor::set_constructor);
+ ClassDB::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"));
@@ -3283,11 +3283,11 @@ VisualScriptNodeInstance* VisualScriptLocalVar::instance(VisualScriptInstance* p
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);
+ ClassDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVar::set_var_name);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVar::set_var_type);
+ ClassDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVar::get_var_type);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -3420,11 +3420,11 @@ VisualScriptNodeInstance* VisualScriptLocalVarSet::instance(VisualScriptInstance
void VisualScriptLocalVarSet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVarSet::set_var_name);
- ObjectTypeDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVarSet::get_var_name);
+ ClassDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVarSet::set_var_name);
+ ClassDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVarSet::get_var_name);
- ObjectTypeDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVarSet::set_var_type);
- ObjectTypeDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVarSet::get_var_type);
+ ClassDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVarSet::set_var_type);
+ ClassDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVarSet::get_var_type);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -3600,7 +3600,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
String actions;
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -3630,11 +3630,11 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
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);
+ ClassDB::bind_method(_MD("set_action_name","name"),&VisualScriptInputAction::set_action_name);
+ ClassDB::bind_method(_MD("get_action_name"),&VisualScriptInputAction::get_action_name);
- ObjectTypeDB::bind_method(_MD("set_action_mode","mode"),&VisualScriptInputAction::set_action_mode);
- ObjectTypeDB::bind_method(_MD("get_action_mode"),&VisualScriptInputAction::get_action_mode);
+ ClassDB::bind_method(_MD("set_action_mode","mode"),&VisualScriptInputAction::set_action_mode);
+ ClassDB::bind_method(_MD("get_action_mode"),&VisualScriptInputAction::get_action_mode);
ADD_PROPERTY( PropertyInfo(Variant::STRING,"action"),_SCS("set_action_name"),_SCS("get_action_name"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Pressed,Released,JustPressed,JustReleased"),_SCS("set_action_mode"),_SCS("get_action_mode"));
@@ -3834,21 +3834,21 @@ void VisualScriptDeconstruct::_validate_property(PropertyInfo& property) const {
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);
+ ClassDB::bind_method(_MD("set_deconstruct_type","type"),&VisualScriptDeconstruct::set_deconstruct_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("set_deconstruct_input_type","input_type"),&VisualScriptDeconstruct::set_deconstruct_input_type);
+ ClassDB::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);
+ ClassDB::bind_method(_MD("_set_elem_cache","_cache"),&VisualScriptDeconstruct::_set_elem_cache);
+ ClassDB::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";
+ String iet="None,Key,MouseMotion,MouseButton,JoypadMotion,JoypadButton,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"));
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 94eeadca57..7a06fbf5e8 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -5,7 +5,7 @@
class VisualScriptFunction : public VisualScriptNode {
- OBJ_TYPE(VisualScriptFunction,VisualScriptNode)
+ GDCLASS(VisualScriptFunction,VisualScriptNode)
struct Argument {
@@ -72,7 +72,7 @@ public:
class VisualScriptOperator : public VisualScriptNode {
- OBJ_TYPE(VisualScriptOperator,VisualScriptNode)
+ GDCLASS(VisualScriptOperator,VisualScriptNode)
Variant::Type typed;
@@ -114,7 +114,7 @@ public:
class VisualScriptVariableGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptVariableGet,VisualScriptNode)
+ GDCLASS(VisualScriptVariableGet,VisualScriptNode)
StringName variable;
@@ -153,7 +153,7 @@ public:
class VisualScriptVariableSet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptVariableSet,VisualScriptNode)
+ GDCLASS(VisualScriptVariableSet,VisualScriptNode)
StringName variable;
@@ -192,7 +192,7 @@ public:
class VisualScriptConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptConstant,VisualScriptNode)
+ GDCLASS(VisualScriptConstant,VisualScriptNode)
Variant::Type type;
@@ -236,7 +236,7 @@ public:
class VisualScriptPreload : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPreload,VisualScriptNode)
+ GDCLASS(VisualScriptPreload,VisualScriptNode)
Ref<Resource> preload;
@@ -274,7 +274,7 @@ public:
class VisualScriptIndexGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIndexGet,VisualScriptNode)
+ GDCLASS(VisualScriptIndexGet,VisualScriptNode)
public:
@@ -305,7 +305,7 @@ public:
class VisualScriptIndexSet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIndexSet,VisualScriptNode)
+ GDCLASS(VisualScriptIndexSet,VisualScriptNode)
public:
@@ -337,7 +337,7 @@ public:
class VisualScriptGlobalConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptGlobalConstant,VisualScriptNode)
+ GDCLASS(VisualScriptGlobalConstant,VisualScriptNode)
int index;
@@ -373,7 +373,7 @@ public:
class VisualScriptClassConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptClassConstant,VisualScriptNode)
+ GDCLASS(VisualScriptClassConstant,VisualScriptNode)
StringName base_type;
StringName name;
@@ -414,7 +414,7 @@ public:
class VisualScriptBasicTypeConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptBasicTypeConstant,VisualScriptNode)
+ GDCLASS(VisualScriptBasicTypeConstant,VisualScriptNode)
Variant::Type type;
StringName name;
@@ -457,7 +457,7 @@ public:
class VisualScriptMathConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptMathConstant,VisualScriptNode)
+ GDCLASS(VisualScriptMathConstant,VisualScriptNode)
public:
enum MathConstant {
@@ -508,7 +508,7 @@ VARIANT_ENUM_CAST( VisualScriptMathConstant::MathConstant )
class VisualScriptEngineSingleton : public VisualScriptNode {
- OBJ_TYPE(VisualScriptEngineSingleton,VisualScriptNode)
+ GDCLASS(VisualScriptEngineSingleton,VisualScriptNode)
String singleton;
@@ -549,7 +549,7 @@ public:
class VisualScriptSceneNode : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSceneNode,VisualScriptNode)
+ GDCLASS(VisualScriptSceneNode,VisualScriptNode)
NodePath path;
protected:
@@ -590,7 +590,7 @@ public:
class VisualScriptSceneTree : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSceneTree,VisualScriptNode)
+ GDCLASS(VisualScriptSceneTree,VisualScriptNode)
protected:
@@ -627,7 +627,7 @@ public:
class VisualScriptResourcePath : public VisualScriptNode {
- OBJ_TYPE(VisualScriptResourcePath,VisualScriptNode)
+ GDCLASS(VisualScriptResourcePath,VisualScriptNode)
String path;
protected:
@@ -664,7 +664,7 @@ public:
class VisualScriptSelf : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSelf,VisualScriptNode)
+ GDCLASS(VisualScriptSelf,VisualScriptNode)
protected:
@@ -701,13 +701,11 @@ public:
class VisualScriptCustomNode: public VisualScriptNode {
- OBJ_TYPE(VisualScriptCustomNode,VisualScriptNode)
+ GDCLASS(VisualScriptCustomNode,VisualScriptNode)
protected:
- virtual bool _use_builtin_script() const { return true; }
-
static void _bind_methods();
public:
@@ -752,7 +750,7 @@ public:
class VisualScriptSubCall: public VisualScriptNode {
- OBJ_TYPE(VisualScriptSubCall,VisualScriptNode)
+ GDCLASS(VisualScriptSubCall,VisualScriptNode)
protected:
@@ -785,7 +783,7 @@ public:
class VisualScriptComment: public VisualScriptNode {
- OBJ_TYPE(VisualScriptComment,VisualScriptNode)
+ GDCLASS(VisualScriptComment,VisualScriptNode)
String title;
@@ -829,7 +827,7 @@ public:
class VisualScriptConstructor: public VisualScriptNode {
- OBJ_TYPE(VisualScriptConstructor,VisualScriptNode)
+ GDCLASS(VisualScriptConstructor,VisualScriptNode)
Variant::Type type;
@@ -874,7 +872,7 @@ public:
class VisualScriptLocalVar: public VisualScriptNode {
- OBJ_TYPE(VisualScriptLocalVar,VisualScriptNode)
+ GDCLASS(VisualScriptLocalVar,VisualScriptNode)
StringName name;
Variant::Type type;
@@ -914,7 +912,7 @@ public:
class VisualScriptLocalVarSet: public VisualScriptNode {
- OBJ_TYPE(VisualScriptLocalVarSet,VisualScriptNode)
+ GDCLASS(VisualScriptLocalVarSet,VisualScriptNode)
StringName name;
Variant::Type type;
@@ -956,7 +954,7 @@ public:
class VisualScriptInputAction: public VisualScriptNode {
- OBJ_TYPE(VisualScriptInputAction,VisualScriptNode)
+ GDCLASS(VisualScriptInputAction,VisualScriptNode)
public:
enum Mode {
MODE_PRESSED,
@@ -1007,7 +1005,7 @@ VARIANT_ENUM_CAST( VisualScriptInputAction::Mode )
class VisualScriptDeconstruct: public VisualScriptNode {
- OBJ_TYPE(VisualScriptDeconstruct,VisualScriptNode)
+ GDCLASS(VisualScriptDeconstruct,VisualScriptNode)
struct Element {
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 221c46b6fd..8b251e667c 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -157,11 +157,11 @@ void VisualScriptYield::_validate_property(PropertyInfo& property) const {
void VisualScriptYield::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_yield_mode","mode"),&VisualScriptYield::set_yield_mode);
- ObjectTypeDB::bind_method(_MD("get_yield_mode"),&VisualScriptYield::get_yield_mode);
+ ClassDB::bind_method(_MD("set_yield_mode","mode"),&VisualScriptYield::set_yield_mode);
+ ClassDB::bind_method(_MD("get_yield_mode"),&VisualScriptYield::get_yield_mode);
- ObjectTypeDB::bind_method(_MD("set_wait_time","sec"),&VisualScriptYield::set_wait_time);
- ObjectTypeDB::bind_method(_MD("get_wait_time"),&VisualScriptYield::get_wait_time);
+ ClassDB::bind_method(_MD("set_wait_time","sec"),&VisualScriptYield::set_wait_time);
+ ClassDB::bind_method(_MD("get_wait_time"),&VisualScriptYield::get_wait_time);
ADD_PROPERTY(PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Frame,FixedFrame,Time",PROPERTY_USAGE_NOEDITOR),_SCS("set_yield_mode"),_SCS("get_yield_mode"));
ADD_PROPERTY(PropertyInfo(Variant::REAL,"wait_time"),_SCS("set_wait_time"),_SCS("get_wait_time"));
@@ -270,7 +270,7 @@ StringName VisualScriptYieldSignal::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -290,7 +290,7 @@ int VisualScriptYieldSignal::get_output_value_port_count() const{
MethodInfo sr;
- if (!ObjectTypeDB::get_signal(_get_base_type(),signal,&sr))
+ if (!ClassDB::get_signal(_get_base_type(),signal,&sr))
return 0;
return sr.arguments.size();
@@ -315,7 +315,7 @@ PropertyInfo VisualScriptYieldSignal::get_output_value_port_info(int p_idx) cons
MethodInfo sr;
- if (!ObjectTypeDB::get_signal(_get_base_type(),signal,&sr))
+ if (!ClassDB::get_signal(_get_base_type(),signal,&sr))
return PropertyInfo(); //no signal
ERR_FAIL_INDEX_V(p_idx,sr.arguments.size(),PropertyInfo());
return sr.arguments[p_idx];
@@ -440,7 +440,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo& property) const {
List<MethodInfo> methods;
- ObjectTypeDB::get_signal_list(_get_base_type(),&methods);
+ ClassDB::get_signal_list(_get_base_type(),&methods);
List<String> mstring;
for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
@@ -468,17 +468,17 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo& property) const {
void VisualScriptYieldSignal::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptYieldSignal::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptYieldSignal::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptYieldSignal::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptYieldSignal::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_signal","signal"),&VisualScriptYieldSignal::set_signal);
- ObjectTypeDB::bind_method(_MD("get_signal"),&VisualScriptYieldSignal::get_signal);
+ ClassDB::bind_method(_MD("set_signal","signal"),&VisualScriptYieldSignal::set_signal);
+ ClassDB::bind_method(_MD("get_signal"),&VisualScriptYieldSignal::get_signal);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptYieldSignal::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptYieldSignal::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptYieldSignal::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptYieldSignal::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptYieldSignal::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptYieldSignal::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptYieldSignal::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptYieldSignal::get_base_path);
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index ae7f8c15c1..210d6ec995 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -5,7 +5,7 @@
class VisualScriptYield : public VisualScriptNode {
- OBJ_TYPE(VisualScriptYield,VisualScriptNode)
+ GDCLASS(VisualScriptYield,VisualScriptNode)
public:
enum YieldMode {
@@ -60,7 +60,7 @@ VARIANT_ENUM_CAST( VisualScriptYield::YieldMode )
class VisualScriptYieldSignal : public VisualScriptNode {
- OBJ_TYPE(VisualScriptYieldSignal,VisualScriptNode)
+ GDCLASS(VisualScriptYieldSignal,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 4ce7940a01..2b05daca16 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -78,7 +78,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f,ogg_int64_t offs, int w
}
int AudioStreamPlaybackOGGVorbis::_ov_close_func(void *_f) {
-// printf("close %p\n",_f);
+ //printf("close %p\n",_f);
if (!_f)
return 0;
FileAccess *fa=(FileAccess*)_f;
@@ -419,7 +419,7 @@ void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<St
}
String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="ogg")
+ if (p_path.get_extension().to_lower()=="ogg")
return "AudioStreamOGGVorbis";
return "";
}
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 8d8d7392b5..bc2bfa2ae6 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -38,7 +38,7 @@
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlayback {
- OBJ_TYPE(AudioStreamPlaybackOGGVorbis,AudioStreamPlayback);
+ GDCLASS(AudioStreamPlaybackOGGVorbis,AudioStreamPlayback);
enum {
MIN_MIX=1024
@@ -115,7 +115,7 @@ public:
class AudioStreamOGGVorbis : public AudioStream {
- OBJ_TYPE(AudioStreamOGGVorbis,AudioStream);
+ GDCLASS(AudioStreamOGGVorbis,AudioStream);
String file;
public:
diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp
index ae63b5af3c..de929d9350 100644
--- a/modules/vorbis/register_types.cpp
+++ b/modules/vorbis/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@ void register_vorbis_types() {
vorbis_stream_loader = memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
ResourceLoader::add_resource_format_loader(vorbis_stream_loader);
- ObjectTypeDB::register_type<AudioStreamOGGVorbis>();
+ ClassDB::register_class<AudioStreamOGGVorbis>();
}
void unregister_vorbis_types() {
diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h
index 6baaed7ce8..b2adb55acd 100644
--- a/modules/vorbis/register_types.h
+++ b/modules/vorbis/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index a6b9e46ee8..241d6e30cd 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -263,6 +263,8 @@ if env["platform"] == 'uwp':
else:
webm_cpu_x86 = True
else:
+ import platform
+ is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm'))
is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"] == "yes")
is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
if is_android_x86:
@@ -270,8 +272,8 @@ else:
if osx_fat:
webm_cpu_x86 = True
else:
- webm_cpu_x86 = (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86 or is_ios_x86)
- webm_cpu_arm = (not is_ios_x86 and env["platform"] == 'iphone') or env["platform"] == 'bb10' or (not is_android_x86 and env["platform"] == 'android')
+ webm_cpu_x86 = not is_x11_or_server_arm and (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86 or is_ios_x86)
+ webm_cpu_arm = is_x11_or_server_arm or (not is_ios_x86 and env["platform"] == 'iphone') or env["platform"] == 'bb10' or (not is_android_x86 and env["platform"] == 'android')
if webm_cpu_x86:
import subprocess
@@ -331,7 +333,7 @@ if webm_cpu_x86:
if webm_cpu_arm:
if env["platform"] == 'iphone':
env_libvpx["ASFLAGS"] = '-arch armv7'
- elif env["platform"] == 'android':
+ elif env["platform"] == 'android' or env["platform"] == 'x11' or env["platform"] == 'server':
env_libvpx["ASFLAGS"] = '-mfpu=neon'
elif env["platform"] == 'uwp':
env_libvpx["AS"] = 'armasm'
diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp
index 07031caad1..e50eb337ae 100644
--- a/modules/webm/register_types.cpp
+++ b/modules/webm/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@ void register_webm_types() {
webm_stream_loader = memnew(ResourceFormatLoaderVideoStreamWebm);
ResourceLoader::add_resource_format_loader(webm_stream_loader);
- ObjectTypeDB::register_type<VideoStreamWebm>();
+ ClassDB::register_class<VideoStreamWebm>();
}
void unregister_webm_types() {
diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h
index 62f08646a4..3df0d7bbaa 100644
--- a/modules/webm/register_types.h
+++ b/modules/webm/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index dc2266804d..bdd97f1df7 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -127,7 +127,7 @@ bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
}
frame_data.resize((webm->getWidth() * webm->getHeight()) << 2);
- texture->create(webm->getWidth(), webm->getHeight(), Image::FORMAT_RGBA, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE);
+ texture->create(webm->getWidth(), webm->getHeight(), Image::FORMAT_RGBA8, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE);
return true;
}
@@ -167,7 +167,7 @@ void VideoStreamPlaybackWebm::play() {
stop();
- delay_compensation = Globals::get_singleton()->get("audio/video_delay_compensation_ms");
+ delay_compensation = GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms");
delay_compensation /= 1000.0;
playing = true;
@@ -293,7 +293,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) {
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
bool converted = false;
if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
@@ -318,7 +318,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
}
if (converted)
- texture->set_data(Image(image.w, image.h, 0, Image::FORMAT_RGBA, frame_data)); //Zero copy send to visual server
+ texture->set_data(Image(image.w, image.h, 0, Image::FORMAT_RGBA8, frame_data)); //Zero copy send to visual server
}
break;
@@ -415,7 +415,7 @@ bool ResourceFormatLoaderVideoStreamWebm::handles_type(const String &p_type) con
String ResourceFormatLoaderVideoStreamWebm::get_resource_type(const String &p_path) const {
- const String exl = p_path.extension().to_lower();
+ const String exl = p_path.get_extension().to_lower();
if (exl == "webm")
return "VideoStreamWebm";
return "";
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index d1e02d0663..cb4ef53f6d 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,7 +36,7 @@ class OpusVorbisDecoder;
class VideoStreamPlaybackWebm : public VideoStreamPlayback {
- OBJ_TYPE(VideoStreamPlaybackWebm, VideoStreamPlayback)
+ GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback)
String file_name;
int audio_track;
@@ -56,7 +56,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback {
double delay_compensation;
double time, video_frame_delay, video_pos;
- DVector<uint8_t> frame_data;
+ PoolVector<uint8_t> frame_data;
Ref<ImageTexture> texture;
int16_t *pcm;
@@ -102,7 +102,7 @@ private:
class VideoStreamWebm : public VideoStream {
- OBJ_TYPE(VideoStreamWebm, VideoStream)
+ GDCLASS(VideoStreamWebm, VideoStream)
String file;
int audio_track;
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 0fe2db3261..3508c6a663 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -36,48 +36,48 @@
#include <webp/decode.h>
#include <webp/encode.h>
-static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
+static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
- ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>());
+ ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>());
Image img=p_image;
if (img.detect_alpha())
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
else
- img.convert(Image::FORMAT_RGB);
+ img.convert(Image::FORMAT_RGB8);
Size2 s(img.get_width(),img.get_height());
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
uint8_t *dst_buff=NULL;
size_t dst_size=0;
- if (img.get_format()==Image::FORMAT_RGB) {
+ if (img.get_format()==Image::FORMAT_RGB8) {
dst_size = WebPEncodeRGB(r.ptr(),s.width,s.height,3*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
} else {
dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
}
- ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>());
- DVector<uint8_t> dst;
+ ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>());
+ PoolVector<uint8_t> dst;
dst.resize(4+dst_size);
- DVector<uint8_t>::Write w = dst.write();
+ PoolVector<uint8_t>::Write w = dst.write();
w[0]='W';
w[1]='E';
w[2]='B';
w[3]='P';
copymem(&w[4],dst_buff,dst_size);
free(dst_buff);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
return dst;
}
-static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
+static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) {
int size = p_buffer.size()-4;
ERR_FAIL_COND_V(size<=0,Image());
- DVector<uint8_t>::Read r = p_buffer.read();
+ PoolVector<uint8_t>::Read r = p_buffer.read();
ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image());
WebPBitstreamFeatures features;
@@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//print_line("height: "+itos(features.height));
//print_line("alpha: "+itos(features.has_alpha));
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
if (features.has_alpha) {
@@ -107,9 +107,9 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,Image());
- dst_w = DVector<uint8_t>::Write();
+ dst_w = PoolVector<uint8_t>::Write();
- return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
}
@@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
uint32_t size = f->get_len();
- DVector<uint8_t> src_image;
+ PoolVector<uint8_t> src_image;
src_image.resize(size);
WebPBitstreamFeatures features;
- DVector<uint8_t>::Write src_w = src_image.write();
+ PoolVector<uint8_t>::Write src_w = src_image.write();
f->get_buffer(src_w.ptr(),size);
ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF);
@@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
print_line("height: "+itos(features.height));
print_line("alpha: "+itos(features.has_alpha));
- src_w = DVector<uint8_t>::Write();
+ src_w = PoolVector<uint8_t>::Write();
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Read src_r = src_image.read();
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Read src_r = src_image.read();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
@@ -158,10 +158,10 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT);
- src_r = DVector<uint8_t>::Read();
- dst_w = DVector<uint8_t>::Write();
+ src_r = PoolVector<uint8_t>::Read();
+ dst_w = PoolVector<uint8_t>::Write();
- *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
return OK;
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index 24f79708db..eb1b32ac95 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp
index 039876bbb9..7a4e35dc4c 100644
--- a/modules/webp/register_types.cpp
+++ b/modules/webp/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h
index a200188e47..ce1f29937b 100644
--- a/modules/webp/register_types.h
+++ b/modules/webp/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */