From 8f83f6c67551b86f4eb0661d5594f29e5c84a51c Mon Sep 17 00:00:00 2001
From: Maximillian
Date: Sun, 9 Aug 2015 16:39:59 -0700
Subject: Add create new script button to script editor menu
---
tools/editor/plugins/script_editor_plugin.cpp | 18 ++++++++++++++----
tools/editor/plugins/script_editor_plugin.h | 5 ++++-
tools/editor/script_create_dialog.cpp | 6 +++---
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 302e4f219..250b82706 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -211,7 +211,6 @@ void ScriptEditorQuickOpen::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_confirmed"),&ScriptEditorQuickOpen::_confirmed);
ObjectTypeDB::bind_method(_MD("_sbox_input"),&ScriptEditorQuickOpen::_sbox_input);
-
ADD_SIGNAL(MethodInfo("goto_line",PropertyInfo(Variant::INT,"line")));
}
@@ -547,6 +546,10 @@ void ScriptEditor::_show_debugger(bool p_show) {
}
+void ScriptEditor::_script_created(Ref\n";
- strnew+="\n";
- } else if (lines[i].find("var Module")!=-1) {
- strnew+=lines[i];
- strnew+="TOTAL_MEMORY:"+itos(max_memory*1024*1024)+",";
+
+ if (lines[i].find("$GODOTTMEM")!=-1) {
+
+ strnew+=lines[i].replace("$GODOTTMEM",itos(max_memory*1024*1024))+"\n";
+ } else if (lines[i].find("$GODOTFS")!=-1) {
+ strnew+=lines[i].replace("$GODOTFS",name+"fs.js")+"\n";
+ } else if (lines[i].find("$GODOTMEM")!=-1) {
+ strnew+=lines[i].replace("$GODOTMEM",name+".mem")+"\n";
+ } else if (lines[i].find("$GODOTJS")!=-1) {
+ strnew+=lines[i].replace("$GODOTJS",name+".js")+"\n";
} else {
strnew+=lines[i]+"\n";
}
@@ -267,10 +271,10 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
_fix_html(data,p_path.get_file().basename(),1<<(max_memory+5));
file=p_path.get_file();
}
- if (file=="filesystem.js") {
+ if (file=="godotfs.js") {
_fix_files(data,len);
- file=p_path.get_file().basename()+"_filesystem.js";
+ file=p_path.get_file().basename()+"fs.js";
}
if (file=="godot.js") {
@@ -278,6 +282,12 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
file=p_path.get_file().basename()+".js";
}
+ if (file=="godot.mem") {
+
+ //_fix_godot(data);
+ file=p_path.get_file().basename()+".mem";
+ }
+
String dst = p_path.get_base_dir().plus_file(file);
FileAccess *f=FileAccess::open(dst,FileAccess::WRITE);
if (!f) {
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 5be6c5b64..9aade8c44 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -31,6 +31,8 @@
#include "main/main.h"
#include "io/resource_loader.h"
#include "os/keyboard.h"
+
+
OS_JavaScript *os=NULL;
static void _gfx_init(void *ud,bool gl2,int w, int h,bool fs) {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index a422f77b4..e18d5d949 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -104,21 +104,21 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
visual_server->init();
visual_server->cursor_set_visible(false, 0);
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ /*AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
- }
+ }*/
print_line("Init SM");
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
+ //sample_manager = memnew( SampleManagerMallocSW );
+ audio_server = memnew( AudioServerJavascript );
print_line("Init Mixer");
- audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
+ //audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
audio_server->init();
print_line("Init SoundServer");
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 81bb47440..d52c465c7 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -38,7 +38,7 @@
#include "servers/audio/audio_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
-
+#include "audio_server_javascript.h"
#include "audio_driver_javascript.h"
typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs);
@@ -67,8 +67,8 @@ private:
Rasterizer *rasterizer;
VisualServer *visual_server;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
+ AudioServerJavascript *audio_server;
+ //SampleManagerMallocSW *sample_manager;
SpatialSoundServerSW *spatial_sound_server;
SpatialSound2DServerSW *spatial_sound_2d_server;
PhysicsServer *physics_server;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index f8b58b5cb..c2ea1c8bb 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -857,6 +857,11 @@ void AnimationPlayer::clear_queue() {
queued.clear();
};
+void AnimationPlayer::play_backwards(const StringName& p_name,float p_custom_blend) {
+
+ play(p_name,p_custom_blend,-1,true);
+}
+
void AnimationPlayer::play(const StringName& p_name, float p_custom_blend, float p_custom_scale,bool p_from_end) {
//printf("animation is %ls\n", String(p_name).c_str());
@@ -1216,6 +1221,7 @@ void AnimationPlayer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_default_blend_time"),&AnimationPlayer::get_default_blend_time);
ObjectTypeDB::bind_method(_MD("play","name","custom_blend","custom_speed","from_end"),&AnimationPlayer::play,DEFVAL(""),DEFVAL(-1),DEFVAL(1.0),DEFVAL(false));
+ ObjectTypeDB::bind_method(_MD("play_backwards","name","custom_blend"),&AnimationPlayer::play_backwards,DEFVAL(""),DEFVAL(-1));
ObjectTypeDB::bind_method(_MD("stop","reset"),&AnimationPlayer::stop,DEFVAL(true));
ObjectTypeDB::bind_method(_MD("stop_all"),&AnimationPlayer::stop_all);
ObjectTypeDB::bind_method(_MD("is_playing"),&AnimationPlayer::is_playing);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 3fddc283a..1e3c37c4d 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -258,6 +258,7 @@ public:
float get_default_blend_time() const;
void play(const StringName& p_name=StringName(),float p_custom_blend=-1,float p_custom_scale=1.0,bool p_from_end=false);
+ void play_backwards(const StringName& p_name=StringName(),float p_custom_blend=-1);
void queue(const StringName& p_name);
void clear_queue();
void stop(bool p_reset=true);
diff --git a/tools/html_fs/filesystem.js b/tools/html_fs/filesystem.js
deleted file mode 100644
index 93cc30556..000000000
--- a/tools/html_fs/filesystem.js
+++ /dev/null
@@ -1,149 +0,0 @@
-
-var Module;
-if (typeof Module === 'undefined') Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()');
-if (!Module.expectedDataFileDownloads) {
- Module.expectedDataFileDownloads = 0;
- Module.finishedDataFileDownloads = 0;
-}
-Module.expectedDataFileDownloads++;
-(function() {
-
- function fetchRemotePackage(packageName, callback, errback) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', packageName, true);
- xhr.responseType = 'arraybuffer';
- xhr.onprogress = function(event) {
- var url = packageName;
- if (event.loaded && event.total) {
- if (!xhr.addedTotal) {
- xhr.addedTotal = true;
- if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
- Module.dataFileDownloads[url] = {
- loaded: event.loaded,
- total: event.total
- };
- } else {
- Module.dataFileDownloads[url].loaded = event.loaded;
- }
- var total = 0;
- var loaded = 0;
- var num = 0;
- for (var download in Module.dataFileDownloads) {
- var data = Module.dataFileDownloads[download];
- total += data.total;
- loaded += data.loaded;
- num++;
- }
- total = Math.ceil(total * Module.expectedDataFileDownloads/num);
- if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
- } else if (!Module.dataFileDownloads) {
- if (Module['setStatus']) Module['setStatus']('Downloading data...');
- }
- };
- xhr.onload = function(event) {
- var packageData = xhr.response;
- callback(packageData);
- };
- xhr.send(null);
- };
-
- function handleError(error) {
- console.error('package error:', error);
- };
-
- var fetched = null, fetchedCallback = null;
- fetchRemotePackage('data.pck', function(data) {
- if (fetchedCallback) {
- fetchedCallback(data);
- fetchedCallback = null;
- } else {
- fetched = data;
- }
- }, handleError);
-
- function runWithFS() {
-
-function assert(check, msg) {
- if (!check) throw msg + new Error().stack;
-}
-
- function DataRequest(start, end, crunched, audio) {
- this.start = start;
- this.end = end;
- this.crunched = crunched;
- this.audio = audio;
- }
- DataRequest.prototype = {
- requests: {},
- open: function(mode, name) {
- this.name = name;
- this.requests[name] = this;
- Module['addRunDependency']('fp ' + this.name);
- },
- send: function() {},
- onload: function() {
- var byteArray = this.byteArray.subarray(this.start, this.end);
-
- this.finish(byteArray);
-
- },
- finish: function(byteArray) {
- var that = this;
- Module['FS_createPreloadedFile'](this.name, null, byteArray, true, true, function() {
- Module['removeRunDependency']('fp ' + that.name);
- }, function() {
- if (that.audio) {
- Module['removeRunDependency']('fp ' + that.name); // workaround for chromium bug 124926 (still no audio with this, but at least we don't hang)
- } else {
- Module.printErr('Preloading file ' + that.name + ' failed');
- }
- }, false, true); // canOwn this data in the filesystem, it is a slide into the heap that will never change
- this.requests[this.name] = null;
- },
- };
- new DataRequest(0, $DPLEN, 0, 0).open('GET', '/data.pck');
-
- var PACKAGE_PATH;
- if (typeof window === 'object') {
- PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
- } else {
- // worker
- PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
- }
- var PACKAGE_NAME = 'data.pck';
- var REMOTE_PACKAGE_NAME = 'data.pck';
- var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e';
-
- function processPackageData(arrayBuffer) {
- Module.finishedDataFileDownloads++;
- assert(arrayBuffer, 'Loading data file failed.');
- var byteArray = new Uint8Array(arrayBuffer);
- var curr;
-
- // Reuse the bytearray from the XHR as the source for file reads.
- DataRequest.prototype.byteArray = byteArray;
- DataRequest.prototype.requests["/data.pck"].onload();
- Module['removeRunDependency']('datafile_datapack');
-
- };
- Module['addRunDependency']('datafile_datapack');
-
- if (!Module.preloadResults) Module.preloadResults = {};
-
- Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
- if (fetched) {
- processPackageData(fetched);
- fetched = null;
- } else {
- fetchedCallback = processPackageData;
- }
-
- }
- if (Module['calledRun']) {
- runWithFS();
- } else {
- if (!Module['preRun']) Module['preRun'] = [];
- Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
- }
-
-})();
diff --git a/tools/html_fs/godot.html b/tools/html_fs/godot.html
new file mode 100644
index 000000000..36761deb9
--- /dev/null
+++ b/tools/html_fs/godot.html
@@ -0,0 +1,1317 @@
+
+
+
+
+
+ Emscripten-Generated Code
+
+
+
+
+
+
+
+
+ Downloading...
+
+
+ Resize canvas
+ Lock/hide mouse pointer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/html_fs/godotfs.js b/tools/html_fs/godotfs.js
new file mode 100644
index 000000000..93cc30556
--- /dev/null
+++ b/tools/html_fs/godotfs.js
@@ -0,0 +1,149 @@
+
+var Module;
+if (typeof Module === 'undefined') Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()');
+if (!Module.expectedDataFileDownloads) {
+ Module.expectedDataFileDownloads = 0;
+ Module.finishedDataFileDownloads = 0;
+}
+Module.expectedDataFileDownloads++;
+(function() {
+
+ function fetchRemotePackage(packageName, callback, errback) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', packageName, true);
+ xhr.responseType = 'arraybuffer';
+ xhr.onprogress = function(event) {
+ var url = packageName;
+ if (event.loaded && event.total) {
+ if (!xhr.addedTotal) {
+ xhr.addedTotal = true;
+ if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
+ Module.dataFileDownloads[url] = {
+ loaded: event.loaded,
+ total: event.total
+ };
+ } else {
+ Module.dataFileDownloads[url].loaded = event.loaded;
+ }
+ var total = 0;
+ var loaded = 0;
+ var num = 0;
+ for (var download in Module.dataFileDownloads) {
+ var data = Module.dataFileDownloads[download];
+ total += data.total;
+ loaded += data.loaded;
+ num++;
+ }
+ total = Math.ceil(total * Module.expectedDataFileDownloads/num);
+ if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
+ } else if (!Module.dataFileDownloads) {
+ if (Module['setStatus']) Module['setStatus']('Downloading data...');
+ }
+ };
+ xhr.onload = function(event) {
+ var packageData = xhr.response;
+ callback(packageData);
+ };
+ xhr.send(null);
+ };
+
+ function handleError(error) {
+ console.error('package error:', error);
+ };
+
+ var fetched = null, fetchedCallback = null;
+ fetchRemotePackage('data.pck', function(data) {
+ if (fetchedCallback) {
+ fetchedCallback(data);
+ fetchedCallback = null;
+ } else {
+ fetched = data;
+ }
+ }, handleError);
+
+ function runWithFS() {
+
+function assert(check, msg) {
+ if (!check) throw msg + new Error().stack;
+}
+
+ function DataRequest(start, end, crunched, audio) {
+ this.start = start;
+ this.end = end;
+ this.crunched = crunched;
+ this.audio = audio;
+ }
+ DataRequest.prototype = {
+ requests: {},
+ open: function(mode, name) {
+ this.name = name;
+ this.requests[name] = this;
+ Module['addRunDependency']('fp ' + this.name);
+ },
+ send: function() {},
+ onload: function() {
+ var byteArray = this.byteArray.subarray(this.start, this.end);
+
+ this.finish(byteArray);
+
+ },
+ finish: function(byteArray) {
+ var that = this;
+ Module['FS_createPreloadedFile'](this.name, null, byteArray, true, true, function() {
+ Module['removeRunDependency']('fp ' + that.name);
+ }, function() {
+ if (that.audio) {
+ Module['removeRunDependency']('fp ' + that.name); // workaround for chromium bug 124926 (still no audio with this, but at least we don't hang)
+ } else {
+ Module.printErr('Preloading file ' + that.name + ' failed');
+ }
+ }, false, true); // canOwn this data in the filesystem, it is a slide into the heap that will never change
+ this.requests[this.name] = null;
+ },
+ };
+ new DataRequest(0, $DPLEN, 0, 0).open('GET', '/data.pck');
+
+ var PACKAGE_PATH;
+ if (typeof window === 'object') {
+ PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
+ } else {
+ // worker
+ PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
+ }
+ var PACKAGE_NAME = 'data.pck';
+ var REMOTE_PACKAGE_NAME = 'data.pck';
+ var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e';
+
+ function processPackageData(arrayBuffer) {
+ Module.finishedDataFileDownloads++;
+ assert(arrayBuffer, 'Loading data file failed.');
+ var byteArray = new Uint8Array(arrayBuffer);
+ var curr;
+
+ // Reuse the bytearray from the XHR as the source for file reads.
+ DataRequest.prototype.byteArray = byteArray;
+ DataRequest.prototype.requests["/data.pck"].onload();
+ Module['removeRunDependency']('datafile_datapack');
+
+ };
+ Module['addRunDependency']('datafile_datapack');
+
+ if (!Module.preloadResults) Module.preloadResults = {};
+
+ Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
+ if (fetched) {
+ processPackageData(fetched);
+ fetched = null;
+ } else {
+ fetchedCallback = processPackageData;
+ }
+
+ }
+ if (Module['calledRun']) {
+ runWithFS();
+ } else {
+ if (!Module['preRun']) Module['preRun'] = [];
+ Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
+ }
+
+})();
--
cgit v1.3.1
From fad1faddae96454bbe4abfef1bf394b3d2c9c057 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 13:10:23 -0300
Subject: Removing locatime so this function compiles again. I don't think it
has any practical use anyway.
---
drivers/unix/os_unix.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 05af7ee90..96f90e6be 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -227,8 +227,8 @@ uint64_t OS_Unix::get_system_time_msec() const {
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
//localtime(&tv_now.tv_usec);
- localtime((const long *)&tv_now.tv_usec);
- uint64_t msec = tv_now.tv_usec/1000;
+ //localtime((const long *)&tv_now.tv_usec);
+ uint64_t msec = uint64_t(tv_now.tv_sec)*1000+tv_now.tv_usec/1000;
return msec;
}
--
cgit v1.3.1
From 59e1ad27731e66c58a3d5ee9d783eac74a1d48d9 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 13:27:15 -0300
Subject: disabling theora for now (will be re-written, re-enabled later)
---
platform/iphone/detect.py | 1 +
platform/osx/detect.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index e7a262a2b..3864968d9 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -37,6 +37,7 @@ def get_flags():
return [
('tools', 'no'),
('webp', 'yes'),
+ ("theora","no"),
('openssl','builtin'), #use builtin openssl
]
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 22cee0527..4a20ca80c 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -31,6 +31,7 @@ def get_flags():
('opengl', 'no'),
('legacygl', 'yes'),
('builtin_zlib', 'no'),
+ ("theora","no"),
('freetype','builtin'), #use builtin freetype
]
--
cgit v1.3.1
From b0e5031f1fb417ea087f08649afe9a9fdf072932 Mon Sep 17 00:00:00 2001
From: steve
Date: Thu, 10 Sep 2015 15:01:02 -0700
Subject: ios now displays splash screen between launch image and main scene,
instead of a black screen
---
drivers/gles2/rasterizer_gles2.cpp | 6 ++++++
drivers/gles2/rasterizer_gles2.h | 2 ++
platform/iphone/gl_view.mm | 2 ++
servers/visual/rasterizer.h | 1 +
servers/visual/visual_server_raster.cpp | 2 ++
5 files changed, 13 insertions(+)
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index d3a5f3b5b..ebe0c6196 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -11188,6 +11188,12 @@ RasterizerGLES2::RasterizerGLES2(bool p_compress_arrays,bool p_keep_ram_copy,boo
tc0_idx=0;
};
+void RasterizerGLES2::restore_framebuffer() {
+
+ glBindFramebuffer(GL_FRAMEBUFFER, base_framebuffer);
+
+}
+
RasterizerGLES2::~RasterizerGLES2() {
memdelete_arr(skinned_buffer);
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index d337ecfb6..f759e84b5 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -1695,6 +1695,8 @@ public:
void reload_vram();
virtual bool has_feature(VS::Features p_feature) const;
+
+ virtual void restore_framebuffer();
static RasterizerGLES2* get_singleton();
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 3309fd082..4d5d1b81e 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -345,6 +345,8 @@ static void clear_touches() {
[self destroyFramebuffer];
[self createFramebuffer];
[self drawView];
+ [self drawView];
+
}
- (BOOL)createFramebuffer
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 0b115a4d1..15c757665 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -1022,6 +1022,7 @@ public:
virtual bool has_feature(VS::Features p_feature) const=0;
+ virtual void restore_framebuffer()=0;
virtual int get_render_info(VS::RenderInfo p_info)=0;
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 8b47596d7..155d10d85 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -7427,6 +7427,8 @@ void VisualServerRaster::set_boot_image(const Image& p_image, const Color& p_col
if (p_image.empty())
return;
+ rasterizer->restore_framebuffer();
+
rasterizer->begin_frame();
int window_w = OS::get_singleton()->get_video_mode(0).width;
--
cgit v1.3.1
From 83b69f8fefcc91a1d71b726e7a02623b21386f2b Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 20:30:46 -0300
Subject: remotion of some c++ includes to avoid dependency on libstdc++
---
drivers/convex_decomp/b2Glue.h | 3 ++-
drivers/convex_decomp/b2Polygon.h | 2 +-
platform/javascript/audio_server_javascript.cpp | 11 +++++++----
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/convex_decomp/b2Glue.h b/drivers/convex_decomp/b2Glue.h
index db765f7eb..7ec6d7f18 100644
--- a/drivers/convex_decomp/b2Glue.h
+++ b/drivers/convex_decomp/b2Glue.h
@@ -20,7 +20,8 @@
#define B2GLUE_H
#include "math_2d.h"
-#include
+#include
+
namespace b2ConvexDecomp {
typedef real_t float32;
diff --git a/drivers/convex_decomp/b2Polygon.h b/drivers/convex_decomp/b2Polygon.h
index 82cdc5680..36af2fd9d 100644
--- a/drivers/convex_decomp/b2Polygon.h
+++ b/drivers/convex_decomp/b2Polygon.h
@@ -22,7 +22,7 @@
#include "b2Triangle.h"
#include "stdio.h"
#include
-#include
+#include
namespace b2ConvexDecomp {
static bool B2_POLYGON_REPORT_ERRORS = false;
diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp
index 8fa76d5ae..fd505b8a8 100644
--- a/platform/javascript/audio_server_javascript.cpp
+++ b/platform/javascript/audio_server_javascript.cpp
@@ -626,11 +626,14 @@ void AudioServerJavascript::finish(){
}
void AudioServerJavascript::update(){
- for(List::Element *E=active_audio_streams.front();E;E=E->next()) {
+ for(List::Element *E=active_audio_streams.front();E;) { //stream might be removed durnig this callback
+
+ List::Element *N=E->next();
- if (E->get()->audio_stream ) {
+ if (E->get()->audio_stream)
E->get()->audio_stream->update();
- }
+
+ E=N;
}
}
@@ -653,7 +656,7 @@ int AudioServerJavascript::get_default_mix_rate() const{
void AudioServerJavascript::set_stream_global_volume_scale(float p_volume){
-
+ stream_volume_scale=p_volume;
}
void AudioServerJavascript::set_fx_global_volume_scale(float p_volume){
--
cgit v1.3.1
From 682578f3b307720c4535247cfdc662c0c2fb7114 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 20:53:31 -0300
Subject: more c++ include references removed
---
drivers/convex_decomp/b2Polygon.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp
index 668313967..775f2adfe 100644
--- a/drivers/convex_decomp/b2Polygon.cpp
+++ b/drivers/convex_decomp/b2Polygon.cpp
@@ -21,8 +21,8 @@
#include "b2Triangle.h"
#include "b2Polygon.h"
-#include
-#include
+#include
+#include
#include
#define b2Assert assert
--
cgit v1.3.1
From 751202768c7a396d3f480775225d09d42689b8db Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 21:40:34 -0300
Subject: fix to freetype detection
---
platform/x11/detect.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b8890a3a2..2701a41a5 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -131,8 +131,11 @@ def configure(env):
env.ParseConfig('pkg-config openssl --cflags --libs')
- env.ParseConfig('pkg-config freetype2 --cflags --libs')
- env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
+ if (env["freetype"]=="yes"):
+ env.ParseConfig('pkg-config freetype2 --cflags --libs')
+
+ if (env["freetype"]!="no"):
+ env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
--
cgit v1.3.1
From 56c907ad040b102c1d74d2d54190238989f1a819 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Thu, 10 Sep 2015 22:15:00 -0300
Subject: fix to builtin freetype defines on linux
---
platform/x11/detect.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 2701a41a5..33e8fd03e 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -134,8 +134,14 @@ def configure(env):
if (env["freetype"]=="yes"):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
+
if (env["freetype"]!="no"):
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
+ if (env["freetype"]=="builtin"):
+ env.Append(CPPPATH=['#tools/freetype'])
+ env.Append(CPPPATH=['#tools/freetype/freetype/include'])
+
+
env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
--
cgit v1.3.1
From a88f67821ca828d9b4d3453b19de60e27ab24efc Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Sat, 12 Sep 2015 10:54:47 -0300
Subject: HTML5 exporter seems to be fully functional -user:// filesystem
implemented -default template page could look prettier, help appreciated
---
drivers/unix/file_access_unix.cpp | 6 +++-
drivers/unix/file_access_unix.h | 9 +++++-
platform/javascript/SCsub | 2 +-
platform/javascript/javascript_main.cpp | 57 ++++++++++++++++++++++++++++++---
platform/javascript/os_javascript.cpp | 43 +++++++++++++++++++++++--
platform/javascript/os_javascript.h | 7 +++-
6 files changed, 112 insertions(+), 12 deletions(-)
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 76042089f..8e70ecc93 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -63,7 +63,7 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) {
fclose(f);
f=NULL;
- String path=fix_path(p_path);
+ path=fix_path(p_path);
//printf("opening %ls, %i\n", path.c_str(), Memory::get_static_mem_usage());
ERR_FAIL_COND_V(f,ERR_ALREADY_IN_USE);
@@ -114,6 +114,9 @@ void FileAccessUnix::close() {
return;
fclose(f);
f = NULL;
+ if (close_notification_func) {
+ close_notification_func(path,flags);
+ }
if (save_path!="") {
//unlink(save_path.utf8().get_data());
@@ -240,6 +243,7 @@ FileAccess * FileAccessUnix::create_libc() {
return memnew( FileAccessUnix );
}
+CloseNotificationFunc FileAccessUnix::close_notification_func=NULL;
FileAccessUnix::FileAccessUnix() {
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 5b0f0e7cb..6c41a51ec 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -38,6 +38,10 @@
/**
@author Juan Linietsky
*/
+
+
+typedef void (*CloseNotificationFunc)(const String& p_file,int p_flags);
+
class FileAccessUnix : public FileAccess {
FILE *f;
@@ -45,10 +49,13 @@ class FileAccessUnix : public FileAccess {
void check_errors() const;
mutable Error last_error;
String save_path;
+ String path;
- static FileAccess* create_libc();
+ static FileAccess* create_libc();
public:
+ static CloseNotificationFunc close_notification_func;
+
virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index ac17f68aa..cd96cf4f3 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -17,7 +17,7 @@ javascript_objects=[]
for x in javascript_files:
javascript_objects.append( env_javascript.Object( x ) )
-env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function']\""])
+env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
prog = None
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 9aade8c44..fb87dc848 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -31,7 +31,8 @@
#include "main/main.h"
#include "io/resource_loader.h"
#include "os/keyboard.h"
-
+#include "emscripten.h"
+#include
OS_JavaScript *os=NULL;
@@ -198,15 +199,39 @@ static void _gfx_idle() {
glutPostRedisplay();
}
+int start_step=0;
+
static void _godot_draw(void) {
- os->main_loop_iterate();
+ if (start_step==1) {
+ start_step=2;
+ Main::start();
+ os->main_loop_begin();
+ }
+
+ if (start_step==2) {
+ os->main_loop_iterate();
+ }
+
glutSwapBuffers();
}
+
+
+extern "C" {
+
+void main_after_fs_sync(int value) {
+
+ start_step=1;
+ printf("FS SYNCHED!\n");
+}
+
+}
+
int main(int argc, char *argv[]) {
- /* Initialize the window */
+
+ /* Initialize the window */
printf("let it go!\n");
glutInit(&argc, argv);
os = new OS_JavaScript(_gfx_init,NULL,NULL,NULL,NULL);
@@ -220,7 +245,7 @@ int main(int argc, char *argv[]) {
#endif
ResourceLoader::set_abort_on_missing_resources(false); //ease up compatibility
- Main::start();
+
glutSpecialUpFunc(_glut_skey_up);
glutSpecialFunc(_glut_skey_down);
@@ -238,10 +263,32 @@ int main(int argc, char *argv[]) {
// glutReshapeFunc(gears_reshape);
glutDisplayFunc(_godot_draw);
//glutSpecialFunc(gears_special);
- os->main_loop_begin();
+
+
+
+ //mount persistent filesystem
+ EM_ASM(
+ FS.mkdir('/userfs');
+ FS.mount(IDBFS, {}, '/userfs');
+
+
+
+ // sync from persisted state into memory and then
+ // run the 'test' function
+ FS.syncfs(true, function (err) {
+ assert(!err);
+ console.log("done syncinc!");
+ _after_sync_cb = Module.cwrap('main_after_fs_sync', 'void',['number']);
+ _after_sync_cb(0);
+
+ });
+
+ );
glutMainLoop();
+
+
return 0;
}
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index e18d5d949..ae97bf990 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -37,6 +37,7 @@
#include "main/main.h"
#include "core/globals.h"
+#include "emscripten.h"
int OS_JavaScript::get_video_driver_count() const {
@@ -270,6 +271,32 @@ bool OS_JavaScript::main_loop_iterate() {
if (!main_loop)
return false;
+
+ if (time_to_save_sync>=0) {
+ int64_t newtime = get_ticks_msec();
+ int64_t elapsed = newtime - last_sync_time;
+ last_sync_time=newtime;
+
+ time_to_save_sync-=elapsed;
+
+ print_line("elapsed "+itos(elapsed)+" tts "+itos(time_to_save_sync));
+
+ if (time_to_save_sync<0) {
+ //time to sync, for real
+ // run 'success'
+ print_line("DOING SYNCH!");
+ EM_ASM(
+ FS.syncfs(function (err) {
+ assert(!err);
+ console.log("Synched!");
+ //ccall('success', 'v');
+ });
+ );
+ }
+
+
+ }
+
return Main::iteration();
}
@@ -562,14 +589,21 @@ String OS_JavaScript::get_locale() const {
String OS_JavaScript::get_data_dir() const {
- if (get_data_dir_func)
- return get_data_dir_func();
- return "/";
+ //if (get_data_dir_func)
+ // return get_data_dir_func();
+ return "/userfs";
//return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
};
+void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags) {
+ print_line("close "+p_file+" flags "+itos(p_flags));
+ if (p_file.begins_with("/userfs") && p_flags&FileAccess::WRITE) {
+ static_cast(get_singleton())->last_sync_time=OS::get_singleton()->get_ticks_msec();
+ static_cast(get_singleton())->time_to_save_sync=5000; //five seconds since last save
+ }
+}
OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func) {
@@ -589,6 +623,9 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Ope
open_uri_func=p_open_uri_func;
get_data_dir_func=p_get_data_dir_func;
get_locale_func=p_get_locale_func;
+ FileAccessUnix::close_notification_func=_close_notification_funcs;
+
+ time_to_save_sync=-1;
}
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index d52c465c7..55ac7cdae 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -65,6 +65,9 @@ private:
bool use_gl2;
+ int64_t time_to_save_sync;
+ int64_t last_sync_time;
+
Rasterizer *rasterizer;
VisualServer *visual_server;
AudioServerJavascript *audio_server;
@@ -84,6 +87,8 @@ private:
GetDataDirFunc get_data_dir_func;
GetLocaleFunc get_locale_func;
+ static void _close_notification_funcs(const String& p_file,int p_flags);
+
public:
// functions used by main to initialize/deintialize the OS
@@ -106,7 +111,7 @@ public:
typedef int64_t ProcessID;
- static OS* get_singleton();
+ //static OS* get_singleton();
virtual void vprint(const char* p_format, va_list p_list, bool p_stderr=false);
virtual void print(const char *p_format, ... );
--
cgit v1.3.1
From e5730c1c7c8da29ea85a04daf7479f293329d39c Mon Sep 17 00:00:00 2001
From: romulox_x
Date: Sat, 12 Sep 2015 19:15:02 -0700
Subject: fixed server breaking error in previous splash screen commit
---
servers/visual/rasterizer_dummy.cpp | 3 +++
servers/visual/rasterizer_dummy.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/servers/visual/rasterizer_dummy.cpp b/servers/visual/rasterizer_dummy.cpp
index e32f47b3d..c05438aef 100644
--- a/servers/visual/rasterizer_dummy.cpp
+++ b/servers/visual/rasterizer_dummy.cpp
@@ -1948,6 +1948,9 @@ bool RasterizerDummy::has_feature(VS::Features p_feature) const {
}
+void RasterizerDummy::restore_framebuffer() {
+
+}
RasterizerDummy::RasterizerDummy() {
diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h
index cc3c1724a..9249ad625 100644
--- a/servers/visual/rasterizer_dummy.h
+++ b/servers/visual/rasterizer_dummy.h
@@ -779,6 +779,7 @@ public:
virtual bool has_feature(VS::Features p_feature) const;
+ virtual void restore_framebuffer();
RasterizerDummy();
virtual ~RasterizerDummy();
--
cgit v1.3.1
From 1add3b3daccfd6d8f8f8ab2d0ab8a9795097abf2 Mon Sep 17 00:00:00 2001
From: George Marques
Date: Sun, 13 Sep 2015 16:21:09 -0300
Subject: Set AnimationEditor UndoRedo reference on creation
Fix #2418
---
tools/editor/plugins/animation_player_editor_plugin.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 344e42c13..f8c484e88 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -1393,6 +1393,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor=p_node;
anim_editor = memnew( AnimationPlayerEditor(editor) );
+ anim_editor->set_undo_redo(editor->get_undo_redo());
editor->get_animation_panel()->add_child(anim_editor);
/*
editor->get_viewport()->add_child(anim_editor);
--
cgit v1.3.1
From 2580ca01e6b73a54def5a8f6e61d19509d3278ee Mon Sep 17 00:00:00 2001
From: reduz
Date: Tue, 15 Sep 2015 22:07:03 -0300
Subject: Ability to keep collisionshapes and collisionpolygons when running
the game. Works for 2D and 3D These are still just helpers in case you want
to animate them or access them directly. Modifying the real shapes is still
done via CollisionObject and CollisionObject2D APIs But an API was added so
you can query which shapes from CollisionObject correspond to which
CollisionShape.
Have Fun!
---
demos/2d/dynamic_collision_shapes/ball.gd | 21 ++++
demos/2d/dynamic_collision_shapes/ball.png | Bin 0 -> 321 bytes
demos/2d/dynamic_collision_shapes/ball.scn | Bin 0 -> 1898 bytes
demos/2d/dynamic_collision_shapes/box.png | Bin 0 -> 253 bytes
demos/2d/dynamic_collision_shapes/circle.png | Bin 0 -> 889 bytes
.../2d/dynamic_collision_shapes/dynamic_colobjs.gd | 23 +++++
.../dynamic_collision_shapes/dynamic_colobjs.scn | Bin 0 -> 4348 bytes
demos/2d/dynamic_collision_shapes/engine.cfg | 4 +
demos/2d/dynamic_collision_shapes/poly.png | Bin 0 -> 1638 bytes
demos/2d/isometric/dungeon.scn | Bin 2841 -> 8743 bytes
demos/2d/lights_shadows/light_shadows.scn | Bin 4293 -> 7181 bytes
demos/2d/platformer/stage.xml | 56 +++--------
scene/2d/canvas_item.cpp | 9 ++
scene/2d/canvas_item.h | 7 +-
scene/2d/collision_polygon_2d.cpp | 84 +++++++++++++---
scene/2d/collision_polygon_2d.h | 12 +++
scene/2d/collision_shape_2d.cpp | 64 ++++++++++++-
scene/2d/collision_shape_2d.h | 8 ++
scene/3d/body_shape.cpp | 75 ++++++++++++---
scene/3d/body_shape.h | 14 ++-
scene/3d/collision_polygon.cpp | 106 +++++++++++++++++----
scene/3d/collision_polygon.h | 12 +++
scene/3d/spatial.cpp | 25 +++++
scene/3d/spatial.h | 5 +
scene/register_scene_types.cpp | 10 +-
25 files changed, 434 insertions(+), 101 deletions(-)
create mode 100644 demos/2d/dynamic_collision_shapes/ball.gd
create mode 100644 demos/2d/dynamic_collision_shapes/ball.png
create mode 100644 demos/2d/dynamic_collision_shapes/ball.scn
create mode 100644 demos/2d/dynamic_collision_shapes/box.png
create mode 100644 demos/2d/dynamic_collision_shapes/circle.png
create mode 100644 demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
create mode 100644 demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn
create mode 100644 demos/2d/dynamic_collision_shapes/engine.cfg
create mode 100644 demos/2d/dynamic_collision_shapes/poly.png
diff --git a/demos/2d/dynamic_collision_shapes/ball.gd b/demos/2d/dynamic_collision_shapes/ball.gd
new file mode 100644
index 000000000..c17b20f9c
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/ball.gd
@@ -0,0 +1,21 @@
+
+extends RigidBody2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+var timeout=5
+
+func _process(delta):
+ timeout-=delta
+ if (timeout<1):
+ set_opacity(timeout)
+ if (timeout<0):
+ queue_free()
+func _ready():
+ set_process(true)
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/dynamic_collision_shapes/ball.png b/demos/2d/dynamic_collision_shapes/ball.png
new file mode 100644
index 000000000..b7cf71da2
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/ball.png differ
diff --git a/demos/2d/dynamic_collision_shapes/ball.scn b/demos/2d/dynamic_collision_shapes/ball.scn
new file mode 100644
index 000000000..e332de276
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/ball.scn differ
diff --git a/demos/2d/dynamic_collision_shapes/box.png b/demos/2d/dynamic_collision_shapes/box.png
new file mode 100644
index 000000000..f29b83ce3
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/box.png differ
diff --git a/demos/2d/dynamic_collision_shapes/circle.png b/demos/2d/dynamic_collision_shapes/circle.png
new file mode 100644
index 000000000..9fdfa550b
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/circle.png differ
diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
new file mode 100644
index 000000000..a6a42a191
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
@@ -0,0 +1,23 @@
+
+extends Node2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+const EMIT_INTERVAL=0.1
+var timeout=EMIT_INTERVAL
+
+func _process(delta):
+ timeout-=delta
+ if (timeout<0):
+ timeout=EMIT_INTERVAL
+ var ball = preload("res://ball.scn").instance()
+ ball.set_pos( Vector2(randf() * get_viewport_rect().size.x, 0) )
+ add_child(ball)
+
+func _ready():
+ set_process(true)
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn
new file mode 100644
index 000000000..e6d1ebf9c
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn differ
diff --git a/demos/2d/dynamic_collision_shapes/engine.cfg b/demos/2d/dynamic_collision_shapes/engine.cfg
new file mode 100644
index 000000000..536b75f2f
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Run-Time CollisionShape"
+main_scene="res://dynamic_colobjs.scn"
diff --git a/demos/2d/dynamic_collision_shapes/poly.png b/demos/2d/dynamic_collision_shapes/poly.png
new file mode 100644
index 000000000..49ed55cc7
Binary files /dev/null and b/demos/2d/dynamic_collision_shapes/poly.png differ
diff --git a/demos/2d/isometric/dungeon.scn b/demos/2d/isometric/dungeon.scn
index 64efc257c..e03a3bd3d 100644
Binary files a/demos/2d/isometric/dungeon.scn and b/demos/2d/isometric/dungeon.scn differ
diff --git a/demos/2d/lights_shadows/light_shadows.scn b/demos/2d/lights_shadows/light_shadows.scn
index a13e31376..152f68a40 100644
Binary files a/demos/2d/lights_shadows/light_shadows.scn and b/demos/2d/lights_shadows/light_shadows.scn differ
diff --git a/demos/2d/platformer/stage.xml b/demos/2d/platformer/stage.xml
index 4d6083adf..d081a1be3 100644
--- a/demos/2d/platformer/stage.xml
+++ b/demos/2d/platformer/stage.xml
@@ -1,5 +1,5 @@
-
+
@@ -16,22 +16,12 @@
"conns"
"names"
-
+
"stage"
"Node"
- "_import_path"
"__meta__"
"tile_map"
"TileMap"
- "visibility/visible"
- "visibility/opacity"
- "visibility/self_opacity"
- "visibility/light_mask"
- "transform/pos"
- "transform/rot"
- "transform/scale"
- "z/z"
- "z/relative"
"mode"
"tile_set"
"cell/size"
@@ -49,6 +39,8 @@
"coins"
"coin"
"Area2D"
+ "_import_path"
+ "transform/pos"
"coin 2"
"coin 3"
"coin 4"
@@ -129,14 +121,9 @@
"margin/top"
"margin/right"
"margin/bottom"
- "focus_neighbour/left"
- "focus_neighbour/top"
- "focus_neighbour/right"
- "focus_neighbour/bottom"
"focus/ignore_mouse"
"focus/stop_mouse"
"size_flags/horizontal"
- "size_flags/stretch_ratio"
"range/min"
"range/max"
"range/step"
@@ -145,19 +132,15 @@
"range/exp_edit"
"rounded_values"
"text"
- "align"
- "valign"
"autowrap"
- "uppercase"
"percent_visible"
"node_count"
67
"nodes"
- -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 25, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 8, 14, 2, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 8, 22, 14, 23, 14, 24, 3, 25, 6, 26, 4, 27, 4, 28, 15, 3, 16, 0, 0, 0, 1, 29, -1, 1, 2, 0, 0, 2, 0, 31, 30, 17, 3, 2, 0, 10, 18, 3, 19, 0, 2, 0, 31, 32, 17, 3, 2, 0, 10, 20, 3, 19, 0, 2, 0, 31, 33, 17, 3, 2, 0, 10, 21, 3, 19, 0, 2, 0, 31, 34, 17, 3, 2, 0, 10, 22, 3, 19, 0, 2, 0, 31, 35, 17, 3, 2, 0, 10, 23, 3, 19, 0, 2, 0, 31, 36, 17, 3, 2, 0, 10, 24, 3, 19, 0, 2, 0, 31, 37, 17, 3, 2, 0, 10, 25, 3, 19, 0, 2, 0, 31, 38, 17, 3, 2, 0, 10, 26, 3, 19, 0, 2, 0, 31, 39, 17, 3, 2, 0, 10, 27, 3, 19, 0, 2, 0, 31, 40, 17, 3, 2, 0, 10, 28, 3, 19, 0, 2, 0, 31, 41, 17, 3, 2, 0, 10, 29, 3, 19, 0, 2, 0, 31, 42, 17, 3, 2, 0, 10, 30, 3, 19, 0, 2, 0, 31, 43, 17, 3, 2, 0, 10, 31, 3, 19, 0, 2, 0, 31, 44, 17, 3, 2, 0, 10, 32, 3, 19, 0, 2, 0, 31, 45, 17, 3, 2, 0, 10, 33, 3, 19, 0, 2, 0, 31, 46, 17, 3, 2, 0, 10, 34, 3, 19, 0, 2, 0, 31, 47, 17, 3, 2, 0, 10, 35, 3, 19, 0, 2, 0, 31, 48, 17, 3, 2, 0, 10, 36, 3, 19, 0, 2, 0, 31, 49, 17, 3, 2, 0, 10, 37, 3, 19, 0, 2, 0, 31, 50, 17, 3, 2, 0, 10, 38, 3, 19, 0, 2, 0, 31, 51, 17, 3, 2, 0, 10, 39, 3, 19, 0, 2, 0, 31, 52, 17, 3, 2, 0, 10, 40, 3, 19, 0, 2, 0, 31, 53, 17, 3, 2, 0, 10, 41, 3, 19, 0, 2, 0, 31, 54, 17, 3, 2, 0, 10, 42, 3, 19, 0, 2, 0, 31, 55, 17, 3, 2, 0, 10, 43, 3, 19, 0, 2, 0, 31, 56, 17, 3, 2, 0, 10, 44, 3, 19, 0, 2, 0, 31, 57, 17, 3, 2, 0, 10, 45, 3, 19, 0, 2, 0, 31, 58, 17, 3, 2, 0, 10, 46, 3, 19, 0, 2, 0, 31, 59, 17, 3, 2, 0, 10, 47, 3, 19, 0, 2, 0, 31, 60, 17, 3, 2, 0, 10, 48, 3, 19, 0, 2, 0, 31, 61, 17, 3, 2, 0, 10, 49, 3, 19, 0, 2, 0, 31, 62, 17, 3, 2, 0, 10, 50, 3, 19, 0, 2, 0, 31, 63, 17, 3, 2, 0, 10, 51, 3, 19, 0, 2, 0, 31, 64, 17, 3, 2, 0, 10, 52, 3, 19, 0, 2, 0, 31, 65, 17, 3, 2, 0, 10, 53, 3, 19, 0, 2, 0, 31, 66, 17, 3, 2, 0, 10, 54, 3, 19, 0, 2, 0, 31, 67, 17, 3, 2, 0, 10, 55, 3, 19, 0, 2, 0, 31, 68, 17, 3, 2, 0, 10, 56, 3, 19, 0, 2, 0, 31, 69, 17, 3, 2, 0, 10, 57, 3, 19, 0, 2, 0, 31, 70, 17, 3, 2, 0, 10, 58, 3, 19, 0, 2, 0, 31, 71, 17, 3, 2, 0, 10, 59, 3, 19, 0, 2, 0, 31, 72, 17, 3, 2, 0, 10, 60, 3, 19, 0, 0, 0, 1, 73, -1, 1, 2, 0, 0, 45, 0, 75, 74, 61, 5, 2, 0, 10, 62, 3, 63, 76, 64, 77, 65, 0, 45, 0, 75, 78, 61, 5, 2, 0, 10, 66, 3, 63, 76, 67, 77, 68, 0, 45, 0, 75, 79, 61, 5, 2, 0, 10, 69, 3, 63, 76, 70, 77, 68, 0, 45, 0, 75, 80, 71, 3, 2, 0, 10, 72, 3, 73, 0, 45, 0, 82, 81, 74, 3, 2, 0, 10, 75, 3, 76, 0, 0, 0, 84, 83, 77, 3, 2, 0, 10, 78, 3, 79, 0, 0, 0, 86, 85, -1, 7, 2, 0, 87, 80, 88, 14, 89, 2, 90, 81, 91, 2, 92, 14, 0, 0, 0, 1, 93, -1, 1, 2, 0, 0, 53, 0, 84, 94, 82, 3, 2, 0, 10, 83, 3, 84, 0, 53, 0, 84, 95, 82, 3, 2, 0, 10, 85, 3, 84, 0, 53, 0, 84, 96, 82, 3, 2, 0, 10, 86, 3, 84, 0, 53, 0, 84, 97, 82, 3, 2, 0, 10, 87, 3, 84, 0, 53, 0, 84, 98, 82, 3, 2, 0, 10, 88, 3, 84, 0, 53, 0, 84, 99, 82, 3, 2, 0, 10, 89, 3, 84, 0, 53, 0, 84, 100, 82, 3, 2, 0, 10, 90, 3, 84, 0, 53, 0, 84, 101, 82, 3, 2, 0, 10, 91, 3, 84, 0, 53, 0, 84, 102, 82, 3, 2, 0, 10, 92, 3, 84, 0, 53, 0, 84, 103, 82, 3, 2, 0, 10, 93, 3, 84, 0, 53, 0, 84, 104, 82, 3, 2, 0, 10, 94, 3, 84, 0, 0, 0, 106, 105, 95, 2, 2, 0, 3, 96, 0, 0, 0, 107, 107, -1, 30, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 108, 97, 109, 98, 110, 99, 111, 100, 112, 0, 113, 0, 114, 0, 115, 0, 116, 2, 117, 2, 118, 13, 119, 3, 120, 6, 121, 101, 122, 3, 123, 102, 124, 6, 125, 14, 126, 14, 127, 103, 128, 8, 129, 8, 130, 2, 131, 14, 132, 104, 0
+ -1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 4, 3, -1, 15, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 1, 12, 7, 13, 7, 14, 8, 15, 9, 16, 10, 17, 10, 18, 11, 2, 12, 0, 0, 0, 1, 19, -1, 0, 0, 2, 0, 21, 20, 13, 3, 22, 14, 23, 15, 2, 16, 0, 2, 0, 21, 24, 13, 3, 22, 14, 23, 17, 2, 16, 0, 2, 0, 21, 25, 13, 3, 22, 14, 23, 18, 2, 16, 0, 2, 0, 21, 26, 13, 3, 22, 14, 23, 19, 2, 16, 0, 2, 0, 21, 27, 13, 3, 22, 14, 23, 20, 2, 16, 0, 2, 0, 21, 28, 13, 3, 22, 14, 23, 21, 2, 16, 0, 2, 0, 21, 29, 13, 3, 22, 14, 23, 22, 2, 16, 0, 2, 0, 21, 30, 13, 3, 22, 14, 23, 23, 2, 16, 0, 2, 0, 21, 31, 13, 3, 22, 14, 23, 24, 2, 16, 0, 2, 0, 21, 32, 13, 3, 22, 14, 23, 25, 2, 16, 0, 2, 0, 21, 33, 13, 3, 22, 14, 23, 26, 2, 16, 0, 2, 0, 21, 34, 13, 3, 22, 14, 23, 27, 2, 16, 0, 2, 0, 21, 35, 13, 3, 22, 14, 23, 28, 2, 16, 0, 2, 0, 21, 36, 13, 3, 22, 14, 23, 29, 2, 16, 0, 2, 0, 21, 37, 13, 3, 22, 14, 23, 30, 2, 16, 0, 2, 0, 21, 38, 13, 3, 22, 14, 23, 31, 2, 16, 0, 2, 0, 21, 39, 13, 3, 22, 14, 23, 32, 2, 16, 0, 2, 0, 21, 40, 13, 3, 22, 14, 23, 33, 2, 16, 0, 2, 0, 21, 41, 13, 3, 22, 14, 23, 34, 2, 16, 0, 2, 0, 21, 42, 13, 3, 22, 14, 23, 35, 2, 16, 0, 2, 0, 21, 43, 13, 3, 22, 14, 23, 36, 2, 16, 0, 2, 0, 21, 44, 13, 3, 22, 14, 23, 37, 2, 16, 0, 2, 0, 21, 45, 13, 3, 22, 14, 23, 38, 2, 16, 0, 2, 0, 21, 46, 13, 3, 22, 14, 23, 39, 2, 16, 0, 2, 0, 21, 47, 13, 3, 22, 14, 23, 40, 2, 16, 0, 2, 0, 21, 48, 13, 3, 22, 14, 23, 41, 2, 16, 0, 2, 0, 21, 49, 13, 3, 22, 14, 23, 42, 2, 16, 0, 2, 0, 21, 50, 13, 3, 22, 14, 23, 43, 2, 16, 0, 2, 0, 21, 51, 13, 3, 22, 14, 23, 44, 2, 16, 0, 2, 0, 21, 52, 13, 3, 22, 14, 23, 45, 2, 16, 0, 2, 0, 21, 53, 13, 3, 22, 14, 23, 46, 2, 16, 0, 2, 0, 21, 54, 13, 3, 22, 14, 23, 47, 2, 16, 0, 2, 0, 21, 55, 13, 3, 22, 14, 23, 48, 2, 16, 0, 2, 0, 21, 56, 13, 3, 22, 14, 23, 49, 2, 16, 0, 2, 0, 21, 57, 13, 3, 22, 14, 23, 50, 2, 16, 0, 2, 0, 21, 58, 13, 3, 22, 14, 23, 51, 2, 16, 0, 2, 0, 21, 59, 13, 3, 22, 14, 23, 52, 2, 16, 0, 2, 0, 21, 60, 13, 3, 22, 14, 23, 53, 2, 16, 0, 2, 0, 21, 61, 13, 3, 22, 14, 23, 54, 2, 16, 0, 2, 0, 21, 62, 13, 3, 22, 14, 23, 55, 2, 16, 0, 2, 0, 21, 63, 13, 3, 22, 14, 23, 56, 2, 16, 0, 2, 0, 21, 64, 13, 3, 22, 14, 23, 57, 2, 16, 0, 0, 0, 1, 65, -1, 0, 0, 45, 0, 67, 66, 58, 5, 22, 14, 23, 59, 2, 60, 68, 61, 69, 62, 0, 45, 0, 67, 70, 58, 5, 22, 14, 23, 63, 2, 60, 68, 64, 69, 65, 0, 45, 0, 67, 71, 58, 5, 22, 14, 23, 66, 2, 60, 68, 67, 69, 65, 0, 45, 0, 67, 72, 68, 3, 22, 14, 23, 69, 2, 70, 0, 45, 0, 74, 73, 71, 3, 22, 14, 23, 72, 2, 73, 0, 0, 0, 76, 75, 74, 3, 22, 14, 23, 75, 2, 76, 0, 0, 0, 78, 77, -1, 6, 79, 77, 80, 7, 81, 78, 82, 79, 83, 78, 84, 7, 0, 0, 0, 1, 85, -1, 0, 0, 53, 0, 76, 86, 80, 3, 22, 14, 23, 81, 2, 82, 0, 53, 0, 76, 87, 80, 3, 22, 14, 23, 83, 2, 82, 0, 53, 0, 76, 88, 80, 3, 22, 14, 23, 84, 2, 82, 0, 53, 0, 76, 89, 80, 3, 22, 14, 23, 85, 2, 82, 0, 53, 0, 76, 90, 80, 3, 22, 14, 23, 86, 2, 82, 0, 53, 0, 76, 91, 80, 3, 22, 14, 23, 87, 2, 82, 0, 53, 0, 76, 92, 80, 3, 22, 14, 23, 88, 2, 82, 0, 53, 0, 76, 93, 80, 3, 22, 14, 23, 89, 2, 82, 0, 53, 0, 76, 94, 80, 3, 22, 14, 23, 90, 2, 82, 0, 53, 0, 76, 95, 80, 3, 22, 14, 23, 91, 2, 82, 0, 53, 0, 76, 96, 80, 3, 22, 14, 23, 92, 2, 82, 0, 0, 0, 98, 97, 93, 2, 22, 14, 2, 94, 0, 0, 0, 99, 99, -1, 17, 100, 95, 101, 96, 102, 97, 103, 98, 104, 78, 105, 78, 106, 6, 107, 9, 108, 99, 109, 8, 110, 100, 111, 9, 112, 7, 113, 7, 114, 101, 115, 78, 116, 102, 0
"variants"
-
- ""
+
"__editor_plugin_screen__"
"2D"
@@ -166,7 +149,7 @@
"2D"
"ofs"
- 328.379, 822.226
+ -70.6559, 735.599
"snap_grid"
False
"snap_offset"
@@ -186,7 +169,7 @@
"snap_step"
10, 10
"zoom"
- 1.108032
+ 0.663419
"3D"
@@ -280,18 +263,6 @@
"znear"
0.1
- "Script"
-
- "current"
- 0
- "sources"
-
- "res://moving_platform.gd"
- "res://enemy.gd"
- "res://player.gd"
- "res://coin.gd"
-
-
"__editor_run_settings__"
@@ -301,12 +272,6 @@
0
- True
- 1
- 1
- 0, 0
- 0
- 1, 1
0
64, 64
@@ -314,12 +279,16 @@
1, 0, 0, 1, 0, 0
2
False
+ 1
+ 0
+ 1
0, 2, 70, 536870914, 71, 10, 72, 10, 73, 10, 74, 10, 75, 10, 76, 10, 77, 10, 78, 10, 65536, 2, 65606, 536870914, 65607, 10, 65608, 10, 65609, 10, 65610, 10, 65611, 10, 65612, 10, 65613, 10, 65614, 10, 131072, 2, 131142, 536870914, 131143, 10, 131144, 10, 131145, 10, 131146, 10, 131147, 10, 131148, 10, 131149, 10, 131150, 10, 196608, 2, 196626, 9, 196678, 536870914, 196679, 10, 196680, 10, 196681, 10, 196682, 10, 196683, 10, 196684, 10, 196685, 10, 196686, 10, 262144, 2, 262162, 8, 262214, 536870914, 262215, 10, 262216, 10, 262217, 10, 262218, 10, 262219, 10, 262220, 10, 262221, 10, 262222, 10, 327680, 2, 327697, 536870921, 327698, 7, 327733, 9, 327750, 536870914, 327751, 10, 327752, 10, 327753, 10, 327754, 10, 327755, 10, 327756, 10, 327757, 10, 327758, 10, 393216, 2, 393233, 536870920, 393234, 7, 393257, 9, 393269, 7, 393286, 536870914, 393287, 10, 393288, 10, 393289, 10, 393290, 10, 393291, 10, 393292, 10, 393293, 10, 393294, 10, 458752, 2, 458769, 7, 458770, 8, 458790, 9, 458793, 8, 458805, 8, 458822, 536870914, 458823, 10, 458824, 10, 458825, 10, 458826, 10, 458827, 10, 458828, 10, 458829, 10, 458830, 10, 524288, 4, 524289, 1, 524304, 536870913, 524305, 536870918, 524306, 6, 524307, 5, 524308, 1, 524326, 8, 524329, 7, 524341, 7, 524358, 536870914, 524359, 10, 524360, 10, 524361, 10, 524362, 10, 524363, 10, 524364, 10, 524365, 10, 524366, 10, 589824, 10, 589825, 13, 589840, 536870914, 589841, 10, 589842, 10, 589843, 10, 589844, 2, 589862, 7, 589865, 7, 589876, 536870913, 589877, 6, 589878, 1, 589894, 536870914, 589895, 10, 589896, 10, 589897, 10, 589898, 10, 589899, 10, 589900, 10, 589901, 10, 589902, 10, 655360, 2, 655376, 536870914, 655377, 10, 655378, 10, 655379, 10, 655380, 2, 655398, 7, 655401, 8, 655412, 536870925, 655413, 11, 655414, 13, 655430, 536870914, 655431, 10, 655432, 10, 655433, 10, 655434, 10, 655435, 10, 655436, 10, 655437, 10, 655438, 10, 720896, 2, 720912, 536870914, 720913, 10, 720914, 10, 720915, 10, 720916, 2, 720934, 8, 720937, 7, 720958, 536870913, 720959, 5, 720960, 536870917, 720961, 5, 720962, 5, 720963, 536870917, 720964, 5, 720965, 0, 720966, 536870916, 720967, 10, 720968, 10, 720969, 10, 720970, 10, 720971, 10, 720972, 10, 720973, 10, 720974, 10, 786432, 2, 786437, 9, 786448, 536870914, 786449, 10, 786450, 10, 786451, 10, 786452, 2, 786464, 536870913, 786465, 1, 786470, 7, 786473, 7, 786474, 536870924, 786475, 1, 786494, 536870914, 786495, 10, 786496, 10, 786497, 10, 786498, 10, 786499, 10, 786500, 10, 786501, 10, 786502, 10, 786503, 10, 786504, 10, 786505, 10, 786506, 10, 786507, 10, 786508, 10, 786509, 10, 851968, 2, 851973, 7, 851984, 536870914, 851985, 10, 851986, 10, 851987, 10, 851988, 2, 851996, 536870913, 851997, 1, 852000, 536870914, 852001, 3, 852006, 7, 852009, 536870913, 852011, 2, 852030, 536870914, 852031, 10, 852032, 10, 852033, 10, 852034, 10, 852035, 10, 852036, 10, 852037, 10, 852038, 10, 852039, 10, 852040, 10, 852041, 10, 852042, 10, 852043, 10, 852044, 10, 852045, 10, 917504, 2, 917506, 9, 917509, 7, 917512, 536870921, 917520, 536870925, 917521, 11, 917522, 11, 917523, 11, 917524, 13, 917532, 536870925, 917533, 13, 917536, 536870914, 917537, 4, 917538, 1, 917540, 536870913, 917541, 0, 917542, 1, 917545, 536870914, 917546, 10, 917547, 4, 917548, 1, 917566, 536870914, 917567, 10, 917568, 10, 917569, 10, 917570, 10, 917571, 10, 917572, 10, 917573, 10, 917574, 10, 917575, 10, 917576, 10, 917577, 10, 917578, 10, 917579, 10, 917580, 10, 917581, 10, 983040, 2, 983042, 7, 983045, 7, 983048, 536870920, 983050, 536870913, 983051, 0, 983052, 1, 983064, 536870913, 983065, 1, 983072, 536870914, 983073, 10, 983074, 4, 983075, 0, 983076, 536870916, 983077, 10, 983078, 4, 983079, 536870912, 983080, 536870912, 983081, 536870916, 983082, 10, 983083, 10, 983084, 2, 983095, 9, 983102, 536870914, 983103, 10, 983104, 10, 983105, 10, 983106, 10, 983107, 10, 983108, 10, 983109, 10, 983110, 10, 983111, 10, 983112, 10, 983113, 10, 983114, 10, 983115, 10, 983116, 10, 983117, 10, 1048576, 2, 1048578, 8, 1048581, 8, 1048584, 536870919, 1048586, 536870914, 1048587, 536870922, 1048588, 2, 1048600, 536870925, 1048601, 13, 1048604, 9, 1048608, 536870925, 1048609, 536870923, 1048610, 536870923, 1048611, 536870923, 1048612, 10, 1048613, 10, 1048614, 10, 1048615, 10, 1048616, 10, 1048617, 10, 1048618, 10, 1048619, 10, 1048620, 4, 1048621, 1, 1048630, 536870921, 1048631, 8, 1048638, 536870914, 1048639, 10, 1048640, 10, 1048641, 10, 1048642, 10, 1048643, 10, 1048644, 10, 1048645, 10, 1048646, 10, 1048647, 10, 1048648, 10, 1048649, 10, 1048650, 10, 1048651, 10, 1048652, 10, 1048653, 10, 1114112, 4, 1114113, 0, 1114114, 6, 1114115, 0, 1114116, 0, 1114117, 6, 1114118, 1, 1114120, 536870920, 1114122, 536870925, 1114123, 11, 1114124, 13, 1114128, 536870913, 1114129, 5, 1114130, 536870917, 1114131, 5, 1114132, 0, 1114133, 1, 1114140, 7, 1114141, 536870921, 1114148, 536870914, 1114149, 10, 1114150, 10, 1114151, 10, 1114152, 10, 1114153, 10, 1114154, 10, 1114155, 10, 1114156, 10, 1114157, 2, 1114166, 536870920, 1114167, 8, 1114174, 536870914, 1114175, 10, 1114176, 10, 1114177, 10, 1114178, 10, 1114179, 10, 1114180, 10, 1114181, 10, 1114182, 10, 1114183, 10, 1114184, 10, 1114185, 10, 1114186, 10, 1114187, 10, 1114188, 10, 1179648, 10, 1179649, 10, 1179650, 10, 1179651, 10, 1179652, 10, 1179653, 10, 1179654, 2, 1179656, 536870919, 1179663, 536870915, 1179665, 10, 1179666, 10, 1179667, 10, 1179668, 10, 1179669, 4, 1179670, 12, 1179675, 9, 1179676, 8, 1179677, 8, 1179684, 536870914, 1179685, 10, 1179686, 10, 1179687, 10, 1179688, 10, 1179689, 10, 1179690, 10, 1179691, 10, 1179692, 10, 1179693, 4, 1179694, 1, 1179701, 9, 1179702, 536870919, 1179703, 7, 1179710, 536870914, 1179711, 10, 1179712, 10, 1179713, 10, 1179714, 10, 1179715, 10, 1179716, 10, 1179717, 10, 1179718, 10, 1179719, 10, 1179720, 10, 1179721, 10, 1179722, 10, 1245184, 10, 1245185, 10, 1245186, 10, 1245187, 10, 1245188, 10, 1245189, 10, 1245190, 2, 1245192, 536870919, 1245199, 536870913, 1245200, 536870916, 1245201, 10, 1245202, 10, 1245203, 10, 1245204, 10, 1245205, 10, 1245207, 1, 1245211, 7, 1245212, 7, 1245213, 536870920, 1245220, 536870914, 1245221, 10, 1245222, 10, 1245223, 10, 1245224, 10, 1245225, 10, 1245226, 10, 1245227, 10, 1245228, 10, 1245229, 10, 1245230, 2, 1245237, 8, 1245238, 536870919, 1245239, 8, 1245240, 536870921, 1245246, 536870914, 1245247, 10, 1245248, 10, 1245249, 10, 1245250, 10, 1245251, 10, 1245252, 10, 1245253, 10, 1245254, 10, 1245255, 10, 1245256, 10, 1245257, 10, 1245258, 10, 1310720, 10, 1310721, 10, 1310722, 10, 1310723, 10, 1310724, 10, 1310725, 10, 1310726, 2, 1310728, 536870920, 1310730, 536870913, 1310731, 1, 1310734, 536870913, 1310735, 536870916, 1310736, 10, 1310737, 10, 1310738, 10, 1310739, 10, 1310740, 10, 1310741, 10, 1310742, 10, 1310743, 4, 1310744, 1, 1310747, 8, 1310748, 7, 1310749, 536870919, 1310756, 536870914, 1310757, 10, 1310758, 10, 1310759, 10, 1310760, 10, 1310761, 10, 1310762, 10, 1310763, 10, 1310764, 10, 1310765, 10, 1310766, 4, 1310767, 5, 1310768, 12, 1310773, 7, 1310774, 536870919, 1310775, 7, 1310776, 536870919, 1310782, 536870914, 1310783, 10, 1310784, 10, 1310785, 10, 1310786, 10, 1310787, 10, 1310788, 10, 1310789, 10, 1310790, 10, 1310791, 10, 1310792, 10, 1310793, 10, 1376256, 10, 1376257, 10, 1376258, 10, 1376259, 10, 1376260, 10, 1376261, 10, 1376262, 4, 1376263, 0, 1376264, 0, 1376265, 0, 1376266, 536870916, 1376267, 4, 1376268, 0, 1376269, 0, 1376270, 536870916, 1376271, 10, 1376272, 10, 1376273, 10, 1376274, 10, 1376275, 10, 1376276, 10, 1376277, 10, 1376278, 10, 1376279, 10, 1376280, 4, 1376281, 12, 1376283, 8, 1376284, 8, 1376285, 536870920, 1376287, 536870924, 1376288, 0, 1376289, 5, 1376290, 536870917, 1376291, 0, 1376292, 536870916, 1376293, 10, 1376294, 10, 1376295, 10, 1376296, 10, 1376297, 10, 1376298, 10, 1376299, 10, 1376300, 10, 1376301, 10, 1376302, 10, 1376303, 10, 1376305, 12, 1376309, 7, 1376310, 536870920, 1376311, 7, 1376312, 536870920, 1376318, 536870914, 1376319, 10, 1376320, 10, 1376321, 10, 1376322, 10, 1376323, 10, 1376324, 10, 1376325, 10, 1376326, 10, 1376327, 10, 1376328, 10, 1441792, 10, 1441793, 10, 1441794, 10, 1441795, 10, 1441796, 10, 1441797, 10, 1441798, 10, 1441799, 10, 1441800, 10, 1441801, 10, 1441802, 10, 1441803, 10, 1441804, 10, 1441805, 10, 1441806, 10, 1441807, 10, 1441808, 10, 1441809, 10, 1441810, 10, 1441811, 10, 1441812, 10, 1441813, 10, 1441814, 10, 1441815, 10, 1441816, 10, 1441818, 0, 1441819, 6, 1441820, 6, 1441821, 536870918, 1441822, 5, 1441824, 10, 1441825, 10, 1441826, 10, 1441827, 10, 1441828, 10, 1441829, 10, 1441830, 10, 1441831, 10, 1441832, 10, 1441833, 10, 1441834, 10, 1441835, 10, 1441836, 10, 1441837, 10, 1441838, 10, 1441839, 10, 1441840, 10, 1441842, 0, 1441843, 0, 1441844, 0, 1441845, 6, 1441846, 536870918, 1441847, 6, 1441848, 536870918, 1441849, 0, 1441850, 5, 1441851, 536870917, 1441852, 5, 1441853, 0, 1441854, 536870916, 1441855, 10, 1441856, 10, 1441857, 10, 1441858, 10, 1441859, 10, 1441860, 10, 1441861, 10, 1441862, 10, 1441863, 10, 1507328, 10, 1507329, 10, 1507330, 10, 1507331, 10, 1507332, 10, 1507333, 10, 1507334, 10, 1507335, 10, 1507336, 10, 1507337, 10, 1507338, 10, 1507339, 10, 1507340, 10, 1507341, 10, 1507342, 10, 1507343, 10, 1507344, 10, 1507345, 10, 1507346, 10, 1507347, 10, 1507348, 10, 1507349, 10, 1507350, 10, 1507351, 10, 1507352, 10, 1507353, 10, 1507354, 10, 1507355, 10, 1507356, 10, 1507357, 10, 1507358, 10, 1507359, 10, 1507360, 10, 1507361, 10, 1507362, 10, 1507363, 10, 1507364, 10, 1507365, 10, 1507366, 10, 1507367, 10, 1507368, 10, 1507369, 10, 1507370, 10, 1507371, 10, 1507372, 10, 1507373, 10, 1507374, 10, 1507375, 10, 1507376, 10, 1507377, 10, 1507378, 10, 1507379, 10, 1507380, 10, 1507381, 10, 1507382, 10, 1507383, 10, 1507384, 10, 1507385, 10, 1507386, 10, 1507387, 10, 1507388, 10, 1507389, 10, 1507390, 10, 1507391, 10, 1507392, 10, 1507393, 10, 1507394, 10, 1507395, 10, 1507396, 10, 1507397, 10, 1507398, 10, 1507399, 10, 1572864, 10, 1572865, 10, 1572866, 10, 1572867, 10, 1572868, 10, 1572869, 10, 1572870, 10, 1572871, 10, 1572872, 10, 1572873, 10, 1572874, 10, 1572875, 10, 1572876, 10, 1572877, 10, 1572878, 10, 1572879, 10, 1572880, 10, 1572881, 10, 1572882, 10, 1572883, 10, 1572884, 10, 1572885, 10, 1572886, 10, 1572887, 10, 1572888, 10, 1572889, 10, 1572890, 10, 1572891, 10, 1572892, 10, 1572893, 10, 1572894, 10, 1572895, 10, 1572896, 10, 1572897, 10, 1572898, 10, 1572899, 10, 1572900, 10, 1572901, 10, 1572902, 10, 1572903, 10, 1572904, 10, 1572905, 10, 1572906, 10, 1572907, 10, 1572908, 10, 1572909, 10, 1572910, 10, 1572911, 10, 1572912, 10, 1572913, 10, 1572914, 10, 1572915, 10, 1572916, 10, 1572917, 10, 1572918, 10, 1572919, 10, 1572920, 10, 1572921, 10, 1572922, 10, 1572923, 10, 1572924, 10, 1572925, 10, 1572926, 10, 1572927, 10, 1572928, 10, 1572929, 10, 1572930, 10, 1572931, 10, 1572932, 10, 1572933, 10, 1572934, 10, 1572935, 10, 1638400, 10, 1638401, 10, 1638402, 10, 1638403, 10, 1638404, 10, 1638405, 10, 1638406, 10, 1638407, 10, 1638408, 10, 1638409, 10, 1638410, 10, 1638411, 10, 1638412, 10, 1638413, 10, 1638414, 10, 1638415, 10, 1638416, 10, 1638417, 10, 1638418, 10, 1638419, 10, 1638420, 10, 1638421, 10, 1638422, 10, 1638423, 10, 1638424, 10, 1638425, 10, 1638426, 10, 1638427, 10, 1638428, 10, 1638429, 10, 1638430, 10, 1638431, 10, 1638432, 10, 1638433, 10, 1638434, 10, 1638435, 10, 1638436, 10, 1638437, 10, 1638438, 10, 1638439, 10, 1638440, 10, 1638441, 10, 1638442, 10, 1638443, 10, 1638444, 10, 1638445, 10, 1638446, 10, 1638447, 10, 1638448, 10, 1638449, 10, 1638450, 10, 1638451, 10, 1638452, 10, 1638453, 10, 1638454, 10, 1638455, 10, 1638456, 10, 1638457, 10, 1638458, 10, 1638459, 10, 1638460, 10, 1638461, 10, 1638462, 10, 1638463, 10, 1638464, 10, 1638465, 10, 1638466, 10, 1638467, 10, 1638468, 10, 1638469, 10, 1638470, 10, 1638471, 10, 1703952, 10, 1703953, 10, 1703954, 10, 1703955, 10, 1703956, 10, 1703957, 10, 1703958, 10, 1703959, 10, 1703960, 10, 1703961, 10, 1703962, 10, 1703963, 10, 1703964, 10, 1703965, 10, 1703966, 10, 1703967, 10, 1703968, 10, 1703969, 10, 1703970, 10, 1703971, 10, 1703972, 10, 1703973, 10, 1703974, 10, 1703975, 10, 1703976, 10, 1703977, 10, 1703978, 10, 1703979, 10, 1703980, 10, 1703981, 10, 1703982, 10, 1703983, 10, 1703984, 10, 1703985, 10, 1703986, 10, 1703987, 10, 1703988, 10, 1703989, 10, 1703990, 10, 1703991, 10, 1703992, 10, 1703993, 10, 1703994, 10, 1703995, 10, 1703996, 10, 1703997, 10, 1703998, 10, 1703999, 10, 1704000, 10, 1704001, 10, 1704002, 10, 1704003, 10, 1704004, 10, 1704005, 10, 1704006, 10, 1704007, 10, 1769488, 10, 1769489, 10, 1769490, 10, 1769491, 10, 1769492, 10, 1769493, 10, 1769494, 10, 1769495, 10, 1769496, 10, 1769497, 10, 1769498, 10, 1769499, 10, 1769500, 10, 1769501, 10, 1769502, 10, 1769503, 10, 1769504, 10, 1769505, 10, 1769506, 10, 1769507, 10, 1769508, 10, 1769509, 10, 1769510, 10, 1769511, 10, 1769512, 10, 1769513, 10, 1769514, 10, 1769515, 10, 1769516, 10, 1769517, 10, 1769518, 10, 1769519, 10, 1769520, 10, 1769521, 10, 1769522, 10, 1769523, 10, 1769524, 10, 1769525, 10, 1769526, 10, 1769527, 10, 1769528, 10, 1769529, 10, 1769530, 10, 1769531, 10, 1769532, 10, 1769533, 10, 1769534, 10, 1769535, 10, 1769536, 10, 1769537, 10, 1769538, 10, 1769539, 10, 1769540, 10, 1769541, 10
"_edit_lock_"
True
+ ""
672, 1179
"__editor_plugin_screen__"
@@ -957,6 +926,7 @@
+ True
2
834.664, 1309.6
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 92d5088b8..49229ba50 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1172,6 +1172,14 @@ Matrix32 CanvasItem::get_viewport_transform() const {
}
+void CanvasItem::set_notify_local_transform(bool p_enable) {
+ notify_local_transform=p_enable;
+}
+
+bool CanvasItem::is_local_transform_notification_enabled() const {
+ return notify_local_transform;
+}
+
CanvasItem::CanvasItem() : xform_change(this) {
@@ -1191,6 +1199,7 @@ CanvasItem::CanvasItem() : xform_change(this) {
canvas_layer=NULL;
use_parent_material=false;
global_invalid=true;
+ notify_local_transform=false;
light_mask=1;
C=NULL;
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 6d8308dbe..4885256c6 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -126,6 +126,7 @@ private:
bool block_transform_notify;
bool behind;
bool use_parent_material;
+ bool notify_local_transform;
Ref material;
@@ -155,7 +156,7 @@ private:
protected:
- _FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); }
+ _FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify && notify_local_transform) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); }
void item_rect_changed();
@@ -263,6 +264,10 @@ public:
Vector2 get_global_mouse_pos() const;
Vector2 get_local_mouse_pos() const;
+ void set_notify_local_transform(bool p_enable);
+ bool is_local_transform_notification_enabled() const;
+
+
CanvasItem();
~CanvasItem();
};
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index ceea41d1c..8a5e2f51d 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -33,7 +33,7 @@
void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) {
- if (unparenting)
+ if (unparenting || !can_update_body)
return;
CollisionObject2D *co = p_obj->cast_to();
@@ -49,6 +49,7 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) {
//here comes the sun, lalalala
//decompose concave into multiple convex polygons and add them
Vector< Vector > decomp = Geometry::decompose_polygon(polygon);
+ shape_from=co->get_shape_count();
for(int i=0;i convex = memnew( ConvexPolygonShape2D );
convex->set_points(decomp[i]);
@@ -57,6 +58,11 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) {
co->set_shape_as_trigger(co->get_shape_count()-1,true);
}
+ shape_to=co->get_shape_count()-1;
+ if (shape_toset_shape_as_trigger(co->get_shape_count()-1,true);
+ shape_from=co->get_shape_count()-1;
+ shape_to=co->get_shape_count()-1;
+
}
@@ -86,6 +95,8 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) {
void CollisionPolygon2D::_update_parent() {
+ if (!can_update_body)
+ return;
Node *parent = get_parent();
if (!parent)
return;
@@ -101,12 +112,24 @@ void CollisionPolygon2D::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_ENTER_TREE: {
unparenting=false;
+ can_update_body=get_tree()->is_editor_hint();
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+ can_update_body=false;
} break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (!is_inside_tree())
break;
- _update_parent();
+ if (can_update_body) {
+ _update_parent();
+ } else if (shape_from>=0 && shape_to>=0) {
+ CollisionObject2D *co = get_parent()->cast_to();
+ for(int i=shape_from;i<=shape_to;i++) {
+ co->set_shape_transform(i,get_transform());
+ }
+ }
+
} break;
@@ -141,20 +164,22 @@ void CollisionPolygon2D::set_polygon(const Vector& p_polygon) {
polygon=p_polygon;
- for(int i=0;i=0 && shape_to>=0) {
+ CollisionObject2D *co = get_parent()->cast_to();
+ for(int i=shape_from;i<=shape_to;i++) {
+ co->set_shape_as_trigger(i,p_trigger);
+ }
+
+ }
}
bool CollisionPolygon2D::is_trigger() const{
@@ -192,6 +224,17 @@ bool CollisionPolygon2D::is_trigger() const{
}
+void CollisionPolygon2D::_set_shape_range(const Vector2& p_range) {
+
+ shape_from=p_range.x;
+ shape_to=p_range.y;
+}
+
+Vector2 CollisionPolygon2D::_get_shape_range() const {
+
+ return Vector2(shape_from,shape_to);
+}
+
void CollisionPolygon2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon2D::_add_to_collision_object);
@@ -204,9 +247,17 @@ void CollisionPolygon2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_trigger"),&CollisionPolygon2D::set_trigger);
ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionPolygon2D::is_trigger);
+ ObjectTypeDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon2D::_set_shape_range);
+ ObjectTypeDB::bind_method(_MD("_get_shape_range"),&CollisionPolygon2D::_get_shape_range);
+
+ ObjectTypeDB::bind_method(_MD("get_collision_object_first_shape"),&CollisionPolygon2D::get_collision_object_first_shape);
+ ObjectTypeDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon2D::get_collision_object_last_shape);
+
ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Segments"),_SCS("set_build_mode"),_SCS("get_build_mode"));
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon"));
+ ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger"));
+
}
CollisionPolygon2D::CollisionPolygon2D() {
@@ -215,6 +266,9 @@ CollisionPolygon2D::CollisionPolygon2D() {
build_mode=BUILD_SOLIDS;
trigger=false;
unparenting=false;
-
+ shape_from=-1;
+ shape_to=-1;
+ can_update_body=false;
+ set_notify_local_transform(true);
}
diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h
index 4e7886808..4bc9713c8 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -56,6 +56,14 @@ protected:
void _add_to_collision_object(Object *p_obj);
void _update_parent();
+ bool can_update_body;
+ int shape_from;
+ int shape_to;
+
+ void _set_shape_range(const Vector2& p_range);
+ Vector2 _get_shape_range() const;
+
+
protected:
void _notification(int p_what);
@@ -72,6 +80,10 @@ public:
Vector get_polygon() const;
virtual Rect2 get_item_rect() const;
+
+ int get_collision_object_first_shape() const { return shape_from; }
+ int get_collision_object_last_shape() const { return shape_to; }
+
CollisionPolygon2D();
};
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 5012c54b1..a0a015a99 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -44,10 +44,12 @@ void CollisionShape2D::_add_to_collision_object(Object *p_obj) {
CollisionObject2D *co = p_obj->cast_to();
ERR_FAIL_COND(!co);
+ update_shape_index=co->get_shape_count();
co->add_shape(shape,get_transform());
if (trigger)
co->set_shape_as_trigger(co->get_shape_count()-1,true);
+
}
void CollisionShape2D::_shape_changed() {
@@ -74,12 +76,27 @@ void CollisionShape2D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
unparenting=false;
+ can_update_body=get_tree()->is_editor_hint();
+
} break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (!is_inside_tree())
break;
- _update_parent();
+ if (can_update_body) {
+ _update_parent();
+ } else if (update_shape_index>=0){
+
+ CollisionObject2D *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape_transform(update_shape_index,get_transform());
+ }
+
+ }
+
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+ can_update_body=false;
} break;
/*
@@ -92,6 +109,9 @@ void CollisionShape2D::_notification(int p_what) {
} break;*/
case NOTIFICATION_DRAW: {
+ if (!get_tree()->is_editor_hint())
+ return;
+
rect=Rect2();
Color draw_col=Color(0,0.6,0.7,0.5);
@@ -209,7 +229,14 @@ void CollisionShape2D::set_shape(const Ref& p_shape) {
shape->disconnect("changed",this,"_shape_changed");
shape=p_shape;
update();
- _update_parent();
+ if (is_inside_tree() && can_update_body)
+ _update_parent();
+ if (is_inside_tree() && !can_update_body && update_shape_index>=0) {
+ CollisionObject2D *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape(update_shape_index,p_shape);
+ }
+ }
if (shape.is_valid())
shape->connect("changed",this,"_shape_changed");
@@ -228,7 +255,14 @@ Rect2 CollisionShape2D::get_item_rect() const {
void CollisionShape2D::set_trigger(bool p_trigger) {
trigger=p_trigger;
- _update_parent();
+ if (can_update_body) {
+ _update_parent();
+ } else if (is_inside_tree() && update_shape_index>=0){
+ CollisionObject2D *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape_as_trigger(update_shape_index,p_trigger);
+ }
+ }
}
bool CollisionShape2D::is_trigger() const{
@@ -236,6 +270,19 @@ bool CollisionShape2D::is_trigger() const{
return trigger;
}
+
+void CollisionShape2D::_set_update_shape_index(int p_index) {
+
+
+ update_shape_index=p_index;
+}
+
+int CollisionShape2D::_get_update_shape_index() const{
+
+ return update_shape_index;
+}
+
+
void CollisionShape2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_shape","shape"),&CollisionShape2D::set_shape);
@@ -245,14 +292,23 @@ void CollisionShape2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_trigger","enable"),&CollisionShape2D::set_trigger);
ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionShape2D::is_trigger);
+ ObjectTypeDB::bind_method(_MD("_set_update_shape_index","index"),&CollisionShape2D::_set_update_shape_index);
+ ObjectTypeDB::bind_method(_MD("_get_update_shape_index"),&CollisionShape2D::_get_update_shape_index);
+
+ ObjectTypeDB::bind_method(_MD("get_collision_object_shape_index"),&CollisionShape2D::get_collision_object_shape_index);
+
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D"),_SCS("set_shape"),_SCS("get_shape"));
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger"));
+ ADD_PROPERTY( PropertyInfo( Variant::INT, "_update_shape_index", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR), _SCS("_set_update_shape_index"), _SCS("_get_update_shape_index"));
+
}
CollisionShape2D::CollisionShape2D() {
rect=Rect2(-Point2(10,10),Point2(20,20));
-
+ set_notify_local_transform(true);
trigger=false;
unparenting = false;
+ can_update_body = false;
+ update_shape_index=-1;
}
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index 507912d31..82e113717 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -39,7 +39,13 @@ class CollisionShape2D : public Node2D {
Rect2 rect;
bool trigger;
bool unparenting;
+ bool can_update_body;
void _shape_changed();
+ int update_shape_index;
+
+ void _set_update_shape_index(int p_index);
+ int _get_update_shape_index() const;
+
protected:
void _update_parent();
@@ -55,6 +61,8 @@ public:
void set_trigger(bool p_trigger);
bool is_trigger() const;
+ int get_collision_object_shape_index() const { return _get_update_shape_index(); }
+
CollisionShape2D();
};
diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp
index c49d1b028..709a79a5f 100644
--- a/scene/3d/body_shape.cpp
+++ b/scene/3d/body_shape.cpp
@@ -43,7 +43,10 @@
void CollisionShape::_update_body() {
-
+ if (!get_tree() || !can_update_body)
+ return;
+ if (!get_tree()->is_editor_hint())
+ return;
if (get_parent() && get_parent()->cast_to())
get_parent()->cast_to()->_update_shapes_from_children();
@@ -310,10 +313,13 @@ void CollisionShape::_add_to_collision_object(Object* p_cshape) {
if (shape.is_valid()) {
+ update_shape_index=co->get_shape_count();
co->add_shape(shape,get_transform());
- if (trigger)
- co->set_shape_as_trigger( co->get_shape_count() -1, true );
- }
+ if (trigger)
+ co->set_shape_as_trigger( co->get_shape_count() -1, true );
+ } else {
+ update_shape_index=-1;
+ }
}
void CollisionShape::_notification(int p_what) {
@@ -322,12 +328,14 @@ void CollisionShape::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
unparenting=false;
+ can_update_body=get_tree()->is_editor_hint();
+ set_notify_local_transform(!can_update_body);
//indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
// VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform());
- if (updating_body) {
+ if (can_update_body && updating_body) {
_update_body();
}
} break;
@@ -336,16 +344,30 @@ void CollisionShape::_notification(int p_what) {
VisualServer::get_singleton()->free(indicator_instance);
indicator_instance=RID();
}*/
+ can_update_body=false;
+ set_notify_local_transform(false);
} break;
case NOTIFICATION_UNPARENTED: {
unparenting=true;
- if (updating_body)
+ if (can_update_body && updating_body)
_update_body();
} break;
case NOTIFICATION_PARENTED: {
- if (updating_body)
+ if (can_update_body && updating_body)
_update_body();
} break;
+ case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
+
+ if (!can_update_body && update_shape_index>=0) {
+
+ CollisionObject *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape_transform(update_shape_index,get_transform());
+ }
+ }
+
+ } break;
+
}
}
@@ -357,6 +379,18 @@ void CollisionShape::resource_changed(RES res) {
}
+void CollisionShape::_set_update_shape_index(int p_index) {
+
+
+ update_shape_index=p_index;
+}
+
+int CollisionShape::_get_update_shape_index() const{
+
+ return update_shape_index;
+}
+
+
void CollisionShape::_bind_methods() {
//not sure if this should do anything
@@ -368,10 +402,14 @@ void CollisionShape::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionShape::is_trigger);
ObjectTypeDB::bind_method(_MD("make_convex_from_brothers"),&CollisionShape::make_convex_from_brothers);
ObjectTypeDB::set_method_flags("CollisionShape","make_convex_from_brothers",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ObjectTypeDB::bind_method(_MD("_set_update_shape_index","index"),&CollisionShape::_set_update_shape_index);
+ ObjectTypeDB::bind_method(_MD("_get_update_shape_index"),&CollisionShape::_get_update_shape_index);
+ ObjectTypeDB::bind_method(_MD("get_collision_object_shape_index"),&CollisionShape::get_collision_object_shape_index);
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape"), _SCS("set_shape"), _SCS("get_shape"));
- ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger"));
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger"));
+ ADD_PROPERTY( PropertyInfo( Variant::INT, "_update_shape_index", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR), _SCS("_set_update_shape_index"), _SCS("_get_update_shape_index"));
}
@@ -383,8 +421,15 @@ void CollisionShape::set_shape(const Ref &p_shape) {
if (!shape.is_null())
shape->register_owner(this);
update_gizmo();
- if (updating_body)
+ if (updating_body) {
_update_body();
+ } else if (can_update_body && update_shape_index>=0 && is_inside_tree()){
+ CollisionObject *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape(update_shape_index,p_shape);
+ }
+
+ }
}
Ref CollisionShape::get_shape() const {
@@ -405,8 +450,14 @@ bool CollisionShape::is_updating_body() const {
void CollisionShape::set_trigger(bool p_trigger) {
trigger=p_trigger;
- if (updating_body)
+ if (updating_body) {
_update_body();
+ } else if (can_update_body && update_shape_index>=0 && is_inside_tree()){
+ CollisionObject *co = get_parent()->cast_to();
+ if (co) {
+ co->set_shape_as_trigger(update_shape_index,p_trigger);
+ }
+ }
}
bool CollisionShape::is_trigger() const{
@@ -419,7 +470,9 @@ CollisionShape::CollisionShape() {
//indicator = VisualServer::get_singleton()->mesh_create();
updating_body=true;
unparenting=false;
- trigger=false;
+ update_shape_index=-1;
+ trigger=false;
+ can_update_body=false;
}
CollisionShape::~CollisionShape() {
diff --git a/scene/3d/body_shape.h b/scene/3d/body_shape.h
index b3c0006d7..c1ebf806a 100644
--- a/scene/3d/body_shape.h
+++ b/scene/3d/body_shape.h
@@ -56,8 +56,16 @@ class CollisionShape : public Spatial {
bool unparenting;
bool trigger;
+ bool can_update_body;
+
+ int update_shape_index;
+
void _update_body();
void _add_to_collision_object(Object* p_cshape);
+
+ void _set_update_shape_index(int p_index);
+ int _get_update_shape_index() const;
+
protected:
void _notification(int p_what);
@@ -73,8 +81,10 @@ public:
void set_updating_body(bool p_update);
bool is_updating_body() const;
- void set_trigger(bool p_trigger);
- bool is_trigger() const;
+ void set_trigger(bool p_trigger);
+ bool is_trigger() const;
+
+ int get_collision_object_shape_index() const { return _get_update_shape_index(); }
CollisionShape();
~CollisionShape();
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp
index 4ab1a1a1a..c857b4851 100644
--- a/scene/3d/collision_polygon.cpp
+++ b/scene/3d/collision_polygon.cpp
@@ -6,6 +6,8 @@
void CollisionPolygon::_add_to_collision_object(Object *p_obj) {
+ if (!can_update_body)
+ return;
CollisionObject *co = p_obj->cast_to();
ERR_FAIL_COND(!co);
@@ -23,6 +25,7 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) {
//here comes the sun, lalalala
//decompose concave into multiple convex polygons and add them
+ shape_from=co->get_shape_count();
for(int i=0;i convex = memnew( ConvexPolygonShape );
DVector cp;
@@ -43,6 +46,11 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) {
co->add_shape(convex,get_transform());
}
+ shape_to=co->get_shape_count()-1;
+ if (shape_to_update_shapes_from_children();
}
+void CollisionPolygon::_set_shape_range(const Vector2& p_range) {
+
+ shape_from=p_range.x;
+ shape_to=p_range.y;
+}
+
+Vector2 CollisionPolygon::_get_shape_range() const {
+
+ return Vector2(shape_from,shape_to);
+}
+
void CollisionPolygon::_notification(int p_what) {
switch(p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ can_update_body=get_tree()->is_editor_hint();
+ set_notify_local_transform(!can_update_body);
+
+ //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+ can_update_body=false;
+ set_notify_local_transform(false);
+ } break;
case NOTIFICATION_TRANSFORM_CHANGED: {
if (!is_inside_tree())
break;
- _update_parent();
+ if (can_update_body) {
+ _update_parent();
+ }
+
+ } break;
+ case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
+ if (!can_update_body && shape_from>=0 && shape_from>=0) {
+
+ CollisionObject *co = get_parent()->cast_to();
+ if (co) {
+ for(int i=shape_from;i<=shape_to;i++) {
+ co->set_shape_transform(i,get_transform());
+ }
+ }
+ }
} break;
#if 0
@@ -119,29 +165,31 @@ void CollisionPolygon::_notification(int p_what) {
void CollisionPolygon::set_polygon(const Vector& p_polygon) {
polygon=p_polygon;
+ if (can_update_body) {
- for(int i=0;i polygon;
+
void _add_to_collision_object(Object *p_obj);
void _update_parent();
+ bool can_update_body;
+ int shape_from;
+ int shape_to;
+
+ void _set_shape_range(const Vector2& p_range);
+ Vector2 _get_shape_range() const;
+
protected:
void _notification(int p_what);
@@ -43,6 +51,10 @@ public:
Vector get_polygon() const;
virtual AABB get_item_rect() const;
+
+ int get_collision_object_first_shape() const { return shape_from; }
+ int get_collision_object_last_shape() const { return shape_to; }
+
CollisionPolygon();
};
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 7117c5917..a65f68ed2 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -231,6 +231,11 @@ void Spatial::set_transform(const Transform& p_transform) {
_change_notify("transform/rotation");
_change_notify("transform/scale");
_propagate_transform_changed(this);
+ if (data.notify_local_transform) {
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ }
+
+
}
@@ -335,6 +340,9 @@ void Spatial::set_translation(const Vector3& p_translation) {
data.local_transform.origin=p_translation;
_propagate_transform_changed(this);
+ if (data.notify_local_transform) {
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ }
}
@@ -348,6 +356,9 @@ void Spatial::set_rotation(const Vector3& p_euler){
data.rotation=p_euler;
data.dirty|=DIRTY_LOCAL;
_propagate_transform_changed(this);
+ if (data.notify_local_transform) {
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ }
}
void Spatial::set_scale(const Vector3& p_scale){
@@ -360,6 +371,9 @@ void Spatial::set_scale(const Vector3& p_scale){
data.scale=p_scale;
data.dirty|=DIRTY_LOCAL;
_propagate_transform_changed(this);
+ if (data.notify_local_transform) {
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ }
}
@@ -685,6 +699,13 @@ void Spatial::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, con
}
+void Spatial::set_notify_local_transform(bool p_enable) {
+ data.notify_local_transform=p_enable;
+}
+
+bool Spatial::is_local_transform_notification_enabled() const {
+ return data.notify_local_transform;
+}
void Spatial::_bind_methods() {
@@ -725,6 +746,9 @@ void Spatial::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_);
ObjectTypeDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_);
+ ObjectTypeDB::bind_method(_MD("set_notify_local_transform","enable"), &Spatial::set_notify_local_transform);
+ ObjectTypeDB::bind_method(_MD("is_local_transform_notification_enabled"), &Spatial::is_local_transform_notification_enabled);
+
void rotate(const Vector3& p_normal,float p_radians);
void rotate_x(float p_radians);
void rotate_y(float p_radians);
@@ -783,6 +807,7 @@ Spatial::Spatial() : xform_change(this)
data.gizmo_disabled=false;
data.gizmo_dirty=false;
#endif
+ data.notify_local_transform=false;
data.parent=NULL;
data.C=NULL;
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 8b40786fb..7fa6099d7 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -91,6 +91,7 @@ class Spatial : public Node {
List::Element *C;
bool ignore_notification;
+ bool notify_local_transform;
bool visible;
@@ -134,6 +135,7 @@ public:
NOTIFICATION_ENTER_WORLD=41,
NOTIFICATION_EXIT_WORLD=42,
NOTIFICATION_VISIBILITY_CHANGED=43,
+ NOTIFICATION_LOCAL_TRANSFORM_CHANGED=44,
};
Spatial *get_parent_spatial() const;
@@ -179,6 +181,9 @@ public:
void look_at(const Vector3& p_target, const Vector3& p_up_normal);
void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
+ void set_notify_local_transform(bool p_enable);
+ bool is_local_transform_notification_enabled() const;
+
void orthonormalize();
void set_identity();
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 3727c2e8e..851de4a89 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -458,7 +458,6 @@ void register_scene_types() {
/* disable types by default, only editors should enable them */
- ObjectTypeDB::set_type_enabled("CollisionShape",false);
//ObjectTypeDB::set_type_enabled("BodyVolumeSphere",false);
//ObjectTypeDB::set_type_enabled("BodyVolumeBox",false);
//ObjectTypeDB::set_type_enabled("BodyVolumeCapsule",false);
@@ -492,9 +491,12 @@ void register_scene_types() {
ObjectTypeDB::register_type();
ObjectTypeDB::register_type();
ObjectTypeDB::register_type();
-
- ObjectTypeDB::set_type_enabled("CollisionShape2D",false);
- ObjectTypeDB::set_type_enabled("CollisionPolygon2D",false);
+ if (bool(GLOBAL_DEF("physics/remove_collision_helpers_at_runtime",false))) {
+ ObjectTypeDB::set_type_enabled("CollisionShape2D",false);
+ ObjectTypeDB::set_type_enabled("CollisionPolygon2D",false);
+ ObjectTypeDB::set_type_enabled("CollisionShape",false);
+ ObjectTypeDB::set_type_enabled("CollisionPolygon",false);
+ }
OS::get_singleton()->yield(); //may take time to init
--
cgit v1.3.1
From 3f9e5afe68df1e3b4bcf34a21468ed55a57a7973 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Fri, 18 Sep 2015 23:10:58 -0300
Subject: begin work on debugging collisions....
---
main/main.cpp | 7 +++++++
scene/2d/collision_shape_2d.cpp | 4 ++++
scene/main/scene_main_loop.cpp | 13 +++++++++++++
scene/main/scene_main_loop.h | 4 ++++
4 files changed, 28 insertions(+)
diff --git a/main/main.cpp b/main/main.cpp
index 9b7e190e0..69e4dc38e 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -97,6 +97,7 @@ static OS::VideoMode video_mode;
static bool init_maximized=false;
static bool init_fullscreen=false;
static bool init_use_custom_pos=false;
+static bool debug_collisions=false;
static Vector2 init_custom_pos;
static int video_driver_idx=-1;
static int audio_driver_idx=-1;
@@ -514,6 +515,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
} else if (I->get()=="-debug" || I->get()=="-d") {
debug_mode="local";
+ } else if (I->get()=="-debugcol" || I->get()=="-dc") {
+ debug_collisions=true;
} else if (I->get()=="-editor_scene") {
if (I->next()) {
@@ -1154,8 +1157,12 @@ bool Main::start() {
SceneTree *sml = main_loop->cast_to();
+ if (debug_collisions) {
+ sml->set_debug_collisions_hint(true);
+ }
#ifdef TOOLS_ENABLED
+
EditorNode *editor_node=NULL;
if (editor) {
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 5012c54b1..02e4c79a0 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -92,8 +92,12 @@ void CollisionShape2D::_notification(int p_what) {
} break;*/
case NOTIFICATION_DRAW: {
+ if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
+ break;
+
rect=Rect2();
+
Color draw_col=Color(0,0.6,0.7,0.5);
if (shape->cast_to()) {
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 45e3d92ec..ead729c2b 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -471,6 +471,7 @@ void SceneTree::init() {
editor_hint=false;
+ debug_collisions_hint=false;
pause=false;
root->_set_tree(this);
@@ -624,6 +625,16 @@ bool SceneTree::is_editor_hint() const {
return editor_hint;
}
+void SceneTree::set_debug_collisions_hint(bool p_enabled) {
+
+ debug_collisions_hint=p_enabled;
+}
+
+bool SceneTree::is_debugging_collisions_hint() const {
+
+ return debug_collisions_hint;
+}
+
void SceneTree::set_pause(bool p_enabled) {
if (p_enabled==pause)
@@ -1424,6 +1435,8 @@ void SceneTree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneTree::set_editor_hint);
ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneTree::is_editor_hint);
+ ObjectTypeDB::bind_method(_MD("set_debug_collisions_hint","enable"),&SceneTree::set_debug_collisions_hint);
+ ObjectTypeDB::bind_method(_MD("is_debugging_collisions_hint"),&SceneTree::is_debugging_collisions_hint);
#ifdef TOOLS_ENABLED
ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneTree::set_edited_scene_root);
ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneTree::get_edited_scene_root);
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index 1f09d9c54..b44456bf1 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -87,6 +87,7 @@ private:
uint32_t last_id;
bool editor_hint;
+ bool debug_collisions_hint;
bool pause;
int root_lock;
@@ -270,6 +271,9 @@ public:
void set_camera(const RID& p_camera);
RID get_camera() const;
+ void set_debug_collisions_hint(bool p_enabled);
+ bool is_debugging_collisions_hint() const;
+
int64_t get_frame() const;
int get_node_count() const;
--
cgit v1.3.1
From 205634791c0de937427310738e8bab45d7096e12 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Sun, 20 Sep 2015 17:29:36 -0300
Subject: fixed stupid bug caused by accidentally removed line before commit
---
scene/main/viewport.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 089f3b5d6..d19b5767c 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -319,6 +319,7 @@ void Viewport::_notification(int p_what) {
// update_worlds();
}
+ add_to_group("_viewports");
if (get_tree()->is_debugging_collisions_hint()) {
//2D
Physics2DServer::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(),get_tree()->get_collision_debug_contact_count());
--
cgit v1.3.1
From 8f07f243183136d141562f19321ca45246d597f9 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Mon, 21 Sep 2015 03:47:56 -0300
Subject: remove required argument from streamplayer (was a bug), make it
default as 0, closes #2492
---
scene/3d/spatial_stream_player.cpp | 2 +-
scene/audio/stream_player.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp
index b81d98e8b..346e354df 100644
--- a/scene/3d/spatial_stream_player.cpp
+++ b/scene/3d/spatial_stream_player.cpp
@@ -331,7 +331,7 @@ void SpatialStreamPlayer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&SpatialStreamPlayer::set_stream);
ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&SpatialStreamPlayer::get_stream);
- ObjectTypeDB::bind_method(_MD("play"),&SpatialStreamPlayer::play);
+ ObjectTypeDB::bind_method(_MD("play"),&SpatialStreamPlayer::play,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("stop"),&SpatialStreamPlayer::stop);
ObjectTypeDB::bind_method(_MD("is_playing"),&SpatialStreamPlayer::is_playing);
diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp
index 699d06828..c4e1ccc9b 100644
--- a/scene/audio/stream_player.cpp
+++ b/scene/audio/stream_player.cpp
@@ -325,7 +325,7 @@ void StreamPlayer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&StreamPlayer::set_stream);
ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&StreamPlayer::get_stream);
- ObjectTypeDB::bind_method(_MD("play"),&StreamPlayer::play);
+ ObjectTypeDB::bind_method(_MD("play"),&StreamPlayer::play,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("stop"),&StreamPlayer::stop);
ObjectTypeDB::bind_method(_MD("is_playing"),&StreamPlayer::is_playing);
--
cgit v1.3.1
From ce6fefced8b0ac6d3be886db5ee1234dba7ec544 Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Mon, 21 Sep 2015 09:39:46 -0300
Subject: Properly implement OS.alert() from script, and use xmessage on X11
---
core/bind/core_bind.cpp | 6 ++++++
core/bind/core_bind.h | 3 +++
platform/x11/os_x11.cpp | 10 ++++++++++
platform/x11/os_x11.h | 2 +-
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index b4bf1ed4b..94557d149 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -732,6 +732,11 @@ int _OS::find_scancode_from_string(const String& p_code) const {
return find_keycode(p_code);
}
+void _OS::alert(const String& p_alert,const String& p_title) {
+
+ OS::get_singleton()->alert(p_alert,p_title);
+}
+
_OS *_OS::singleton=NULL;
void _OS::_bind_methods() {
@@ -859,6 +864,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap);
+ ObjectTypeDB::bind_method(_MD("alert","text","title"),&_OS::alert,DEFVAL("Alert!"));
BIND_CONSTANT( DAY_SUNDAY );
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index ed3db2925..24ea81076 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -256,6 +256,9 @@ public:
String get_data_dir() const;
+ void alert(const String& p_alert,const String& p_title="ALERT!");
+
+
void set_screen_orientation(ScreenOrientation p_orientation);
ScreenOrientation get_screen_orientation() const;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 51f4392eb..ce8259eea 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1866,6 +1866,16 @@ void OS_X11::swap_buffers() {
context_gl->swap_buffers();
}
+void OS_X11::alert(const String& p_alert,const String& p_title) {
+
+ List args;
+ args.push_back("-center");
+ args.push_back("-title");
+ args.push_back(p_title);
+ args.push_back(p_alert);
+
+ execute("/usr/bin/xmessage",args,true);
+}
void OS_X11::set_icon(const Image& p_icon) {
if (!p_icon.empty()) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 12f0aec61..cc6a90c6d 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -243,7 +243,7 @@ public:
virtual bool is_window_maximized() const;
virtual void move_window_to_foreground();
-
+ virtual void alert(const String& p_alert,const String& p_title="ALERT!");
void run();
OS_X11();
--
cgit v1.3.1
From e6e9e83c2edf315e6b84abe6ce21c1cc3aa59f19 Mon Sep 17 00:00:00 2001
From: George Marques
Date: Mon, 21 Sep 2015 14:08:10 -0300
Subject: Fix typo in ItemList bindings
---
scene/gui/item_list.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index b7b2f061e..40fade840 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1025,7 +1025,7 @@ void ItemList::_bind_methods(){
ObjectTypeDB::bind_method(_MD("get_item_text","idx"),&ItemList::get_item_text);
ObjectTypeDB::bind_method(_MD("set_item_icon","idx","icon:Texture"),&ItemList::set_item_icon);
- ObjectTypeDB::bind_method(_MD("get_item_icon:Tedture","idx"),&ItemList::get_item_icon);
+ ObjectTypeDB::bind_method(_MD("get_item_icon:Texture","idx"),&ItemList::get_item_icon);
ObjectTypeDB::bind_method(_MD("set_item_selectable","idx","selectable"),&ItemList::set_item_selectable);
ObjectTypeDB::bind_method(_MD("is_item_selectable","idx"),&ItemList::is_item_selectable);
--
cgit v1.3.1
From ab3b0c82c8786fbba97cc20bfd5331022fc4d725 Mon Sep 17 00:00:00 2001
From: eska
Date: Tue, 22 Sep 2015 05:59:10 +0200
Subject: Add missing `return` so Visual Studio compiles
---
scene/resources/rectangle_shape_2d.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index 9a32b013c..7903d8873 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -57,7 +57,7 @@ void RectangleShape2D::draw(const RID& p_to_rid,const Color& p_color) {
Rect2 RectangleShape2D::get_rect() const {
- Rect2(-extents,extents*2.0);
+ return Rect2(-extents,extents*2.0);
}
--
cgit v1.3.1
From e68f04b9d07b6128eb05bc6ca042c986c6501e90 Mon Sep 17 00:00:00 2001
From: George Marques
Date: Tue, 22 Sep 2015 20:27:48 -0300
Subject: Check if shape is valid before referencing it
See the comment from @MartiniMoe at #2366.
---
scene/2d/collision_shape_2d.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index cd89e914f..dbe9d7179 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -117,6 +117,9 @@ void CollisionShape2D::_notification(int p_what) {
Color draw_col=get_tree()->get_debug_collisions_color();
+ if(!shape.is_valid()) {
+ break;
+ }
shape->draw(get_canvas_item(),draw_col);
--
cgit v1.3.1
From 5ff0b69dae55e35ef57277d32296effc9318213f Mon Sep 17 00:00:00 2001
From: George Marques
Date: Tue, 22 Sep 2015 21:30:08 -0300
Subject: Move the shape test to a little sooner
---
scene/2d/collision_shape_2d.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index dbe9d7179..85751fc73 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -113,13 +113,14 @@ void CollisionShape2D::_notification(int p_what) {
break;
}
+ if (!shape.is_valid()) {
+ break;
+ }
+
rect=Rect2();
Color draw_col=get_tree()->get_debug_collisions_color();
- if(!shape.is_valid()) {
- break;
- }
shape->draw(get_canvas_item(),draw_col);
--
cgit v1.3.1
From 38a5e023afb0894e30a6d1bdea8e7ccb429e3d0d Mon Sep 17 00:00:00 2001
From: Bojidar Marinov
Date: Wed, 23 Sep 2015 17:16:39 +0300
Subject: Fix a bug with doctool (" >")
Please test, this was made from GitHub GUI, so couldn't test it myself.---
tools/doc/doc_data.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index 08697ab72..432f35862 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -917,9 +917,9 @@ Error DocData::save(const String& p_path) {
String qualifiers;
if (m.qualifiers!="")
- qualifiers+="qualifiers=\""+m.qualifiers.xml_escape()+"\"";
+ qualifiers+=" qualifiers=\""+m.qualifiers.xml_escape()+"\"";
- _write_string(f,2,"");
+ _write_string(f,2,"");
if (m.return_type!="") {
--
cgit v1.3.1
From 6adb5ed4406bb415b5b1728af64bb5fa7580151e Mon Sep 17 00:00:00 2001
From: Bojidar Marinov
Date: Wed, 23 Sep 2015 17:34:07 +0300
Subject: Regenerate docs
---
doc/base/classes.xml | 7362 +++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 6133 insertions(+), 1229 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 7488d93fe..f41cc3ec5 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -1,5 +1,5 @@
-
+
Built-in GDScript functions.
@@ -312,6 +312,14 @@
Random range, any floating point value between 'from' and 'to'
+
+
+
+
+
+
+
+
@@ -402,7 +410,7 @@
-
+
@@ -411,7 +419,7 @@
-
+
@@ -476,6 +484,16 @@
Print one or more arguments to the console with a tab between each argument.
+
+
+
+
+
+
+
+
+
+
@@ -508,9 +526,9 @@
-
+
-
+
Converts the value of a String to a variable.
@@ -526,7 +544,7 @@
-
+
@@ -568,6 +586,14 @@
Print a stack track at code location, only works when running with debugger turned on.
+
+
+
+
+
+
+
+
@@ -1178,6 +1204,8 @@
+
+
@@ -1379,51 +1407,53 @@
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
No hint for edited property.
@@ -1441,34 +1471,37 @@
-
+
-
+
Property hint for a bitmask description, for bits 0,1,2,3 and 5 the hint would be like "Bit0,Bit1,Bit2,Bit3,,Bit5". Valid only for integers.
-
+
Property hint for a bitmask description that covers all 32 bits. Valid only for integers.
-
+
String property is a file (so pop up a file dialog when edited). Hint string can be a set of wildcards like "*.doc".
-
+
String property is a directory (so pop up a file dialog when edited).
-
+
-
+
-
+
String property is a resource, so open the resource popup menu when edited.
-
+
-
+
-
+
-
+
+
+
+ Property will be used as storage (default).
Property will be used as storage (default).
@@ -1737,6 +1770,8 @@
+
+
@@ -1959,6 +1994,12 @@
+
+
+
+
+
+
@@ -1993,6 +2034,12 @@
+
+
+
+
+
+
@@ -2472,9 +2519,18 @@
Play a given animation by the animation name. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards.
+
+
+
+
+
+
+
+
+
+
- Stop the currently played animation.
@@ -3123,6 +3179,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3191,6 +3259,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3215,13 +3295,25 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3239,6 +3331,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3257,6 +3361,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3277,6 +3403,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3295,6 +3439,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3333,6 +3495,18 @@
Return if gravity is a point. When overriding space parameters, areas can have a center of gravity as a point.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3358,13 +3532,25 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -3382,6 +3568,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3394,12 +3636,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3420,6 +3696,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3438,6 +3732,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3502,6 +3814,12 @@
+
+
+
+
+
+
@@ -3543,6 +3861,8 @@
+
+
@@ -3550,6 +3870,8 @@
+
+
@@ -3557,6 +3879,8 @@
+
+
@@ -3564,6 +3888,8 @@
+
+
@@ -3571,6 +3897,8 @@
+
+
@@ -3578,6 +3906,8 @@
+
+
@@ -3585,6 +3915,8 @@
+
+
@@ -4128,64 +4460,85 @@
Base class for audio streams. Audio streams are used for music playback, or other types of streamed sounds that don't fit or requiere more flexibility than a [Sample].
+
+
+
+
+
+
+
+ MusePack audio stream driver.
+
+
+ MusePack audio stream driver.
+
+
+
+
+
+
+
+
+ OGG Vorbis audio stream driver.
+
+
+ OGG Vorbis audio stream driver.
+
+
+
+
+
+
+
+
+
+
+
+
+
- Start playback of an audio stream.
- Stop playback of an audio stream.
- Return wether the audio stream is currently playing.
- Set the loop hint for the audio stream playback. if true, audio stream will attempt to loop (restart) when finished.
- Return wether the audio stream loops. See [method set_loop]
-
-
-
-
-
-
- Return the name of the audio stream. Often the song title when the stream is music.
- Return the amount of times that the stream has looped (if loop is supported).
- Seek to a certain position (in seconds) in an audio stream.
- Return the current playing position (in seconds) of the audio stream (if supported). Since this value is updated internally, it may not be exact or updated continuosly. Accuracy depends on the sample buffer size of the audio driver.
@@ -4194,173 +4547,78 @@
-
+
- Return the type of update that the stream uses. Some types of stream may need manual polling.
-
+
+
+
+
+
+
+
+
+
- Manually poll the audio stream (if it is requested to).
-
- Does not need update, or manual polling.
-
-
- Stream is updated on the main thread, when idle.
-
-
- Stream is updated on its own thread.
-
-
+
- Simple gibberish speech stream playback.
+ Speex audio stream driver.
- AudioStream used for gibberish playback. It plays randomized phonemes, which can be used to accompany text dialogs.
+ Speex audio stream driver. Speex is very useful for compressed speech. It allows loading a very large amount of speech in memory at little IO/latency cost.
-
-
-
-
- Set the phoneme library.
-
-
-
-
-
-
- Return the phoneme library.
-
-
-
-
-
-
- Set pitch scale for the speech. Animating this value holds amusing results.
-
-
-
-
-
-
- Return the pitch scale.
-
-
-
-
-
-
- Set the random scaling for the pitch.
-
-
-
-
-
-
- Return the pitch random scaling.
-
-
-
-
-
-
- Set the cross-fade time between random phonemes.
-
-
-
-
-
-
- Return the cross-fade time between random phonemes.
-
-
-
+
- MusePack audio stream driver.
- MusePack audio stream driver.
-
-
+
+
- Set the file to be played.
-
-
+
+
- Return the file being played.
-
-
-
-
-
-
- OGG Vorbis audio stream driver.
-
-
- OGG Vorbis audio stream driver.
-
-
-
-
-
-
-
-
- Base class for resampled audio streams.
-
-
- Base class for resampled audio streams.
-
-
-
-
-
-
-
-
- Speex audio stream driver.
-
-
- Speex audio stream driver. Speex is very useful for compressed speech. It allows loading a very large amount of speech in memory at little IO/latency cost.
-
-
-
-
+
+
- Set the speech file (which is loaded to memory).
-
-
+
+
- Return the speech file.
+
+
+
+
+
+
@@ -4739,6 +4997,16 @@
BaseButton is the abstract base class for buttons, so it shouldn't be used directly (It doesnt display anything). Other types of buttons inherit from it.
+
+
+
+
+
+
+
+
+
+
@@ -5262,6 +5530,14 @@
Return how a 3D point in worldpsace maps to a 2D coordinate in the [Viewport] rectangle.
+
+
+
+
+
+
+
+
@@ -5357,24 +5633,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -5436,18 +5694,16 @@
Return the scroll offset.
-
-
+
+
- Set to true if the camera is at the center of the screen (default: true).
-
-
+
+
- Return true if the camera is at the center of the screen (default: true).
@@ -5467,6 +5723,10 @@
Make this the current 2D camera for the scene (viewport and layer), in case there's many cameras in the scene.
+
+
+
+
@@ -5602,6 +5862,10 @@
+
+
+
+
@@ -5716,6 +5980,18 @@
Return the current blending mode from enum BLEND_MODE_*.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -5745,7 +6021,7 @@
-
+
Sets whether the canvas item is drawn behind its parent.
@@ -5805,7 +6081,7 @@
-
+
@@ -5935,6 +6211,12 @@
+
+
+
+
+
+
@@ -5947,6 +6229,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -5959,6 +6259,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6015,6 +6347,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Canvas Item layer.
@@ -6111,6 +6517,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Capsule shape resource.
@@ -6215,6 +6643,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checkable button.
@@ -6441,6 +6913,16 @@
CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing CollisionBody2D and CollisionPolygon2D nodes as children. Such nodes are for reference ant not present outside the editor, so code should use the regular shape API.
+
+
+
+
+
+
+
+
+
+
@@ -6528,7 +7010,39 @@
Return the RID of the object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6538,14 +7052,14 @@
-
-
+
+
-
-
+
+
@@ -6562,13 +7076,25 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6586,6 +7112,54 @@
Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6596,6 +7170,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6608,6 +7222,36 @@
Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6684,6 +7328,8 @@
+
+
@@ -6697,6 +7343,8 @@
+
+
@@ -6708,6 +7356,8 @@
+
+
@@ -6715,6 +7365,8 @@
+
+
@@ -6789,6 +7441,8 @@
+
+
@@ -6936,6 +7590,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Concave polygon shape.
@@ -7083,7 +7771,7 @@
-
+
@@ -7091,7 +7779,7 @@
-
+
@@ -7694,6 +8382,12 @@
+
+
+
+
+
+
@@ -7727,6 +8421,8 @@
+
+
Emitted when an input event is received. Connecting in realtime is recommended for accepting the events.
@@ -8114,6 +8810,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -8270,6 +8976,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -8478,7 +9194,7 @@
-
+
@@ -8522,7 +9238,7 @@
-
+
@@ -8536,7 +9252,7 @@
-
+
@@ -8544,7 +9260,7 @@
-
+
@@ -8574,7 +9290,7 @@
-
+
@@ -8584,7 +9300,7 @@
-
+
@@ -8594,15 +9310,163 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8734,7 +9598,7 @@
-
+
@@ -8823,28 +9687,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -8919,23 +9761,23 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -9376,7 +10218,7 @@
-
+
@@ -9504,7 +10346,7 @@
- Add a custom filter. Filter format is: "mask ; description", example (C++): dialog->add_filter("*.png ; PNG Images");
+ Add a custom filter. Filter format is: "mask ; description", example (C++): dialog-<add_filter("*.png ; PNG Images");
@@ -9578,6 +10420,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9802,6 +10656,14 @@
Font contains an unicode compatible character set, as well as the ability to draw it with variable width, ascent, descent and kerning. For creating fonts from TTF files (or other font formats), see the editor support for fonts. TODO check wikipedia for graph of ascent/baseline/descent/height/etc.
+
+
+
+
+
+
+
+
@@ -9881,6 +10743,20 @@
Add a character to the font, where "character" is the unicode value, "texture" is the texture index, "rect" is the region in the texture (in pixels!), "align" is the (optional) alignment for the character and "advance" is the (optional) advance.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9901,6 +10777,18 @@
Return the size of a string, taking kerning and advance into account.
+
+
+
+
+
+
+
+
+
+
+
+
Clear all the font data.
@@ -10036,6 +10924,12 @@
+
+
+
+
+
+
@@ -10370,6 +11264,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -10464,6 +11372,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -10592,322 +11512,650 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
-
+
-
-
-
-
-
+
-
-
+
+
+
+
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
-
-
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
+
-
-
+
+
+
+
-
+
+
+
-
+
+
+
+
+
-
-
+
+
-
+
-
+
+
+
-
-
-
-
-
-
-
-
-
- Groove constraint for 2D physics.
-
-
- Groove constraint for 2D physics. This is useful for making a body "slide" through a segment placed in another.
-
-
-
-
+
+
+
+
+
+
+
+
+
- Set the length of the groove.
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Return the length of the groove.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Groove constraint for 2D physics.
+
+
+ Groove constraint for 2D physics. This is useful for making a body "slide" through a segment placed in another.
+
+
+
+
+
+
+ Set the length of the groove.
+
+
+
+
+
+
+ Return the length of the groove.
@@ -11081,7 +12329,7 @@
-
+
@@ -11176,6 +12424,12 @@
+
+
+
+
+
+
@@ -11195,7 +12449,7 @@
-
+
@@ -11787,6 +13041,10 @@
+
+
+
+
@@ -11848,7 +13106,7 @@
-
+
@@ -11939,13 +13197,6 @@
-
-
-
-
- Return the global, unscaled, screen pointer coordinates. If the 2D viewport has been scaled, it may not work well with [Camera] or controls.
-
-
@@ -11976,6 +13227,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12023,6 +13286,22 @@
Return if this input event matches a pre-defined action, no matter the type.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12037,6 +13316,14 @@
Return if this input event is pressed (for key, mouse, joy button or screen press events).
+
+
+
+
+
+
+
+
@@ -12087,6 +13374,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12099,6 +13402,14 @@
+
+
+
+
+
+
+
+
@@ -12143,6 +13454,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12155,6 +13482,14 @@
+
+
+
+
+
+
+
+
@@ -12205,62 +13540,18 @@
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -12277,6 +13568,14 @@
+
+
+
+
+
+
+
+
@@ -12285,21 +13584,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -12323,7 +13610,7 @@
-
+
@@ -12337,86 +13624,18 @@
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -12433,6 +13652,14 @@
+
+
+
+
+
+
+
+
@@ -12449,31 +13676,235 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12511,6 +13942,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12523,6 +13970,14 @@
+
+
+
+
+
+
+
+
@@ -12587,6 +14042,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12599,6 +14070,14 @@
+
+
+
+
+
+
+
+
@@ -12710,7 +14189,7 @@
-
+
@@ -12783,6 +14262,8 @@
+
+
@@ -12845,328 +14326,510 @@
-
+
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
- Base node for all joint constraints in 2D phyisics.
-
-
- Base node for all joint constraints in 2D phyisics. Joints take 2 bodies and apply a custom constraint.
-
-
-
-
+
+
+
+
- Set the path to the A node for the joint. Must be of type PhysicsBody2D.
-
-
+
+
+
+
- Return the path to the A node for the joint.
-
-
+
+
+
+
- Set the path to the B node for the joint. Must be of type PhysicsBody2D.
-
-
+
+
+
+
- Return the path to the B node for the joint.
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
-
+
-
-
-
-
+
+
-
+
-
-
+
+
+
+
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base node for all joint constraints in 2D phyisics.
+
+
+ Base node for all joint constraints in 2D phyisics. Joints take 2 bodies and apply a custom constraint.
+
+
+
+
+
+
+ Set the path to the A node for the joint. Must be of type PhysicsBody2D.
+
+
+
+
+
+
+ Return the path to the A node for the joint.
+
+
+
+
+
+
+ Set the path to the B node for the joint. Must be of type PhysicsBody2D.
+
+
+
+
+
+
+ Return the path to the B node for the joint.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13207,6 +14870,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Control that displays formatted text.
@@ -13551,7 +15308,7 @@
-
+
@@ -13571,226 +15328,554 @@
-
+
- Control that provides single line string editing.
- LineEdit provides a single line string editor, used for text fields.
-
+
+
+
- Clear the [LineEdit] text.
-
+
+
+
- Select the whole string.
-
-
+
+
- Set the text in the [LineEdit], clearing the existing one and the selection.
-
-
+
+
- Return the text in the [LineEdit].
-
-
+
+
- Set the cursor position inside the [LineEdit], causing it to scroll if needed.
-
-
+
+
- Return the cursor position inside the [LineEdit].
-
-
+
+
- Set the maximum amount of characters the [LineEdit] can edit, and cropping existing text in case it exceeds that limit. Setting 0 removes the limit.
-
-
+
+
- Return the maximum amount of characters the [LineEdit] can edit. If 0 is returned, no limit exists.
-
-
+
+
- Append text at cursor, scrolling the [LineEdit] when needed.
-
-
+
+
+
+
+
+
+
+
- Set the [i]editable[/i] status of the [LineEdit]. When disabled, existing text can't be modified and new text can't be added.
-
-
+
+
- Return the [i]editable[/i] status of the [LineEdit] (see [method set_editable]).
-
-
+
+
- Set the [i]secret[/i] status of the [LineEdit]. When enabled, every character is displayed as "*".
-
-
+
+
- Return the [i]secret[/i] status of the [LineEdit] (see [method set_secret]).
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
- This signal is emitted when the user presses KEY_ENTER on the [LineEdit]. This signal is often used as an alternate confirmation mechanism in dialogs.
-
-
-
+
+
+
+
+
+
+
+
+
- When the text changes, this signal is emitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Line shape for 2D collision objects.
-
-
- Line shape for 2D collision objects. It works like a 2D plane and will not allow any body to go to the negative side. Not recommended for rigid bodies, and usually not recommended for static bodies either because it forces checks against it on every frame.
-
-
-
-
+
+
+
+
+
+
+
+
+
- Set the line normal.
-
-
+
+
- Return the line normal.
-
-
+
+
- Set the line distance from the origin.
-
-
+
+
- Return the line distance from the origin.
-
-
-
-
-
-
- Main loop is the abstract main loop base class.
-
-
- Main loop is the abstract main loop base class. All other main loop classes are derived from it. Upon application start, a [MainLoop] has to be provided to OS, else the application will exit. This happens automatically (and a [SceneMainLoop] is created), unless a main [Script] is supplied, which may or not create and return a [MainLoop].
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Simple margin container.
-
-
- Simple margin container. Adds a left margin to anything contained.
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control that provides single line string editing.
+
+
+ LineEdit provides a single line string editor, used for text fields.
+
+
+
+
+ Clear the [LineEdit] text.
+
+
+
+
+ Select the whole string.
+
+
+
+
+
+
+ Set the text in the [LineEdit], clearing the existing one and the selection.
+
+
+
+
+
+
+ Return the text in the [LineEdit].
+
+
+
+
+
+
+ Set the cursor position inside the [LineEdit], causing it to scroll if needed.
+
+
+
+
+
+
+ Return the cursor position inside the [LineEdit].
+
+
+
+
+
+
+ Set the maximum amount of characters the [LineEdit] can edit, and cropping existing text in case it exceeds that limit. Setting 0 removes the limit.
+
+
+
+
+
+
+ Return the maximum amount of characters the [LineEdit] can edit. If 0 is returned, no limit exists.
+
+
+
+
+
+
+ Append text at cursor, scrolling the [LineEdit] when needed.
+
+
+
+
+
+
+ Set the [i]editable[/i] status of the [LineEdit]. When disabled, existing text can't be modified and new text can't be added.
+
+
+
+
+
+
+ Return the [i]editable[/i] status of the [LineEdit] (see [method set_editable]).
+
+
+
+
+
+
+ Set the [i]secret[/i] status of the [LineEdit]. When enabled, every character is displayed as "*".
+
+
+
+
+
+
+ Return the [i]secret[/i] status of the [LineEdit] (see [method set_secret]).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This signal is emitted when the user presses KEY_ENTER on the [LineEdit]. This signal is often used as an alternate confirmation mechanism in dialogs.
+
+
+
+
+
+
+ When the text changes, this signal is emitted.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Line shape for 2D collision objects.
+
+
+ Line shape for 2D collision objects. It works like a 2D plane and will not allow any body to go to the negative side. Not recommended for rigid bodies, and usually not recommended for static bodies either because it forces checks against it on every frame.
+
+
+
+
+
+
+ Set the line normal.
+
+
+
+
+
+
+ Return the line normal.
+
+
+
+
+
+
+ Set the line distance from the origin.
+
+
+
+
+
+
+ Return the line distance from the origin.
+
+
+
+
+
+
+
+
+ Main loop is the abstract main loop base class.
+
+
+ Main loop is the abstract main loop base class. All other main loop classes are derived from it. Upon application start, a [MainLoop] has to be provided to OS, else the application will exit. This happens automatically (and a [SceneMainLoop] is created), unless a main [Script] is supplied, which may or not create and return a [MainLoop].
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Simple margin container.
+
+
+ Simple margin container. Adds a left margin to anything contained.
+
+
+
@@ -13818,6 +15903,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13934,6 +16051,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
3x3 matrix datatype.
@@ -14055,6 +16192,8 @@
+
+
@@ -14066,6 +16205,8 @@
+
+
@@ -14075,6 +16216,8 @@
+
+
@@ -14204,6 +16347,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -14213,6 +16368,14 @@
+
+
+
+
+
+
+
+
@@ -14234,7 +16397,7 @@
-
+
Return the [PopupMenu] contained in this button.
@@ -15105,7 +17268,7 @@
-
+
@@ -15169,6 +17332,8 @@
+
+
@@ -15188,6 +17353,14 @@
+
+
+
+
+
+
+
+
@@ -15204,6 +17377,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -15284,6 +17521,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -15554,12 +17921,6 @@
Remove a child [Node]. Node is NOT deleted and will have to be deleted manually.
-
-
-
-
-
-
@@ -15621,6 +17982,14 @@
Return the parent [Node] of the current [Node], or an empty Object if the node lacks a parent.
+
+
+
+
+
+
+
+
@@ -15893,8 +18262,9 @@
+
+
- Return a duplicate of the scene, with all nodes and parameters copied. Subscriptions will not be duplicated.
@@ -16015,7 +18385,7 @@
-
+
@@ -16036,19 +18406,37 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Return the global position of the 2D node.
-
+
+
+
+
+
+ Return the global position of the 2D node.
+
+
@@ -16061,12 +18449,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16133,6 +18567,8 @@
+
+
@@ -16222,6 +18658,124 @@
Return the list of fullscreen modes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16266,6 +18820,12 @@
+
+
+
+
+
+
@@ -16373,15 +18933,23 @@
+
+
- Return the current date.
+
+
+
+
+
+
+
+
- Return the current time.
@@ -16390,6 +18958,12 @@
+
+
+
+
+
+
@@ -16417,6 +18991,12 @@
Return the amount of time passed in milliseconds since the engine started.
+
+
+
+
+
+
@@ -16519,12 +19099,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16548,9 +19142,9 @@
-
+
-
+
@@ -16569,12 +19163,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16615,6 +19241,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16663,6 +19319,10 @@
Set a property. Return true if the property was found.
+
+
+
+
@@ -16702,6 +19362,12 @@
Return the list of properties as an array of dictionaries, dictionaries countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals).
+
+
+
+
+
+
@@ -16773,6 +19439,14 @@
Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*).
+
+
+
+
+
+
+
+
@@ -16948,6 +19622,12 @@
Translate a message. Only works in message translation is enabled (which is by default). See [method set_message_translation].
+
+
+
+
+
+
@@ -16973,6 +19653,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
OmniDirectional Light, such as a lightbulb or a candle.
@@ -17185,7 +19917,7 @@
-
+
@@ -17248,7 +19980,7 @@
-
+
@@ -17335,6 +20067,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -17371,7 +20123,7 @@
-
+
@@ -17385,7 +20137,7 @@
-
+
@@ -17650,28 +20402,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Particle system 3D Node
@@ -18062,6 +20792,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18242,6 +20996,8 @@
+
+
@@ -18250,18 +21006,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18644,11 +21470,16 @@
Return the total gravity vector being currently applied to this body.
-
+
+
+
+
+
+
+
- Return the space density currently being applied to this body.
@@ -18855,6 +21686,22 @@
Direct access object to a space in the [Physics2DServer]. It's used mainly to do queries against objects and areas residing in a given space.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18869,7 +21716,7 @@
- Intersect a ray in a given space, the returned object is a dictionary with the following fields:
+ Intersect a ray in a given space, the returned object is a dictionary with the following fields:
position: place where ray is stopped.
normal: normal of the object at the point where the ray was stopped.
shape: shape index of the object agaisnt which the ray was stopped.
@@ -19131,6 +21978,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19388,8 +22251,6 @@
-
-
@@ -19406,8 +22267,6 @@
-
-
@@ -19499,6 +22358,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19527,6 +22418,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19661,11 +22566,15 @@
-
+
+
+
-
+
-
+
+
+
@@ -19687,7 +22596,13 @@
-
+
+
+
+
+
+
+
@@ -19887,6 +22802,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Base class for differnt types of Physics bodies.
@@ -19941,6 +22920,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19969,7 +23016,13 @@
-
+
+
+
+
+
+
+
@@ -21249,11 +24302,15 @@
-
+
+
+
-
+
-
+
+
+
@@ -21275,7 +24332,13 @@
-
+
+
+
+
+
+
+
@@ -21591,6 +24654,8 @@
+
+
@@ -21604,6 +24669,8 @@
+
+
@@ -21615,6 +24682,8 @@
+
+
@@ -21751,18 +24820,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -22613,6 +25670,8 @@
+
+
@@ -22625,6 +25684,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -22657,6 +25728,8 @@
+
+
@@ -22875,6 +25948,8 @@
+
+
@@ -22944,6 +26019,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -23143,6 +26246,8 @@
+
+
@@ -23227,6 +26332,8 @@
+
+
@@ -23235,6 +26342,8 @@
+
+
@@ -23356,6 +26465,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -23498,7 +26631,7 @@
-
+
@@ -23627,8 +26760,9 @@
+
+
- Load a resource. Optionally a hint can be given for the resource type to load.
@@ -23883,6 +27017,12 @@
+
+
+
+
+
+
@@ -23925,6 +27065,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -23981,7 +27163,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -24083,6 +27273,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -24324,6 +27550,42 @@
Return the body bounciness.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -24460,6 +27722,18 @@
Return true if the body has the ability to fall asleep when not moving. See [set_can_sleep].
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25437,6 +28711,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25484,356 +28782,1254 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base class for scripts.
+
+
+ Base class for scripts. Any script that is loaded becomes one of these resources, which can then create instances.
+
+
+
+
+
+
+ Return true if this script can be instance (ie not a library).
+
+
+
+
+
+
+
+
+ Return true if a given object uses an instance of this script.
+
+
+
+
+
+
+ Return true if the script contains source code.
+
+
+
+
+
+
+ Return the script source code (if available).
+
+
+
+
+
+
+ Set the script source code.
+
+
+
+
+
+
+ Reload the script. This will fail if there are existing instances.
+
+
+
+
+
+
+
+
+ Base class for scroll bars.
+
+
+ Scrollbars are a [Range] based [Control], that display a draggable area (the size of the page). Horizontal ([HScrollBar]) and Vertical ([VScrollBar]) versions are available.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment Shape for 2D Collision Detection.
+
+
+ Segment Shape for 2D Collision Detection, consists of two points, 'a' and 'b'.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base class for separators.
+
+
+ Separator is a [Control] used for sepataring other controls. It's purely a visual decoration. Horizontal ([HSeparator]) and Vertical ([VSeparator]) versions are available.
+
+
+
+
+
+
+
+
+ To be changed, ignore.
+
+
+ To be changed, ignore.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Base class for scripts.
-
-
- Base class for scripts. Any script that is loaded becomes one of these resources, which can then create instances.
-
-
-
-
-
+
+
+
+
+
+
+
+
- Return true if this script can be instance (ie not a library).
-
-
+
+
-
+
+
+
- Return true if a given object uses an instance of this script.
-
-
-
+
+
+
+
+
+
+
- Return true if the script contains source code.
-
+
+
+
+
+
- Return the script source code (if available).
-
-
+
+
+
+
+
+
- Set the script source code.
-
-
+
+
+
+
+
+
- Reload the script. This will fail if there are existing instances.
-
-
-
-
-
-
- Base class for scroll bars.
-
-
- Scrollbars are a [Range] based [Control], that display a draggable area (the size of the page). Horizontal ([HScrollBar]) and Vertical ([VScrollBar]) versions are available.
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
- Segment Shape for 2D Collision Detection.
-
-
- Segment Shape for 2D Collision Detection, consists of two points, 'a' and 'b'.
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- Base class for separators.
-
-
- Separator is a [Control] used for sepataring other controls. It's purely a visual decoration. Horizontal ([HSeparator]) and Vertical ([VSeparator]) versions are available.
-
-
-
-
-
-
-
-
- To be changed, ignore.
-
-
- To be changed, ignore.
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26474,6 +30670,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26678,6 +30958,8 @@
+
+
@@ -26691,6 +30973,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26703,6 +30997,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26727,6 +31069,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26865,6 +31225,14 @@
+
+
+
+
+
+
+
+
@@ -27043,6 +31411,12 @@
+
+
+
+
+
+
@@ -27125,6 +31499,12 @@
+
+
+
+
+
+
@@ -27518,7 +31898,7 @@
-
+
@@ -27526,7 +31906,7 @@
-
+
@@ -27572,7 +31952,7 @@
-
+
@@ -27638,6 +32018,8 @@
+
+
@@ -27699,6 +32081,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -28110,6 +32516,12 @@
Return part of the string from "from", with length "len".
+
+
+
+
+
+
@@ -28138,6 +32550,12 @@
Return the string converted to uppercase.
+
+
+
+
+
+
@@ -28199,6 +32617,8 @@
+
+
@@ -28682,6 +33102,20 @@
Return the current tab that is being showed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -28745,8 +33179,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -28772,8 +33222,12 @@
+
+
+
+
@@ -28862,8 +33316,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -28872,6 +33344,12 @@
+
+
+
+
+
+
@@ -28890,10 +33368,14 @@
+
+
+
+
@@ -29179,10 +33661,6 @@
-
-
-
-
@@ -29223,6 +33701,8 @@
+
+
@@ -29304,8 +33784,9 @@
+
+
- Draw the texture into a a [VisualServer] canvas item.
@@ -29317,6 +33798,8 @@
+
+
@@ -29329,6 +33812,8 @@
+
+
@@ -29353,6 +33838,8 @@
+
+
@@ -29400,6 +33887,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29436,6 +33935,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29810,7 +34321,7 @@
-
+
@@ -29936,6 +34447,18 @@
Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29964,13 +34487,49 @@
Return true if tiles are to be centered in y coordinate (by default this is false and they are drawn from upper left cell corner).
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30011,8 +34570,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Set the contents of a cell. Cells can be optionally flipped in y or x.
@@ -30053,6 +34627,12 @@
Clear all cells.
+
+
+
+
+
+
@@ -30094,6 +34674,10 @@
+
+
+
+
@@ -30147,6 +34731,22 @@
Return the texture of the tile.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30231,6 +34831,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30335,6 +34999,18 @@
Return the time left for timeout if the timer is active.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30346,6 +35022,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30526,6 +35236,8 @@
+
+
@@ -30538,6 +35250,8 @@
+
+
@@ -30546,18 +35260,24 @@
+
+
+
+
+
+
@@ -31411,7 +36131,7 @@
-
+
@@ -31427,7 +36147,7 @@
-
+
@@ -31443,7 +36163,7 @@
-
+
@@ -31459,7 +36179,7 @@
-
+
@@ -31495,7 +36215,7 @@
-
+
@@ -31517,7 +36237,7 @@
-
+
@@ -31539,13 +36259,43 @@
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -31553,7 +36303,7 @@
-
+
@@ -31577,7 +36327,7 @@
-
+
@@ -31601,7 +36351,7 @@
-
+
@@ -31625,7 +36375,7 @@
-
+
@@ -31649,7 +36399,7 @@
-
+
@@ -31657,7 +36407,7 @@
-
+
@@ -31669,7 +36419,7 @@
-
+
@@ -31678,6 +36428,10 @@
+
+
+
+
@@ -31710,44 +36464,104 @@
-
+
-
-
+
+
+
+
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -32019,7 +36833,7 @@
-
+
@@ -32035,7 +36849,7 @@
-
+
@@ -32057,6 +36871,8 @@
+
+
@@ -32119,6 +36935,8 @@
+
+
@@ -32280,6 +37098,8 @@
+
+
@@ -32348,6 +37168,8 @@
+
+
@@ -32869,6 +37691,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -32994,6 +37832,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -33130,7 +37980,13 @@
-
+
+
+
+
+
+
+
@@ -34478,6 +39334,8 @@
+
+
@@ -34492,6 +39350,8 @@
+
+
@@ -34625,7 +39485,7 @@
-
+
@@ -34877,6 +39737,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Base class for window dialogs.
@@ -34914,10 +39788,10 @@
-
-
+
+
@@ -34968,6 +39842,12 @@
+
+
+
+
+
+
@@ -34998,6 +39878,12 @@
+
+
+
+
+
+
@@ -35195,18 +40081,24 @@
+
+
+
+
+
+
@@ -35223,18 +40115,24 @@
+
+
+
+
+
+
@@ -35253,18 +40151,24 @@
+
+
+
+
+
+
--
cgit v1.3.1
From f41ed99df20f8c436f64b159045f3be5acd86e2c Mon Sep 17 00:00:00 2001
From: Bojidar Marinov
Date: Wed, 23 Sep 2015 17:41:02 +0300
Subject: Update descriptions for Vector2 and Vector2Array
---
doc/base/classes.xml | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index f41cc3ec5..74cacb091 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -10346,7 +10346,7 @@
- Add a custom filter. Filter format is: "mask ; description", example (C++): dialog-<add_filter("*.png ; PNG Images");
+ Add a custom filter. Filter format is: "mask ; description", example (C++): dialog->add_filter("*.png ; PNG Images");
@@ -36726,6 +36726,7 @@
+ Returns the angle in radians between the two vectors.
@@ -36734,12 +36735,14 @@
+ Returns the angle in radians between the line connecting the two points and the x coordinate.
+ Returns the result of atan2 when called with the Vector's x and y as parameters.
@@ -36754,6 +36757,7 @@
+ Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t".
@@ -36762,6 +36766,7 @@
+ Returns the squared distance to vector "b". Prefer this function over "distance_to" if you need to sort vectors or need the squared distance for some formula.
@@ -36799,6 +36804,7 @@
+ Returns the ratio of X to Y.
@@ -36812,6 +36818,7 @@
+ Returns the squared length of the vector. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
@@ -36822,7 +36829,7 @@
- Returns the result of the linear interpolation between this vector and "b", by amount "i".
+ Returns the result of the linear interpolation between this vector and "b", by amount "t".
@@ -36838,6 +36845,7 @@
+ Reflects/mirrors the vector around another vector.
@@ -36846,6 +36854,7 @@
+ Rotates the vector by "phi" radians.
@@ -36854,6 +36863,7 @@
+ Slides the vector by the other vector.
@@ -36862,12 +36872,14 @@
+ Snaps the vector to a grid with the given size.
+ Returns a perpendicular vector.
@@ -36878,6 +36890,7 @@
+ Constructs a new Vector2 from the given x and y.
@@ -36896,8 +36909,10 @@
+ An Array of Vector2's.
+ An Array specifically designed to hold Vector2's.
@@ -36906,18 +36921,21 @@
+ Get the Vector2 at the given index.
+ Insert a new Vector2.
+ Set the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
@@ -36926,12 +36944,14 @@
+ Set the Vector2 at the given index.
+ Returns the size of the array.
@@ -36940,6 +36960,7 @@
+ Constructs a new Vector2Array. Optionally, you can pass in an Array that will be converted.
--
cgit v1.3.1
From a7f0846a6bda8ec789288f1ed3db2d6d82a72322 Mon Sep 17 00:00:00 2001
From: Bojidar Marinov
Date: Wed, 23 Sep 2015 21:33:31 +0300
Subject: Flip < and > in String::xml_escape. Close #2511
Before > referred to < and < to >, which is incorrect...---
core/ustring.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/ustring.cpp b/core/ustring.cpp
index ff7c8984f..f6d8e6c1f 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3119,8 +3119,8 @@ String String::xml_escape(bool p_escape_quotes) const {
String str=*this;
str=str.replace("&","&");
- str=str.replace("<",">");
- str=str.replace(">","<");
+ str=str.replace("<","<");
+ str=str.replace(">",">");
if (p_escape_quotes) {
str=str.replace("'","'");
str=str.replace("\"",""");
--
cgit v1.3.1
From ca11b2fa4b87642d6e1bbd000bfa74e4922b390b Mon Sep 17 00:00:00 2001
From: Bojidar Marinov
Date: Wed, 23 Sep 2015 21:40:24 +0300
Subject: Fix _xml_unescape, as suggested by @reduz
---
core/ustring.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/ustring.cpp b/core/ustring.cpp
index f6d8e6c1f..e5419effc 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3172,12 +3172,12 @@ static _FORCE_INLINE_ int _xml_unescape(const CharType *p_src,int p_src_len,Char
} else if (p_src_len>=4 && p_src[1]=='g' && p_src[2]=='t' && p_src[3]==';') {
if (p_dst)
- *p_dst='<';
+ *p_dst='>';
eat=4;
} else if (p_src_len>=4 && p_src[1]=='l' && p_src[2]=='t' && p_src[3]==';') {
if (p_dst)
- *p_dst='>';
+ *p_dst='<';
eat=4;
} else if (p_src_len>=5 && p_src[1]=='a' && p_src[2]=='m' && p_src[3]=='p' && p_src[4]==';') {
--
cgit v1.3.1
From d55274b5b05198b7beee2ccf61d5259f64cb566a Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Wed, 23 Sep 2015 22:58:30 +0200
Subject: Document TileMap class
---
doc/base/classes.xml | 58 ++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 52 insertions(+), 6 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 74cacb091..438ca6baa 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -34362,10 +34362,10 @@
- Node for 2D Tile-Based games.
+ Node for 2D tile-based games.
- Node for 2D Tile-Based games. Tilemaps use a TileSet which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps.
+ Node for 2D tile-based games. Tilemaps use a [TileSet] which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps.
To optimize drawing and culling (sort of like [GridMap]), you can specify a quadrant size, so chunks of the map will be batched together at drawing time.
@@ -34387,36 +34387,43 @@
+ Set the orientation mode as square, isometric or custom (use MODE_* constants as argument).
+ Return the orientation mode.
+ Set an half offset on the X coordinate, Y coordinate, or none (use HALF_OFFSET_* constants as argument).
+ Half offset sets every other tile off by a half tile size in the specified direction.
+ Return the current half offset configuration.
+ Set custom transform matrix, to use in combination with the custom orientation mode.
+ Return the custom transform matrix.
@@ -34438,25 +34445,28 @@
Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
+ Allowed values are integers ranging from 1 to 128.
- Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
+ Return the quadrant size.
+ Set the tile origin to the tile center or its top-left corner (use TILE_ORIGIN_* constants as argument).
+ Return the tile origin configuration.
@@ -34491,72 +34501,89 @@
+ Set the Y sort mode. Enabled Y sort mode means that children of the tilemap will be drawn in the order defined by their Y coordinate.
+ A tile with a higher Y coordinate will therefore be drawn later, potentially covering up the tile(s) above it if its sprite is higher than its cell size.
+ Return the Y sort mode.
+ Set the tilemap to handle collisions as a kinematic body (enabled) or a static body (disabled).
+ Return whether the tilemap handles collisions as a kinematic body.
+ Set the collision layer.
+ Layers are referenced by binary indexes, so allowable values to describe the 20 available layers range from 0 to 2^20-1.
+ Return the collision layer.
+ Set the collision masks.
+ Masks are referenced by binary indexes, so allowable values to describe the 20 available masks range from 0 to 2^20-1.
+ Return the collision mask.
+ Set the collision friction parameter.
+ Allowable values range from 0 to 1.
+ Return the collision friction parameter.
+ Set the collision bounce parameter.
+ Allowable values range from 0 to 1.
+ Return the collision bounce parameter.
@@ -34573,6 +34600,9 @@
+ Set the tile index for the cell referenced by its grid-based X and Y coordinates.
+ A tile index of -1 clears the cell.
+ Optionally, the tile can also be flipped over the X and Y coordinates or transposed.
@@ -34587,6 +34617,9 @@
+ Set the tile index for the cell referenced by a Vector2 of grid-based coordinates.
+ A tile index of -1 clears the cell.
+ Optionally, the tile can also be flipped over the X and Y axes or transposed.
@@ -34597,7 +34630,7 @@
- Return the contents of a cell.
+ Return the tile index of the referenced cell.
@@ -34608,7 +34641,7 @@
- Return if a given cell is flipped in x axis.
+ Return whether the referenced cell is flipped over the X axis.
@@ -34619,7 +34652,7 @@
- Return if a given cell is flipped in y axis.
+ Return whether the referenced cell is flipped over the Y axis.
@@ -34631,6 +34664,7 @@
+ Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1).
@@ -34641,6 +34675,8 @@
+ Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument.
+ Optionally, the tilemap's potential half offset can be ignored.
@@ -34649,12 +34685,14 @@
+ Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.
+ Signal indicating that a tilemap setting has changed.
@@ -34663,20 +34701,28 @@
Returned when a cell doesn't exist.
+ Orthogonal orientation mode.
+ Isometric orientation mode.
+ Custom orientation mode.
+ Half offset on the X coordinate.
+ Half offset on the Y coordinate.
+ Half offset disabled.
+ Tile origin at its top-left corner.
+ Tile origin at its center.
--
cgit v1.3.1
From c38808b5b1b838c075ded22c490a37dfef3b0ce9 Mon Sep 17 00:00:00 2001
From: Zher Huei Lee
Date: Thu, 24 Sep 2015 14:04:15 +0100
Subject: added alignment to BoxContainer
Allows aligning contents of VBoxContainer and HBoxcontainer without
having to insert expanding spacers.
---
scene/gui/box_container.cpp | 36 ++++++++++++++++++++++++++++++++++++
scene/gui/box_container.h | 17 +++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 6489cbccd..b63b3de53 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -99,8 +99,10 @@ void BoxContainer::_resort() {
elements exist */
+ bool has_stretched = false;
while(stretch_ratio_total>0) { // first of all, dont even be here if no stretchable objects exist
+ has_stretched = true;
bool refit_successful=true; //assume refit-test will go well
for(int i=0;iget_ticks_usec();
- uint32_t tdiff = tick-last_tick;
- float delta_t = tdiff / 1000000.0;
- last_tick=tick;
-
-
- accum+=p_delta_p;
- accum_t+=delta_t;
-
- if (accum_t>max_ref_frame*10)
- accum_t=max_ref_frame*10;
-
- while( accum_t>=min_ref_frame ) {
-
- float slice_t = min_ref_frame / accum_t;
- Vector2 slice = accum*slice_t;
- accum=accum-slice;
- accum_t-=min_ref_frame;
-
- speed=(slice/min_ref_frame).linear_interpolate(speed,min_ref_frame/max_ref_frame);
- }
-
-
-
-}
-
-void InputDefault::SpeedTrack::reset() {
- last_tick = OS::get_singleton()->get_ticks_usec();
- speed=Vector2();
- accum_t=0;
-}
-
-InputDefault::SpeedTrack::SpeedTrack() {
-
- min_ref_frame=0.1;
- max_ref_frame=0.3;
- reset();
-}
-
-bool InputDefault::is_key_pressed(int p_scancode) {
-
- _THREAD_SAFE_METHOD_
- return keys_pressed.has(p_scancode);
-}
-
-bool InputDefault::is_mouse_button_pressed(int p_button) {
-
- _THREAD_SAFE_METHOD_
- return (mouse_button_mask&(1< *alist = InputMap::get_singleton()->get_action_list(p_action);
- if (!alist)
- return NULL;
-
-
- for (const List::Element *E=alist->front();E;E=E->next()) {
-
-
- int device=E->get().device;
-
- switch(E->get().type) {
-
- case InputEvent::KEY: {
-
- const InputEventKey &iek=E->get().key;
- if ((keys_pressed.has(iek.scancode)))
- return true;
- } break;
- case InputEvent::MOUSE_BUTTON: {
-
- const InputEventMouseButton &iemb=E->get().mouse_button;
- if(mouse_button_mask&(1<get().joy_button;
- int c = _combine_device(iejb.button_index,device);
- if (joy_buttons_pressed.has(c))
- return true;
- } break;
- }
- }
-
- return false;
-}
-
-float InputDefault::get_joy_axis(int p_device,int p_axis) {
-
- _THREAD_SAFE_METHOD_
- int c = _combine_device(p_axis,p_device);
- if (joy_axis.has(c)) {
- return joy_axis[c];
- } else {
- return 0;
- }
-}
-
-String InputDefault::get_joy_name(int p_idx) {
-
- _THREAD_SAFE_METHOD_
- return joy_names[p_idx];
-};
-
-void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name) {
-
- _THREAD_SAFE_METHOD_
- joy_names[p_idx] = p_connected ? p_name : "";
-
- emit_signal("joy_connection_changed", p_idx, p_connected);
-};
-
-Vector3 InputDefault::get_accelerometer() {
-
- _THREAD_SAFE_METHOD_
- return accelerometer;
-}
-
-void InputDefault::parse_input_event(const InputEvent& p_event) {
-
- _THREAD_SAFE_METHOD_
- switch(p_event.type) {
-
- case InputEvent::KEY: {
-
- if (p_event.key.echo)
- break;
- if (p_event.key.scancode==0)
- break;
-
- // print_line(p_event);
-
- if (p_event.key.pressed)
- keys_pressed.insert(p_event.key.scancode);
- else
- keys_pressed.erase(p_event.key.scancode);
- } break;
- case InputEvent::MOUSE_BUTTON: {
-
- if (p_event.mouse_button.doubleclick)
- break;
-
- if (p_event.mouse_button.pressed)
- mouse_button_mask|=(1<input_event(ev);
- }
- } break;
- case InputEvent::MOUSE_MOTION: {
-
- if (main_loop && emulate_touch && p_event.mouse_motion.button_mask&1) {
- InputEventScreenDrag drag_event;
- drag_event.index=0;
- drag_event.x=p_event.mouse_motion.x;
- drag_event.y=p_event.mouse_motion.y;
- drag_event.relative_x=p_event.mouse_motion.relative_x;
- drag_event.relative_y=p_event.mouse_motion.relative_y;
- drag_event.speed_x=p_event.mouse_motion.speed_x;
- drag_event.speed_y=p_event.mouse_motion.speed_y;
-
- InputEvent ev;
- ev.type=InputEvent::SCREEN_DRAG;
- ev.screen_drag=drag_event;
-
- main_loop->input_event(ev);
- }
-
- } break;
- case InputEvent::JOYSTICK_BUTTON: {
-
- int c = _combine_device(p_event.joy_button.button_index,p_event.device);
-
- if (p_event.joy_button.pressed)
- joy_buttons_pressed.insert(c);
- else
- joy_buttons_pressed.erase(c);
- } break;
- case InputEvent::JOYSTICK_MOTION: {
- set_joy_axis(p_event.device, p_event.joy_motion.axis, p_event.joy_motion.axis_value);
- } break;
-
- }
-
- if (main_loop)
- main_loop->input_event(p_event);
-
-}
-
-void InputDefault::set_joy_axis(int p_device,int p_axis,float p_value) {
-
- _THREAD_SAFE_METHOD_
- int c = _combine_device(p_axis,p_device);
- joy_axis[c]=p_value;
-}
-
-void InputDefault::set_accelerometer(const Vector3& p_accel) {
-
- _THREAD_SAFE_METHOD_
-
- accelerometer=p_accel;
-
-}
-
-void InputDefault::set_main_loop(MainLoop *p_main_loop) {
- main_loop=p_main_loop;
-
-}
-
-void InputDefault::set_mouse_pos(const Point2& p_posf) {
-
- mouse_speed_track.update(p_posf-mouse_pos);
- mouse_pos=p_posf;
-}
-
-Point2 InputDefault::get_mouse_pos() const {
-
- return mouse_pos;
-}
-Point2 InputDefault::get_mouse_speed() const {
-
- return mouse_speed_track.speed;
-}
-
-int InputDefault::get_mouse_button_mask() const {
-
- return OS::get_singleton()->get_mouse_button_state();
-}
-
-void InputDefault::warp_mouse_pos(const Vector2& p_to) {
-
- OS::get_singleton()->warp_mouse_pos(p_to);
-}
-
-
-void InputDefault::iteration(float p_step) {
-
-
-}
-
-void InputDefault::action_press(const StringName& p_action) {
-
- if (custom_action_press.has(p_action)) {
-
- custom_action_press[p_action]++;
- } else {
- custom_action_press[p_action]=1;
- }
-}
-
-void InputDefault::action_release(const StringName& p_action){
-
- ERR_FAIL_COND(!custom_action_press.has(p_action));
- custom_action_press[p_action]--;
- if (custom_action_press[p_action]==0) {
- custom_action_press.erase(p_action);
- }
-}
-
-void InputDefault::set_emulate_touch(bool p_emulate) {
-
- emulate_touch=p_emulate;
-}
-
-bool InputDefault::is_emulating_touchscreen() const {
-
- return emulate_touch;
-}
-
-InputDefault::InputDefault() {
-
- mouse_button_mask=0;
- emulate_touch=false;
- main_loop=NULL;
-}
diff --git a/core/os/input.h b/core/os/input.h
index 5c69ced82..8aa0e6b18 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -80,82 +80,13 @@ public:
virtual bool is_emulating_touchscreen() const=0;
+ virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0;
+ virtual void set_mouse_in_window(bool p_in_window)=0;
Input();
};
VARIANT_ENUM_CAST(Input::MouseMode);
-class InputDefault : public Input {
-
- OBJ_TYPE( InputDefault, Input );
- _THREAD_SAFE_CLASS_
-
- int mouse_button_mask;
- Set keys_pressed;
- Set joy_buttons_pressed;
- Map joy_axis;
- Map custom_action_press;
- Map joy_names;
- Vector3 accelerometer;
- Vector2 mouse_pos;
- MainLoop *main_loop;
-
- bool emulate_touch;
-
- struct SpeedTrack {
-
- uint64_t last_tick;
- Vector2 speed;
- Vector2 accum;
- float accum_t;
- float min_ref_frame;
- float max_ref_frame;
-
- void update(const Vector2& p_delta_p);
- void reset();
- SpeedTrack();
- };
-
- SpeedTrack mouse_speed_track;
-
-public:
-
- virtual bool is_key_pressed(int p_scancode);
- virtual bool is_mouse_button_pressed(int p_button);
- virtual bool is_joy_button_pressed(int p_device, int p_button);
- virtual bool is_action_pressed(const StringName& p_action);
-
- virtual float get_joy_axis(int p_device,int p_axis);
- String get_joy_name(int p_idx);
- void joy_connection_changed(int p_idx, bool p_connected, String p_name);
-
- virtual Vector3 get_accelerometer();
-
- virtual Point2 get_mouse_pos() const;
- virtual Point2 get_mouse_speed() const;
- virtual int get_mouse_button_mask() const;
-
- virtual void warp_mouse_pos(const Vector2& p_to);
-
-
- void parse_input_event(const InputEvent& p_event);
- void set_accelerometer(const Vector3& p_accel);
- void set_joy_axis(int p_device,int p_axis,float p_value);
-
- void set_main_loop(MainLoop *main_loop);
- void set_mouse_pos(const Point2& p_posf);
-
- void action_press(const StringName& p_action);
- void action_release(const StringName& p_action);
-
- void iteration(float p_step);
-
- void set_emulate_touch(bool p_emulate);
- virtual bool is_emulating_touchscreen() const;
-
- InputDefault();
-
-};
#endif // INPUT_H
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index b4c02ddbc..c37c281fb 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -45,7 +45,8 @@ void MainLoop::_bind_methods() {
BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) );
BIND_VMETHOD( MethodInfo("_finalize") );
-
+ BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
+ BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT);
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index bf9fe83a4..c5d58120c 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -47,6 +47,8 @@ protected:
public:
enum {
+ NOTIFICATION_WM_MOUSE_ENTER = 3,
+ NOTIFICATION_WM_MOUSE_EXIT = 4,
NOTIFICATION_WM_FOCUS_IN = 5,
NOTIFICATION_WM_FOCUS_OUT = 6,
NOTIFICATION_WM_QUIT_REQUEST = 7,
diff --git a/main/input_default.cpp b/main/input_default.cpp
new file mode 100644
index 000000000..878d21c30
--- /dev/null
+++ b/main/input_default.cpp
@@ -0,0 +1,343 @@
+#include "input_default.h"
+#include "servers/visual_server.h"
+#include "os/os.h"
+#include "input_map.h"
+
+void InputDefault::SpeedTrack::update(const Vector2& p_delta_p) {
+
+ uint64_t tick = OS::get_singleton()->get_ticks_usec();
+ uint32_t tdiff = tick-last_tick;
+ float delta_t = tdiff / 1000000.0;
+ last_tick=tick;
+
+
+ accum+=p_delta_p;
+ accum_t+=delta_t;
+
+ if (accum_t>max_ref_frame*10)
+ accum_t=max_ref_frame*10;
+
+ while( accum_t>=min_ref_frame ) {
+
+ float slice_t = min_ref_frame / accum_t;
+ Vector2 slice = accum*slice_t;
+ accum=accum-slice;
+ accum_t-=min_ref_frame;
+
+ speed=(slice/min_ref_frame).linear_interpolate(speed,min_ref_frame/max_ref_frame);
+ }
+
+}
+
+void InputDefault::SpeedTrack::reset() {
+ last_tick = OS::get_singleton()->get_ticks_usec();
+ speed=Vector2();
+ accum_t=0;
+}
+
+InputDefault::SpeedTrack::SpeedTrack() {
+
+ min_ref_frame=0.1;
+ max_ref_frame=0.3;
+ reset();
+}
+
+bool InputDefault::is_key_pressed(int p_scancode) {
+
+ _THREAD_SAFE_METHOD_
+ return keys_pressed.has(p_scancode);
+}
+
+bool InputDefault::is_mouse_button_pressed(int p_button) {
+
+ _THREAD_SAFE_METHOD_
+ return (mouse_button_mask&(1< *alist = InputMap::get_singleton()->get_action_list(p_action);
+ if (!alist)
+ return NULL;
+
+
+ for (const List::Element *E=alist->front();E;E=E->next()) {
+
+
+ int device=E->get().device;
+
+ switch(E->get().type) {
+
+ case InputEvent::KEY: {
+
+ const InputEventKey &iek=E->get().key;
+ if ((keys_pressed.has(iek.scancode)))
+ return true;
+ } break;
+ case InputEvent::MOUSE_BUTTON: {
+
+ const InputEventMouseButton &iemb=E->get().mouse_button;
+ if(mouse_button_mask&(1<get().joy_button;
+ int c = _combine_device(iejb.button_index,device);
+ if (joy_buttons_pressed.has(c))
+ return true;
+ } break;
+ }
+ }
+
+ return false;
+}
+
+float InputDefault::get_joy_axis(int p_device,int p_axis) {
+
+ _THREAD_SAFE_METHOD_
+ int c = _combine_device(p_axis,p_device);
+ if (joy_axis.has(c)) {
+ return joy_axis[c];
+ } else {
+ return 0;
+ }
+}
+
+String InputDefault::get_joy_name(int p_idx) {
+
+ _THREAD_SAFE_METHOD_
+ return joy_names[p_idx];
+};
+
+void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name) {
+
+ _THREAD_SAFE_METHOD_
+ joy_names[p_idx] = p_connected ? p_name : "";
+
+ emit_signal("joy_connection_changed", p_idx, p_connected);
+};
+
+Vector3 InputDefault::get_accelerometer() {
+
+ _THREAD_SAFE_METHOD_
+ return accelerometer;
+}
+
+void InputDefault::parse_input_event(const InputEvent& p_event) {
+
+ _THREAD_SAFE_METHOD_
+ switch(p_event.type) {
+
+ case InputEvent::KEY: {
+
+ if (p_event.key.echo)
+ break;
+ if (p_event.key.scancode==0)
+ break;
+
+ // print_line(p_event);
+
+ if (p_event.key.pressed)
+ keys_pressed.insert(p_event.key.scancode);
+ else
+ keys_pressed.erase(p_event.key.scancode);
+ } break;
+ case InputEvent::MOUSE_BUTTON: {
+
+ if (p_event.mouse_button.doubleclick)
+ break;
+
+ if (p_event.mouse_button.pressed)
+ mouse_button_mask|=(1<input_event(ev);
+ }
+ } break;
+ case InputEvent::MOUSE_MOTION: {
+
+ if (main_loop && emulate_touch && p_event.mouse_motion.button_mask&1) {
+ InputEventScreenDrag drag_event;
+ drag_event.index=0;
+ drag_event.x=p_event.mouse_motion.x;
+ drag_event.y=p_event.mouse_motion.y;
+ drag_event.relative_x=p_event.mouse_motion.relative_x;
+ drag_event.relative_y=p_event.mouse_motion.relative_y;
+ drag_event.speed_x=p_event.mouse_motion.speed_x;
+ drag_event.speed_y=p_event.mouse_motion.speed_y;
+
+ InputEvent ev;
+ ev.type=InputEvent::SCREEN_DRAG;
+ ev.screen_drag=drag_event;
+
+ main_loop->input_event(ev);
+ }
+
+ } break;
+ case InputEvent::JOYSTICK_BUTTON: {
+
+ int c = _combine_device(p_event.joy_button.button_index,p_event.device);
+
+ if (p_event.joy_button.pressed)
+ joy_buttons_pressed.insert(c);
+ else
+ joy_buttons_pressed.erase(c);
+ } break;
+ case InputEvent::JOYSTICK_MOTION: {
+ set_joy_axis(p_event.device, p_event.joy_motion.axis, p_event.joy_motion.axis_value);
+ } break;
+
+ }
+
+ if (main_loop)
+ main_loop->input_event(p_event);
+
+}
+
+void InputDefault::set_joy_axis(int p_device,int p_axis,float p_value) {
+
+ _THREAD_SAFE_METHOD_
+ int c = _combine_device(p_axis,p_device);
+ joy_axis[c]=p_value;
+}
+
+void InputDefault::set_accelerometer(const Vector3& p_accel) {
+
+ _THREAD_SAFE_METHOD_
+
+ accelerometer=p_accel;
+
+}
+
+void InputDefault::set_main_loop(MainLoop *p_main_loop) {
+ main_loop=p_main_loop;
+
+}
+
+void InputDefault::set_mouse_pos(const Point2& p_posf) {
+
+ mouse_speed_track.update(p_posf-mouse_pos);
+ mouse_pos=p_posf;
+ if (custom_cursor.is_valid()) {
+ VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos());
+ }
+}
+
+Point2 InputDefault::get_mouse_pos() const {
+
+ return mouse_pos;
+}
+Point2 InputDefault::get_mouse_speed() const {
+
+ return mouse_speed_track.speed;
+}
+
+int InputDefault::get_mouse_button_mask() const {
+
+ return OS::get_singleton()->get_mouse_button_state();
+}
+
+void InputDefault::warp_mouse_pos(const Vector2& p_to) {
+
+ OS::get_singleton()->warp_mouse_pos(p_to);
+}
+
+
+void InputDefault::iteration(float p_step) {
+
+
+}
+
+void InputDefault::action_press(const StringName& p_action) {
+
+ if (custom_action_press.has(p_action)) {
+
+ custom_action_press[p_action]++;
+ } else {
+ custom_action_press[p_action]=1;
+ }
+}
+
+void InputDefault::action_release(const StringName& p_action){
+
+ ERR_FAIL_COND(!custom_action_press.has(p_action));
+ custom_action_press[p_action]--;
+ if (custom_action_press[p_action]==0) {
+ custom_action_press.erase(p_action);
+ }
+}
+
+void InputDefault::set_emulate_touch(bool p_emulate) {
+
+ emulate_touch=p_emulate;
+}
+
+bool InputDefault::is_emulating_touchscreen() const {
+
+ return emulate_touch;
+}
+
+void InputDefault::set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot) {
+ if (custom_cursor==p_cursor)
+ return;
+
+ custom_cursor=p_cursor;
+
+ if (p_cursor.is_null()) {
+ set_mouse_mode(MOUSE_MODE_VISIBLE);
+ VisualServer::get_singleton()->cursor_set_visible(false);
+ } else {
+ set_mouse_mode(MOUSE_MODE_HIDDEN);
+ VisualServer::get_singleton()->cursor_set_visible(true);
+ VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(),p_hotspot);
+ VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos());
+ }
+}
+
+void InputDefault::set_mouse_in_window(bool p_in_window) {
+
+ if (custom_cursor.is_valid()) {
+
+ if (p_in_window) {
+ set_mouse_mode(MOUSE_MODE_HIDDEN);
+ VisualServer::get_singleton()->cursor_set_visible(true);
+ } else {
+ set_mouse_mode(MOUSE_MODE_VISIBLE);
+ VisualServer::get_singleton()->cursor_set_visible(false);
+ }
+
+ }
+}
+
+InputDefault::InputDefault() {
+
+ mouse_button_mask=0;
+ emulate_touch=false;
+ main_loop=NULL;
+}
diff --git a/main/input_default.h b/main/input_default.h
new file mode 100644
index 000000000..2ef4f727c
--- /dev/null
+++ b/main/input_default.h
@@ -0,0 +1,83 @@
+#ifndef INPUT_DEFAULT_H
+#define INPUT_DEFAULT_H
+
+#include "os/input.h"
+
+class InputDefault : public Input {
+
+ OBJ_TYPE( InputDefault, Input );
+ _THREAD_SAFE_CLASS_
+
+ int mouse_button_mask;
+ Set keys_pressed;
+ Set joy_buttons_pressed;
+ Map joy_axis;
+ Map custom_action_press;
+ Map joy_names;
+ Vector3 accelerometer;
+ Vector2 mouse_pos;
+ MainLoop *main_loop;
+
+ bool emulate_touch;
+
+ struct SpeedTrack {
+
+ uint64_t last_tick;
+ Vector2 speed;
+ Vector2 accum;
+ float accum_t;
+ float min_ref_frame;
+ float max_ref_frame;
+
+ void update(const Vector2& p_delta_p);
+ void reset();
+ SpeedTrack();
+ };
+
+ SpeedTrack mouse_speed_track;
+
+ RES custom_cursor;
+
+public:
+
+ virtual bool is_key_pressed(int p_scancode);
+ virtual bool is_mouse_button_pressed(int p_button);
+ virtual bool is_joy_button_pressed(int p_device, int p_button);
+ virtual bool is_action_pressed(const StringName& p_action);
+
+ virtual float get_joy_axis(int p_device,int p_axis);
+ String get_joy_name(int p_idx);
+ void joy_connection_changed(int p_idx, bool p_connected, String p_name);
+
+ virtual Vector3 get_accelerometer();
+
+ virtual Point2 get_mouse_pos() const;
+ virtual Point2 get_mouse_speed() const;
+ virtual int get_mouse_button_mask() const;
+
+ virtual void warp_mouse_pos(const Vector2& p_to);
+
+
+ void parse_input_event(const InputEvent& p_event);
+ void set_accelerometer(const Vector3& p_accel);
+ void set_joy_axis(int p_device,int p_axis,float p_value);
+
+ void set_main_loop(MainLoop *main_loop);
+ void set_mouse_pos(const Point2& p_posf);
+
+ void action_press(const StringName& p_action);
+ void action_release(const StringName& p_action);
+
+ void iteration(float p_step);
+
+ void set_emulate_touch(bool p_emulate);
+ virtual bool is_emulating_touchscreen() const;
+
+ virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2());
+ virtual void set_mouse_in_window(bool p_in_window);
+
+ InputDefault();
+
+};
+
+#endif // INPUT_DEFAULT_H
diff --git a/main/main.cpp b/main/main.cpp
index 9b7e190e0..dc117153b 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -75,7 +75,7 @@
#include "core/io/file_access_zip.h"
#include "translation.h"
#include "version.h"
-#include "os/input.h"
+#include "main/input_default.h"
#include "performance.h"
static Globals *globals=NULL;
@@ -920,6 +920,9 @@ Error Main::setup2() {
id->set_emulate_touch(true);
}
}
+
+
+
MAIN_PRINT("Main: Load Remaps");
MAIN_PRINT("Main: Load Scene Types");
@@ -927,6 +930,20 @@ Error Main::setup2() {
register_scene_types();
register_server_types();
+ GLOBAL_DEF("display/custom_mouse_cursor",String());
+ GLOBAL_DEF("display/custom_mouse_cursor_hotspot",Vector2());
+ Globals::get_singleton()->set_custom_property_info("display/custom_mouse_cursor",PropertyInfo(Variant::STRING,"display/custom_mouse_cursor",PROPERTY_HINT_FILE,"*.png,*.webp"));
+
+ if (String(Globals::get_singleton()->get("display/custom_mouse_cursor"))!=String()) {
+
+ print_line("use custom cursor");
+ Ref cursor=ResourceLoader::load(Globals::get_singleton()->get("display/custom_mouse_cursor"));
+ if (cursor.is_valid()) {
+ print_line("loaded ok");
+ Vector2 hotspot = Globals::get_singleton()->get("display/custom_mouse_cursor_hotspot");
+ Input::get_singleton()->set_custom_mouse_cursor(cursor,hotspot);
+ }
+ }
#ifdef TOOLS_ENABLED
EditorNode::register_editor_types();
ObjectTypeDB::register_type(); // todo: move somewhere else
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index e9b0d0019..dcaa1db65 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -39,7 +39,7 @@
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
-
+#include "main/input_default.h"
//#ifdef USE_JAVA_FILE_ACCESS
diff --git a/platform/flash/os_flash.h b/platform/flash/os_flash.h
index 42ae3f071..c8013df2f 100644
--- a/platform/flash/os_flash.h
+++ b/platform/flash/os_flash.h
@@ -11,6 +11,7 @@
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/audio/audio_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
+#include "main/input_default.h"
class OSFlash : public OS_Unix {
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 844f06755..de167dd30 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -43,9 +43,11 @@
#include "servers/audio/sample_manager_sw.h"
#include "servers/spatial_sound/spatial_sound_server_sw.h"
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "main/input_default.h"
#include "game_center.h"
#include "in_app_store.h"
+
class AudioDriverIphone;
class RasterizerGLES2;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index d52c465c7..5f671d45c 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -40,6 +40,7 @@
#include "servers/visual/rasterizer.h"
#include "audio_server_javascript.h"
#include "audio_driver_javascript.h"
+#include "main/input_default.h"
typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs);
typedef int (*OpenURIFunc)(const String&);
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 869997f19..49fa6c086 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -32,7 +32,7 @@
#include "os/input.h"
#include "drivers/unix/os_unix.h"
-
+#include "main/input_default.h"
#include "servers/visual_server.h"
#include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index abfe42bed..b0ce37cec 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -512,12 +512,26 @@ static int button_mask=0;
- (void)mouseExited:(NSEvent *)event
{
+ if (!OS_OSX::singleton)
+ return;
+
+ if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED)
+ OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
+ if (OS_OSX::singleton->input)
+ OS_OSX::singleton->input->set_mouse_in_window(false);
// _glfwInputCursorEnter(window, GL_FALSE);
}
- (void)mouseEntered:(NSEvent *)event
{
// _glfwInputCursorEnter(window, GL_TRUE);
+ if (!OS_OSX::singleton)
+ return;
+ if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED)
+ OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
+ if (OS_OSX::singleton->input)
+ OS_OSX::singleton->input->set_mouse_in_window(true);
+
}
- (void)viewDidChangeBackingProperties
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 4e7721f06..b3410f795 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -30,7 +30,7 @@
#define OS_SERVER_H
-#include "os/input.h"
+#include "main/input_default.h"
#include "drivers/unix/os_unix.h"
#include "servers/visual_server.h"
#include "servers/visual/rasterizer.h"
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 87d9a43d8..438a5a690 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -323,11 +323,21 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
old_invalid=true;
outside=true;
+ if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
+ if (input)
+ input->set_mouse_in_window(false);
} break;
case WM_MOUSEMOVE: {
if (outside) {
+ //mouse enter
+
+ if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
+ if (input)
+ input->set_mouse_in_window(true);
CursorShape c=cursor_shape;
cursor_shape=CURSOR_MAX;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index cce94f5b2..026b50c33 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -47,6 +47,7 @@
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
+#include "main/input_default.h"
#include
diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h
index b69feccae..5719426f9 100644
--- a/platform/winrt/os_winrt.h
+++ b/platform/winrt/os_winrt.h
@@ -50,6 +50,8 @@
#include
#include
+#include "main/input_default.h"
+
/**
@author Juan Linietsky
*/
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 51f4392eb..482e4d715 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1181,8 +1181,22 @@ void OS_X11::process_xevents() {
XVisibilityEvent * visibility = (XVisibilityEvent *)&event;
minimized = (visibility->state == VisibilityFullyObscured);
} break;
+ case LeaveNotify: {
- case FocusIn:
+ if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
+ if (input)
+ input->set_mouse_in_window(false);
+
+ } break;
+ case EnterNotify: {
+
+ if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
+ if (input)
+ input->set_mouse_in_window(true);
+ } break;
+ case FocusIn:
minimized = false;
#ifdef NEW_WM_API
if(current_videomode.fullscreen) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 12f0aec61..95857c034 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -46,6 +46,7 @@
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
+#include "main/input_default.h"
#include
#include
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 9df29f70e..4712ba308 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -187,30 +187,59 @@ void Skeleton::_notification(int p_what) {
Bone &b=bonesptr[i];
- if (b.enabled) {
+ if (b.disable_rest) {
+ if (b.enabled) {
- Transform pose=b.pose;
- if (b.custom_pose_enable) {
+ Transform pose=b.pose;
+ if (b.custom_pose_enable) {
- pose = b.custom_pose * pose;
- }
+ pose = b.custom_pose * pose;
+ }
+
+ if (b.parent>=0) {
+
+ b.pose_global=bonesptr[b.parent].pose_global * pose;
+ } else {
- if (b.parent>=0) {
-
- b.pose_global=bonesptr[b.parent].pose_global * (b.rest * pose);
+ b.pose_global=pose;
+ }
} else {
-
- b.pose_global=b.rest * pose;
+
+ if (b.parent>=0) {
+
+ b.pose_global=bonesptr[b.parent].pose_global;
+ } else {
+
+ b.pose_global=Transform();
+ }
}
+
} else {
-
- if (b.parent>=0) {
-
- b.pose_global=bonesptr[b.parent].pose_global * b.rest;
+ if (b.enabled) {
+
+ Transform pose=b.pose;
+ if (b.custom_pose_enable) {
+
+ pose = b.custom_pose * pose;
+ }
+
+ if (b.parent>=0) {
+
+ b.pose_global=bonesptr[b.parent].pose_global * (b.rest * pose);
+ } else {
+
+ b.pose_global=b.rest * pose;
+ }
} else {
-
- b.pose_global=b.rest;
- }
+
+ if (b.parent>=0) {
+
+ b.pose_global=bonesptr[b.parent].pose_global * b.rest;
+ } else {
+
+ b.pose_global=b.rest;
+ }
+ }
}
vs->skeleton_bone_set_transform( skeleton, i, b.pose_global * b.rest_global_inverse );
@@ -315,6 +344,37 @@ void Skeleton::set_bone_parent(int p_bone, int p_parent) {
_make_dirty();
}
+void Skeleton::unparent_bone_and_rest(int p_bone) {
+
+ ERR_FAIL_INDEX( p_bone, bones.size() );
+
+ int parent=bones[p_bone].parent;
+ while(parent>=0) {
+ bones[p_bone].rest = bones[parent].rest * bones[p_bone].rest;
+ parent=bones[parent].parent;
+ }
+
+ bones[p_bone].parent=-1;
+ bones[p_bone].rest_global_inverse=bones[p_bone].rest.affine_inverse(); //same thing
+
+ _make_dirty();
+
+}
+
+void Skeleton::set_bone_disable_rest(int p_bone, bool p_disable) {
+
+ ERR_FAIL_INDEX( p_bone, bones.size() );
+ bones[p_bone].disable_rest=p_disable;
+
+}
+
+bool Skeleton::is_bone_rest_disabled(int p_bone) const {
+
+ ERR_FAIL_INDEX_V( p_bone, bones.size(), false );
+ return bones[p_bone].disable_rest;
+}
+
+
int Skeleton::get_bone_parent(int p_bone) const {
ERR_FAIL_INDEX_V( p_bone, bones.size(), -1 );
@@ -522,9 +582,14 @@ void Skeleton::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_bone_count"),&Skeleton::get_bone_count);
+ ObjectTypeDB::bind_method(_MD("unparent_bone_and_rest","bone_idx"),&Skeleton::unparent_bone_and_rest);
+
ObjectTypeDB::bind_method(_MD("get_bone_rest","bone_idx"),&Skeleton::get_bone_rest);
ObjectTypeDB::bind_method(_MD("set_bone_rest","bone_idx","rest"),&Skeleton::set_bone_rest);
+ ObjectTypeDB::bind_method(_MD("set_bone_disable_rest","bone_idx","disable"),&Skeleton::set_bone_disable_rest);
+ ObjectTypeDB::bind_method(_MD("is_bone_rest_disabled","bone_idx"),&Skeleton::is_bone_rest_disabled);
+
ObjectTypeDB::bind_method(_MD("bind_child_node_to_bone","bone_idx","node:Node"),&Skeleton::bind_child_node_to_bone);
ObjectTypeDB::bind_method(_MD("unbind_child_node_from_bone","bone_idx","node:Node"),&Skeleton::unbind_child_node_from_bone);
ObjectTypeDB::bind_method(_MD("get_bound_child_nodes_to_bone","bone_idx"),&Skeleton::_get_bound_child_nodes_to_bone);
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index b7f84f44c..6678722d1 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -46,6 +46,7 @@ class Skeleton : public Spatial {
bool enabled;
int parent;
+ bool disable_rest;
Transform rest;
Transform rest_global_inverse;
@@ -57,7 +58,7 @@ class Skeleton : public Spatial {
List nodes_bound;
- Bone() { parent=-1; enabled=true; custom_pose_enable=false; }
+ Bone() { parent=-1; enabled=true; custom_pose_enable=false; disable_rest=false; }
};
bool rest_global_inverse_dirty;
@@ -111,6 +112,11 @@ public:
void set_bone_parent(int p_bone, int p_parent);
int get_bone_parent(int p_bone) const;
+ void unparent_bone_and_rest(int p_idx);
+
+ void set_bone_disable_rest(int p_bone, bool p_disable);
+ bool is_bone_rest_disabled(int p_bone) const;
+
int get_bone_count() const;
void set_bone_rest(int p_bone, const Transform& p_rest);
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 84fc14d2e..0f7b4a5e0 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -842,6 +842,17 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
boot_splash=splash;
}
}
+ StringName custom_cursor;
+ {
+ String splash=Globals::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted
+ splash=splash.strip_edges();
+ if (splash!=String()) {
+ if (!splash.begins_with("res://"))
+ splash="res://"+splash;
+ splash=splash.simplify_path();
+ custom_cursor=splash;
+ }
+ }
@@ -853,7 +864,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
String src=files[i];
Vector buf;
- if (src==boot_splash)
+ if (src==boot_splash || src==custom_cursor)
buf = get_exported_file_default(src); //bootsplash must be kept if used
else
buf = get_exported_file(src);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 63684dcc9..14ed75d1a 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -93,7 +93,7 @@
#include "plugins/light_occluder_2d_editor_plugin.h"
#include "plugins/color_ramp_editor_plugin.h"
#include "plugins/collision_shape_2d_editor_plugin.h"
-#include "os/input.h"
+#include "main/input_default.h"
// end
#include "tools/editor/io_plugins/editor_texture_import_plugin.h"
#include "tools/editor/io_plugins/editor_scene_import_plugin.h"
@@ -4390,11 +4390,15 @@ EditorNode::EditorNode() {
EditorHelp::generate_doc(); //before any editor classes are crated
- if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) {
- //only if no touchscreen ui hint, set emulation
- InputDefault *id = Input::get_singleton()->cast_to();
- if (id)
+ InputDefault *id = Input::get_singleton()->cast_to();
+
+ if (id) {
+
+ if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) {
+ //only if no touchscreen ui hint, set emulation
id->set_emulate_touch(false); //just disable just in case
+ }
+ id->set_custom_mouse_cursor(RES());
}
--
cgit v1.3.1
From c69ea708fabd04f0bf4aafc590e63bb165b88ee0 Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Fri, 25 Sep 2015 17:54:24 +0200
Subject: Sync classes reference template with current code base
---
doc/base/classes.xml | 76 +++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 64 insertions(+), 12 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 289c98691..80cf70a86 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -5182,8 +5182,26 @@
Base class for Box containers. It arranges children controls vertically or horizontally, and rearranges them automatically when their minimum size changes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13239,6 +13257,14 @@
+
+
+
+
+
+
+
+
@@ -14375,7 +14401,7 @@
-
+
@@ -14964,7 +14990,7 @@
-
+
Control that displays formatted text.
@@ -15105,32 +15131,32 @@
Return the restricted number of characters to display (as a percentage of the total text).
-
-
+
+
- Restricts the number of lines to display. Set to -1 to disable.
+ Sets the number of lines to skip before displaying. Useful for scrolling text.
-
+
- Return the restricted number of lines to display. Returns -1 if unrestricted.
+ Return the the number of lines to skipped before displaying.
-
-
+
+
- Sets the number of lines to skip before displaying. Useful for scrolling text.
+ Restricts the number of lines to display. Set to -1 to disable.
-
+
- Return the the number of lines to skipped before displaying.
+ Return the restricted number of lines to display. Returns -1 if unrestricted.
@@ -15912,6 +15938,10 @@
+
+
+
+
@@ -30272,6 +30302,12 @@
Return the amount of bones in the skeleton.
+
+
+
+
+
+
@@ -30290,6 +30326,22 @@
Set the rest transform for bone "bone_idx"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.3.1
From 4abc7f57403bdc2e29b0c6a6627a556440b2b9b9 Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Fri, 25 Sep 2015 20:45:00 +0200
Subject: Update documentation for TileSet and Timer
---
doc/base/classes.xml | 52 +++++++++++++++++++++++++++++++++++++++-------------
scene/main/timer.cpp | 5 ++++-
2 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 80cf70a86..9a863ab86 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -34841,13 +34841,14 @@
A TileSet is a library of tiles for a [TileMap]. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
+ Tiles are referenced by a unique integer ID.
- Create a new tile, the ID must be specified.
+ Create a new tile which will be referenced by the given ID.
@@ -34856,7 +34857,7 @@
- Set the name of a tile, for decriptive purposes.
+ Set the name of the tile, for descriptive purposes.
@@ -34865,7 +34866,7 @@
- Return the name of a tile, for decriptive purposes.
+ Return the name of the tile.
@@ -34892,6 +34893,7 @@
+ Set the material of the tile.
@@ -34900,6 +34902,7 @@
+ Return the material of the tile.
@@ -34908,6 +34911,7 @@
+ Set the texture offset of the tile.
@@ -34916,6 +34920,7 @@
+ Return the texture offset of the tile.
@@ -34924,6 +34929,7 @@
+ Set the shape offset of the tile.
@@ -34932,6 +34938,7 @@
+ Return the shape offset of the tile.
@@ -34949,7 +34956,7 @@
- Return the tile sub-region in the texture. This is common in texture atlases.
+ Return the tile sub-region in the texture.
@@ -34976,6 +34983,7 @@
+ Set an array of shapes for the tile, enabling physics to collide with it.
@@ -34984,6 +34992,7 @@
+ Return the array of shapes of the tile.
@@ -34992,6 +35001,7 @@
+ Set a navigation polygon for the tile.
@@ -35000,6 +35010,7 @@
+ Return the navigation polygon of the tile.
@@ -35008,6 +35019,7 @@
+ Set an offset for the tile's navigation polygon.
@@ -35016,6 +35028,7 @@
+ Return the offset of the tile's navigation polygon.
@@ -35024,6 +35037,7 @@
+ Set a light occluder for the tile.
@@ -35032,6 +35046,7 @@
+ Return the light occluder of the tile.
@@ -35040,6 +35055,7 @@
+ Set an offset for the tile's light occluder.
@@ -35048,13 +35064,14 @@
+ Return the offset of the tile's light occluder.
- Remove a tile, by integer id.
+ Remove the tile referenced by the given ID.
@@ -35066,7 +35083,7 @@
- Find an empty id for creating a new tile.
+ Return the ID following the last currently used ID, useful when creating a new tile.
@@ -35075,13 +35092,14 @@
- Find the first tile with the given name.
+ Find the first tile matching the given name.
+ Return an array of all currently used tile IDs.
@@ -35092,35 +35110,35 @@
- Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optinally be set to loop.
+ Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optionally be set to loop.
- Set wait time. When the time is over, it will emit the timeout signal.
+ Set wait time in seconds. When the time is over, it will emit the timeout signal.
- Return the wait time. When the time is over, it will emit the timeout signal.
+ Return the wait time in seconds.
- Set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart.
+ Set as one-shot. If enabled, the timer will stop after timeout, otherwise it will automatically restart.
- Return true if is set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart.
+ Return true if configured as one-shot.
@@ -35151,19 +35169,21 @@
- Return the time left for timeout if the timer is active.
+ Return the time left for timeout in seconds if the timer is active, 0 otherwise.
+ Set the timer's processing mode (fixed or idle, use TIMER_PROCESS_* constants as argument).
+ Return the timer's processing mode.
@@ -35175,6 +35195,12 @@
+
+ Update the timer at fixed intervals (framerate processing).
+
+
+ Update the timer during the idle time at each frame.
+
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 3a80382a4..1bd22a9db 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -182,11 +182,14 @@ void Timer::_bind_methods() {
ADD_SIGNAL( MethodInfo("timeout") );
- ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode") );
ADD_PROPERTY( PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.01,4096,0.01" ), _SCS("set_wait_time"), _SCS("get_wait_time") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL, "one_shot" ), _SCS("set_one_shot"), _SCS("is_one_shot") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL, "autostart" ), _SCS("set_autostart"), _SCS("has_autostart") );
+ BIND_CONSTANT( TIMER_PROCESS_FIXED );
+ BIND_CONSTANT( TIMER_PROCESS_IDLE );
+
}
Timer::Timer() {
--
cgit v1.3.1
From b9bb2ab9c08c5acfcbbb6a2a744a0afd1da48f83 Mon Sep 17 00:00:00 2001
From: eska
Date: Sat, 26 Sep 2015 02:23:19 +0200
Subject: Fix propagation of NOTIFICATION_VISIBILITY_CHANGED
---
scene/2d/canvas_item.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 49229ba50..357aaa225 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -265,7 +265,7 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) {
CanvasItem *c=get_child(i)->cast_to();
- if (c && c->hidden!=p_visible) //should the toplevels stop propagation? i think so but..
+ if (c && !c->hidden) //should the toplevels stop propagation? i think so but..
c->_propagate_visibility_changed(p_visible);
}
--
cgit v1.3.1
From ce2faae2c512b03a575db1cca0696cbec0469bfa Mon Sep 17 00:00:00 2001
From: eska
Date: Sat, 26 Sep 2015 03:06:42 +0200
Subject: Fix BaseButtons remaining pressed when hiding them while pressing
them down
---
scene/gui/base_button.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 965e7f399..0c63a3bc7 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -255,6 +255,16 @@ void BaseButton::_notification(int p_what) {
group->_remove_button(this);
}
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) {
+
+ if (!toggle_mode) {
+ status.pressed = false;
+ }
+ status.hovering = false;
+ status.press_attempt = false;
+ status.pressing_inside = false;
+ status.pressing_button = 0;
+ }
}
void BaseButton::pressed() {
--
cgit v1.3.1
From 6ee2a84e8aaea03ff5007526ae8c597d14a5274b Mon Sep 17 00:00:00 2001
From: eska
Date: Sat, 26 Sep 2015 05:48:51 +0200
Subject: Clarify `BaseButton::is_pressed()` documentation
---
doc/base/classes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 289c98691..946e54210 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -5018,7 +5018,7 @@
- Return when the button is pressed (only if toggle_mode is active).
+ If toggle_mode is active, return whether the button is toggled. If toggle_mode is not active, return whether the button is pressed down.
--
cgit v1.3.1
From c858515785e2406bfc07da587ffc3bb353b7504c Mon Sep 17 00:00:00 2001
From: Juan Linietsky
Date: Sat, 26 Sep 2015 14:50:42 -0300
Subject: Fixed theora playback. Removed theoraplayer. Still need to get proper
audio output latency in some platforms.
---
drivers/SCsub | 4 +-
drivers/pulseaudio/audio_driver_pulseaudio.cpp | 13 +
drivers/pulseaudio/audio_driver_pulseaudio.h | 5 +
drivers/register_driver_types.cpp | 24 +-
drivers/theora/video_stream_theora.cpp | 436 +-
drivers/theora/video_stream_theora.h | 51 +-
drivers/theoraplayer/SCsub | 106 -
.../include/theoraplayer/TheoraAsync.h | 51 -
.../include/theoraplayer/TheoraAudioInterface.h | 51 -
.../include/theoraplayer/TheoraAudioPacketQueue.h | 48 -
.../include/theoraplayer/TheoraDataSource.h | 89 -
.../include/theoraplayer/TheoraException.h | 46 -
.../include/theoraplayer/TheoraExport.h | 38 -
.../include/theoraplayer/TheoraFrameQueue.h | 95 -
.../include/theoraplayer/TheoraPixelTransform.h | 18 -
.../include/theoraplayer/TheoraPlayer.h | 17 -
.../include/theoraplayer/TheoraTimer.h | 69 -
.../theoraplayer/include/theoraplayer/TheoraUtil.h | 32 -
.../include/theoraplayer/TheoraVideoClip.h | 282 -
.../include/theoraplayer/TheoraVideoFrame.h | 56 -
.../include/theoraplayer/TheoraVideoManager.h | 110 -
.../include/theoraplayer/TheoraWorkerThread.h | 32 -
.../AVFoundation/TheoraVideoClip_AVFoundation.h | 47 -
.../AVFoundation/TheoraVideoClip_AVFoundation.mm | 457 --
.../src/FFmpeg/TheoraVideoClip_FFmpeg.cpp | 439 --
.../src/FFmpeg/TheoraVideoClip_FFmpeg.h | 53 -
.../src/Theora/TheoraVideoClip_Theora.cpp | 703 --
.../src/Theora/TheoraVideoClip_Theora.h | 64 -
drivers/theoraplayer/src/TheoraAsync.cpp | 253 -
drivers/theoraplayer/src/TheoraAudioInterface.cpp | 21 -
.../theoraplayer/src/TheoraAudioPacketQueue.cpp | 126 -
drivers/theoraplayer/src/TheoraDataSource.cpp | 128 -
drivers/theoraplayer/src/TheoraException.cpp | 37 -
drivers/theoraplayer/src/TheoraFrameQueue.cpp | 174 -
drivers/theoraplayer/src/TheoraTimer.cpp | 70 -
drivers/theoraplayer/src/TheoraUtil.cpp | 59 -
drivers/theoraplayer/src/TheoraVideoClip.cpp | 496 --
drivers/theoraplayer/src/TheoraVideoFrame.cpp | 159 -
drivers/theoraplayer/src/TheoraVideoManager.cpp | 485 --
drivers/theoraplayer/src/TheoraWorkerThread.cpp | 49 -
drivers/theoraplayer/src/YUV/C/yuv420_grey_c.c | 56 -
drivers/theoraplayer/src/YUV/C/yuv420_rgb_c.c | 358 -
drivers/theoraplayer/src/YUV/C/yuv420_yuv_c.c | 86 -
.../theoraplayer/src/YUV/android/cpu-features.c | 1095 ---
.../theoraplayer/src/YUV/android/cpu-features.h | 212 -
drivers/theoraplayer/src/YUV/libyuv/LICENSE | 29 -
.../src/YUV/libyuv/LICENSE_THIRD_PARTY | 8 -
.../theoraplayer/src/YUV/libyuv/include/libyuv.h | 33 -
.../src/YUV/libyuv/include/libyuv/basic_types.h | 118 -
.../src/YUV/libyuv/include/libyuv/compare.h | 73 -
.../src/YUV/libyuv/include/libyuv/convert.h | 254 -
.../src/YUV/libyuv/include/libyuv/convert_argb.h | 225 -
.../src/YUV/libyuv/include/libyuv/convert_from.h | 173 -
.../YUV/libyuv/include/libyuv/convert_from_argb.h | 168 -
.../src/YUV/libyuv/include/libyuv/cpu_id.h | 81 -
.../YUV/libyuv/include/libyuv/format_conversion.h | 168 -
.../src/YUV/libyuv/include/libyuv/mjpeg_decoder.h | 201 -
.../YUV/libyuv/include/libyuv/planar_functions.h | 434 --
.../src/YUV/libyuv/include/libyuv/rotate.h | 117 -
.../src/YUV/libyuv/include/libyuv/rotate_argb.h | 33 -
.../src/YUV/libyuv/include/libyuv/row.h | 1694 -----
.../src/YUV/libyuv/include/libyuv/scale.h | 85 -
.../src/YUV/libyuv/include/libyuv/scale_argb.h | 57 -
.../src/YUV/libyuv/include/libyuv/scale_row.h | 301 -
.../src/YUV/libyuv/include/libyuv/version.h | 16 -
.../src/YUV/libyuv/include/libyuv/video_common.h | 182 -
.../src/YUV/libyuv/libtheoraplayer-readme.txt | 15 -
drivers/theoraplayer/src/YUV/libyuv/src/compare.cc | 325 -
.../src/YUV/libyuv/src/compare_common.cc | 42 -
.../src/YUV/libyuv/src/compare_neon.cc | 64 -
.../src/YUV/libyuv/src/compare_posix.cc | 158 -
.../theoraplayer/src/YUV/libyuv/src/compare_win.cc | 232 -
drivers/theoraplayer/src/YUV/libyuv/src/convert.cc | 1491 ----
.../src/YUV/libyuv/src/convert_argb.cc | 901 ---
.../src/YUV/libyuv/src/convert_from.cc | 1196 ----
.../src/YUV/libyuv/src/convert_from_argb.cc | 1096 ---
.../src/YUV/libyuv/src/convert_jpeg.cc | 392 --
.../src/YUV/libyuv/src/convert_to_argb.cc | 327 -
.../src/YUV/libyuv/src/convert_to_i420.cc | 383 -
drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc | 300 -
.../src/YUV/libyuv/src/format_conversion.cc | 552 --
.../src/YUV/libyuv/src/mjpeg_decoder.cc | 558 --
.../src/YUV/libyuv/src/mjpeg_validate.cc | 47 -
.../src/YUV/libyuv/src/planar_functions.cc | 2238 ------
drivers/theoraplayer/src/YUV/libyuv/src/rotate.cc | 1301 ----
.../theoraplayer/src/YUV/libyuv/src/rotate_argb.cc | 209 -
.../theoraplayer/src/YUV/libyuv/src/rotate_mips.cc | 486 --
.../theoraplayer/src/YUV/libyuv/src/rotate_neon.cc | 412 --
drivers/theoraplayer/src/YUV/libyuv/src/row_any.cc | 542 --
.../theoraplayer/src/YUV/libyuv/src/row_common.cc | 2247 ------
.../theoraplayer/src/YUV/libyuv/src/row_mips.cc | 991 ---
.../theoraplayer/src/YUV/libyuv/src/row_neon.cc | 2847 --------
.../theoraplayer/src/YUV/libyuv/src/row_posix.cc | 6443 -----------------
drivers/theoraplayer/src/YUV/libyuv/src/row_win.cc | 7284 --------------------
.../theoraplayer/src/YUV/libyuv/src/row_x86.asm | 146 -
drivers/theoraplayer/src/YUV/libyuv/src/scale.cc | 926 ---
.../theoraplayer/src/YUV/libyuv/src/scale_argb.cc | 809 ---
.../src/YUV/libyuv/src/scale_argb_neon.cc | 145 -
.../src/YUV/libyuv/src/scale_common.cc | 772 ---
.../theoraplayer/src/YUV/libyuv/src/scale_mips.cc | 653 --
.../theoraplayer/src/YUV/libyuv/src/scale_neon.cc | 699 --
.../theoraplayer/src/YUV/libyuv/src/scale_posix.cc | 1315 ----
.../theoraplayer/src/YUV/libyuv/src/scale_win.cc | 1320 ----
.../src/YUV/libyuv/src/video_common.cc | 64 -
drivers/theoraplayer/src/YUV/libyuv/src/x86inc.asm | 1136 ---
drivers/theoraplayer/src/YUV/libyuv/yuv_libyuv.c | 72 -
drivers/theoraplayer/src/YUV/libyuv/yuv_libyuv.h | 14 -
drivers/theoraplayer/src/YUV/yuv_util.c | 39 -
drivers/theoraplayer/src/YUV/yuv_util.h | 17 -
.../theoraplayer.xcodeproj/project.pbxproj | 2606 -------
drivers/theoraplayer/video_stream_theoraplayer.cpp | 556 --
drivers/theoraplayer/video_stream_theoraplayer.h | 66 -
platform/android/detect.py | 2 -
platform/iphone/detect.py | 1 -
platform/osx/detect.py | 1 -
platform/windows/detect.py | 1 -
platform/x11/detect.py | 2 +-
scene/2d/navigation2d.cpp | 6 +-
scene/3d/navigation.cpp | 2 +
scene/gui/video_player.cpp | 176 +-
scene/gui/video_player.h | 30 +
scene/io/resource_format_wav.cpp | 1 +
scene/resources/packed_scene.h | 9 +
scene/resources/video_stream.cpp | 8 +-
scene/resources/video_stream.h | 35 +-
servers/audio/audio_server_sw.cpp | 2 +-
servers/audio/audio_server_sw.h | 2 +
servers/audio_server.cpp | 1 +
128 files changed, 559 insertions(+), 55904 deletions(-)
delete mode 100644 drivers/theoraplayer/SCsub
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraAsync.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraAudioInterface.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraAudioPacketQueue.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraDataSource.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraException.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraExport.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraFrameQueue.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraPixelTransform.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraPlayer.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraTimer.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraUtil.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraVideoClip.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraVideoFrame.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraVideoManager.h
delete mode 100644 drivers/theoraplayer/include/theoraplayer/TheoraWorkerThread.h
delete mode 100644 drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.h
delete mode 100644 drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm
delete mode 100644 drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.cpp
delete mode 100644 drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.h
delete mode 100644 drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.cpp
delete mode 100644 drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.h
delete mode 100644 drivers/theoraplayer/src/TheoraAsync.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraAudioInterface.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraAudioPacketQueue.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraDataSource.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraException.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraFrameQueue.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraTimer.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraUtil.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraVideoClip.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraVideoFrame.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraVideoManager.cpp
delete mode 100644 drivers/theoraplayer/src/TheoraWorkerThread.cpp
delete mode 100644 drivers/theoraplayer/src/YUV/C/yuv420_grey_c.c
delete mode 100644 drivers/theoraplayer/src/YUV/C/yuv420_rgb_c.c
delete mode 100644 drivers/theoraplayer/src/YUV/C/yuv420_yuv_c.c
delete mode 100644 drivers/theoraplayer/src/YUV/android/cpu-features.c
delete mode 100644 drivers/theoraplayer/src/YUV/android/cpu-features.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/LICENSE
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/LICENSE_THIRD_PARTY
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/basic_types.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/compare.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/convert.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/convert_argb.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/convert_from.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/convert_from_argb.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/cpu_id.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/format_conversion.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/mjpeg_decoder.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/planar_functions.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/rotate.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/rotate_argb.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/row.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/scale.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/scale_argb.h
delete mode 100644 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/scale_row.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/version.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/include/libyuv/video_common.h
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/libtheoraplayer-readme.txt
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/compare.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/compare_common.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/compare_neon.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/compare_posix.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/compare_win.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_argb.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_from.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_from_argb.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_jpeg.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_to_argb.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/convert_to_i420.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/format_conversion.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/mjpeg_decoder.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/mjpeg_validate.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/planar_functions.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/rotate.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/rotate_argb.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/rotate_mips.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/rotate_neon.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_any.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_common.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_mips.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_neon.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_posix.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_win.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/row_x86.asm
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/scale.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/scale_argb.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/scale_argb_neon.cc
delete mode 100644 drivers/theoraplayer/src/YUV/libyuv/src/scale_common.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/scale_mips.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/scale_neon.cc
delete mode 100644 drivers/theoraplayer/src/YUV/libyuv/src/scale_posix.cc
delete mode 100644 drivers/theoraplayer/src/YUV/libyuv/src/scale_win.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/video_common.cc
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/src/x86inc.asm
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/yuv_libyuv.c
delete mode 100755 drivers/theoraplayer/src/YUV/libyuv/yuv_libyuv.h
delete mode 100644 drivers/theoraplayer/src/YUV/yuv_util.c
delete mode 100644 drivers/theoraplayer/src/YUV/yuv_util.h
delete mode 100644 drivers/theoraplayer/theoraplayer.xcodeproj/project.pbxproj
delete mode 100644 drivers/theoraplayer/video_stream_theoraplayer.cpp
delete mode 100644 drivers/theoraplayer/video_stream_theoraplayer.h
diff --git a/drivers/SCsub b/drivers/SCsub
index 3028139f5..626893096 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -38,8 +38,8 @@ if (env["vorbis"]=="yes"):
if (env["tools"]=="yes"):
SConscript("convex_decomp/SCsub");
-if env["theora"]=="yes":
- SConscript("theoraplayer/SCsub")
+#if env["theora"]=="yes":
+# SConscript("theoraplayer/SCsub")
if (env["theora"]=="yes"):
SConscript("theora/SCsub");
if (env['speex']=='yes'):
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index dfe9ddc55..4cda141f9 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -82,6 +82,17 @@ Error AudioDriverPulseAudio::init() {
return OK;
}
+float AudioDriverPulseAudio::get_latency() {
+
+ if (latency==0) { //only do this once since it's approximate anyway
+ int error_code;
+ pa_usec_t palat = pa_simple_get_latency( pulse,&error_code);
+ latency=double(palat)/1000000.0;
+ }
+
+ return latency;
+}
+
void AudioDriverPulseAudio::thread_func(void* p_udata) {
AudioDriverPulseAudio* ad = (AudioDriverPulseAudio*)p_udata;
@@ -121,6 +132,7 @@ void AudioDriverPulseAudio::thread_func(void* p_udata) {
ad->exit_thread = true;
break;
}
+
}
ad->thread_exited = true;
@@ -185,6 +197,7 @@ AudioDriverPulseAudio::AudioDriverPulseAudio() {
mutex = NULL;
thread = NULL;
pulse = NULL;
+ latency=0;
}
AudioDriverPulseAudio::~AudioDriverPulseAudio() {
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h
index e82e0c24b..e7c8bcce3 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.h
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.h
@@ -58,6 +58,8 @@ class AudioDriverPulseAudio : public AudioDriverSW {
mutable bool exit_thread;
bool pcm_open;
+ float latency;
+
public:
const char* get_name() const {
@@ -72,6 +74,9 @@ public:
virtual void unlock();
virtual void finish();
+ virtual float get_latency();
+
+
AudioDriverPulseAudio();
~AudioDriverPulseAudio();
};
diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp
index 01f6a8b5b..20c8e0e4b 100644
--- a/drivers/register_driver_types.cpp
+++ b/drivers/register_driver_types.cpp
@@ -43,7 +43,10 @@
#endif
#ifdef THEORA_ENABLED
-//#include "theora/video_stream_theora.h"
+#include "theora/video_stream_theora.h"
+#endif
+
+#ifdef THEORAPLAYER_ENABLED
#include "theoraplayer/video_stream_theoraplayer.h"
#endif
@@ -90,7 +93,10 @@ static ResourceFormatLoaderAudioStreamSpeex *speex_stream_loader=NULL;
#endif
#ifdef THEORA_ENABLED
-//static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
+static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
+#endif
+
+#ifdef THEORAPLAYER_ENABLED
static ResourceFormatLoaderVideoStreamTheoraplayer* theoraplayer_stream_loader = NULL;
#endif
@@ -205,9 +211,12 @@ void register_driver_types() {
#endif
#ifdef THEORA_ENABLED
- //theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
- //ResourceLoader::add_resource_format_loader(theora_stream_loader);
- //ObjectTypeDB::register_type();
+ theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
+ ResourceLoader::add_resource_format_loader(theora_stream_loader);
+ ObjectTypeDB::register_type();
+#endif
+
+#ifdef THEORAPLAYER_ENABLED
theoraplayer_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheoraplayer );
ResourceLoader::add_resource_format_loader(theoraplayer_stream_loader);
ObjectTypeDB::register_type();
@@ -244,7 +253,10 @@ void unregister_driver_types() {
#endif
#ifdef THEORA_ENABLED
- //memdelete (theora_stream_loader);
+ memdelete (theora_stream_loader);
+#endif
+
+#ifdef THEORAPLAYER_ENABLED
memdelete (theoraplayer_stream_loader);
#endif
diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp
index 214185cf8..48529d563 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/drivers/theora/video_stream_theora.cpp
@@ -1,16 +1,12 @@
#ifdef THEORA_ENABLED
-#if 0
+
#include "video_stream_theora.h"
#include "os/os.h"
#include "yuv2rgb.h"
+#include "globals.h"
-AudioStream::UpdateMode VideoStreamTheora::get_update_mode() const {
-
- return UPDATE_IDLE;
-};
-
-int VideoStreamTheora:: buffer_data() {
+int VideoStreamPlaybackTheora:: buffer_data() {
char *buffer=ogg_sync_buffer(&oy,4096);
int bytes=file->get_buffer((uint8_t*)buffer, 4096);
@@ -18,33 +14,13 @@ int VideoStreamTheora:: buffer_data() {
return(bytes);
}
-int VideoStreamTheora::queue_page(ogg_page *page){
+int VideoStreamPlaybackTheora::queue_page(ogg_page *page){
if(theora_p)ogg_stream_pagein(&to,page);
if(vorbis_p)ogg_stream_pagein(&vo,page);
return 0;
}
-Image VideoStreamTheora::peek_frame() const {
-
- if (frames_pending == 0)
- return Image();
- return Image(size.x, size.y, 0, format, frame_data);
-};
-
-Image VideoStreamTheora::pop_frame() {
-
- Image ret = peek_frame();
- frames_pending = 0;
-
- return ret;
-};
-
-int VideoStreamTheora::get_pending_frame_count() const {
-
- return frames_pending;
-};
-
-void VideoStreamTheora::video_write(void){
+void VideoStreamPlaybackTheora::video_write(void){
th_ycbcr_buffer yuv;
int y_offset, uv_offset;
th_decode_ycbcr_out(td,yuv);
@@ -78,25 +54,31 @@ void VideoStreamTheora::video_write(void){
int pitch = 4;
frame_data.resize(size.x * size.y * pitch);
- DVector::Write w = frame_data.write();
- char* dst = (char*)w.ptr();
+ {
+ DVector::Write w = frame_data.write();
+ char* dst = (char*)w.ptr();
- uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
+ uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
- if (px_fmt == TH_PF_444) {
+ if (px_fmt == TH_PF_444) {
- yuv444_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[1].data, (uint8_t*)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
+ yuv444_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[1].data, (uint8_t*)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
- } else if (px_fmt == TH_PF_422) {
+ } else if (px_fmt == TH_PF_422) {
- yuv422_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[1].data, (uint8_t*)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
+ yuv422_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[1].data, (uint8_t*)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
- } else if (px_fmt == TH_PF_420) {
+ } else if (px_fmt == TH_PF_420) {
- 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);
- };
+ 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_RGBA;
+ }
+
+ Image img(size.x,size.y,0,Image::FORMAT_RGBA,frame_data); //zero copy image creation
+
+ texture->set_data(img); //zero copy send to visual server
/*
@@ -194,7 +176,7 @@ void VideoStreamTheora::video_write(void){
frames_pending = 1;
}
-void VideoStreamTheora::clear() {
+void VideoStreamPlaybackTheora::clear() {
if (file_name == "")
return;
@@ -218,7 +200,7 @@ void VideoStreamTheora::clear() {
}
ogg_sync_clear(&oy);
- file_name = "";
+ //file_name = "";
theora_p = 0;
vorbis_p = 0;
@@ -229,7 +211,7 @@ void VideoStreamTheora::clear() {
playing = false;
};
-void VideoStreamTheora::set_file(const String& p_file) {
+void VideoStreamPlaybackTheora::set_file(const String& p_file) {
ogg_packet op;
th_setup_info *ts = NULL;
@@ -241,7 +223,7 @@ void VideoStreamTheora::set_file(const String& p_file) {
file = FileAccess::open(p_file, FileAccess::READ);
ERR_FAIL_COND(!file);
- audio_frames_wrote = 0;
+
ogg_sync_init(&oy);
@@ -386,6 +368,8 @@ void VideoStreamTheora::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);
+
}else{
/* tear down the partial theora setup */
th_info_clear(&ti);
@@ -399,7 +383,7 @@ void VideoStreamTheora::set_file(const String& p_file) {
vorbis_block_init(&vd,&vb);
fprintf(stderr,"Ogg logical stream %lx is Vorbis %d channel %ld Hz audio.\n",
vo.serialno,vi.channels,vi.rate);
- _setup(vi.channels, vi.rate);
+ //_setup(vi.channels, vi.rate);
}else{
/* tear down the partial vorbis setup */
vorbis_info_clear(&vi);
@@ -411,227 +395,299 @@ void VideoStreamTheora::set_file(const String& p_file) {
time=0;
};
-float VideoStreamTheora::get_time() const {
+float VideoStreamPlaybackTheora::get_time() const {
//print_line("total: "+itos(get_total())+" todo: "+itos(get_todo()));
//return MAX(0,time-((get_total())/(float)vi.rate));
- return time-((get_total())/(float)vi.rate);
+ return time-AudioServer::get_singleton()->get_output_delay()-delay_compensation;//-((get_total())/(float)vi.rate);
};
-void VideoStreamTheora::update() {
+Ref VideoStreamPlaybackTheora::get_texture() {
+
+ return texture;
+}
+
+void VideoStreamPlaybackTheora::update(float p_delta) {
if (!playing) {
//printf("not playing\n");
return;
};
- double ctime =AudioServer::get_singleton()->get_mix_time();
+ //double ctime =AudioServer::get_singleton()->get_mix_time();
- if (last_update_time) {
- double delta = (ctime-last_update_time);
- time+=delta;
- //print_line("delta: "+rtos(delta));
- }
- last_update_time=ctime;
+ //print_line("play "+rtos(p_delta));
+ time+=p_delta;
+ if (videobuf_time>get_time())
+ return; //no new frames need to be produced
- int audio_todo = get_todo();
- ogg_packet op;
- int audio_pending = 0;
+ bool frame_done=false;
+ while (!frame_done) {
+ //a frame needs to be produced
- while (vorbis_p && audio_todo) {
- int ret;
- float **pcm;
-
- /* if there's pending, decoded audio, grab it */
- if ((ret=vorbis_synthesis_pcmout(&vd,&pcm))>0) {
-
- audio_pending = ret;
- int16_t* out = get_write_buffer();
- int count = 0;
- int to_read = MIN(ret, audio_todo);
- for (int i=0; i32767)val=32767;
- if(val<-32768)val=-32768;
- out[count++] = val;
- };
- };
- int tr = vorbis_synthesis_read(&vd, to_read);
- audio_todo -= to_read;
- audio_frames_wrote += to_read;
- write(to_read);
- audio_pending -= to_read;
- if (audio_todo==0)
- buffering=false;
+ ogg_packet op;
+ bool audio_pending = false;
- } else {
+ while (vorbis_p) {
+ int ret;
+ float **pcm;
+
+ bool buffer_full=false;
+
+ /* if there's pending, decoded audio, grab it */
+ if ((ret=vorbis_synthesis_pcmout(&vd,&pcm))>0) {
+
+
+
+ const int AUXBUF_LEN=4096;
+ int to_read = ret;
+ int16_t aux_buffer[AUXBUF_LEN];
+
+ while(to_read) {
+
+ int m = MIN(AUXBUF_LEN/vi.channels,to_read);
+
+ int count = 0;
+
+ for(int j=0;j32767)val=32767;
+ if(val<-32768)val=-32768;
+ aux_buffer[count++] = val;
+ }
+ }
+
+ if (mix_callback) {
+ int mixed = mix_callback(mix_udata,aux_buffer,m);
+ to_read-=mixed;
+ if (mixed!=m) { //could mix no more
+ buffer_full=true;
+ break;
+ }
+ } else {
+ to_read-=m; //just pretend we sent the audio
+ }
+
- /* no pending audio; is there a pending packet to decode? */
- if (ogg_stream_packetout(&vo,&op)>0){
- if(vorbis_synthesis(&vb,&op)==0) { /* test for success! */
- vorbis_synthesis_blockin(&vd,&vb);
}
- } else { /* we need more data; break out to suck in another page */
- //printf("need moar data\n");
+
+
+ int tr = vorbis_synthesis_read(&vd, ret-to_read);
+
+ audio_pending=true;
+
+
+ } else {
+
+ /* no pending audio; is there a pending packet to decode? */
+ if (ogg_stream_packetout(&vo,&op)>0){
+ if(vorbis_synthesis(&vb,&op)==0) { /* test for success! */
+ vorbis_synthesis_blockin(&vd,&vb);
+ }
+ } else { /* we need more data; break out to suck in another page */
+ //printf("need moar data\n");
+ break;
+ };
+ }
+
+ if (buffer_full)
break;
- };
}
- }
- while(theora_p && !videobuf_ready){
- /* theora is one in, one out... */
- if(ogg_stream_packetout(&to,&op)>0){
+ while(theora_p && !frame_done){
+ /* theora is one in, one out... */
+ if(ogg_stream_packetout(&to,&op)>0){
- if(pp_inc){
- pp_level+=pp_inc;
- th_decode_ctl(td,TH_DECCTL_SET_PPLEVEL,&pp_level,
- sizeof(pp_level));
- pp_inc=0;
- }
- /*HACK: This should be set after a seek or a gap, but we might not have
- a granulepos for the first packet (we only have them for the last
- packet on a page), so we just set it as often as we get it.
- To do this right, we should back-track from the last packet on the
- page and compute the correct granulepos for the first packet after
- a seek or a gap.*/
- if(op.granulepos>=0){
- th_decode_ctl(td,TH_DECCTL_SET_GRANPOS,&op.granulepos,
- sizeof(op.granulepos));
- }
- ogg_int64_t videobuf_granulepos;
- if(th_decode_packetin(td,&op,&videobuf_granulepos)==0){
- videobuf_time=th_granule_time(td,videobuf_granulepos);
- //printf("frame time %f, play time %f, ready %i\n", (float)videobuf_time, get_time(), videobuf_ready);
-
- /* is it already too old to be useful? This is only actually
- useful cosmetically after a SIGSTOP. Note that we have to
- decode the frame even if we don't show it (for now) due to
- keyframing. Soon enough libtheora will be able to deal
- with non-keyframe seeks. */
-
- if(videobuf_time>=get_time())
- videobuf_ready=1;
- else{
- /*If we are too slow, reduce the pp level.*/
- pp_inc=pp_level>0?-1:0;
+ if(pp_inc){
+ pp_level+=pp_inc;
+ th_decode_ctl(td,TH_DECCTL_SET_PPLEVEL,&pp_level,
+ sizeof(pp_level));
+ pp_inc=0;
+ }
+ /*HACK: This should be set after a seek or a gap, but we might not have
+ a granulepos for the first packet (we only have them for the last
+ packet on a page), so we just set it as often as we get it.
+ To do this right, we should back-track from the last packet on the
+ page and compute the correct granulepos for the first packet after
+ a seek or a gap.*/
+ if(op.granulepos>=0){
+ th_decode_ctl(td,TH_DECCTL_SET_GRANPOS,&op.granulepos,
+ sizeof(op.granulepos));
+ }
+ ogg_int64_t videobuf_granulepos;
+ if(th_decode_packetin(td,&op,&videobuf_granulepos)==0){
+ videobuf_time=th_granule_time(td,videobuf_granulepos);
+
+ //printf("frame time %f, play time %f, ready %i\n", (float)videobuf_time, get_time(), videobuf_ready);
+
+ /* is it already too old to be useful? This is only actually
+ useful cosmetically after a SIGSTOP. Note that we have to
+ decode the frame even if we don't show it (for now) due to
+ keyframing. Soon enough libtheora will be able to deal
+ with non-keyframe seeks. */
+
+ if(videobuf_time>=get_time())
+ frame_done=true;
+ else{
+ /*If we are too slow, reduce the pp level.*/
+ pp_inc=pp_level>0?-1:0;
+ }
}
- }
-
- } else
- break;
- }
- if (/*!videobuf_ready && */ audio_pending == 0 && file->eof_reached()) {
- printf("video done, stopping\n");
- stop();
- return;
- };
+ } else
+ break;
+ }
- if (!videobuf_ready || audio_todo > 0){
- /* no data yet for somebody. Grab another page */
+ if (file && /*!videobuf_ready && */ file->eof_reached()) {
+ printf("video done, stopping\n");
+ stop();
+ return;
+ };
+ #if 0
+ if (!videobuf_ready || audio_todo > 0){
+ /* no data yet for somebody. Grab another page */
- buffer_data();
- while(ogg_sync_pageout(&oy,&og)>0){
- queue_page(&og);
+ buffer_data();
+ while(ogg_sync_pageout(&oy,&og)>0){
+ queue_page(&og);
+ }
}
- }
+ #else
+ if (!frame_done){
+ //what's the point of waiting for audio to grab a page?
- /* If playback has begun, top audio buffer off immediately. */
- //if(stateflag) audio_write_nonblocking();
+ buffer_data();
+ while(ogg_sync_pageout(&oy,&og)>0){
+ queue_page(&og);
+ }
+ }
+ #endif
+ /* If playback has begun, top audio buffer off immediately. */
+ //if(stateflag) audio_write_nonblocking();
- /* are we at or past time for this video frame? */
- if(videobuf_ready && videobuf_time<=get_time()){
+ /* are we at or past time for this video frame? */
+ if(videobuf_ready && videobuf_time<=get_time()){
- video_write();
- videobuf_ready=0;
- } else {
- //printf("frame at %f not ready (time %f), ready %i\n", (float)videobuf_time, get_time(), videobuf_ready);
- }
+ //video_write();
+ //videobuf_ready=0;
+ } else {
+ //printf("frame at %f not ready (time %f), ready %i\n", (float)videobuf_time, get_time(), videobuf_ready);
+ }
- float tdiff=videobuf_time-get_time();
- /*If we have lots of extra time, increase the post-processing level.*/
- if(tdiff>ti.fps_denominator*0.25/ti.fps_numerator){
- pp_inc=pp_level0?-1:0;
+ float tdiff=videobuf_time-get_time();
+ /*If we have lots of extra time, increase the post-processing level.*/
+ if(tdiff>ti.fps_denominator*0.25/ti.fps_numerator){
+ pp_inc=pp_level0?-1:0;
+ }
}
-};
-bool VideoStreamTheora::_can_mix() const {
+ video_write();
- return !buffering;
};
-void VideoStreamTheora::play() {
+
+void VideoStreamPlaybackTheora::play() {
if (!playing)
- last_update_time=0;
+ time=0;
playing = true;
+ delay_compensation=Globals::get_singleton()->get("audio/video_delay_compensation_ms");
+ delay_compensation/=1000.0;
+
};
-void VideoStreamTheora::stop() {
+void VideoStreamPlaybackTheora::stop() {
+ if (playing) {
+ clear();
+ set_file(file_name); //reset
+ }
playing = false;
- last_update_time=0;
+ time=0;
};
-bool VideoStreamTheora::is_playing() const {
+bool VideoStreamPlaybackTheora::is_playing() const {
return playing;
};
-void VideoStreamTheora::set_paused(bool p_paused) {
+void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
playing = !p_paused;
};
-bool VideoStreamTheora::is_paused(bool p_paused) const {
+bool VideoStreamPlaybackTheora::is_paused(bool p_paused) const {
return playing;
};
-void VideoStreamTheora::set_loop(bool p_enable) {
+void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
};
-bool VideoStreamTheora::has_loop() const {
+bool VideoStreamPlaybackTheora::has_loop() const {
return false;
};
-float VideoStreamTheora::get_length() const {
+float VideoStreamPlaybackTheora::get_length() const {
return 0;
};
-String VideoStreamTheora::get_stream_name() const {
+String VideoStreamPlaybackTheora::get_stream_name() const {
return "";
};
-int VideoStreamTheora::get_loop_count() const {
+int VideoStreamPlaybackTheora::get_loop_count() const {
return 0;
};
-float VideoStreamTheora::get_pos() const {
+float VideoStreamPlaybackTheora::get_pos() const {
return get_time();
};
-void VideoStreamTheora::seek_pos(float p_time) {
+void VideoStreamPlaybackTheora::seek_pos(float p_time) {
// no
};
-VideoStreamTheora::VideoStreamTheora() {
+void VideoStreamPlaybackTheora::set_mix_callback(AudioMixCallback p_callback,void *p_userdata) {
+
+ mix_callback=p_callback;
+ mix_udata=p_userdata;
+}
+
+int VideoStreamPlaybackTheora::get_channels() const{
+
+ return vi.channels;
+}
+
+void VideoStreamPlaybackTheora::set_audio_track(int p_idx) {
+
+
+}
+
+int VideoStreamPlaybackTheora::get_mix_rate() const{
+
+ return vi.rate;
+}
+
+
+
+VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
file = NULL;
theora_p = 0;
@@ -640,11 +696,15 @@ VideoStreamTheora::VideoStreamTheora() {
playing = false;
frames_pending = 0;
videobuf_time = 0;
- last_update_time =0;
+
buffering=false;
+ texture = Ref( memnew(ImageTexture ));
+ mix_callback=NULL;
+ mix_udata=NULL;
+ delay_compensation=0;
};
-VideoStreamTheora::~VideoStreamTheora() {
+VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
clear();
@@ -653,10 +713,16 @@ VideoStreamTheora::~VideoStreamTheora() {
};
-RES ResourceFormatLoaderVideoStreamTheora::load(const String &p_path,const String& p_original_path) {
+RES ResourceFormatLoaderVideoStreamTheora::load(const String &p_path,const String& p_original_path, Error *r_error) {
+ if (r_error)
+ *r_error=ERR_FILE_CANT_OPEN;
VideoStreamTheora *stream = memnew(VideoStreamTheora);
stream->set_file(p_path);
+
+ if (r_error)
+ *r_error=OK;
+
return Ref(stream);
}
@@ -666,16 +732,16 @@ void ResourceFormatLoaderVideoStreamTheora::get_recognized_extensions(Listpush_back("ogv");
}
bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String& p_type) const {
- return (p_type=="AudioStream" || p_type=="VideoStreamTheora");
+ return (p_type=="VideoStream" || p_type=="VideoStreamTheora");
}
String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const {
String exl=p_path.extension().to_lower();
if (exl=="ogm" || exl=="ogv")
- return "AudioStreamTheora";
+ return "VideoStreamTheora";
return "";
}
#endif
-#endif
+
diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h
index 12aac731f..77a9ae866 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/drivers/theora/video_stream_theora.h
@@ -10,9 +10,9 @@
#include "io/resource_loader.h"
#include "scene/resources/video_stream.h"
-class VideoStreamTheora : public VideoStream {
+class VideoStreamPlaybackTheora : public VideoStreamPlayback {
- OBJ_TYPE(VideoStreamTheora, VideoStream);
+ OBJ_TYPE(VideoStreamPlaybackTheora, VideoStreamPlayback);
enum {
MAX_FRAMES = 4,
@@ -58,16 +58,17 @@ class VideoStreamTheora : public VideoStream {
double last_update_time;
double time;
+ double delay_compensation;
-protected:
+ Ref texture;
- virtual UpdateMode get_update_mode() const;
- virtual void update();
+ AudioMixCallback mix_callback;
+ void* mix_udata;
- void clear();
-
- virtual bool _can_mix() const;
+protected:
+ void clear();
+
public:
virtual void play();
@@ -92,12 +93,36 @@ public:
void set_file(const String& p_file);
- int get_pending_frame_count() const;
- Image pop_frame();
- Image peek_frame() const;
+ virtual Ref get_texture();
+ virtual void update(float p_delta);
+
+ virtual void set_mix_callback(AudioMixCallback p_callback,void *p_userdata);
+ virtual int get_channels() const;
+ virtual int get_mix_rate() const;
+
+ virtual void set_audio_track(int p_idx);
+
+ VideoStreamPlaybackTheora();
+ ~VideoStreamPlaybackTheora();
+};
+
+
+
+class VideoStreamTheora : public VideoStream {
+
+ OBJ_TYPE(VideoStreamTheora,VideoStream);
+
+ String file;
+public:
+
+ Ref instance_playback() {
+ Ref pb = memnew( VideoStreamPlaybackTheora );
+ pb->set_file(file);
+ return pb;
+ }
+
+ void set_file(const String& p_file) { file=p_file; }
- VideoStreamTheora();
- ~VideoStreamTheora();
};
class ResourceFormatLoaderVideoStreamTheora : public ResourceFormatLoader {
diff --git a/drivers/theoraplayer/SCsub b/drivers/theoraplayer/SCsub
deleted file mode 100644
index 09fb13d8e..000000000
--- a/drivers/theoraplayer/SCsub
+++ /dev/null
@@ -1,106 +0,0 @@
-Import("env")
-
-import string
-
-sources = string.split("""
-src/TheoraVideoClip.cpp
-src/FFmpeg/TheoraVideoClip_FFmpeg.cpp
-src/TheoraAsync.cpp
-src/TheoraAudioInterface.cpp
-src/TheoraException.cpp
-src/TheoraWorkerThread.cpp
-src/TheoraVideoManager.cpp
-src/TheoraTimer.cpp
-src/TheoraUtil.cpp
-src/TheoraDataSource.cpp
-src/TheoraAudioPacketQueue.cpp
-src/TheoraFrameQueue.cpp
-src/Theora/TheoraVideoClip_Theora.cpp
-src/YUV/yuv_util.c
-src/YUV/libyuv/src/row_any.cc
-src/YUV/libyuv/src/compare_common.cc
-src/YUV/libyuv/src/scale_neon.cc
-src/YUV/libyuv/src/planar_functions.cc
-src/YUV/libyuv/src/compare.cc
-src/YUV/libyuv/src/scale_mips.cc
-src/YUV/libyuv/src/scale_posix.cc
-src/YUV/libyuv/src/row_posix.cc
-src/YUV/libyuv/src/row_win.cc
-src/YUV/libyuv/src/compare_neon.cc
-src/YUV/libyuv/src/convert_from_argb.cc
-src/YUV/libyuv/src/mjpeg_validate.cc
-src/YUV/libyuv/src/convert_from.cc
-src/YUV/libyuv/src/rotate_neon.cc
-src/YUV/libyuv/src/row_neon.cc
-src/YUV/libyuv/src/rotate_mips.cc
-src/YUV/libyuv/src/compare_posix.cc
-src/YUV/libyuv/src/row_mips.cc
-src/YUV/libyuv/src/scale.cc
-src/YUV/libyuv/src/scale_argb.cc
-src/YUV/libyuv/src/mjpeg_decoder.cc
-src/YUV/libyuv/src/scale_win.cc
-src/YUV/libyuv/src/scale_common.cc
-src/YUV/libyuv/src/scale_argb_neon.cc
-src/YUV/libyuv/src/row_common.cc
-src/YUV/libyuv/src/convert.cc
-src/YUV/libyuv/src/format_conversion.cc
-src/YUV/libyuv/src/rotate_argb.cc
-src/YUV/libyuv/src/rotate.cc
-src/YUV/libyuv/src/convert_argb.cc
-src/YUV/libyuv/src/cpu_id.cc
-src/YUV/libyuv/src/video_common.cc
-src/YUV/libyuv/src/convert_to_argb.cc
-src/YUV/libyuv/src/compare_win.cc
-src/YUV/libyuv/src/convert_to_i420.cc
-src/YUV/libyuv/src/convert_jpeg.cc
-src/YUV/libyuv/yuv_libyuv.c
-src/YUV/android/cpu-features.c
-src/YUV/C/yuv420_grey_c.c
-src/YUV/C/yuv420_yuv_c.c
-src/YUV/C/yuv420_rgb_c.c
-src/TheoraVideoFrame.cpp
-""")
-
-env_theora = env.Clone()
-
-if env["platform"] == "iphone":
- sources.append("src/AVFoundation/TheoraVideoClip_AVFoundation.mm")
- env.Append(LINKFLAGS=['-framework', 'CoreVideo', '-framework', 'CoreMedia', '-framework', 'AVFoundation'])
- if env["target"] == "release":
- env_theora.Append(CPPFLAGS=["-D_IOS", "-D__ARM_NEON__", "-fstrict-aliasing", "-fmessage-length=210", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fcolor-diagnostics", "-Wno-trigraphs", "-fpascal-strings", "-fvisibility=hidden", "-fvisibility-inlines-hidden"])
-
-env_theora.Append(CPPFLAGS=["-D_LIB", "-D__THEORA"]) # removed -D_YUV_C
-env_theora.Append(CPPFLAGS=["-D_YUV_LIBYUV"])
-#env_theora.Append(CPPFLAGS=["-D_YUV_C"])
-
-if env["platform"] == "iphone":
- env_theora.Append(CPPFLAGS=["-D__AVFOUNDATION"])
-else:
- pass
- #env_theora.Append(CPPFLAGS=["-D__FFMPEG"])
-
-if env["platform"] == "android":
- env_theora.Append(CPPFLAGS=["-D_ANDROID"])
-
-if env["platform"] == "winrt":
- env_theora.Append(CPPFLAGS=["-D_WINRT"])
-
-env_theora.Append(CPPPATH=["#drivers/theoraplayer/include/theoraplayer", "#drivers/theoraplayer/src/YUV", "#drivers/theoraplayer/src/YUV/libyuv/include", "#drivers/theoraplayer/src/Theora", "#drivers/theoraplayer/src/AVFoundation"])
-
-objs = []
-
-env_theora.add_source_files(objs, ["video_stream_theoraplayer.cpp"])
-
-if env['use_theoraplayer_binary'] == "yes":
- if env["platform"] == "iphone":
- env.Append(LIBPATH=['#drivers/theoraplayer/lib/ios'])
- env.Append(LIBS=['theoraplayer', 'ogg', 'theora', 'tremor'])
- if env["platform"] == "windows":
- env.Append(LIBPATH=['#drivers/theoraplayer/lib/windows'])
- env.Append(LINKFLAGS=['libtheoraplayer_static.lib', 'libogg.lib', 'libtheora.lib', 'libvorbis.lib'])
-else:
- env_theora.add_source_files(objs, sources)
-
-env.drivers_sources += objs
-
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraAsync.h b/drivers/theoraplayer/include/theoraplayer/TheoraAsync.h
deleted file mode 100644
index 7f1b49b9a..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraAsync.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraAsync_h
-#define _TheoraAsync_h
-
-#ifndef _WIN32
-#include
-#endif
-
-/// @note Based on hltypes::Thread
-class TheoraMutex
-{
-public:
- TheoraMutex();
- ~TheoraMutex();
- void lock();
- void unlock();
-
-protected:
- void* mHandle;
-
-};
-
-/// @note Based on hltypes::Thread
-class TheoraThread
-{
- TheoraMutex mRunningMutex;
-public:
- TheoraThread();
- virtual ~TheoraThread();
- void start();
- void stop();
- void resume();
- void pause();
- bool isRunning();
- virtual void execute() = 0;
- void join();
-
-protected:
- void* mId;
- volatile bool mRunning;
-
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraAudioInterface.h b/drivers/theoraplayer/include/theoraplayer/TheoraAudioInterface.h
deleted file mode 100644
index aa0329380..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraAudioInterface.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraAudioInterface_h
-#define _TheoraAudioInterface_h
-
-#include "TheoraExport.h"
-
-class TheoraVideoClip;
-
-
-/**
- This is the class that serves as an interface between the library's audio
- output and the audio playback library of your choice.
- The class gets mono or stereo PCM data in in floating point data
- */
-class TheoraPlayerExport TheoraAudioInterface
-{
-public:
- //! PCM frequency, usualy 44100 Hz
- int mFreq;
- //! Mono or stereo
- int mNumChannels;
- //! Pointer to the parent TheoraVideoClip object
- TheoraVideoClip* mClip;
-
- TheoraAudioInterface(TheoraVideoClip* owner, int nChannels, int freq);
- virtual ~TheoraAudioInterface();
- //! A function that the TheoraVideoClip object calls once more audio packets are decoded
- /*!
- \param data contains one or two channels of float PCM data in the range [-1,1]
- \param nSamples contains the number of samples that the data parameter contains in each channel
- */
- virtual void insertData(float* data, int nSamples)=0;
-};
-
-class TheoraPlayerExport TheoraAudioInterfaceFactory
-{
-public:
- //! VideoManager calls this when creating a new TheoraVideoClip object
- virtual TheoraAudioInterface* createInstance(TheoraVideoClip* owner, int nChannels, int freq) = 0;
-};
-
-
-#endif
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraAudioPacketQueue.h b/drivers/theoraplayer/include/theoraplayer/TheoraAudioPacketQueue.h
deleted file mode 100644
index e0d17516e..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraAudioPacketQueue.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraAudioPacketQueue_h
-#define _TheoraAudioPacketQueue_h
-
-#include "TheoraExport.h"
-
-class TheoraAudioInterface;
-/**
- This is an internal structure which TheoraVideoClip_Theora uses to store audio packets
- */
-struct TheoraAudioPacket
-{
- float* pcm;
- int numSamples; //! size in number of float samples (stereo has twice the number of samples)
- TheoraAudioPacket* next; // pointer to the next audio packet, to implement a linked list
-};
-
-/**
- This is a Mutex object, used in thread syncronization.
- */
-class TheoraPlayerExport TheoraAudioPacketQueue
-{
-protected:
- unsigned int mAudioFrequency, mNumAudioChannels;
- TheoraAudioPacket* mTheoraAudioPacketQueue;
- void _addAudioPacket(float* data, int numSamples);
-public:
- TheoraAudioPacketQueue();
- ~TheoraAudioPacketQueue();
-
- float getAudioPacketQueueLength();
- void addAudioPacket(float** buffer, int numSamples, float gain);
- void addAudioPacket(float* buffer, int numSamples, float gain);
- TheoraAudioPacket* popAudioPacket();
- void destroyAudioPacket(TheoraAudioPacket* p);
- void destroyAllAudioPackets();
-
- void flushAudioPackets(TheoraAudioInterface* audioInterface);
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraDataSource.h b/drivers/theoraplayer/include/theoraplayer/TheoraDataSource.h
deleted file mode 100644
index b7427e97d..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraDataSource.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraDataSource_h
-#define _TheoraDataSource_h
-
-#include
-#include
-#include "TheoraExport.h"
-
-/**
- This is a simple class that provides abstracted data feeding. You can use the
- TheoraFileDataSource for regular file playback or you can implement your own
- internet streaming solution, or a class that uses encrypted datafiles etc.
- The sky is the limit
-*/
-class TheoraPlayerExport TheoraDataSource
-{
-public:
-
- virtual ~TheoraDataSource();
- /**
- Reads nBytes bytes from data source and returns number of read bytes.
- if function returns less bytes then nBytes, the system assumes EOF is reached.
- */
- virtual int read(void* output,int nBytes)=0;
- //! returns a string representation of the DataSource, eg 'File: source.ogg'
- virtual std::string repr()=0;
- //! position the source pointer to byte_index from the start of the source
- virtual void seek(unsigned long byte_index)=0;
- //! return the size of the stream in bytes
- virtual unsigned long size()=0;
- //! return the current position of the source pointer
- virtual unsigned long tell()=0;
-};
-
-
-/**
- provides standard file IO
-*/
-class TheoraPlayerExport TheoraFileDataSource : public TheoraDataSource
-{
- FILE* mFilePtr;
- std::string mFilename;
- unsigned long mSize;
-
- void openFile();
-public:
- TheoraFileDataSource(std::string filename);
- ~TheoraFileDataSource();
-
- int read(void* output,int nBytes);
- void seek(unsigned long byte_index);
- std::string repr() { return mFilename; }
- unsigned long size();
- unsigned long tell();
-
- std::string getFilename() { return mFilename; }
-};
-
-/**
- Pre-loads the entire file and streams from memory.
- Very useful if you're continuously displaying a video and want to avoid disk reads.
- Not very practical for large files.
-*/
-class TheoraPlayerExport TheoraMemoryFileDataSource : public TheoraDataSource
-{
- std::string mFilename;
- unsigned long mSize, mReadPointer;
- unsigned char* mData;
-public:
- TheoraMemoryFileDataSource(unsigned char* data, long size, const std::string& filename = "memory");
- TheoraMemoryFileDataSource(std::string filename);
- ~TheoraMemoryFileDataSource();
-
- int read(void* output,int nBytes);
- void seek(unsigned long byte_index);
- std::string repr() { return "MEM:"+mFilename; }
- unsigned long size();
- unsigned long tell();
- std::string getFilename() { return mFilename; }
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraException.h b/drivers/theoraplayer/include/theoraplayer/TheoraException.h
deleted file mode 100644
index f79368fa1..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraException.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef EXCEPTION_H
-#define EXCEPTION_H
-
-#include
-#include "TheoraExport.h"
-
-class TheoraPlayerExport _TheoraGenericException
-{
-public:
- std::string mErrText,mFile,mType;
- int mLineNumber;
-
- _TheoraGenericException(const std::string& errorText, std::string type = "",std::string file = "", int line = 0);
- virtual ~_TheoraGenericException() {}
-
- virtual std::string repr();
-
- void writeOutput();
-
- virtual const std::string& getErrorText() { return mErrText; }
-
- const std::string getType(){ return mType; }
-};
-
-#define TheoraGenericException(msg) _TheoraGenericException(msg, "TheoraGenericException", __FILE__, __LINE__)
-
-
-#define exception_cls(name) class name : public _TheoraGenericException \
-{ \
-public: \
- name(const std::string& errorText,std::string type = "",std::string file = "",int line = 0) : \
- _TheoraGenericException(errorText, type, file, line){} \
-}
-
-exception_cls(_KeyException);
-
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraExport.h b/drivers/theoraplayer/include/theoraplayer/TheoraExport.h
deleted file mode 100644
index cf16d1004..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraExport.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _theoraVideoExport_h
-#define _theoraVideoExport_h
-
- #ifdef _LIB
- #define TheoraPlayerExport
- #define TheoraPlayerFnExport
- #else
- #ifdef _WIN32
- #ifdef THEORAVIDEO_EXPORTS
- #define TheoraPlayerExport __declspec(dllexport)
- #define TheoraPlayerFnExport __declspec(dllexport)
- #else
- #define TheoraPlayerExport __declspec(dllimport)
- #define TheoraPlayerFnExport __declspec(dllimport)
- #endif
- #else
- #define TheoraPlayerExport __attribute__ ((visibility("default")))
- #define TheoraPlayerFnExport __attribute__ ((visibility("default")))
- #endif
- #endif
- #ifndef DEPRECATED_ATTRIBUTE
- #ifdef _MSC_VER
- #define DEPRECATED_ATTRIBUTE __declspec(deprecated("function is deprecated"))
- #else
- #define DEPRECATED_ATTRIBUTE __attribute__((deprecated))
- #endif
- #endif
-
-#endif
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraFrameQueue.h b/drivers/theoraplayer/include/theoraplayer/TheoraFrameQueue.h
deleted file mode 100644
index fd985bb65..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraFrameQueue.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-
-#ifndef _TheoraFrameQueue_h
-#define _TheoraFrameQueue_h
-
-#include "TheoraAsync.h"
-#include
-#include "TheoraExport.h"
-
-class TheoraVideoFrame;
-class TheoraVideoClip;
-
-/**
- This class handles the frame queue. contains frames and handles their alloctation/deallocation
- it is designed to be thread-safe
-*/
-class TheoraPlayerExport TheoraFrameQueue
-{
-protected:
- std::list mQueue;
- TheoraVideoClip* mParent;
- TheoraMutex mMutex;
-
- //! implementation function that returns a TheoraVideoFrame instance
- TheoraVideoFrame* createFrameInstance(TheoraVideoClip* clip);
-public:
- TheoraFrameQueue(TheoraVideoClip* parent);
- ~TheoraFrameQueue();
-
- /**
- \brief Returns the first available frame in the queue or NULL if no frames are available.
-
- This function DOES NOT remove the frame from the queue, you have to do it manually
- when you want to mark the frame as used by calling the pop() function.
- */
- TheoraVideoFrame* getFirstAvailableFrame();
- //! non-mutex version
- TheoraVideoFrame* _getFirstAvailableFrame();
-
- //! return the number of used (not ready) frames
- int getUsedCount();
-
- //! return the number of ready frames
- int getReadyCount();
- //! non-mutex version
- int _getReadyCount();
-
- /**
- \brief remove the first N available frame from the queue.
-
- Use this every time you display a frame so you can get the next one when the time comes.
- This function marks the frame on the front of the queue as unused and it's memory then
- get's used again in the decoding process.
- If you don't call this, the frame queue will fill up with precached frames up to the
- specified amount in the TheoraVideoManager class and you won't be able to advance the video.
- */
- void pop(int n = 1);
-
- //! This is an internal _pop function. use externally only in combination with lock() / unlock() calls
- void _pop(int n);
-
- //! frees all decoded frames for reuse (does not destroy memory, just marks them as free)
- void clear();
- //! Called by WorkerThreads when they need to unload frame data, do not call directly!
- TheoraVideoFrame* requestEmptyFrame();
-
- /**
- \brief set's the size of the frame queue.
-
- Beware, currently stored ready frames will be lost upon this call
- */
- void setSize(int n);
- //! return the size of the queue
- int getSize();
-
- //! return whether all frames in the queue are ready for display
- bool isFull();
-
- //! lock the queue's mutex manually
- void lock();
- //! unlock the queue's mutex manually
- void unlock();
-
- //! returns the internal frame queue. Warning: Always lock / unlock queue's mutex before accessing frames directly!
- std::list& _getFrameQueue();
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraPixelTransform.h b/drivers/theoraplayer/include/theoraplayer/TheoraPixelTransform.h
deleted file mode 100644
index 73d853cd0..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraPixelTransform.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraPixelTransform_h
-#define _TheoraPixelTransform_h
-
-struct TheoraPixelTransform
-{
- unsigned char *raw, *y, *u, *v, *out;
- unsigned int w, h, rawStride, yStride, uStride, vStride;
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraPlayer.h b/drivers/theoraplayer/include/theoraplayer/TheoraPlayer.h
deleted file mode 100644
index 8c5f2c735..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraPlayer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraPlayer_h
-#define _TheoraPlayer_h
-
-#include "TheoraVideoManager.h"
-#include "TheoraVideoClip.h"
-#include "TheoraVideoFrame.h"
-
-#endif
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraTimer.h b/drivers/theoraplayer/include/theoraplayer/TheoraTimer.h
deleted file mode 100644
index 14fdbf47f..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraTimer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-
-#ifndef _TheoraTimer_h
-#define _TheoraTimer_h
-
-#include "TheoraExport.h"
-
-/**
- This is a Timer object, it is used to control the playback of a TheoraVideoClip.
-
- You can inherit this class and make a timer that eg. plays twice as fast,
- or playbacks an audio track and uses it's time offset for syncronizing Video etc.
- */
-class TheoraPlayerExport TheoraTimer
-{
-protected:
- //! Current time in seconds
- float mTime,mSpeed;
- //! Is the timer paused or not
- bool mPaused;
-public:
- TheoraTimer();
- virtual ~TheoraTimer();
-
- virtual float getTime();
- /**
- \brief advance the time.
-
- If you're using another synronization system, eg. an audio track,
- then you can ignore this call or use it to perform other updates.
-
- NOTE: this is called by TheoraVideoManager from the main thread
- */
- virtual void update(float timeDelta);
-
- virtual void pause();
- virtual void play();
- virtual bool isPaused();
- virtual void stop();
- /**
- \brief set's playback speed
-
- 1.0 is the default. The speed factor multiplies time advance, thus
- setting the value higher will increase playback speed etc.
-
- NOTE: depending on Timer implementation, it may not support setting the speed
-
- */
- virtual void setSpeed(float speed);
- //! return the update speed 1.0 is the default
- virtual float getSpeed();
-
- /**
- \brief change the current time.
-
- if you're using another syncronization mechanism, make sure to adjust
- the time offset there
- */
- virtual void seek(float time);
-};
-#endif
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraUtil.h b/drivers/theoraplayer/include/theoraplayer/TheoraUtil.h
deleted file mode 100644
index f168971ac..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraUtil.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraUtil_h
-#define _TheoraUtil_h
-
-#include
-#include
-
-#ifndef THEORAUTIL_NOMACROS
-
-#define foreach(type,lst) for (std::vector::iterator it=lst.begin();it != lst.end(); ++it)
-#define foreach_l(type,lst) for (std::list::iterator it=lst.begin();it != lst.end(); ++it)
-#define foreach_r(type,lst) for (std::vector::reverse_iterator it=lst.rbegin();it != lst.rend(); ++it)
-#define foreach_in_map(type,lst) for (std::map::iterator it=lst.begin();it != lst.end(); ++it)
-
-#endif
-
-#define th_writelog(x) TheoraVideoManager::getSingleton().logMessage(x)
-
-
-std::string str(int i);
-std::string strf(float i);
-void _psleep(int milliseconds);
-int _nextPow2(int x);
-
-#endif
\ No newline at end of file
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraVideoClip.h b/drivers/theoraplayer/include/theoraplayer/TheoraVideoClip.h
deleted file mode 100644
index fe71cf856..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraVideoClip.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-
-#ifndef _TheoraVideoClip_h
-#define _TheoraVideoClip_h
-
-#include
-#include "TheoraExport.h"
-
-// forward class declarations
-class TheoraMutex;
-class TheoraFrameQueue;
-class TheoraTimer;
-class TheoraAudioInterface;
-class TheoraWorkerThread;
-class TheoraDataSource;
-class TheoraVideoFrame;
-
-/**
- format of the TheoraVideoFrame pixels. Affects decoding time
- */
-enum TheoraOutputMode
-{
- // A = full alpha (255), order of letters represents the byte order for a pixel
- // A means the image is treated as if it contains an alpha channel, while X formats
- // just mean that RGB frame is transformed to a 4 byte format
- TH_UNDEFINED = 0,
- TH_RGB = 1,
- TH_RGBA = 2,
- TH_RGBX = 3,
- TH_ARGB = 4,
- TH_XRGB = 5,
- TH_BGR = 6,
- TH_BGRA = 7,
- TH_BGRX = 8,
- TH_ABGR = 9,
- TH_XBGR = 10,
- TH_GREY = 11,
- TH_GREY3 = 12,
- TH_GREY3A = 13,
- TH_GREY3X = 14,
- TH_AGREY3 = 15,
- TH_XGREY3 = 16,
- TH_YUV = 17,
- TH_YUVA = 18,
- TH_YUVX = 19,
- TH_AYUV = 20,
- TH_XYUV = 21
-};
-
-/**
- This object contains all data related to video playback, eg. the open source file,
- the frame queue etc.
-*/
-class TheoraPlayerExport TheoraVideoClip
-{
- friend class TheoraWorkerThread;
- friend class TheoraVideoFrame;
- friend class TheoraVideoManager;
-protected:
- TheoraFrameQueue* mFrameQueue;
- TheoraAudioInterface* mAudioInterface;
- TheoraDataSource* mStream;
-
- TheoraTimer *mTimer, *mDefaultTimer;
-
- TheoraWorkerThread* mAssignedWorkerThread;
-
- bool mUseAlpha;
-
- bool mWaitingForCache;
-
- // benchmark vars
- int mNumDroppedFrames, mNumDisplayedFrames, mNumPrecachedFrames;
-
- int mThreadAccessCount; //! counter used by TheoraVideoManager to schedule workload
-
- int mSeekFrame; //! stores desired seek position as a frame number. next worker thread will do the seeking and reset this var to -1
- float mDuration, mFrameDuration, mFPS;
- float mPriority; //! User assigned priority. Default value is 1
- std::string mName;
- int mWidth, mHeight, mStride;
- int mNumFrames;
- int audio_track;
-
- int mSubFrameWidth, mSubFrameHeight, mSubFrameOffsetX, mSubFrameOffsetY;
- float mAudioGain; //! multiplier for audio samples. between 0 and 1
-
- TheoraOutputMode mOutputMode, mRequestedOutputMode;
- bool mFirstFrameDisplayed;
- bool mAutoRestart;
- bool mEndOfFile, mRestarted;
- int mIteration, mPlaybackIteration; //! used to ensure smooth playback of looping videos
-
- TheoraMutex* mAudioMutex; //! syncs audio decoding and extraction
- TheoraMutex* mThreadAccessMutex;
-
- /**
- * Get the priority of a video clip. based on a forumula that includes user
- * priority factor, whether the video is paused or not, how many precached
- * frames it has etc.
- * This function is used in TheoraVideoManager to efficiently distribute job
- * assignments among worker threads
- * @return priority number of this video clip
- */
- int calculatePriority();
- void readTheoraVorbisHeaders();
- virtual void doSeek() = 0; //! called by WorkerThread to seek to mSeekFrame
- virtual bool _readData() = 0;
- bool isBusy();
-
- /**
- * decodes audio from the vorbis stream and stores it in audio packets
- * This is an internal function of TheoraVideoClip, called regularly if playing an
- * audio enabled video clip.
- * @return last decoded timestamp (if found in decoded packet's granule position)
- */
- virtual float decodeAudio() = 0;
-
- int _getNumReadyFrames();
- void resetFrameQueue();
- int discardOutdatedFrames(float absTime);
- float getAbsPlaybackTime();
- virtual void load(TheoraDataSource* source) = 0;
-
- virtual void _restart() = 0; // resets the decoder and stream but leaves the frame queue intact
-public:
- TheoraVideoClip(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride);
- virtual ~TheoraVideoClip();
-
- std::string getName();
- //! Returns the string name of the decoder backend (eg. Theora, AVFoundation)
- virtual std::string getDecoderName() = 0;
-
- //! benchmark function
- int getNumDisplayedFrames() { return mNumDisplayedFrames; }
- //! benchmark function
- int getNumDroppedFrames() { return mNumDroppedFrames; }
-
- //! return width in pixels of the video clip
- int getWidth();
- //! return height in pixels of the video clip
- int getHeight();
-
- //! Width of the actual picture inside a video frame (depending on implementation, this may be equal to mWidth or differ within a codec block size (usually 16))
- int getSubFrameWidth();
- //! Height of the actual picture inside a video frame (depending on implementation, this may be equal to mHeight or differ within a codec block size (usually 16))
- int getSubFrameHeight();
- //! X Offset of the actual picture inside a video frame (depending on implementation, this may be 0 or within a codec block size (usually 16))
- int getSubFrameOffsetX();
- //! Y Offset of the actual picture inside a video frame (depending on implementation, this may be 0 or differ within a codec block size (usually 16))
- int getSubFrameOffsetY();
- /**
- \brief return stride in pixels
-
- If you've specified usePower2Stride when creating the TheoraVideoClip object
- then this value will be the next power of two size compared to width,
- eg: w=376, stride=512.
-
- Otherwise, stride will be equal to width
- */
- int getStride() { return mStride; }
-
- //! retur the timer objet associated with this object
- TheoraTimer* getTimer();
- //! replace the timer object with a new one
- void setTimer(TheoraTimer* timer);
-
- //! used by TheoraWorkerThread, do not call directly
- virtual bool decodeNextFrame() = 0;
-
- //! advance time. TheoraVideoManager calls this
- void update(float timeDelta);
- /**
- \brief update timer to the display time of the next frame
-
- useful if you want to grab frames instead of regular display
- \return time advanced. 0 if no frames are ready
- */
- float updateToNextFrame();
-
-
- TheoraFrameQueue* getFrameQueue();
-
- /**
- \brief pop the frame from the front of the FrameQueue
-
- see TheoraFrameQueue::pop() for more details
- */
- void popFrame();
-
- /**
- \brief Returns the first available frame in the queue or NULL if no frames are available.
-
- see TheoraFrameQueue::getFirstAvailableFrame() for more details
- */
- TheoraVideoFrame* getNextFrame();
- /**
- check if there is enough audio data decoded to submit to the audio interface
-
- TheoraWorkerThread calls this
- */
- virtual void decodedAudioCheck() = 0;
-
- void setAudioInterface(TheoraAudioInterface* iface);
- TheoraAudioInterface* getAudioInterface();
-
- /**
- \brief resize the frame queues
-
- Warning: this call discards ready frames in the frame queue
- */
- void setNumPrecachedFrames(int n);
- //! returns the size of the frame queue
- int getNumPrecachedFrames();
- //! returns the number of ready frames in the frame queue
- int getNumReadyFrames();
-
- //! if you want to adjust the audio gain. range [0,1]
- void setAudioGain(float gain);
- float getAudioGain();
-
- //! if you want the video to automatically and smoothly restart when the last frame is reached
- void setAutoRestart(bool value);
- bool getAutoRestart() { return mAutoRestart; }
-
-
- void set_audio_track(int p_track) { audio_track=p_track; }
-
- /**
- TODO: user priority. Useful only when more than one video is being decoded
- */
- void setPriority(float priority);
- float getPriority();
-
- //! Used by TheoraVideoManager to schedule work
- float getPriorityIndex();
-
- //! get the current time index from the timer object
- float getTimePosition();
- //! get the duration of the movie in seconds
- float getDuration();
- //! return the clips' frame rate, warning, fps can be a non integer number!
- float getFPS();
- //! get the number of frames in this movie
- int getNumFrames() { return mNumFrames; }
-
- //! return the current output mode for this video object
- TheoraOutputMode getOutputMode();
- /**
- set a new output mode
-
- Warning: this discards the frame queue. ready frames will be lost.
- */
- void setOutputMode(TheoraOutputMode mode);
-
- bool isDone();
- void play();
- void pause();
- void restart();
- bool isPaused();
- void stop();
- void setPlaybackSpeed(float speed);
- float getPlaybackSpeed();
- //! seek to a given time position
- void seek(float time);
- //! seek to a given frame number
- void seekToFrame(int frame);
- //! wait max_time for the clip to cache a given percentage of frames, factor in range [0,1]
- void waitForCache(float desired_cache_factor = 0.5f, float max_wait_time = 1.0f);
-};
-
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraVideoFrame.h b/drivers/theoraplayer/include/theoraplayer/TheoraVideoFrame.h
deleted file mode 100644
index 5d27f54d1..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraVideoFrame.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraVideoFrame_h
-#define _TheoraVideoFrame_h
-
-#include "TheoraExport.h"
-#include "TheoraVideoClip.h"
-
-struct TheoraPixelTransform;
-/**
-
-*/
-class TheoraPlayerExport TheoraVideoFrame
-{
-protected:
- TheoraVideoClip* mParent;
- unsigned char* mBuffer;
- unsigned long mFrameNumber;
-public:
- //! global time in seconds this frame should be displayed on
- float mTimeToDisplay;
- //! whether the frame is ready for display or not
- bool mReady;
- //! indicates the frame is being used by TheoraWorkerThread instance
- bool mInUse;
- //! used to keep track of linear time in looping videos
- int mIteration;
-
- int mBpp;
-
- TheoraVideoFrame(TheoraVideoClip* parent);
- virtual ~TheoraVideoFrame();
-
- //! internal function, do not use directly
- void _setFrameNumber(unsigned long number) { mFrameNumber = number; }
- //! returns the frame number of this frame in the theora stream
- unsigned long getFrameNumber() { return mFrameNumber; }
-
- void clear();
-
- int getWidth();
- int getStride();
- int getHeight();
-
- unsigned char* getBuffer();
-
- //! Called by TheoraVideoClip to decode a source buffer onto itself
- virtual void decode(struct TheoraPixelTransform* t);
-};
-#endif
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraVideoManager.h b/drivers/theoraplayer/include/theoraplayer/TheoraVideoManager.h
deleted file mode 100644
index d94c51b4d..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraVideoManager.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-
-#ifndef _TheoraVideoManager_h
-#define _TheoraVideoManager_h
-
-#include
-#include
-#include
-#include "TheoraExport.h"
-#include "TheoraVideoClip.h"
-#ifdef _WIN32
-#pragma warning( disable: 4251 ) // MSVC++
-#endif
-// forward class declarations
-class TheoraWorkerThread;
-class TheoraMutex;
-class TheoraDataSource;
-class TheoraAudioInterfaceFactory;
-/**
- This is the main singleton class that handles all playback/sync operations
-*/
-class TheoraPlayerExport TheoraVideoManager
-{
-protected:
- friend class TheoraWorkerThread;
- typedef std::vector ClipList;
- typedef std::vector ThreadList;
-
- //! stores pointers to worker threads which are decoding video and audio
- ThreadList mWorkerThreads;
- //! stores pointers to created video clips
- ClipList mClips;
-
- //! stores pointer to clips that were docoded in the past in order to achieve fair scheduling
- std::list mWorkLog;
-
- int mDefaultNumPrecachedFrames;
-
- TheoraMutex* mWorkMutex;
- TheoraAudioInterfaceFactory* mAudioFactory;
-
- void createWorkerThreads(int n);
- void destroyWorkerThreads();
-
- float calcClipWorkTime(TheoraVideoClip* clip);
-
- /**
- * Called by TheoraWorkerThread to request a TheoraVideoClip instance to work on decoding
- */
- TheoraVideoClip* requestWork(TheoraWorkerThread* caller);
-public:
- TheoraVideoManager(int num_worker_threads=1);
- virtual ~TheoraVideoManager();
-
- //! get the global reference to the manager instance
- static TheoraVideoManager& getSingleton();
- //! get the global pointer to the manager instance
- static TheoraVideoManager* getSingletonPtr();
-
- //! search registered clips by name
- TheoraVideoClip* getVideoClipByName(std::string name);
-
- TheoraVideoClip* createVideoClip(std::string filename,TheoraOutputMode output_mode=TH_RGB,int numPrecachedOverride=0,bool usePower2Stride=0, int p_track=0);
- TheoraVideoClip* createVideoClip(TheoraDataSource* data_source,TheoraOutputMode output_mode=TH_RGB,int numPrecachedOverride=0,bool usePower2Stride=0, int p_audio_track=0);
-
- void update(float timeDelta);
-
- void destroyVideoClip(TheoraVideoClip* clip);
-
- void setAudioInterfaceFactory(TheoraAudioInterfaceFactory* factory);
- TheoraAudioInterfaceFactory* getAudioInterfaceFactory();
-
- int getNumWorkerThreads();
- void setNumWorkerThreads(int n);
-
- void setDefaultNumPrecachedFrames(int n) { mDefaultNumPrecachedFrames=n; }
- int getDefaultNumPrecachedFrames() { return mDefaultNumPrecachedFrames; }
-
- //! used by libtheoraplayer functions
- void logMessage(std::string msg);
-
- /**
- \brief you can set your own log function to recieve theora's log calls
-
- This way you can integrate libtheoraplayer's log messages in your own
- logging system, prefix them, mute them or whatever you want
- */
- static void setLogFunction(void (*fn)(std::string));
-
- //! get nicely formated version string
- std::string getVersionString();
- /**
- \brief get version numbers
-
- if c is negative, it means it's a release candidate -c
- */
- void getVersion(int* a,int* b,int* c);
-
- //! returns the supported decoders (eg. Theora, AVFoundation...)
- std::vector getSupportedDecoders();
-};
-#endif
-
diff --git a/drivers/theoraplayer/include/theoraplayer/TheoraWorkerThread.h b/drivers/theoraplayer/include/theoraplayer/TheoraWorkerThread.h
deleted file mode 100644
index 2299acedb..000000000
--- a/drivers/theoraplayer/include/theoraplayer/TheoraWorkerThread.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifndef _TheoraWorkerThread_h
-#define _TheoraWorkerThread_h
-
-#include "TheoraAsync.h"
-
-class TheoraVideoClip;
-
-/**
- This is the worker thread, requests work from TheoraVideoManager
- and decodes assigned TheoraVideoClip objects
-*/
-class TheoraWorkerThread : public TheoraThread
-{
- TheoraVideoClip* mClip;
-public:
- TheoraWorkerThread();
- ~TheoraWorkerThread();
-
- TheoraVideoClip* getAssignedClip() { return mClip; }
-
- //! Main Thread Body - do not call directly!
- void execute();
-};
-#endif
diff --git a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.h b/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.h
deleted file mode 100644
index abd898aa0..000000000
--- a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#if defined(__AVFOUNDATION) && !defined(_TheoraVideoClip_AVFoundation_h)
-#define _TheoraVideoClip_AVFoundation_h
-
-#include "TheoraAudioPacketQueue.h"
-#include "TheoraVideoClip.h"
-
-#ifndef AVFOUNDATION_CLASSES_DEFINED
-class AVAssetReader;
-class AVAssetReaderTrackOutput;
-#endif
-
-class TheoraVideoClip_AVFoundation : public TheoraVideoClip, public TheoraAudioPacketQueue
-{
-protected:
- bool mLoaded;
- int mFrameNumber;
- AVAssetReader* mReader;
- AVAssetReaderTrackOutput *mOutput, *mAudioOutput;
- unsigned int mReadAudioSamples;
-
- void unload();
- void doSeek();
-public:
- TheoraVideoClip_AVFoundation(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride);
- ~TheoraVideoClip_AVFoundation();
-
- bool _readData();
- bool decodeNextFrame();
- void _restart();
- void load(TheoraDataSource* source);
- float decodeAudio();
- void decodedAudioCheck();
- std::string getDecoderName() { return "AVFoundation"; }
-};
-
-#endif
diff --git a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm b/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm
deleted file mode 100644
index 1b5cf0ab1..000000000
--- a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm
+++ /dev/null
@@ -1,457 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifdef __AVFOUNDATION
-#define AVFOUNDATION_CLASSES_DEFINED
-#import
-#include "TheoraAudioInterface.h"
-#include "TheoraDataSource.h"
-#include "TheoraException.h"
-#include "TheoraTimer.h"
-#include "TheoraUtil.h"
-#include "TheoraFrameQueue.h"
-#include "TheoraVideoFrame.h"
-#include "TheoraVideoManager.h"
-#include "TheoraVideoClip_AVFoundation.h"
-#include "TheoraPixelTransform.h"
-
-#ifdef _AVFOUNDATION_BGRX
-// a fast function developed to use kernel byte swapping calls to optimize alpha decoding.
-// In AVFoundation, BGRX mode conversion is prefered to YUV conversion because apple's YUV
-// conversion on iOS seems to run faster than libtheoraplayer's implementation
-// This may change in the future with more optimizations to libtheoraplayers's YUV conversion
-// code, making this function obsolete.
-static void bgrx2rgba(unsigned char* dest, int w, int h, struct TheoraPixelTransform* t)
-{
- unsigned register int a;
- unsigned int *dst = (unsigned int*) dest, *dstEnd;
- unsigned char* src = t->raw;
- int y, x, ax;
-
- for (y = 0; y < h; ++y, src += t->rawStride)
- {
- for (x = 0, ax = w * 4, dstEnd = dst + w; dst != dstEnd; x += 4, ax += 4, ++dst)
- {
- // use the full alpha range here because the Y channel has already been converted
- // to RGB and that's in [0, 255] range.
- a = src[ax];
- *dst = (OSReadSwapInt32(src, x) >> 8) | (a << 24);
- }
- }
-}
-#endif
-
-static CVPlanarPixelBufferInfo_YCbCrPlanar getYUVStruct(void* src)
-{
- CVPlanarPixelBufferInfo_YCbCrPlanar* bigEndianYuv = (CVPlanarPixelBufferInfo_YCbCrPlanar*) src;
- CVPlanarPixelBufferInfo_YCbCrPlanar yuv;
- yuv.componentInfoY.offset = OSSwapInt32(bigEndianYuv->componentInfoY.offset);
- yuv.componentInfoY.rowBytes = OSSwapInt32(bigEndianYuv->componentInfoY.rowBytes);
- yuv.componentInfoCb.offset = OSSwapInt32(bigEndianYuv->componentInfoCb.offset);
- yuv.componentInfoCb.rowBytes = OSSwapInt32(bigEndianYuv->componentInfoCb.rowBytes);
- yuv.componentInfoCr.offset = OSSwapInt32(bigEndianYuv->componentInfoCr.offset);
- yuv.componentInfoCr.rowBytes = OSSwapInt32(bigEndianYuv->componentInfoCr.rowBytes);
- return yuv;
-}
-
-TheoraVideoClip_AVFoundation::TheoraVideoClip_AVFoundation(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride):
- TheoraVideoClip(data_source, output_mode, nPrecachedFrames, usePower2Stride),
- TheoraAudioPacketQueue()
-{
- mLoaded = 0;
- mReader = NULL;
- mOutput = mAudioOutput = NULL;
- mReadAudioSamples = mAudioFrequency = mNumAudioChannels = 0;
-}
-
-TheoraVideoClip_AVFoundation::~TheoraVideoClip_AVFoundation()
-{
- unload();
-}
-
-void TheoraVideoClip_AVFoundation::unload()
-{
- if (mOutput != NULL || mAudioOutput != NULL || mReader != NULL)
- {
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-
- if (mOutput != NULL)
- {
- [mOutput release];
- mOutput = NULL;
- }
-
- if (mAudioOutput)
- {
- [mAudioOutput release];
- mAudioOutput = NULL;
- }
-
- if (mReader != NULL)
- {
- [mReader release];
- mReader = NULL;
- }
-
- [pool release];
- }
-}
-
-bool TheoraVideoClip_AVFoundation::_readData()
-{
- return 1;
-}
-
-bool TheoraVideoClip_AVFoundation::decodeNextFrame()
-{
- if (mReader == NULL || mEndOfFile) return 0;
- AVAssetReaderStatus status = [mReader status];
- if (status == AVAssetReaderStatusFailed)
- {
- // This can happen on iOS when you suspend the app... Only happens on the device, iOS simulator seems to work fine.
- th_writelog("AVAssetReader reading failed, restarting...");
-
- mSeekFrame = mTimer->getTime() * mFPS;
- // just in case
- if (mSeekFrame < 0) mSeekFrame = 0;
- if (mSeekFrame > mDuration * mFPS - 1) mSeekFrame = mDuration * mFPS - 1;
- _restart();
- status = [mReader status];
- if (status == AVAssetReaderStatusFailed)
- {
- th_writelog("AVAssetReader restart failed!");
- return 0;
- }
- th_writelog("AVAssetReader restart succeeded!");
- }
-
- TheoraVideoFrame* frame = mFrameQueue->requestEmptyFrame();
- if (!frame) return 0;
-
- CMSampleBufferRef sampleBuffer = NULL;
- NSAutoreleasePool* pool = NULL;
- CMTime presentationTime;
-
- if (mAudioInterface) decodeAudio();
-
- if (status == AVAssetReaderStatusReading)
- {
- pool = [[NSAutoreleasePool alloc] init];
-
- while ((sampleBuffer = [mOutput copyNextSampleBuffer]))
- {
- presentationTime = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
- frame->mTimeToDisplay = (float) CMTimeGetSeconds(presentationTime);
- frame->mIteration = mIteration;
- frame->_setFrameNumber(mFrameNumber);
- ++mFrameNumber;
- if (frame->mTimeToDisplay < mTimer->getTime() && !mRestarted && mFrameNumber % 16 != 0)
- {
- // %16 operation is here to prevent a playback halt during video playback if the decoder can't keep up with demand.
-#ifdef _DEBUG
- th_writelog(mName + ": pre-dropped frame " + str(mFrameNumber - 1));
-#endif
- ++mNumDisplayedFrames;
- ++mNumDroppedFrames;
- CMSampleBufferInvalidate(sampleBuffer);
- CFRelease(sampleBuffer);
- sampleBuffer = NULL;
- continue; // drop frame
- }
-
- CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
- CVPixelBufferLockBaseAddress(imageBuffer, 0);
- void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer);
-
- mStride = CVPixelBufferGetBytesPerRow(imageBuffer);
- size_t width = CVPixelBufferGetWidth(imageBuffer);
- size_t height = CVPixelBufferGetHeight(imageBuffer);
-
- TheoraPixelTransform t;
- memset(&t, 0, sizeof(TheoraPixelTransform));
-#ifdef _AVFOUNDATION_BGRX
- if (mOutputMode == TH_BGRX || mOutputMode == TH_RGBA)
- {
- t.raw = (unsigned char*) baseAddress;
- t.rawStride = mStride;
- }
- else
-#endif
- {
- CVPlanarPixelBufferInfo_YCbCrPlanar yuv = getYUVStruct(baseAddress);
-
- t.y = (unsigned char*) baseAddress + yuv.componentInfoY.offset; t.yStride = yuv.componentInfoY.rowBytes;
- t.u = (unsigned char*) baseAddress + yuv.componentInfoCb.offset; t.uStride = yuv.componentInfoCb.rowBytes;
- t.v = (unsigned char*) baseAddress + yuv.componentInfoCr.offset; t.vStride = yuv.componentInfoCr.rowBytes;
- }
-#ifdef _AVFOUNDATION_BGRX
- if (mOutputMode == TH_RGBA)
- {
- for (int i = 0; i < 1000; ++i)
- bgrx2rgba(frame->getBuffer(), mWidth / 2, mHeight, &t);
- frame->mReady = true;
- }
- else
-#endif
- frame->decode(&t);
-
- CVPixelBufferUnlockBaseAddress(imageBuffer, 0);
- CMSampleBufferInvalidate(sampleBuffer);
- CFRelease(sampleBuffer);
-
- break; // TODO - should this really be a while loop instead of an if block?
- }
- }
- if (pool) [pool release];
-
- if (!frame->mReady) // in case the frame wasn't used
- {
- frame->mInUse = 0;
- }
-
- if (sampleBuffer == NULL && mReader.status == AVAssetReaderStatusCompleted) // other cases could be app suspended
- {
- if (mAutoRestart)
- {
- ++mIteration;
- _restart();
- }
- else
- {
- unload();
- mEndOfFile = true;
- }
- return 0;
- }
-
-
- return 1;
-}
-
-void TheoraVideoClip_AVFoundation::_restart()
-{
- mEndOfFile = false;
- unload();
- load(mStream);
- mRestarted = true;
-}
-
-void TheoraVideoClip_AVFoundation::load(TheoraDataSource* source)
-{
- mStream = source;
- mFrameNumber = 0;
- mEndOfFile = false;
- TheoraFileDataSource* fileDataSource = dynamic_cast(source);
- std::string filename;
- if (fileDataSource != NULL) filename = fileDataSource->getFilename();
- else
- {
- TheoraMemoryFileDataSource* memoryDataSource = dynamic_cast(source);
- if (memoryDataSource != NULL) filename = memoryDataSource->getFilename();
- else throw TheoraGenericException("Unable to load MP4 file");
- }
-
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- NSString* path = [NSString stringWithUTF8String:filename.c_str()];
- NSError* err;
- NSURL *url = [NSURL fileURLWithPath:path];
- AVAsset* asset = [[AVURLAsset alloc] initWithURL:url options:nil];
- mReader = [[AVAssetReader alloc] initWithAsset:asset error:&err];
- NSArray* tracks = [asset tracksWithMediaType:AVMediaTypeVideo];
- if ([tracks count] == 0)
- throw TheoraGenericException("Unable to open video file: " + filename);
- AVAssetTrack *videoTrack = [tracks objectAtIndex:0];
-
- NSArray* audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio];
- if (audio_track >= audioTracks.count)
- audio_track = 0;
- AVAssetTrack *audioTrack = audioTracks.count > 0 ? [audioTracks objectAtIndex:audio_track] : NULL;
- printf("*********** using audio track %i\n", audio_track);
-
-#ifdef _AVFOUNDATION_BGRX
- bool yuv_output = (mOutputMode != TH_BGRX && mOutputMode != TH_RGBA);
-#else
- bool yuv_output = true;
-#endif
-
- NSDictionary *videoOptions = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:(yuv_output) ? kCVPixelFormatType_420YpCbCr8Planar : kCVPixelFormatType_32BGRA], kCVPixelBufferPixelFormatTypeKey, nil];
-
- mOutput = [[AVAssetReaderTrackOutput alloc] initWithTrack:videoTrack outputSettings:videoOptions];
- [mReader addOutput:mOutput];
- if ([mOutput respondsToSelector:@selector(setAlwaysCopiesSampleData:)]) // Not supported on iOS versions older than 5.0
- mOutput.alwaysCopiesSampleData = NO;
-
- mFPS = videoTrack.nominalFrameRate;
- mWidth = mSubFrameWidth = mStride = videoTrack.naturalSize.width;
- mHeight = mSubFrameHeight = videoTrack.naturalSize.height;
- mFrameDuration = 1.0f / mFPS;
- mDuration = (float) CMTimeGetSeconds(asset.duration);
- if (mFrameQueue == NULL)
- {
- mFrameQueue = new TheoraFrameQueue(this);
- mFrameQueue->setSize(mNumPrecachedFrames);
- }
-
- if (mSeekFrame != -1)
- {
- mFrameNumber = mSeekFrame;
- [mReader setTimeRange: CMTimeRangeMake(CMTimeMakeWithSeconds(mSeekFrame / mFPS, 1), kCMTimePositiveInfinity)];
- }
- if (audioTrack)
- {
- TheoraAudioInterfaceFactory* audio_factory = TheoraVideoManager::getSingleton().getAudioInterfaceFactory();
- if (audio_factory)
- {
- NSDictionary *audioOptions = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
- [NSNumber numberWithBool:NO], AVLinearPCMIsNonInterleaved,
- [NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey,
- [NSNumber numberWithBool:YES], AVLinearPCMIsFloatKey,
- [NSNumber numberWithInt:32], AVLinearPCMBitDepthKey,
- nil];
-
- mAudioOutput = [[AVAssetReaderTrackOutput alloc] initWithTrack:audioTrack outputSettings:audioOptions];
- [mReader addOutput:mAudioOutput];
- if ([mAudioOutput respondsToSelector:@selector(setAlwaysCopiesSampleData:)]) // Not supported on iOS versions older than 5.0
- mAudioOutput.alwaysCopiesSampleData = NO;
-
- NSArray* desclst = audioTrack.formatDescriptions;
- CMAudioFormatDescriptionRef desc = (CMAudioFormatDescriptionRef) [desclst objectAtIndex:0];
- const AudioStreamBasicDescription* audioDesc = CMAudioFormatDescriptionGetStreamBasicDescription(desc);
- mAudioFrequency = (unsigned int) audioDesc->mSampleRate;
- mNumAudioChannels = audioDesc->mChannelsPerFrame;
-
- if (mSeekFrame != -1)
- {
- mReadAudioSamples = mFrameNumber * (mAudioFrequency * mNumAudioChannels) / mFPS;
- }
- else mReadAudioSamples = 0;
-
- if (mAudioInterface == NULL)
- setAudioInterface(audio_factory->createInstance(this, mNumAudioChannels, mAudioFrequency));
- }
- }
-
-#ifdef _DEBUG
- else if (!mLoaded)
- {
- th_writelog("-----\nwidth: " + str(mWidth) + ", height: " + str(mHeight) + ", fps: " + str((int) getFPS()));
- th_writelog("duration: " + strf(mDuration) + " seconds\n-----");
- }
-#endif
- [mReader startReading];
- [pool release];
- mLoaded = true;
-}
-
-void TheoraVideoClip_AVFoundation::decodedAudioCheck()
-{
- if (!mAudioInterface || mTimer->isPaused()) return;
-
- mAudioMutex->lock();
- flushAudioPackets(mAudioInterface);
- mAudioMutex->unlock();
-}
-
-float TheoraVideoClip_AVFoundation::decodeAudio()
-{
- if (mRestarted) return -1;
-
- if (mReader == NULL || mEndOfFile) return 0;
- AVAssetReaderStatus status = [mReader status];
-
- if (mAudioOutput)
- {
- CMSampleBufferRef sampleBuffer = NULL;
- NSAutoreleasePool* pool = NULL;
- bool mutexLocked = 0;
-
- float factor = 1.0f / (mAudioFrequency * mNumAudioChannels);
- float videoTime = (float) mFrameNumber / mFPS;
- float min = mFrameQueue->getSize() / mFPS + 1.0f;
-
- if (status == AVAssetReaderStatusReading)
- {
- pool = [[NSAutoreleasePool alloc] init];
-
- // always buffer up of audio ahead of the frames
- while (mReadAudioSamples * factor - videoTime < min)
- {
- if ((sampleBuffer = [mAudioOutput copyNextSampleBuffer]))
- {
- AudioBufferList audioBufferList;
-
- CMBlockBufferRef blockBuffer = NULL;
- CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
-
- for (int y = 0; y < audioBufferList.mNumberBuffers; ++y)
- {
- AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
- float *frame = (float*) audioBuffer.mData;
-
- if (!mutexLocked)
- {
- mAudioMutex->lock();
- mutexLocked = 1;
- }
- addAudioPacket(frame, audioBuffer.mDataByteSize / (mNumAudioChannels * sizeof(float)), mAudioGain);
-
- mReadAudioSamples += audioBuffer.mDataByteSize / (sizeof(float));
- }
-
- CFRelease(blockBuffer);
- CMSampleBufferInvalidate(sampleBuffer);
- CFRelease(sampleBuffer);
- }
- else
- {
- [mAudioOutput release];
- mAudioOutput = nil;
- break;
- }
- }
- [pool release];
- }
- if (mutexLocked) mAudioMutex->unlock();
- }
-
- return -1;
-}
-
-void TheoraVideoClip_AVFoundation::doSeek()
-{
-#if _DEBUG
- th_writelog(mName + " [seek]: seeking to frame " + str(mSeekFrame));
-#endif
- int frame;
- float time = mSeekFrame / getFPS();
- mTimer->seek(time);
- bool paused = mTimer->isPaused();
- if (!paused) mTimer->pause(); // pause until seeking is done
-
- mEndOfFile = false;
- mRestarted = false;
-
- resetFrameQueue();
- unload();
- load(mStream);
-
- if (mAudioInterface)
- {
- mAudioMutex->lock();
- destroyAllAudioPackets();
- mAudioMutex->unlock();
- }
-
- if (!paused) mTimer->play();
- mSeekFrame = -1;
-}
-#endif
diff --git a/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.cpp b/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.cpp
deleted file mode 100644
index fa3fd43a4..000000000
--- a/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifdef __FFMPEG
-#include "TheoraAudioInterface.h"
-#include "TheoraDataSource.h"
-#include "TheoraException.h"
-#include "TheoraTimer.h"
-#include "TheoraUtil.h"
-#include "TheoraFrameQueue.h"
-#include "TheoraVideoFrame.h"
-#include "TheoraVideoManager.h"
-#include "TheoraVideoClip_FFmpeg.h"
-#include "TheoraPixelTransform.h"
-
-#define READ_BUFFER_SIZE 4096
-
-#ifdef __cplusplus
-#define __STDC_CONSTANT_MACROS
-#ifdef _STDINT_H
-#undef _STDINT_H
-#endif
-# include
-#endif
-
-#define _FFMPEG_DEBUG
-
-extern "C"
-{
-#include
-#include
-#include "libavutil/avassert.h"
-}
-
-static bool ffmpegInitialised = 0;
-
-static int readFunction(void* data, uint8_t* buf, int buf_size)
-{
-#ifdef _FFMPEG_DEBUG
- th_writelog("reading " + str(buf_size) + " bytes");
-#endif
-
- TheoraDataSource* src = (TheoraDataSource*) data;
- return src->read(buf, buf_size);
-}
-
-static int64_t seekFunction(void* data, int64_t offset, int whence)
-{
-#ifdef _FFMPEG_DEBUG
- th_writelog("seeking: offset = " + str((long) offset) + ", whence = " + str(whence));
-#endif
-
- TheoraDataSource* src = (TheoraDataSource*) data;
- if (whence == AVSEEK_SIZE)
- return src->size();
- else if (whence == SEEK_SET)
- src->seek((long) offset);
- else if (whence == SEEK_END)
- src->seek(src->size() - (long) offset);
- return src->tell();
-}
-
-static void avlog_theoraplayer(void* p, int level, const char* fmt, va_list vargs)
-{
- th_writelog(fmt);
- static char logstr[2048];
- vsprintf(logstr, fmt, vargs);
- th_writelog("ffmpeg: " + std::string(logstr));
-}
-
-
-std::string text;
-
-static void _log(const char* s)
-{
- text += s;
-// th_writelog(text);
-// text = "";
-}
-
-static void _log(const char c)
-{
- char s[2] = {c, 0};
- _log(s);
-}
-
-static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
- int encoder)
-{
- while ((prev = av_codec_next(prev))) {
- if (prev->id == id &&
- (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
- return prev;
- }
- return NULL;
-}
-
-static int compare_codec_desc(const void *a, const void *b)
-{
- const AVCodecDescriptor **da = (const AVCodecDescriptor **) a;
- const AVCodecDescriptor **db = (const AVCodecDescriptor **) b;
-
- return (*da)->type != (*db)->type ? (*da)->type - (*db)->type :
- strcmp((*da)->name, (*db)->name);
-}
-
-static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
-{
- const AVCodecDescriptor *desc = NULL;
- const AVCodecDescriptor **codecs;
- unsigned nb_codecs = 0, i = 0;
-
- while ((desc = avcodec_descriptor_next(desc)))
- ++nb_codecs;
- if (!(codecs = (const AVCodecDescriptor**) av_calloc(nb_codecs, sizeof(*codecs)))) {
- av_log(NULL, AV_LOG_ERROR, "Out of memory\n");
- exit(1);
- }
- desc = NULL;
- while ((desc = avcodec_descriptor_next(desc)))
- codecs[i++] = desc;
- av_assert0(i == nb_codecs);
- qsort(codecs, nb_codecs, sizeof(*codecs), compare_codec_desc);
- *rcodecs = codecs;
- return nb_codecs;
-}
-
-static char get_media_type_char(enum AVMediaType type)
-{
- switch (type) {
- case AVMEDIA_TYPE_VIDEO: return 'V';
- case AVMEDIA_TYPE_AUDIO: return 'A';
- case AVMEDIA_TYPE_DATA: return 'D';
- case AVMEDIA_TYPE_SUBTITLE: return 'S';
- case AVMEDIA_TYPE_ATTACHMENT:return 'T';
- default: return '?';
- }
-}
-
-static void print_codecs_for_id(enum AVCodecID id, int encoder)
-{
- const AVCodec *codec = NULL;
-
- _log(encoder ? "encoders" : "decoders");
-
- while ((codec = next_codec_for_id(id, codec, encoder)))
- _log(codec->name);
-
- _log(")");
-}
-
-int show_codecs(void *optctx, const char *opt, const char *arg)
-{
- const AVCodecDescriptor **codecs;
- unsigned i, nb_codecs = get_codecs_sorted(&codecs);
-
- char tmp[1024];
- th_writelog("Codecs:\n"
- " D..... = Decoding supported\n"
- " .E.... = Encoding supported\n"
- " ..V... = Video codec\n"
- " ..A... = Audio codec\n"
- " ..S... = Subtitle codec\n"
- " ...I.. = Intra frame-only codec\n"
- " ....L. = Lossy compression\n"
- " .....S = Lossless compression\n"
- " -------\n");
- for (i = 0; i < nb_codecs; ++i) {
- const AVCodecDescriptor *desc = codecs[i];
- const AVCodec *codec = NULL;
-
- _log(" ");
- _log(avcodec_find_decoder(desc->id) ? "D" : ".");
- _log(avcodec_find_encoder(desc->id) ? "E" : ".");
-
- _log(get_media_type_char(desc->type));
- _log((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
- _log((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
- _log((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
-
-
- sprintf(tmp, " %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
-
- _log(tmp);
- /* print decoders/encoders when there's more than one or their
- * names are different from codec name */
- while ((codec = next_codec_for_id(desc->id, codec, 0))) {
- if (strcmp(codec->name, desc->name)) {
- print_codecs_for_id(desc->id, 0);
- break;
- }
- }
- codec = NULL;
- while ((codec = next_codec_for_id(desc->id, codec, 1))) {
- if (strcmp(codec->name, desc->name)) {
- print_codecs_for_id(desc->id, 1);
- break;
- }
- }
- _log("\n");
- }
- av_free(codecs);
-
- av_log(0, 0, "%s", text.c_str());
- return 0;
-}
-
-TheoraVideoClip_FFmpeg::TheoraVideoClip_FFmpeg(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride):
- TheoraVideoClip(data_source, output_mode, nPrecachedFrames, usePower2Stride),
- TheoraAudioPacketQueue()
-{
- mFormatContext = NULL;
- mCodecContext = NULL;
- mCodec = NULL;
- mFrame = NULL;
- mVideoStreamIndex = -1;
-}
-
-TheoraVideoClip_FFmpeg::~TheoraVideoClip_FFmpeg()
-{
- unload();
-}
-
-void TheoraVideoClip_FFmpeg::load(TheoraDataSource* source)
-{
- mVideoStreamIndex = -1;
- mFrameNumber = 0;
- AVDictionary* optionsDict = NULL;
-
- if (!ffmpegInitialised)
- {
-#ifdef _FFMPEG_DEBUG
- th_writelog("Initializing ffmpeg");
-#endif
- th_writelog("avcodec version: " + str(avcodec_version()));
- av_register_all();
- av_log_set_level(AV_LOG_DEBUG);
- av_log_set_callback(avlog_theoraplayer);
- ffmpegInitialised = 1;
- //show_codecs(0, 0, 0);
- }
-
- mInputBuffer = (unsigned char*) av_malloc(READ_BUFFER_SIZE);
- mAvioContext = avio_alloc_context(mInputBuffer, READ_BUFFER_SIZE, 0, source, &readFunction, NULL, &seekFunction);
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": avio context created");
-#endif
-
- mFormatContext = avformat_alloc_context();
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": avformat context created");
-#endif
- mFormatContext->pb = mAvioContext;
-
- int err;
- if ((err = avformat_open_input(&mFormatContext, "", NULL, NULL)) != 0)
- {
- th_writelog(mName + ": avformat input opening failed!");
- th_writelog(mName + ": error_code: " + str(err));
- return;
- }
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": avformat input opened");
-#endif
-
- // Retrieve stream information
- if (avformat_find_stream_info(mFormatContext, NULL) < 0)
- return; // Couldn't find stream information
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": got stream info");
-#endif
-
- // Dump information about file onto standard error
- // av_dump_format(mFormatContext, 0, "", 0);
-
- // Find the first video stream
- for (int i = 0; i < mFormatContext->nb_streams; ++i)
- {
- if(mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
- {
- mVideoStreamIndex = i;
- break;
- }
- }
- if (mVideoStreamIndex == -1)
- return; // Didn't find a video stream
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": Found video stream at index " + str(mVideoStreamIndex));
-#endif
-
- // Get a pointer to the codec context for the video stream
- mCodecContext = mFormatContext->streams[mVideoStreamIndex]->codec;
-
- // Find the decoder for the video stream
- mCodec = avcodec_find_decoder(mCodecContext->codec_id);
- if (mCodec == NULL)
- {
- th_writelog("Unsupported codec!");
- return; // Codec not found
- }
- // Open codec
- if(avcodec_open2(mCodecContext, mCodec, &optionsDict) < 0)
- return; // Could not open codec
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": Codec opened");
-#endif
-
-
- mFrame = avcodec_alloc_frame();
-
-#ifdef _FFMPEG_DEBUG
- th_writelog(mName + ": Frame allocated");
-#endif
-
- //AVRational rational = mCodecContext->time_base;
-
- mFPS = 25; //TODOOOOOO!!!
-
- mWidth = mStride = mCodecContext->width;
- mHeight = mCodecContext->height;
- mFrameDuration = 1.0f / mFPS;
- mDuration = mFormatContext->duration / AV_TIME_BASE;
-
- if (mFrameQueue == NULL) // todo - why is this set in the backend class? it should be set in the base class, check other backends as well
- {
- mFrameQueue = new TheoraFrameQueue(this);
- mFrameQueue->setSize(mNumPrecachedFrames);
- }
-}
-
-void TheoraVideoClip_FFmpeg::unload()
-{
- if (mInputBuffer)
- {
-// av_free(mInputBuffer);
- mInputBuffer = NULL;
- }
- if (mAvioContext)
- {
- av_free(mAvioContext);
- mAvioContext = NULL;
- }
- if (mFrame)
- {
- av_free(mFrame);
- mFrame = NULL;
- }
- if (mCodecContext)
- {
- avcodec_close(mCodecContext);
- mCodecContext = NULL;
- }
- if (mFormatContext)
- {
- avformat_close_input(&mFormatContext);
- mFormatContext = NULL;
- }
-}
-
-bool TheoraVideoClip_FFmpeg::_readData()
-{
- return 1;
-}
-
-bool TheoraVideoClip_FFmpeg::decodeNextFrame()
-{
- TheoraVideoFrame* frame = mFrameQueue->requestEmptyFrame();
- if (!frame) return 0;
-
- AVPacket packet;
- int frameFinished;
-
- while (av_read_frame(mFormatContext, &packet) >= 0)
- {
- if (packet.stream_index == mVideoStreamIndex)
- {
- avcodec_decode_video2(mCodecContext, mFrame, &frameFinished, &packet);
-
- if (frameFinished)
- {
- TheoraPixelTransform t;
- memset(&t, 0, sizeof(TheoraPixelTransform));
-
- t.y = mFrame->data[0]; t.yStride = mFrame->linesize[0];
- t.u = mFrame->data[1]; t.uStride = mFrame->linesize[1];
- t.v = mFrame->data[2]; t.vStride = mFrame->linesize[2];
-
- frame->decode(&t);
- frame->mTimeToDisplay = mFrameNumber / mFPS;
- frame->mIteration = mIteration;
- frame->_setFrameNumber(mFrameNumber++);
-
- av_free_packet(&packet);
- break;
- }
- }
- av_free_packet(&packet);
- }
- return 1;
-}
-
-void TheoraVideoClip_FFmpeg::decodedAudioCheck()
-{
- if (!mAudioInterface || mTimer->isPaused()) return;
-
- mAudioMutex->lock();
- flushAudioPackets(mAudioInterface);
- mAudioMutex->unlock();
-}
-
-float TheoraVideoClip_FFmpeg::decodeAudio()
-{
- return -1;
-}
-
-void TheoraVideoClip_FFmpeg::doSeek()
-{
-
-}
-
-void TheoraVideoClip_FFmpeg::_restart()
-{
-
-}
-
-#endif
diff --git a/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.h b/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.h
deleted file mode 100644
index 03f9a3d96..000000000
--- a/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#if defined(__FFMPEG) && !defined(_TheoraVideoClip_FFmpeg_h)
-#define _TheoraVideoClip_FFmpeg_h
-
-#include "TheoraAudioPacketQueue.h"
-#include "TheoraVideoClip.h"
-
-struct AVFormatContext;
-struct AVCodecContext;
-struct AVCodec;
-struct AVFrame;
-struct AVIOContext;
-
-class TheoraVideoClip_FFmpeg : public TheoraVideoClip, public TheoraAudioPacketQueue
-{
-protected:
- bool mLoaded;
-
- AVFormatContext* mFormatContext;
- AVCodecContext* mCodecContext;
- AVIOContext* mAvioContext;
- AVCodec* mCodec;
- AVFrame* mFrame;
- unsigned char* mInputBuffer;
- int mVideoStreamIndex;
- int mFrameNumber;
-
- void unload();
- void doSeek();
-public:
- TheoraVideoClip_FFmpeg(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride);
- ~TheoraVideoClip_FFmpeg();
-
- bool _readData();
- bool decodeNextFrame();
- void _restart();
- void load(TheoraDataSource* source);
- float decodeAudio();
- void decodedAudioCheck();
- std::string getDecoderName() { return "FFmpeg"; }
-};
-
-#endif
diff --git a/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.cpp b/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.cpp
deleted file mode 100644
index c4f070ec5..000000000
--- a/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.cpp
+++ /dev/null
@@ -1,703 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#ifdef __THEORA
-#include
-#include
-#include "TheoraVideoManager.h"
-#include "TheoraFrameQueue.h"
-#include "TheoraVideoFrame.h"
-#include "TheoraAudioInterface.h"
-#include "TheoraTimer.h"
-#include "TheoraDataSource.h"
-#include "TheoraUtil.h"
-#include "TheoraException.h"
-#include "TheoraVideoClip_Theora.h"
-#include "TheoraPixelTransform.h"
-
-TheoraVideoClip_Theora::TheoraVideoClip_Theora(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride):
- TheoraVideoClip(data_source, output_mode, nPrecachedFrames, usePower2Stride),
- TheoraAudioPacketQueue()
-{
- mInfo.TheoraDecoder = NULL;
- mInfo.TheoraSetup = NULL;
- mVorbisStreams = mTheoraStreams = 0;
- mReadAudioSamples = 0;
- mLastDecodedFrameNumber = 0;
-}
-
-TheoraVideoClip_Theora::~TheoraVideoClip_Theora()
-{
- if (mInfo.TheoraDecoder)
- {
- th_decode_free(mInfo.TheoraDecoder);
- th_setup_free(mInfo.TheoraSetup);
-
- if (mAudioInterface)
- {
- vorbis_dsp_clear(&mInfo.VorbisDSPState);
- vorbis_block_clear(&mInfo.VorbisBlock);
- }
-
- ogg_stream_clear(&mInfo.TheoraStreamState);
- th_comment_clear(&mInfo.TheoraComment);
- th_info_clear(&mInfo.TheoraInfo);
-
- ogg_stream_clear(&mInfo.VorbisStreamState);
- vorbis_comment_clear(&mInfo.VorbisComment);
- vorbis_info_clear(&mInfo.VorbisInfo);
-
- ogg_sync_clear(&mInfo.OggSyncState);
- }
-}
-
-bool TheoraVideoClip_Theora::_readData()
-{
- int audio_eos = 0, serno;
- float audio_time = 0;
- float time = mTimer->getTime();
- if (mRestarted) time = 0;
-
- for (;;)
- {
- char *buffer = ogg_sync_buffer(&mInfo.OggSyncState, 4096);
- int bytes_read = mStream->read(buffer, 4096);
- ogg_sync_wrote(&mInfo.OggSyncState, bytes_read);
-
- if (bytes_read < 4096)
- {
- if (bytes_read == 0)
- {
- if (!mAutoRestart) mEndOfFile = true;
- return 0;
- }
- }
- // when we fill the stream with enough pages, it'll start spitting out packets
- // which contain keyframes, delta frames or audio data
- while (ogg_sync_pageout(&mInfo.OggSyncState, &mInfo.OggPage) > 0)
- {
- serno = ogg_page_serialno(&mInfo.OggPage);
- if (serno == mInfo.TheoraStreamState.serialno) ogg_stream_pagein(&mInfo.TheoraStreamState, &mInfo.OggPage);
- if (mAudioInterface && serno == mInfo.VorbisStreamState.serialno)
- {
- ogg_int64_t g = ogg_page_granulepos(&mInfo.OggPage);
- audio_time = (float) vorbis_granule_time(&mInfo.VorbisDSPState, g);
- audio_eos = ogg_page_eos(&mInfo.OggPage);
- ogg_stream_pagein(&mInfo.VorbisStreamState, &mInfo.OggPage);
- }
- }
- if (!(mAudioInterface && !audio_eos && audio_time < time + 1.0f))
- break;
- }
- return 1;
-}
-
-bool TheoraVideoClip_Theora::decodeNextFrame()
-{
- if (mEndOfFile) return 0;
-
- TheoraVideoFrame* frame = mFrameQueue->requestEmptyFrame();
- if (!frame) return 0; // max number of precached frames reached
- bool should_restart = 0;
- ogg_packet opTheora;
- ogg_int64_t granulePos;
- th_ycbcr_buffer buff;
- int ret, nAttempts;
- for (;;)
- {
- // ogg_stream_packetout can return -1 and the official docs suggest to do subsequent calls until it succeeds
- // because the data is out of sync. still will limit the number of attempts just in case
- for (ret = -1, nAttempts = 0; ret < 0 && nAttempts < 100; nAttempts++)
- {
- ret = ogg_stream_packetout(&mInfo.TheoraStreamState, &opTheora);
- }
-
- if (ret > 0)
- {
- int status = th_decode_packetin(mInfo.TheoraDecoder, &opTheora, &granulePos);
- if (status != 0 && status != TH_DUPFRAME) continue; // 0 means success
-
- float time = (float) th_granule_time(mInfo.TheoraDecoder, granulePos);
- unsigned long frame_number = (unsigned long) th_granule_frame(mInfo.TheoraDecoder, granulePos);
-
- if (time < mTimer->getTime() && !mRestarted && frame_number % 16 != 0)
- {
- // %16 operation is here to prevent a playback halt during video playback if the decoder can't keep up with demand.
-#ifdef _DEBUG
- th_writelog(mName + ": pre-dropped frame " + str((int) frame_number));
-#endif
- ++mNumDroppedFrames;
- continue; // drop frame
- }
- frame->mTimeToDisplay = time - mFrameDuration;
- frame->mIteration = mIteration;
- frame->_setFrameNumber(frame_number);
- mLastDecodedFrameNumber = frame_number;
- th_decode_ycbcr_out(mInfo.TheoraDecoder, buff);
- TheoraPixelTransform t;
- memset(&t, 0, sizeof(TheoraPixelTransform));
-
- t.y = buff[0].data; t.yStride = buff[0].stride;
- t.u = buff[1].data; t.uStride = buff[1].stride;
- t.v = buff[2].data; t.vStride = buff[2].stride;
- frame->decode(&t);
- break;
- }
- else
- {
- if (!_readData())
- {
- frame->mInUse = 0;
- should_restart = mAutoRestart;
- break;
- }
- }
- }
-
- if (mAudioInterface != NULL)
- {
- mAudioMutex->lock();
- decodeAudio();
- mAudioMutex->unlock();
- }
- if (should_restart)
- {
- ++mIteration;
- _restart();
- }
- return 1;
-}
-
-void TheoraVideoClip_Theora::_restart()
-{
- bool paused = mTimer->isPaused();
- if (!paused) mTimer->pause();
- long granule=0;
- th_decode_ctl(mInfo.TheoraDecoder,TH_DECCTL_SET_GRANPOS,&granule,sizeof(granule));
- th_decode_free(mInfo.TheoraDecoder);
- mInfo.TheoraDecoder=th_decode_alloc(&mInfo.TheoraInfo,mInfo.TheoraSetup);
- ogg_stream_reset(&mInfo.TheoraStreamState);
- if (mAudioInterface)
- {
- // empty the DSP buffer
- //float **pcm;
- //int len = vorbis_synthesis_pcmout(&mInfo.VorbisDSPState,&pcm);
- //if (len) vorbis_synthesis_read(&mInfo.VorbisDSPState,len);
- ogg_packet opVorbis;
- mReadAudioSamples = 0;
- while (ogg_stream_packetout(&mInfo.VorbisStreamState,&opVorbis) > 0)
- {
- if (vorbis_synthesis(&mInfo.VorbisBlock,&opVorbis) == 0)
- vorbis_synthesis_blockin(&mInfo.VorbisDSPState,&mInfo.VorbisBlock);
- }
- ogg_stream_reset(&mInfo.VorbisStreamState);
- }
-
- ogg_sync_reset(&mInfo.OggSyncState);
- mStream->seek(0);
- ogg_int64_t granulePos = 0;
- th_decode_ctl(mInfo.TheoraDecoder, TH_DECCTL_SET_GRANPOS, &granulePos, sizeof(granule));
-
- mEndOfFile = false;
-
- mRestarted = 1;
-
- if (!paused) mTimer->play();
-}
-
-void TheoraVideoClip_Theora::load(TheoraDataSource* source)
-{
-#ifdef _DEBUG
- th_writelog("-----");
-#endif
- mStream = source;
- readTheoraVorbisHeaders();
-
- mInfo.TheoraDecoder = th_decode_alloc(&mInfo.TheoraInfo,mInfo.TheoraSetup);
-
- mWidth = mInfo.TheoraInfo.frame_width;
- mHeight = mInfo.TheoraInfo.frame_height;
- mSubFrameWidth = mInfo.TheoraInfo.pic_width;
- mSubFrameHeight = mInfo.TheoraInfo.pic_height;
- mSubFrameOffsetX = mInfo.TheoraInfo.pic_x;
- mSubFrameOffsetY = mInfo.TheoraInfo.pic_y;
- mStride = (mStride == 1) ? mStride = _nextPow2(getWidth()) : getWidth();
- mFPS = mInfo.TheoraInfo.fps_numerator / (float) mInfo.TheoraInfo.fps_denominator;
-
-#ifdef _DEBUG
- th_writelog("width: " + str(mWidth) + ", height: " + str(mHeight) + ", fps: " + str((int) getFPS()));
-#endif
- mFrameQueue = new TheoraFrameQueue(this);
- mFrameQueue->setSize(mNumPrecachedFrames);
- // find out the duration of the file by seeking to the end
- // having ogg decode pages, extract the granule pos from
- // the last theora page and seek back to beginning of the file
- long streamSize = mStream->size(), seekPos;
- for (int i = 1; i <= 50; ++i)
- {
- ogg_sync_reset(&mInfo.OggSyncState);
- seekPos = streamSize - 4096 * i;
- if (seekPos < 0) seekPos = 0;
- mStream->seek(seekPos);
-
- char *buffer = ogg_sync_buffer(&mInfo.OggSyncState, 4096 * i);
- int bytes_read = mStream->read(buffer, 4096 * i);
- ogg_sync_wrote(&mInfo.OggSyncState, bytes_read);
- ogg_sync_pageseek(&mInfo.OggSyncState, &mInfo.OggPage);
-
- for (;;)
- {
- int ret = ogg_sync_pageout(&mInfo.OggSyncState, &mInfo.OggPage);
- if (ret == 0) break;
- // if page is not a theora page, skip it
- if (ogg_page_serialno(&mInfo.OggPage) != mInfo.TheoraStreamState.serialno) continue;
-
- ogg_int64_t granule = ogg_page_granulepos(&mInfo.OggPage);
- if (granule >= 0)
- {
- mNumFrames = (int) th_granule_frame(mInfo.TheoraDecoder, granule) + 1;
- }
- else if (mNumFrames > 0)
- ++mNumFrames; // append delta frames at the end to get the exact numbe
- }
- if (mNumFrames > 0 || streamSize - 4096 * i < 0) break;
-
- }
- if (mNumFrames < 0)
- th_writelog("unable to determine file duration!");
- else
- {
- mDuration = mNumFrames / mFPS;
-#ifdef _DEBUG
- th_writelog("duration: " + strf(mDuration) + " seconds");
-#endif
- }
- // restore to beginning of stream.
- ogg_sync_reset(&mInfo.OggSyncState);
- mStream->seek(0);
-
- if (mVorbisStreams) // if there is no audio interface factory defined, even though the video
- // clip might have audio, it will be ignored
- {
- vorbis_synthesis_init(&mInfo.VorbisDSPState, &mInfo.VorbisInfo);
- vorbis_block_init(&mInfo.VorbisDSPState, &mInfo.VorbisBlock);
- mNumAudioChannels = mInfo.VorbisInfo.channels;
- mAudioFrequency = (int) mInfo.VorbisInfo.rate;
-
- // create an audio interface instance if available
- TheoraAudioInterfaceFactory* audio_factory = TheoraVideoManager::getSingleton().getAudioInterfaceFactory();
- printf("**** audio factory is %p\n", audio_factory);
- if (audio_factory) setAudioInterface(audio_factory->createInstance(this, mNumAudioChannels, mAudioFrequency));
- }
-
- mFrameDuration = 1.0f / getFPS();
-#ifdef _DEBUG
- th_writelog("-----");
-#endif
-}
-
-void TheoraVideoClip_Theora::readTheoraVorbisHeaders()
-{
- ogg_packet tempOggPacket;
- bool done = false;
- bool decode_audio=TheoraVideoManager::getSingleton().getAudioInterfaceFactory() != NULL;
- //init Vorbis/Theora Layer
- //Ensure all structures get cleared out.
- memset(&mInfo.OggSyncState, 0, sizeof(ogg_sync_state));
- memset(&mInfo.OggPage, 0, sizeof(ogg_page));
- memset(&mInfo.VorbisStreamState, 0, sizeof(ogg_stream_state));
- memset(&mInfo.TheoraStreamState, 0, sizeof(ogg_stream_state));
- memset(&mInfo.TheoraInfo, 0, sizeof(th_info));
- memset(&mInfo.TheoraComment, 0, sizeof(th_comment));
- memset(&mInfo.VorbisInfo, 0, sizeof(vorbis_info));
- memset(&mInfo.VorbisDSPState, 0, sizeof(vorbis_dsp_state));
- memset(&mInfo.VorbisBlock, 0, sizeof(vorbis_block));
- memset(&mInfo.VorbisComment, 0, sizeof(vorbis_comment));
-
- ogg_sync_init(&mInfo.OggSyncState);
- th_comment_init(&mInfo.TheoraComment);
- th_info_init(&mInfo.TheoraInfo);
- vorbis_info_init(&mInfo.VorbisInfo);
- vorbis_comment_init(&mInfo.VorbisComment);
-
- while (!done)
- {
- char *buffer = ogg_sync_buffer(&mInfo.OggSyncState, 4096);
- int bytes_read = mStream->read(buffer, 4096);
- ogg_sync_wrote(&mInfo.OggSyncState, bytes_read);
-
- if (bytes_read == 0)
- break;
-
- while (ogg_sync_pageout(&mInfo.OggSyncState, &mInfo.OggPage) > 0)
- {
- ogg_stream_state OggStateTest;
-
- //is this an initial header? If not, stop
- if (!ogg_page_bos(&mInfo.OggPage))
- {
- //This is done blindly, because stream only accept themselves
- if (mTheoraStreams) ogg_stream_pagein(&mInfo.TheoraStreamState, &mInfo.OggPage);
- if (mVorbisStreams) ogg_stream_pagein(&mInfo.VorbisStreamState, &mInfo.OggPage);
-
- done=true;
- break;
- }
-
- ogg_stream_init(&OggStateTest, ogg_page_serialno(&mInfo.OggPage));
- ogg_stream_pagein(&OggStateTest, &mInfo.OggPage);
- ogg_stream_packetout(&OggStateTest, &tempOggPacket);
-
- //identify the codec
- int ret;
- if (!mTheoraStreams)
- {
- ret = th_decode_headerin(&mInfo.TheoraInfo, &mInfo.TheoraComment, &mInfo.TheoraSetup, &tempOggPacket);
-
- if (ret > 0)
- {
- //This is the Theora Header
- memcpy(&mInfo.TheoraStreamState, &OggStateTest, sizeof(OggStateTest));
- mTheoraStreams = 1;
- continue;
- }
- }
- if (decode_audio && !mVorbisStreams &&
- vorbis_synthesis_headerin(&mInfo.VorbisInfo, &mInfo.VorbisComment, &tempOggPacket) >=0)
- {
- //This is vorbis header
- memcpy(&mInfo.VorbisStreamState, &OggStateTest, sizeof(OggStateTest));
- mVorbisStreams = 1;
- continue;
- }
- //Hmm. I guess it's not a header we support, so erase it
- ogg_stream_clear(&OggStateTest);
- }
- }
-
- while ((mTheoraStreams && (mTheoraStreams < 3)) ||
- (mVorbisStreams && (mVorbisStreams < 3)))
- {
- //Check 2nd'dary headers... Theora First
- int iSuccess;
- while (mTheoraStreams && mTheoraStreams < 3 &&
- (iSuccess = ogg_stream_packetout(&mInfo.TheoraStreamState, &tempOggPacket)))
- {
- if (iSuccess < 0)
- throw TheoraGenericException("Error parsing Theora stream headers.");
- if (!th_decode_headerin(&mInfo.TheoraInfo, &mInfo.TheoraComment, &mInfo.TheoraSetup, &tempOggPacket))
- throw TheoraGenericException("invalid theora stream");
-
- ++mTheoraStreams;
- } //end while looking for more theora headers
-
- //look 2nd vorbis header packets
- while (mVorbisStreams < 3 && (iSuccess = ogg_stream_packetout(&mInfo.VorbisStreamState, &tempOggPacket)))
- {
- if (iSuccess < 0)
- throw TheoraGenericException("Error parsing vorbis stream headers");
-
- if (vorbis_synthesis_headerin(&mInfo.VorbisInfo, &mInfo.VorbisComment,&tempOggPacket))
- throw TheoraGenericException("invalid stream");
-
- ++mVorbisStreams;
- } //end while looking for more vorbis headers
-
- //Not finished with Headers, get some more file data
- if (ogg_sync_pageout(&mInfo.OggSyncState, &mInfo.OggPage) > 0)
- {
- if (mTheoraStreams) ogg_stream_pagein(&mInfo.TheoraStreamState, &mInfo.OggPage);
- if (mVorbisStreams) ogg_stream_pagein(&mInfo.VorbisStreamState, &mInfo.OggPage);
- }
- else
- {
- char *buffer = ogg_sync_buffer(&mInfo.OggSyncState, 4096);
- int bytes_read = mStream->read(buffer, 4096);
- ogg_sync_wrote(&mInfo.OggSyncState, bytes_read);
-
- if (bytes_read == 0)
- throw TheoraGenericException("End of file found prematurely");
- }
- } //end while looking for all headers
- // writelog("Vorbis Headers: " + str(mVorbisHeaders) + " Theora Headers : " + str(mTheoraHeaders));
-}
-
-void TheoraVideoClip_Theora::decodedAudioCheck()
-{
- if (!mAudioInterface || mTimer->isPaused()) return;
-
- mAudioMutex->lock();
- flushAudioPackets(mAudioInterface);
- mAudioMutex->unlock();
-}
-
-float TheoraVideoClip_Theora::decodeAudio()
-{
- if (mRestarted) return -1;
-
- ogg_packet opVorbis;
- float **pcm;
- int len = 0;
- float timestamp = -1;
- bool read_past_timestamp = 0;
-
- float factor = 1.0f / mAudioFrequency;
- float videoTime = (float) mLastDecodedFrameNumber / mFPS;
- float min = mFrameQueue->getSize() / mFPS + 1.0f;
-
- for (;;)
- {
- len = vorbis_synthesis_pcmout(&mInfo.VorbisDSPState, &pcm);
- if (len == 0)
- {
- if (ogg_stream_packetout(&mInfo.VorbisStreamState, &opVorbis) > 0)
- {
- if (vorbis_synthesis(&mInfo.VorbisBlock, &opVorbis) == 0)
- {
- if (timestamp < 0 && opVorbis.granulepos >= 0)
- {
- timestamp = (float) vorbis_granule_time(&mInfo.VorbisDSPState, opVorbis.granulepos);
- }
- else if (timestamp >= 0) read_past_timestamp = 1;
- vorbis_synthesis_blockin(&mInfo.VorbisDSPState, &mInfo.VorbisBlock);
- }
- continue;
- }
- else
- {
- float audioTime = mReadAudioSamples * factor;
- // always buffer up of audio ahead of the frames
- if (audioTime - videoTime < min)
- {
- if (!_readData()) break;
- }
- else
- break;
- }
- }
- addAudioPacket(pcm, len, mAudioGain);
- mReadAudioSamples += len;
- if (read_past_timestamp) timestamp += (float) len / mInfo.VorbisInfo.rate;
- vorbis_synthesis_read(&mInfo.VorbisDSPState, len); // tell vorbis we read a number of samples
- }
- return timestamp;
-}
-
-long TheoraVideoClip_Theora::seekPage(long targetFrame, bool return_keyframe)
-{
- int i,seek_min = 0, seek_max = (int) mStream->size();
- long frame;
- ogg_int64_t granule = 0;
-
- if (targetFrame == 0) mStream->seek(0);
- for (i = (targetFrame == 0) ? 100 : 0; i < 100; ++i)
- {
- ogg_sync_reset(&mInfo.OggSyncState);
- mStream->seek((seek_min + seek_max) / 2); // do a binary search
- memset(&mInfo.OggPage, 0, sizeof(ogg_page));
- ogg_sync_pageseek(&mInfo.OggSyncState, &mInfo.OggPage);
-
- for (;i < 1000;)
- {
- int ret = ogg_sync_pageout(&mInfo.OggSyncState, &mInfo.OggPage);
- if (ret == 1)
- {
- int serno = ogg_page_serialno(&mInfo.OggPage);
- if (serno == mInfo.TheoraStreamState.serialno)
- {
- granule = ogg_page_granulepos(&mInfo.OggPage);
- if (granule >= 0)
- {
- frame = (long) th_granule_frame(mInfo.TheoraDecoder, granule);
- if (frame < targetFrame && targetFrame - frame < 10)
- {
- // we're close enough, let's break this.
- i = 1000;
- break;
- }
- // we're not close enough, let's shorten the borders of the binary search
- if (targetFrame - 1 > frame) seek_min = (seek_min + seek_max) / 2;
- else seek_max = (seek_min + seek_max) / 2;
- break;
- }
- }
- }
- else
- {
- char *buffer = ogg_sync_buffer(&mInfo.OggSyncState, 4096);
- int bytes_read = mStream->read(buffer, 4096);
- if (bytes_read == 0) break;
- ogg_sync_wrote(&mInfo.OggSyncState, bytes_read);
- }
- }
- }
- if (return_keyframe) return (long) (granule >> mInfo.TheoraInfo.keyframe_granule_shift);
-
- ogg_sync_reset(&mInfo.OggSyncState);
- memset(&mInfo.OggPage, 0, sizeof(ogg_page));
- ogg_sync_pageseek(&mInfo.OggSyncState, &mInfo.OggPage);
- if (targetFrame == 0) return -1;
- mStream->seek((seek_min + seek_max) / 2); // do a binary search
- return -1;
-}
-
-void TheoraVideoClip_Theora::doSeek()
-{
-#if _DEBUG
- th_writelog(mName + " [seek]: seeking to frame " + str(mSeekFrame));
-#endif
- int frame;
- float time = mSeekFrame / getFPS();
- mTimer->seek(time);
- bool paused = mTimer->isPaused();
- if (!paused) mTimer->pause(); // pause until seeking is done
-
- mEndOfFile = false;
- mRestarted = false;
-
- resetFrameQueue();
- // reset the video decoder.
- ogg_stream_reset(&mInfo.TheoraStreamState);
- th_decode_free(mInfo.TheoraDecoder);
- mInfo.TheoraDecoder = th_decode_alloc(&mInfo.TheoraInfo, mInfo.TheoraSetup);
-
- if (mAudioInterface)
- {
- mAudioMutex->lock();
- ogg_stream_reset(&mInfo.VorbisStreamState);
- vorbis_synthesis_restart(&mInfo.VorbisDSPState);
- destroyAllAudioPackets();
- }
- // first seek to desired frame, then figure out the location of the
- // previous keyframe and seek to it.
- // then by setting the correct time, the decoder will skip N frames untill
- // we get the frame we want.
- frame = (int) seekPage(mSeekFrame, 1); // find the keyframe nearest to the target frame
-#ifdef _DEBUG
- // th_writelog(mName + " [seek]: nearest keyframe for frame " + str(mSeekFrame) + " is frame: " + str(frame));
-#endif
- seekPage(std::max(0, frame - 1), 0);
-
- ogg_packet opTheora;
- ogg_int64_t granulePos;
- bool granule_set = 0;
- if (frame <= 1)
- {
- if (mInfo.TheoraInfo.version_major == 3 && mInfo.TheoraInfo.version_minor == 2 && mInfo.TheoraInfo.version_subminor == 0)
- granulePos = 0;
- else
- granulePos = 1; // because of difference in granule interpretation in theora streams 3.2.0 and newer ones
- th_decode_ctl(mInfo.TheoraDecoder, TH_DECCTL_SET_GRANPOS, &granulePos, sizeof(granulePos));
- granule_set = 1;
- }
-
- // now that we've found the keyframe that preceeds our desired frame, lets keep on decoding frames until we
- // reach our target frame.
-
- int status, ret;
- for (;mSeekFrame != 0;)
- {
- ret = ogg_stream_packetout(&mInfo.TheoraStreamState, &opTheora);
- if (ret > 0)
- {
- if (!granule_set)
- {
- // theora decoder requires to set the granule pos after seek to be able to determine the current frame
- if (opTheora.granulepos >= 0)
- {
- th_decode_ctl(mInfo.TheoraDecoder, TH_DECCTL_SET_GRANPOS, &opTheora.granulepos, sizeof(opTheora.granulepos));
- granule_set = 1;
- }
- else continue; // ignore prev delta frames until we hit a keyframe
- }
- status = th_decode_packetin(mInfo.TheoraDecoder, &opTheora, &granulePos);
- if (status != 0 && status != TH_DUPFRAME) continue;
- frame = (int) th_granule_frame(mInfo.TheoraDecoder, granulePos);
- if (frame >= mSeekFrame - 1) break;
- }
- else
- {
- if (!_readData())
- {
- th_writelog(mName + " [seek]: fineseeking failed, _readData failed!");
- if (mAudioInterface) mAudioMutex->unlock();
- return;
- }
- }
- }
-#ifdef _DEBUG
- // th_writelog(mName + " [seek]: fineseeked to frame " + str(frame + 1) + ", requested: " + str(mSeekFrame));
-#endif
- if (mAudioInterface)
- {
- // read audio data until we reach a timestamp. this usually takes only one iteration, but just in case let's
- // wrap it in a loop
- float timestamp;
- for (;;)
- {
- timestamp = decodeAudio();
- if (timestamp >= 0) break;
- else _readData();
- }
- float rate = (float) mAudioFrequency * mNumAudioChannels;
- float queued_time = getAudioPacketQueueLength();
- // at this point there are only 2 possibilities: either we have too much packets and we have to delete
- // the first N ones, or we don't have enough, so let's fill the gap with silence.
- if (time > timestamp - queued_time)
- {
- while (mTheoraAudioPacketQueue != NULL)
- {
- if (time > timestamp - queued_time + mTheoraAudioPacketQueue->numSamples / rate)
- {
- queued_time -= mTheoraAudioPacketQueue->numSamples / rate;
- destroyAudioPacket(popAudioPacket());
- }
- else
- {
- int n_trim = (int) ((timestamp - queued_time + mTheoraAudioPacketQueue->numSamples / rate - time) * rate);
- if (mTheoraAudioPacketQueue->numSamples - n_trim <= 0)
- destroyAudioPacket(popAudioPacket()); // if there's no data to be left, just destroy it
- else
- {
- for (int i = n_trim, j = 0; i < mTheoraAudioPacketQueue->numSamples; ++i, ++j)
- mTheoraAudioPacketQueue->pcm[j] = mTheoraAudioPacketQueue->pcm[i];
- mTheoraAudioPacketQueue->numSamples -= n_trim;
- }
- break;
- }
- }
- }
- else
- {
- // expand the first packet with silence.
- if (mTheoraAudioPacketQueue) // just in case!
- {
- int i, j, nmissing = (int) ((timestamp - queued_time - time) * rate);
- if (nmissing > 0)
- {
- float* samples = new float[nmissing + mTheoraAudioPacketQueue->numSamples];
- for (i = 0; i < nmissing; ++i) samples[i] = 0;
- for (j = 0; i < nmissing + mTheoraAudioPacketQueue->numSamples; ++i, ++j)
- samples[i] = mTheoraAudioPacketQueue->pcm[j];
- delete [] mTheoraAudioPacketQueue->pcm;
- mTheoraAudioPacketQueue->pcm = samples;
- }
- }
- }
- mLastDecodedFrameNumber = mSeekFrame;
- mReadAudioSamples = (unsigned int) (timestamp * mAudioFrequency);
-
- mAudioMutex->unlock();
- }
- if (!paused) mTimer->play();
- mSeekFrame = -1;
-}
-#endif
diff --git a/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.h b/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.h
deleted file mode 100644
index c64c18302..000000000
--- a/drivers/theoraplayer/src/Theora/TheoraVideoClip_Theora.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#if defined(__THEORA) && !defined(_TheoraVideoClip_Theora_h)
-#define _TheoraVideoClip_Theora_h
-
-#include
-#include
-#include
-#include "TheoraAudioPacketQueue.h"
-#include "TheoraVideoClip.h"
-
-struct TheoraInfoStruct
-{
- // ogg/vorbis/theora variables
- ogg_sync_state OggSyncState;
- ogg_page OggPage;
- ogg_stream_state VorbisStreamState;
- ogg_stream_state TheoraStreamState;
- //Theora State
- th_info TheoraInfo;
- th_comment TheoraComment;
- th_setup_info* TheoraSetup;
- th_dec_ctx* TheoraDecoder;
- //Vorbis State
- vorbis_info VorbisInfo;
- vorbis_dsp_state VorbisDSPState;
- vorbis_block VorbisBlock;
- vorbis_comment VorbisComment;
-};
-
-class TheoraVideoClip_Theora : public TheoraVideoClip, public TheoraAudioPacketQueue
-{
-protected:
- TheoraInfoStruct mInfo; // a pointer is used to avoid having to include theora & vorbis headers
- int mTheoraStreams, mVorbisStreams; // Keeps track of Theora and Vorbis Streams
-
- long seekPage(long targetFrame, bool return_keyframe);
- void doSeek();
- void readTheoraVorbisHeaders();
- unsigned int mReadAudioSamples;
- unsigned long mLastDecodedFrameNumber;
-public:
- TheoraVideoClip_Theora(TheoraDataSource* data_source,
- TheoraOutputMode output_mode,
- int nPrecachedFrames,
- bool usePower2Stride);
- ~TheoraVideoClip_Theora();
-
- bool _readData();
- bool decodeNextFrame();
- void _restart();
- void load(TheoraDataSource* source);
- float decodeAudio();
- void decodedAudioCheck();
- std::string getDecoderName() { return "Theora"; }
-};
-
-#endif
diff --git a/drivers/theoraplayer/src/TheoraAsync.cpp b/drivers/theoraplayer/src/TheoraAsync.cpp
deleted file mode 100644
index cc3b7a4bf..000000000
--- a/drivers/theoraplayer/src/TheoraAsync.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-
-#include
-#include
-
-#ifdef _WIN32
-#include
-#else
-#include
-#include
-#endif
-
-#include "TheoraAsync.h"
-#include "TheoraUtil.h"
-
-#ifdef _WINRT
-#include
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Mutex
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-TheoraMutex::TheoraMutex()
-{
-#ifdef _WIN32
-#ifndef _WINRT // WinXP does not have CreateTheoraMutexEx()
- mHandle = CreateMutex(0, 0, 0);
-#else
- mHandle = CreateMutexEx(NULL, NULL, 0, SYNCHRONIZE);
-#endif
-#else
- mHandle = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init((pthread_mutex_t*)mHandle, 0);
-#endif
-}
-
-TheoraMutex::~TheoraMutex()
-{
-#ifdef _WIN32
- CloseHandle(mHandle);
-#else
- pthread_mutex_destroy((pthread_mutex_t*)mHandle);
- free((pthread_mutex_t*)mHandle);
- mHandle = NULL;
-#endif
-}
-
-void TheoraMutex::lock()
-{
-#ifdef _WIN32
- WaitForSingleObjectEx(mHandle, INFINITE, FALSE);
-#else
- pthread_mutex_lock((pthread_mutex_t*)mHandle);
-#endif
-}
-
-void TheoraMutex::unlock()
-{
-#ifdef _WIN32
- ReleaseMutex(mHandle);
-#else
- pthread_mutex_unlock((pthread_mutex_t*)mHandle);
-#endif
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Thread
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef _WINRT
-using namespace Windows::Foundation;
-using namespace Windows::System::Threading;
-#endif
-
-#ifdef _WIN32
-unsigned long WINAPI theoraAsyncCall(void* param)
-#else
-void* theoraAsyncCall(void* param)
-#endif
-{
- TheoraThread* t = (TheoraThread*)param;
- t->execute();
-#ifdef _WIN32
- return 0;
-#else
- pthread_exit(NULL);
- return NULL;
-#endif
-}
-
-#ifdef _WINRT
-struct TheoraAsyncActionWrapper
-{
-public:
- IAsyncAction^ mAsyncAction;
- TheoraAsyncActionWrapper(IAsyncAction^ asyncAction)
- {
- mAsyncAction = asyncAction;
- }
-};
-#endif
-
-TheoraThread::TheoraThread() : mRunning(false), mId(0)
-{
-#ifndef _WIN32
- mId = (pthread_t*)malloc(sizeof(pthread_t));
-#endif
-}
-
-TheoraThread::~TheoraThread()
-{
- if (mRunning)
- {
- stop();
- }
- if (mId != NULL)
- {
-#ifdef _WIN32
-#ifndef _WINRT
- CloseHandle(mId);
-#else
- delete mId;
-#endif
-#else
- free((pthread_t*)mId);
-#endif
- mId = NULL;
- }
-}
-
-void TheoraThread::start()
-{
- mRunning = true;
-#ifdef _WIN32
-#ifndef _WINRT
- mId = CreateThread(0, 0, &theoraAsyncCall, this, 0, 0);
-#else
- mId = new TheoraAsyncActionWrapper(ThreadPool::RunAsync(
- ref new WorkItemHandler([&](IAsyncAction^ work_item)
- {
- execute();
- }),
- WorkItemPriority::Normal, WorkItemOptions::TimeSliced));
-#endif
-#else
- pthread_create((pthread_t*)mId, NULL, &theoraAsyncCall, this);
-#endif
-}
-
-bool TheoraThread::isRunning()
-{
- bool ret;
- mRunningMutex.lock();
- ret = mRunning;
- mRunningMutex.unlock();
-
- return ret;
-}
-
-void TheoraThread::join()
-{
- mRunningMutex.lock();
- mRunning = false;
- mRunningMutex.unlock();
-#ifdef _WIN32
-#ifndef _WINRT
- WaitForSingleObject(mId, INFINITE);
- if (mId != NULL)
- {
- CloseHandle(mId);
- mId = NULL;
- }
-#else
- IAsyncAction^ action = ((TheoraAsyncActionWrapper*)mId)->mAsyncAction;
- int i = 0;
- while (action->Status != AsyncStatus::Completed &&
- action->Status != AsyncStatus::Canceled &&
- action->Status != AsyncStatus::Error &&
- i < 100)
- {
- _psleep(50);
- ++i;
- }
- if (i >= 100)
- {
- i = 0;
- action->Cancel();
- while (action->Status != AsyncStatus::Completed &&
- action->Status != AsyncStatus::Canceled &&
- action->Status != AsyncStatus::Error &&
- i < 100)
- {
- _psleep(50);
- ++i;
- }
- }
-#endif
-#else
- pthread_join(*((pthread_t*)mId), 0);
-#endif
-}
-
-void TheoraThread::resume()
-{
-#ifdef _WIN32
-#ifndef _WINRT
- ResumeThread(mId);
-#else
- // not available in WinRT
-#endif
-#endif
-}
-
-void TheoraThread::pause()
-{
-#ifdef _WIN32
-#ifndef _WINRT
- SuspendThread(mId);
-#else
- // not available in WinRT
-#endif
-#endif
-}
-
-void TheoraThread::stop()
-{
- if (mRunning)
- {
- mRunningMutex.lock();
- mRunning = false;
- mRunningMutex.unlock();
-#ifdef _WIN32
-#ifndef _WINRT
- TerminateThread(mId, 0);
-#else
- ((TheoraAsyncActionWrapper*)mId)->mAsyncAction->Cancel();
-#endif
-#elif defined(_ANDROID)
- pthread_kill(*((pthread_t*)mId), 0);
-#else
- pthread_cancel(*((pthread_t*)mId));
-#endif
- }
-}
-
diff --git a/drivers/theoraplayer/src/TheoraAudioInterface.cpp b/drivers/theoraplayer/src/TheoraAudioInterface.cpp
deleted file mode 100644
index a265cb57b..000000000
--- a/drivers/theoraplayer/src/TheoraAudioInterface.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include "TheoraAudioInterface.h"
-
-TheoraAudioInterface::TheoraAudioInterface(TheoraVideoClip* owner, int nChannels, int freq)
-{
- mFreq = freq;
- mNumChannels = nChannels;
- mClip = owner;
-}
-
-TheoraAudioInterface::~TheoraAudioInterface()
-{
-
-}
diff --git a/drivers/theoraplayer/src/TheoraAudioPacketQueue.cpp b/drivers/theoraplayer/src/TheoraAudioPacketQueue.cpp
deleted file mode 100644
index be5e1018f..000000000
--- a/drivers/theoraplayer/src/TheoraAudioPacketQueue.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include
-#include "TheoraAudioPacketQueue.h"
-#include "TheoraAudioInterface.h"
-
-TheoraAudioPacketQueue::TheoraAudioPacketQueue()
-{
- mTheoraAudioPacketQueue = NULL;
-}
-
-TheoraAudioPacketQueue::~TheoraAudioPacketQueue()
-{
- destroyAllAudioPackets();
-}
-
-float TheoraAudioPacketQueue::getAudioPacketQueueLength()
-{
- float len = 0;
- for (TheoraAudioPacket* p = mTheoraAudioPacketQueue; p != NULL; p = p->next)
- len += p->numSamples;
-
- return len / (mAudioFrequency * mNumAudioChannels);
-}
-
-void TheoraAudioPacketQueue::_addAudioPacket(float* data, int numSamples)
-{
- TheoraAudioPacket* packet = new TheoraAudioPacket;
- packet->pcm = data;
- packet->numSamples = numSamples;
- packet->next = NULL;
-
-
- if (mTheoraAudioPacketQueue == NULL) mTheoraAudioPacketQueue = packet;
- else
- {
- TheoraAudioPacket* last = mTheoraAudioPacketQueue;
- for (TheoraAudioPacket* p = last; p != NULL; p = p->next)
- last = p;
- last->next = packet;
- }
-}
-
-void TheoraAudioPacketQueue::addAudioPacket(float** buffer, int numSamples, float gain)
-{
- float* data = new float[numSamples * mNumAudioChannels];
- float* dataptr = data;
- int i;
- unsigned int j;
-
- if (gain < 1.0f)
- {
- // apply gain, let's attenuate the samples
- for (i = 0; i < numSamples; ++i)
- for (j = 0; j < mNumAudioChannels; j++, ++dataptr)
- *dataptr = buffer[i][j] * gain;
- }
- else
- {
- // do a simple copy, faster then the above method, when gain is 1.0f
- for (i = 0; i < numSamples; ++i)
- for (j = 0; j < mNumAudioChannels; j++, ++dataptr)
- *dataptr = buffer[j][i];
- }
-
- _addAudioPacket(data, numSamples * mNumAudioChannels);
-}
-
-void TheoraAudioPacketQueue::addAudioPacket(float* buffer, int numSamples, float gain)
-{
- float* data = new float[numSamples * mNumAudioChannels];
- float* dataptr = data;
- int i, numFloats = numSamples * mNumAudioChannels;
-
- if (gain < 1.0f)
- {
- // apply gain, let's attenuate the samples
- for (i = 0; i < numFloats; ++i, dataptr++)
- *dataptr = buffer[i] * gain;
- }
- else
- {
- // do a simple copy, faster then the above method, when gain is 1.0f
- for (i = 0; i < numFloats; ++i, dataptr++)
- *dataptr = buffer[i];
- }
-
- _addAudioPacket(data, numFloats);
-}
-
-TheoraAudioPacket* TheoraAudioPacketQueue::popAudioPacket()
-{
- if (mTheoraAudioPacketQueue == NULL) return NULL;
- TheoraAudioPacket* p = mTheoraAudioPacketQueue;
- mTheoraAudioPacketQueue = mTheoraAudioPacketQueue->next;
- return p;
-}
-
-void TheoraAudioPacketQueue::destroyAudioPacket(TheoraAudioPacket* p)
-{
- if (p == NULL) return;
- delete [] p->pcm;
- delete p;
-}
-
-void TheoraAudioPacketQueue::destroyAllAudioPackets()
-{
- for (TheoraAudioPacket* p = popAudioPacket(); p != NULL; p = popAudioPacket())
- destroyAudioPacket(p);
-}
-
-void TheoraAudioPacketQueue::flushAudioPackets(TheoraAudioInterface* audioInterface)
-{
-
- for (TheoraAudioPacket* p = popAudioPacket(); p != NULL; p = popAudioPacket())
- {
- audioInterface->insertData(p->pcm, p->numSamples);
- destroyAudioPacket(p);
- }
-}
\ No newline at end of file
diff --git a/drivers/theoraplayer/src/TheoraDataSource.cpp b/drivers/theoraplayer/src/TheoraDataSource.cpp
deleted file mode 100644
index 6011dc678..000000000
--- a/drivers/theoraplayer/src/TheoraDataSource.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include
-#include
-#include "TheoraDataSource.h"
-#include "TheoraException.h"
-#include "TheoraVideoManager.h"
-#include "TheoraUtil.h"
-
-TheoraDataSource::~TheoraDataSource()
-{
-
-}
-
-TheoraFileDataSource::TheoraFileDataSource(std::string filename)
-{
- mFilename = filename;
- mFilePtr = NULL;
-}
-
-TheoraFileDataSource::~TheoraFileDataSource()
-{
- if (mFilePtr)
- {
- fclose(mFilePtr);
- mFilePtr = NULL;
- }
-}
-
-void TheoraFileDataSource::openFile()
-{
- if (mFilePtr == NULL)
- {
- mFilePtr=fopen(mFilename.c_str(), "rb");
- if (!mFilePtr)
- {
- std::string msg = "Can't open video file: " + mFilename;
- th_writelog(msg);
- throw TheoraGenericException(msg);
- }
- fseek(mFilePtr, 0, SEEK_END);
- mSize = ftell(mFilePtr);
- fseek(mFilePtr, 0, SEEK_SET);
- }
-}
-
-int TheoraFileDataSource::read(void* output, int nBytes)
-{
- if (mFilePtr == NULL) openFile();
- size_t n = fread(output, 1, nBytes, mFilePtr);
- return (int) n;
-}
-
-void TheoraFileDataSource::seek(unsigned long byte_index)
-{
- if (mFilePtr == NULL) openFile();
- fseek(mFilePtr, byte_index, SEEK_SET);
-}
-
-unsigned long TheoraFileDataSource::size()
-{
- if (mFilePtr == NULL) openFile();
- return mSize;
-}
-
-unsigned long TheoraFileDataSource::tell()
-{
- if (mFilePtr == NULL) return 0;
- return ftell(mFilePtr);
-}
-
-TheoraMemoryFileDataSource::TheoraMemoryFileDataSource(std::string filename) :
- mReadPointer(0),
- mData(0)
-{
- mFilename=filename;
- FILE* f=fopen(filename.c_str(),"rb");
- if (!f) throw TheoraGenericException("Can't open video file: "+filename);
- fseek(f,0,SEEK_END);
- mSize=ftell(f);
- fseek(f,0,SEEK_SET);
- mData=new unsigned char[mSize];
- fread(mData,1,mSize,f);
- fclose(f);
-}
-
-TheoraMemoryFileDataSource::TheoraMemoryFileDataSource(unsigned char* data, long size, const std::string& filename)
-{
- mFilename = filename;
- mData = data;
- mSize = size;
- mReadPointer = 0;
-}
-
-TheoraMemoryFileDataSource::~TheoraMemoryFileDataSource()
-{
- if (mData) delete [] mData;
-}
-
-int TheoraMemoryFileDataSource::read(void* output, int nBytes)
-{
- int n = (int) ((mReadPointer+nBytes <= mSize) ? nBytes : mSize - mReadPointer);
- if (!n) return 0;
- memcpy(output, mData + mReadPointer, n);
- mReadPointer += n;
- return n;
-}
-
-void TheoraMemoryFileDataSource::seek(unsigned long byte_index)
-{
- mReadPointer=byte_index;
-}
-
-unsigned long TheoraMemoryFileDataSource::size()
-{
- return mSize;
-}
-
-unsigned long TheoraMemoryFileDataSource::tell()
-{
- return mReadPointer;
-}
diff --git a/drivers/theoraplayer/src/TheoraException.cpp b/drivers/theoraplayer/src/TheoraException.cpp
deleted file mode 100644
index 4588a8139..000000000
--- a/drivers/theoraplayer/src/TheoraException.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include "TheoraException.h"
-#include "TheoraUtil.h"
-#include "TheoraVideoManager.h"
-#include
-
-_TheoraGenericException::_TheoraGenericException(const std::string& errorText, std::string type, std::string file, int line)
-{
- mErrText = errorText;
- int src = (int) file.find("src");
- if (src >= 0) file = file.substr(src + 4, 1000);
- mLineNumber = line;
- mFile = file;
-}
-
-
-std::string _TheoraGenericException::repr()
-{
- std::string text = getType();
- if (text != "") text += ": ";
-
- if (mFile != "") text += "[" + mFile + ":" + str(mLineNumber) + "] - ";
-
- return text + getErrorText();
-}
-
-void _TheoraGenericException::writeOutput()
-{
- th_writelog("----------------\nException Error!\n\n" + repr() + "\n----------------");
-}
diff --git a/drivers/theoraplayer/src/TheoraFrameQueue.cpp b/drivers/theoraplayer/src/TheoraFrameQueue.cpp
deleted file mode 100644
index f40214479..000000000
--- a/drivers/theoraplayer/src/TheoraFrameQueue.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include "TheoraFrameQueue.h"
-#include "TheoraVideoFrame.h"
-#include "TheoraVideoManager.h"
-#include "TheoraUtil.h"
-
-
-TheoraFrameQueue::TheoraFrameQueue(TheoraVideoClip* parent)
-{
- mParent = parent;
-}
-
-TheoraFrameQueue::~TheoraFrameQueue()
-{
- foreach_l(TheoraVideoFrame*, mQueue)
- {
- delete (*it);
- }
- mQueue.clear();
-}
-
-TheoraVideoFrame* TheoraFrameQueue::createFrameInstance(TheoraVideoClip* clip)
-{
- TheoraVideoFrame* frame = new TheoraVideoFrame(clip);
- if (frame->getBuffer() == NULL) // This can happen if you run out of memory
- {
- delete frame;
- return NULL;
- }
- return frame;
-}
-
-void TheoraFrameQueue::setSize(int n)
-{
- mMutex.lock();
- if (mQueue.size() > 0)
- {
- foreach_l (TheoraVideoFrame*, mQueue)
- {
- delete (*it);
- }
- mQueue.clear();
- }
- TheoraVideoFrame* frame;
- for (int i = 0;i < n; ++i)
- {
- frame = createFrameInstance(mParent);
- if (frame != NULL) mQueue.push_back(frame);
- else
- {
- TheoraVideoManager::getSingleton().logMessage("TheoraFrameQueue: unable to create " + str(n) + " frames, out of memory. Created " + str((int) mQueue.size()) + " frames.");
- break;
- }
- }
- mMutex.unlock();
-}
-
-int TheoraFrameQueue::getSize()
-{
- return (int) mQueue.size();
-}
-
-TheoraVideoFrame* TheoraFrameQueue::_getFirstAvailableFrame()
-{
- TheoraVideoFrame* frame = mQueue.front();
- if (frame->mReady) return frame;
- else return NULL;
-}
-
-TheoraVideoFrame* TheoraFrameQueue::getFirstAvailableFrame()
-{
- mMutex.lock();
- TheoraVideoFrame* frame = _getFirstAvailableFrame();
- mMutex.unlock();
- return frame;
-}
-
-void TheoraFrameQueue::clear()
-{
- mMutex.lock();
- foreach_l (TheoraVideoFrame*, mQueue)
- (*it)->clear();
- mMutex.unlock();
-}
-
-void TheoraFrameQueue::_pop(int n)
-{
- for (int i = 0; i < n; ++i)
- {
- TheoraVideoFrame* first = mQueue.front();
- first->clear();
- mQueue.pop_front();
- mQueue.push_back(first);
- }
-}
-
-void TheoraFrameQueue::pop(int n)
-{
- mMutex.lock();
- _pop(n);
- mMutex.unlock();
-}
-
-TheoraVideoFrame* TheoraFrameQueue::requestEmptyFrame()
-{
- TheoraVideoFrame* frame = NULL;
- mMutex.lock();
- foreach_l (TheoraVideoFrame*, mQueue)
- {
- if (!(*it)->mInUse)
- {
- (*it)->mInUse = 1;
- (*it)->mReady = 0;
- frame = (*it);
- break;
- }
- }
- mMutex.unlock();
- return frame;
-}
-
-int TheoraFrameQueue::getUsedCount()
-{
- mMutex.lock();
- int n=0;
- foreach_l(TheoraVideoFrame*,mQueue)
- if ((*it)->mInUse) ++n;
- mMutex.unlock();
- return n;
-}
-
-int TheoraFrameQueue::_getReadyCount()
-{
- int n = 0;
- foreach_l (TheoraVideoFrame*, mQueue)
- if ((*it)->mReady) ++n;
- return n;
-}
-
-
-int TheoraFrameQueue::getReadyCount()
-{
- mMutex.lock();
- int n = _getReadyCount();
- mMutex.unlock();
- return n;
-}
-
-bool TheoraFrameQueue::isFull()
-{
- return getReadyCount() == mQueue.size();
-}
-
-void TheoraFrameQueue::lock()
-{
- mMutex.lock();
-}
-
-void TheoraFrameQueue::unlock()
-{
- mMutex.unlock();
-}
-
-std::list& TheoraFrameQueue::_getFrameQueue()
-{
- return mQueue;
-}
diff --git a/drivers/theoraplayer/src/TheoraTimer.cpp b/drivers/theoraplayer/src/TheoraTimer.cpp
deleted file mode 100644
index 644d1c2ab..000000000
--- a/drivers/theoraplayer/src/TheoraTimer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include "TheoraTimer.h"
-
-TheoraTimer::TheoraTimer()
-{
- mTime = 0;
- mPaused = 0;
- mSpeed = 1.0f;
-}
-
-TheoraTimer::~TheoraTimer()
-{
-
-}
-
-void TheoraTimer::update(float timeDelta)
-{
- if (!isPaused())
- {
- mTime += timeDelta * mSpeed;
- }
-}
-
-float TheoraTimer::getTime()
-{
- return mTime;
-}
-
-void TheoraTimer::pause()
-{
- mPaused = true;
-}
-
-void TheoraTimer::play()
-{
- mPaused = false;
-}
-
-
-bool TheoraTimer::isPaused()
-{
- return mPaused;
-}
-
-void TheoraTimer::stop()
-{
-
-}
-
-void TheoraTimer::seek(float time)
-{
- mTime = time;
-}
-
-void TheoraTimer::setSpeed(float speed)
-{
- mSpeed = speed;
-}
-
-float TheoraTimer::getSpeed()
-{
- return mSpeed;
-}
diff --git a/drivers/theoraplayer/src/TheoraUtil.cpp b/drivers/theoraplayer/src/TheoraUtil.cpp
deleted file mode 100644
index 8f1ad0c9c..000000000
--- a/drivers/theoraplayer/src/TheoraUtil.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/************************************************************************************
-This source file is part of the Theora Video Playback Library
-For latest info, see http://libtheoraplayer.googlecode.com
-*************************************************************************************
-Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
-This program is free software; you can redistribute it and/or modify it under
-the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
-*************************************************************************************/
-#include
-#include
-#include
-#include