-Ability to ask for documents/pictures/etc system dirs.
-Fixes to animationplayer -fixes to collada importer
This commit is contained in:
parent
9d5a2cb847
commit
e361e8539c
|
@ -606,6 +606,12 @@ bool _OS::is_debug_build() const {
|
|||
#endif
|
||||
|
||||
}
|
||||
|
||||
String _OS::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir));
|
||||
}
|
||||
|
||||
String _OS::get_custom_level() const {
|
||||
|
||||
return OS::get_singleton()->get_custom_level();
|
||||
|
@ -690,6 +696,7 @@ void _OS::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_dynamic_memory_usage"),&_OS::get_dynamic_memory_usage);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_data_dir"),&_OS::get_data_dir);
|
||||
ObjectTypeDB::bind_method(_MD("get_system_dir","dir"),&_OS::get_system_dir);
|
||||
ObjectTypeDB::bind_method(_MD("get_unique_ID"),&_OS::get_unique_ID);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second);
|
||||
|
@ -728,6 +735,14 @@ void _OS::_bind_methods() {
|
|||
BIND_CONSTANT( MONTH_NOVEMBER );
|
||||
BIND_CONSTANT( MONTH_DECEMBER );
|
||||
|
||||
BIND_CONSTANT( SYSTEM_DIR_DESKTOP);
|
||||
BIND_CONSTANT( SYSTEM_DIR_DCIM );
|
||||
BIND_CONSTANT( SYSTEM_DIR_DOCUMENTS );
|
||||
BIND_CONSTANT( SYSTEM_DIR_DOWNLOADS );
|
||||
BIND_CONSTANT( SYSTEM_DIR_MOVIES );
|
||||
BIND_CONSTANT( SYSTEM_DIR_MUSIC );
|
||||
BIND_CONSTANT( SYSTEM_DIR_PICTURES );
|
||||
BIND_CONSTANT( SYSTEM_DIR_RINGTONES );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,20 @@ public:
|
|||
|
||||
int get_processor_count() const;
|
||||
|
||||
enum SystemDir {
|
||||
SYSTEM_DIR_DESKTOP,
|
||||
SYSTEM_DIR_DCIM,
|
||||
SYSTEM_DIR_DOCUMENTS,
|
||||
SYSTEM_DIR_DOWNLOADS,
|
||||
SYSTEM_DIR_MOVIES,
|
||||
SYSTEM_DIR_MUSIC,
|
||||
SYSTEM_DIR_PICTURES,
|
||||
SYSTEM_DIR_RINGTONES,
|
||||
};
|
||||
|
||||
String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
|
||||
String get_data_dir() const;
|
||||
|
||||
void set_time_scale(float p_scale);
|
||||
|
@ -211,6 +225,9 @@ public:
|
|||
_OS();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(_OS::SystemDir);
|
||||
|
||||
|
||||
class _Geometry : public Object {
|
||||
|
||||
OBJ_TYPE(_Geometry, Object);
|
||||
|
|
|
@ -280,6 +280,12 @@ String OS::get_resource_dir() const {
|
|||
return Globals::get_singleton()->get_resource_path();
|
||||
}
|
||||
|
||||
|
||||
String OS::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
return ".";
|
||||
}
|
||||
|
||||
String OS::get_data_dir() const {
|
||||
|
||||
return ".";
|
||||
|
|
14
core/os/os.h
14
core/os/os.h
|
@ -286,6 +286,20 @@ public:
|
|||
virtual String get_data_dir() const;
|
||||
virtual String get_resource_dir() const;
|
||||
|
||||
enum SystemDir {
|
||||
SYSTEM_DIR_DESKTOP,
|
||||
SYSTEM_DIR_DCIM,
|
||||
SYSTEM_DIR_DOCUMENTS,
|
||||
SYSTEM_DIR_DOWNLOADS,
|
||||
SYSTEM_DIR_MOVIES,
|
||||
SYSTEM_DIR_MUSIC,
|
||||
SYSTEM_DIR_PICTURES,
|
||||
SYSTEM_DIR_RINGTONES,
|
||||
};
|
||||
|
||||
virtual String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
|
||||
virtual void set_no_window_mode(bool p_enable);
|
||||
virtual bool is_no_window_mode_enabled() const;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#define _MKSTR(m_x) _STR(m_x)
|
||||
#endif
|
||||
// have to include version.h for this to work, include it in the .cpp not the .h
|
||||
#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"."_MKSTR(VERSION_MINOR)"."_MKSTR(VERSION_REVISION)"-"_MKSTR(VERSION_STATUS)
|
||||
#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"."_MKSTR(VERSION_MINOR)"."_MKSTR(VERSION_STATUS)"."_MKSTR(VERSION_REVISION)
|
||||
#define VERSION_FULL_NAME _MKSTR(VERSION_NAME)" v"VERSION_MKSTRING
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ static String unescape_cmdline(const String& p_str) {
|
|||
|
||||
void Main::print_help(const char* p_binary) {
|
||||
|
||||
OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2010 Juan Linietsky, Ariel Manzur.\n");
|
||||
OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur.\n");
|
||||
OS::get_singleton()->print("Usage: %s [options] [scene]\n",p_binary);
|
||||
OS::get_singleton()->print("Options:\n");
|
||||
OS::get_singleton()->print("\t-path [dir] : Path to a game, containing engine.cfg\n");
|
||||
|
|
39
methods.py
39
methods.py
|
@ -1083,44 +1083,13 @@ def build_gles2_headers( target, source, env ):
|
|||
|
||||
def update_version():
|
||||
|
||||
rev = 0
|
||||
|
||||
try:
|
||||
f = open("custom_version.txt","rb")
|
||||
rev = int( f.readline().strip() )
|
||||
except:
|
||||
pass
|
||||
|
||||
if (rev==0):
|
||||
try:
|
||||
f = open(".svn/entries")
|
||||
line = f.readline();
|
||||
next_rev = False
|
||||
while line != "":
|
||||
line = line.rstrip('\r\n')
|
||||
if next_rev:
|
||||
rev = line
|
||||
break
|
||||
if line == "dir":
|
||||
next_rev = True
|
||||
line = f.readline();
|
||||
|
||||
if rev != 0:
|
||||
f = open("version.py")
|
||||
ver = f.read()
|
||||
import re
|
||||
ver = re.sub(r'\$Rev: \d* \$', '$Rev: '+str(rev)+' $', ver)
|
||||
f = open("version.py", "wb")
|
||||
f.write(ver)
|
||||
f.close()
|
||||
|
||||
except:
|
||||
pass
|
||||
rev = "custom_build"
|
||||
|
||||
if (os.getenv("BUILD_REVISION")!=None):
|
||||
rev=os.getenv("BUILD_REVISION")
|
||||
print("Using custom revision: "+rev)
|
||||
import version
|
||||
|
||||
rev=version.revision
|
||||
rev=rev[5:-1].strip()
|
||||
|
||||
f=open("core/version.h","wb")
|
||||
f.write("#define VERSION_SHORT_NAME "+str(version.short_name)+"\n")
|
||||
|
|
|
@ -557,6 +557,58 @@ public class GodotIO {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static final int SYSTEM_DIR_DESKTOP=0;
|
||||
public static final int SYSTEM_DIR_DCIM=1;
|
||||
public static final int SYSTEM_DIR_DOCUMENTS=2;
|
||||
public static final int SYSTEM_DIR_DOWNLOADS=3;
|
||||
public static final int SYSTEM_DIR_MOVIES=4;
|
||||
public static final int SYSTEM_DIR_MUSIC=5;
|
||||
public static final int SYSTEM_DIR_PICTURES=6;
|
||||
public static final int SYSTEM_DIR_RINGTONES=7;
|
||||
|
||||
|
||||
public String getSystemDir(int idx) {
|
||||
|
||||
String what="";
|
||||
switch(idx) {
|
||||
case SYSTEM_DIR_DESKTOP: {
|
||||
//what=Environment.DIRECTORY_DOCUMENTS;
|
||||
what=Environment.DIRECTORY_DOWNLOADS;
|
||||
} break;
|
||||
case SYSTEM_DIR_DCIM: {
|
||||
what=Environment.DIRECTORY_DCIM;
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_DOCUMENTS: {
|
||||
what=Environment.DIRECTORY_DOWNLOADS;
|
||||
//what=Environment.DIRECTORY_DOCUMENTS;
|
||||
} break;
|
||||
case SYSTEM_DIR_DOWNLOADS: {
|
||||
what=Environment.DIRECTORY_DOWNLOADS;
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_MOVIES: {
|
||||
what=Environment.DIRECTORY_MOVIES;
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_MUSIC: {
|
||||
what=Environment.DIRECTORY_MUSIC;
|
||||
} break;
|
||||
case SYSTEM_DIR_PICTURES: {
|
||||
what=Environment.DIRECTORY_PICTURES;
|
||||
} break;
|
||||
case SYSTEM_DIR_RINGTONES: {
|
||||
what=Environment.DIRECTORY_RINGTONES;
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
if (what.equals(""))
|
||||
return "";
|
||||
return Environment.getExternalStoragePublicDirectory(what).getAbsolutePath();
|
||||
}
|
||||
|
||||
protected static final String PREFS_FILE = "device_id.xml";
|
||||
protected static final String PREFS_DEVICE_ID = "device_id";
|
||||
|
||||
|
|
|
@ -599,7 +599,7 @@ static jmethodID _showKeyboard=0;
|
|||
static jmethodID _hideKeyboard=0;
|
||||
static jmethodID _setScreenOrientation=0;
|
||||
static jmethodID _getUniqueID=0;
|
||||
|
||||
static jmethodID _getSystemDir=0;
|
||||
static jmethodID _playVideo=0;
|
||||
static jmethodID _isVideoPlaying=0;
|
||||
static jmethodID _pauseVideo=0;
|
||||
|
@ -659,6 +659,14 @@ static void _set_screen_orient(int p_orient) {
|
|||
env->CallVoidMethod(godot_io, _setScreenOrientation, p_orient );
|
||||
};
|
||||
|
||||
static String _get_system_dir(int p_dir) {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
jstring s =(jstring)env->CallObjectMethod(godot_io,_getSystemDir,p_dir);
|
||||
return String(env->GetStringUTFChars( s, NULL ));
|
||||
};
|
||||
|
||||
|
||||
static void _hide_vk() {
|
||||
|
||||
JNIEnv* env = ThreadAndroid::get_env();
|
||||
|
@ -738,7 +746,7 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env,
|
|||
_showKeyboard = env->GetMethodID(c,"showKeyboard","(Ljava/lang/String;)V");
|
||||
_hideKeyboard = env->GetMethodID(c,"hideKeyboard","()V");
|
||||
_setScreenOrientation = env->GetMethodID(c,"setScreenOrientation","(I)V");
|
||||
|
||||
_getSystemDir = env->GetMethodID(c,"getSystemDir","(I)Ljava/lang/String;");
|
||||
_playVideo = env->GetMethodID(c,"playVideo","(Ljava/lang/String;)V");
|
||||
_isVideoPlaying = env->GetMethodID(c,"isVideoPlaying","()Z");
|
||||
_pauseVideo = env->GetMethodID(c,"pauseVideo","()V");
|
||||
|
@ -781,7 +789,7 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env,
|
|||
|
||||
__android_log_print(ANDROID_LOG_INFO,"godot","CMDLINE LEN %i - APK EXPANSION %I\n",cmdlen,int(use_apk_expansion));
|
||||
|
||||
os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _play_video, _is_video_playing, _pause_video, _stop_video,use_apk_expansion);
|
||||
os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video,use_apk_expansion);
|
||||
os_android->set_need_reload_hooks(p_need_reload_hook);
|
||||
|
||||
char wd[500];
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
package com.android.vending.expansion.downloader;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = false;
|
||||
public final static boolean DEBUG = true;
|
||||
}
|
|
@ -699,12 +699,19 @@ void OS_Android::native_video_pause() {
|
|||
video_pause_func();
|
||||
}
|
||||
|
||||
String OS_Android::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
if (get_system_dir_func)
|
||||
return get_system_dir_func(p_dir);
|
||||
return String(".");
|
||||
}
|
||||
|
||||
void OS_Android::native_video_stop() {
|
||||
if (video_stop_func)
|
||||
video_stop_func();
|
||||
}
|
||||
|
||||
OS_Android::OS_Android(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,GetModelFunc p_get_model_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func,bool p_use_apk_expansion) {
|
||||
OS_Android::OS_Android(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,GetModelFunc p_get_model_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func,bool p_use_apk_expansion) {
|
||||
|
||||
|
||||
use_apk_expansion=p_use_apk_expansion;
|
||||
|
@ -726,6 +733,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFu
|
|||
get_locale_func=p_get_locale_func;
|
||||
get_model_func=p_get_model_func;
|
||||
get_unique_id_func=p_get_unique_id;
|
||||
get_system_dir_func=p_get_sdir_func;
|
||||
|
||||
video_play_func = p_video_play_func;
|
||||
video_is_playing_func = p_video_is_playing_func;
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef String (*GetUniqueIDFunc)();
|
|||
typedef void (*ShowVirtualKeyboardFunc)(const String&);
|
||||
typedef void (*HideVirtualKeyboardFunc)();
|
||||
typedef void (*SetScreenOrientationFunc)(int);
|
||||
typedef String (*GetSystemDirFunc)(int);
|
||||
|
||||
typedef void (*VideoPlayFunc)(const String&);
|
||||
typedef bool (*VideoIsPlayingFunc)();
|
||||
|
@ -98,6 +99,7 @@ private:
|
|||
SpatialSound2DServerSW *spatial_sound_2d_server;
|
||||
PhysicsServer *physics_server;
|
||||
Physics2DServer *physics_2d_server;
|
||||
|
||||
#if 0
|
||||
AudioDriverAndroid audio_driver_android;
|
||||
#else
|
||||
|
@ -118,6 +120,7 @@ private:
|
|||
HideVirtualKeyboardFunc hide_virtual_keyboard_func;
|
||||
SetScreenOrientationFunc set_screen_orientation_func;
|
||||
GetUniqueIDFunc get_unique_id_func;
|
||||
GetSystemDirFunc get_system_dir_func;
|
||||
|
||||
VideoPlayFunc video_play_func;
|
||||
VideoIsPlayingFunc video_is_playing_func;
|
||||
|
@ -203,6 +206,8 @@ public:
|
|||
|
||||
virtual String get_unique_ID() const;
|
||||
|
||||
virtual String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
|
||||
void process_accelerometer(const Vector3& p_accelerometer);
|
||||
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
|
||||
|
@ -214,7 +219,7 @@ public:
|
|||
virtual void native_video_pause();
|
||||
virtual void native_video_stop();
|
||||
|
||||
OS_Android(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,GetModelFunc p_get_model_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func,bool p_use_apk_expansion);
|
||||
OS_Android(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,GetModelFunc p_get_model_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func,bool p_use_apk_expansion);
|
||||
~OS_Android();
|
||||
|
||||
};
|
||||
|
|
|
@ -31,12 +31,14 @@
|
|||
#import "view_controller.h"
|
||||
|
||||
@interface AppDelegate : NSObject <UIApplicationDelegate, UIAccelerometerDelegate, GLViewDelegate> {
|
||||
UIWindow *window;
|
||||
//@property (strong, nonatomic) UIWindow *window;
|
||||
ViewController* view_controller;
|
||||
UIAccelerationValue accel[3];
|
||||
UIAccelerationValue last_accel[3];
|
||||
};
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
+ (ViewController*)getViewController;
|
||||
|
||||
@end
|
||||
|
|
|
@ -65,6 +65,8 @@ Error _shell_open(String p_uri) {
|
|||
|
||||
@implementation AppDelegate
|
||||
|
||||
@synthesize window;
|
||||
|
||||
extern int gargc;
|
||||
extern char** gargv;
|
||||
extern int iphone_main(int, int, int, char**);
|
||||
|
@ -127,7 +129,7 @@ static int frame_count = 0;
|
|||
|
||||
OSIPhone::get_singleton()->set_unique_ID(String::utf8([uuid UTF8String]));
|
||||
|
||||
}; // break;
|
||||
}; break;
|
||||
/*
|
||||
case 1: {
|
||||
++frame_count;
|
||||
|
@ -154,7 +156,7 @@ static int frame_count = 0;
|
|||
[Appirater appLaunched:YES app_id:aid];
|
||||
#endif
|
||||
|
||||
}; // break; fallthrough
|
||||
}; break; // no fallthrough
|
||||
|
||||
default: {
|
||||
|
||||
|
@ -260,6 +262,9 @@ static int frame_count = 0;
|
|||
if (OS::get_singleton()->get_main_loop())
|
||||
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
|
||||
[view_controller.view stopAnimation];
|
||||
if (OS::get_singleton()->native_video_is_playing()) {
|
||||
OSIPhone::get_singleton()->native_video_focus_out();
|
||||
};
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
|
|
|
@ -21,8 +21,7 @@ def get_opts():
|
|||
return [
|
||||
('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'),
|
||||
('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
|
||||
#('IOS_SDK_VERSION', 'The SDK version', 'iPhoneOS7.0'),
|
||||
('IOS_SDK_VERSION', 'The SDK version', 'iPhoneOS8.1'),
|
||||
('IOS_SDK_VERSION', 'The SDK version', 'iPhoneOS'),
|
||||
('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/${IOS_SDK_VERSION}.sdk/'),
|
||||
('game_center', 'Support for game center', 'yes'),
|
||||
('store_kit', 'Support for in-app store', 'yes'),
|
||||
|
@ -96,8 +95,8 @@ def configure(env):
|
|||
|
||||
if (env["target"]=="release"):
|
||||
|
||||
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall'])
|
||||
env.Append(LINKFLAGS=['-Os', '-ffast-math'])
|
||||
env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall'])
|
||||
env.Append(LINKFLAGS=['-O3', '-ffast-math'])
|
||||
|
||||
elif env["target"] == "release_debug":
|
||||
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
|
||||
|
|
|
@ -125,6 +125,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
|
|||
|
||||
AVMediaSelectionGroup *audioGroup = [_instance.avAsset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicAudible];
|
||||
|
||||
NSMutableArray *allAudioParams = [NSMutableArray array];
|
||||
for (id track in audioGroup.options)
|
||||
{
|
||||
NSString* language = [[track locale] localeIdentifier];
|
||||
|
@ -132,7 +133,17 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
|
|||
|
||||
if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]])
|
||||
{
|
||||
AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];
|
||||
[audioInputParams setVolume:p_volume atTime:kCMTimeZero];
|
||||
[audioInputParams setTrackID:[track trackID]];
|
||||
[allAudioParams addObject:audioInputParams];
|
||||
|
||||
AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
|
||||
[audioMix setInputParameters:allAudioParams];
|
||||
|
||||
[_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: audioGroup];
|
||||
[_instance.avPlayer.currentItem setAudioMix:audioMix];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +185,13 @@ void _pause_video() {
|
|||
video_playing = false;
|
||||
}
|
||||
|
||||
void _focus_out_video() {
|
||||
printf("focus out pausing video\n");
|
||||
[_instance.avPlayer pause];
|
||||
};
|
||||
|
||||
void _unpause_video() {
|
||||
|
||||
[_instance.avPlayer play];
|
||||
video_playing = true;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "audio_driver_iphone.h"
|
||||
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/globals.h"
|
||||
|
||||
#include "sem_iphone.h"
|
||||
|
@ -77,7 +78,7 @@ void OSIPhone::set_data_dir(String p_dir) {
|
|||
DirAccess* da = DirAccess::open(p_dir);
|
||||
|
||||
data_dir = da->get_current_dir();
|
||||
|
||||
printf("setting data dir to %ls from %ls\n", data_dir.c_str(), p_dir.c_str());
|
||||
memdelete(da);
|
||||
};
|
||||
|
||||
|
@ -211,6 +212,7 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
|
|||
|
||||
void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {
|
||||
|
||||
if (!GLOBAL_DEF("debug/disable_touch", false)) {
|
||||
InputEvent ev;
|
||||
ev.type = InputEvent::SCREEN_TOUCH;
|
||||
ev.ID = ++last_event_id;
|
||||
|
@ -219,6 +221,7 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
|
|||
ev.screen_touch.x=p_x;
|
||||
ev.screen_touch.y=p_y;
|
||||
queue_event(ev);
|
||||
};
|
||||
|
||||
if (p_use_as_mouse) {
|
||||
|
||||
|
@ -247,6 +250,8 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
|
|||
|
||||
void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse) {
|
||||
|
||||
if (!GLOBAL_DEF("debug/disable_touch", false)) {
|
||||
|
||||
InputEvent ev;
|
||||
ev.type=InputEvent::SCREEN_DRAG;
|
||||
ev.ID = ++last_event_id;
|
||||
|
@ -256,6 +261,7 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
|
|||
ev.screen_drag.relative_x = p_x - p_prev_x;
|
||||
ev.screen_drag.relative_y = p_y - p_prev_y;
|
||||
queue_event(ev);
|
||||
};
|
||||
|
||||
if (p_use_as_mouse) {
|
||||
InputEvent ev;
|
||||
|
@ -491,8 +497,16 @@ extern bool _is_video_playing();
|
|||
extern void _pause_video();
|
||||
extern void _unpause_video();
|
||||
extern void _stop_video();
|
||||
extern void _focus_out_video();
|
||||
|
||||
Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
|
||||
FileAccess* f = FileAccess::open(p_path, FileAccess::READ);
|
||||
bool exists = f && f->is_open();
|
||||
printf("file exists for %ls, %i, %p\n", p_path.c_str(), (int)exists, f);
|
||||
if (f)
|
||||
memdelete(f);
|
||||
if (!exists)
|
||||
return FAILED;
|
||||
if ( _play_video(p_path, p_volume, p_audio_track, p_subtitle_track) )
|
||||
return OK;
|
||||
return FAILED;
|
||||
|
@ -511,6 +525,9 @@ void OSIPhone::native_video_unpause() {
|
|||
_unpause_video();
|
||||
};
|
||||
|
||||
void OSIPhone::native_video_focus_out() {
|
||||
_focus_out_video();
|
||||
};
|
||||
|
||||
void OSIPhone::native_video_stop() {
|
||||
if (native_video_is_playing())
|
||||
|
|
|
@ -188,6 +188,7 @@ public:
|
|||
virtual bool native_video_is_playing() const;
|
||||
virtual void native_video_pause();
|
||||
virtual void native_video_unpause();
|
||||
virtual void native_video_focus_out();
|
||||
virtual void native_video_stop();
|
||||
|
||||
OSIPhone(int width, int height);
|
||||
|
|
|
@ -52,8 +52,11 @@
|
|||
#include "os/memory_pool_dynamic_prealloc.h"
|
||||
#include "globals.h"
|
||||
#include "io/marshalls.h"
|
||||
|
||||
#include "shlobj.h"
|
||||
static const WORD MAX_CONSOLE_LINES = 1500;
|
||||
|
||||
|
||||
//#define STDOUT_FILE
|
||||
|
||||
extern HINSTANCE godot_hinstance;
|
||||
|
@ -1875,7 +1878,46 @@ MainLoop *OS_Windows::get_main_loop() const {
|
|||
return main_loop;
|
||||
}
|
||||
|
||||
String OS_Windows::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
|
||||
int id;
|
||||
|
||||
|
||||
|
||||
switch(p_dir) {
|
||||
case SYSTEM_DIR_DESKTOP: {
|
||||
id=CSIDL_DESKTOPDIRECTORY;
|
||||
} break;
|
||||
case SYSTEM_DIR_DCIM: {
|
||||
id=CSIDL_MYPICTURES;
|
||||
} break;
|
||||
case SYSTEM_DIR_DOCUMENTS: {
|
||||
id=0x000C;
|
||||
} break;
|
||||
case SYSTEM_DIR_DOWNLOADS: {
|
||||
id=0x000C ;
|
||||
} break;
|
||||
case SYSTEM_DIR_MOVIES: {
|
||||
id=CSIDL_MYVIDEO;
|
||||
} break;
|
||||
case SYSTEM_DIR_MUSIC: {
|
||||
id=CSIDL_MYMUSIC;
|
||||
} break;
|
||||
case SYSTEM_DIR_PICTURES: {
|
||||
id=CSIDL_MYPICTURES;
|
||||
} break;
|
||||
case SYSTEM_DIR_RINGTONES: {
|
||||
id=CSIDL_MYMUSIC;
|
||||
} break;
|
||||
}
|
||||
|
||||
WCHAR szPath[MAX_PATH];
|
||||
HRESULT res = SHGetFolderPathW(NULL,id,NULL,0,szPath);
|
||||
ERR_FAIL_COND_V(res!=S_OK,String());
|
||||
return String(szPath);
|
||||
|
||||
}
|
||||
String OS_Windows::get_data_dir() const {
|
||||
|
||||
String an = Globals::get_singleton()->get("application/name");
|
||||
|
|
|
@ -249,6 +249,8 @@ public:
|
|||
|
||||
virtual void move_window_to_foreground();
|
||||
virtual String get_data_dir() const;
|
||||
virtual String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
|
||||
virtual void release_rendering_thread();
|
||||
virtual void make_rendering_thread();
|
||||
|
|
|
@ -1088,7 +1088,73 @@ String OS_X11::get_name() {
|
|||
|
||||
Error OS_X11::shell_open(String p_uri) {
|
||||
|
||||
return ERR_UNAVAILABLE;
|
||||
Error ok;
|
||||
List<String> args;
|
||||
args.push_back(p_uri);
|
||||
ok = execute("/usr/bin/xdg-open",args,false);
|
||||
if (ok==OK)
|
||||
return OK;
|
||||
ok = execute("gnome-open",args,false);
|
||||
if (ok==OK)
|
||||
return OK;
|
||||
ok = execute("kde-open",args,false);
|
||||
return ok;
|
||||
}
|
||||
|
||||
String OS_X11::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
|
||||
String xdgparam;
|
||||
|
||||
switch(p_dir) {
|
||||
case SYSTEM_DIR_DESKTOP: {
|
||||
|
||||
xdgparam="DESKTOP";
|
||||
} break;
|
||||
case SYSTEM_DIR_DCIM: {
|
||||
|
||||
xdgparam="PICTURES";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_DOCUMENTS: {
|
||||
|
||||
xdgparam="DOCUMENTS";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_DOWNLOADS: {
|
||||
|
||||
xdgparam="DOWNLOAD";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_MOVIES: {
|
||||
|
||||
xdgparam="VIDEOS";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_MUSIC: {
|
||||
|
||||
xdgparam="MUSIC";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_PICTURES: {
|
||||
|
||||
xdgparam="PICTURES";
|
||||
|
||||
} break;
|
||||
case SYSTEM_DIR_RINGTONES: {
|
||||
|
||||
xdgparam="MUSIC";
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
String pipe;
|
||||
List<String> arg;
|
||||
arg.push_back(xdgparam);
|
||||
Error err = const_cast<OS_X11*>(this)->execute("/usr/bin/xdg-user-dir",arg,true,NULL,&pipe);
|
||||
if (err!=OK)
|
||||
return ".";
|
||||
return pipe.strip_edges();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -197,6 +197,8 @@ public:
|
|||
virtual void make_rendering_thread();
|
||||
virtual void swap_buffers();
|
||||
|
||||
virtual String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
virtual Error shell_open(String p_uri);
|
||||
|
||||
virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0);
|
||||
|
|
|
@ -374,7 +374,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
|
|||
|
||||
|
||||
Error err = a->transform_track_interpolate(i,p_time,&loc,&rot,&scale);
|
||||
ERR_CONTINUE(err!=OK); //used for testing, should be removed
|
||||
//ERR_CONTINUE(err!=OK); //used for testing, should be removed
|
||||
|
||||
|
||||
if (err!=OK)
|
||||
|
|
|
@ -2250,29 +2250,35 @@ void Collada::_joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner) {
|
|||
}
|
||||
}
|
||||
|
||||
void Collada::_create_skeletons(Collada::Node **p_node) {
|
||||
void Collada::_create_skeletons(Collada::Node **p_node,NodeSkeleton *p_skeleton) {
|
||||
|
||||
|
||||
Node *node = *p_node;
|
||||
|
||||
|
||||
|
||||
if (node->type==Node::TYPE_JOINT) {
|
||||
|
||||
// ohohohoohoo it's a joint node, time to work!
|
||||
if (!p_skeleton) {
|
||||
|
||||
// ohohohoohoo it's a joint node, time to work!
|
||||
NodeSkeleton *sk = memnew( NodeSkeleton );
|
||||
*p_node=sk;
|
||||
sk->children.push_back(node);
|
||||
sk->parent=node->parent;
|
||||
node->parent=sk;
|
||||
_joint_set_owner(node,sk);
|
||||
p_skeleton=sk;
|
||||
}
|
||||
|
||||
NodeJoint *nj = static_cast<NodeJoint*>(node);
|
||||
nj->owner=p_skeleton;
|
||||
} else {
|
||||
p_skeleton=NULL;
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<node->children.size();i++) {
|
||||
_create_skeletons(&node->children[i]);
|
||||
}
|
||||
_create_skeletons(&node->children[i],p_skeleton);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Collada::_remove_node(Node *p_parent,Node *p_node) {
|
||||
|
@ -2325,6 +2331,9 @@ void Collada::_merge_skeletons(VisualScene *p_vscene,Node *p_node) {
|
|||
|
||||
|
||||
NodeJoint *nj = SAFE_CAST<NodeJoint*>(state.scene_map[nodeid]);
|
||||
if (!nj->owner) {
|
||||
print_line("no owner for: "+String(nodeid));
|
||||
}
|
||||
ERR_CONTINUE( !nj->owner ); //weird, node should have a skeleton owner
|
||||
|
||||
skeletons.insert(nj->owner);
|
||||
|
@ -2626,6 +2635,7 @@ void Collada::_optimize() {
|
|||
_create_skeletons(&vs.root_nodes[i]);
|
||||
|
||||
}
|
||||
#if 1
|
||||
for(int i=0;i<vs.root_nodes.size();i++) {
|
||||
_merge_skeletons(&vs,vs.root_nodes[i]);
|
||||
}
|
||||
|
@ -2653,6 +2663,7 @@ void Collada::_optimize() {
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
for(int i=0;i<vs.root_nodes.size();i++) {
|
||||
_find_morph_nodes(&vs,vs.root_nodes[i]);
|
||||
}
|
||||
|
|
|
@ -619,7 +619,7 @@ private: // private stuff
|
|||
Transform _read_transform(XMLParser& parser);
|
||||
|
||||
void _joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner);
|
||||
void _create_skeletons(Collada::Node **p_node);
|
||||
void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton=NULL);
|
||||
void _find_morph_nodes(VisualScene *p_vscene,Node *p_node);
|
||||
bool _remove_node(Node *p_parent,Node *p_node);
|
||||
void _remove_node(VisualScene *p_vscene,Node *p_node);
|
||||
|
|
|
@ -61,6 +61,7 @@ struct ColladaImport {
|
|||
Color ambient;
|
||||
bool found_directional;
|
||||
bool force_make_tangents;
|
||||
bool apply_mesh_xform_to_vertices;
|
||||
float bake_fps;
|
||||
|
||||
|
||||
|
@ -69,6 +70,7 @@ struct ColladaImport {
|
|||
Map<String, Ref<Mesh> > mesh_cache;
|
||||
Map<String, Ref<Curve3D> > curve_cache;
|
||||
Map<String, Ref<Material> > material_cache;
|
||||
Map<Collada::Node*,Skeleton*> skeleton_map;
|
||||
|
||||
Map< Skeleton*, Map< String, int> > skeleton_bone_map;
|
||||
|
||||
|
@ -77,6 +79,7 @@ struct ColladaImport {
|
|||
Map<String,bool> bones_with_animation;
|
||||
|
||||
Error _populate_skeleton(Skeleton *p_skeleton,Collada::Node *p_node, int &r_bone, int p_parent);
|
||||
Error _create_scene_skeletons(Collada::Node *p_node);
|
||||
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
|
||||
Error _create_resources(Collada::Node *p_node);
|
||||
Error _create_material(const String& p_material);
|
||||
|
@ -96,6 +99,7 @@ struct ColladaImport {
|
|||
found_ambient=false;
|
||||
found_directional=false;
|
||||
force_make_tangents=false;
|
||||
apply_mesh_xform_to_vertices=true;
|
||||
bake_fps=15;
|
||||
|
||||
}
|
||||
|
@ -110,7 +114,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton,Collada::Node *p_no
|
|||
|
||||
Collada::NodeJoint *joint = static_cast<Collada::NodeJoint*>(p_node);
|
||||
|
||||
|
||||
print_line("populating joint "+joint->name);
|
||||
p_skeleton->add_bone(p_node->name);
|
||||
if (p_parent>=0)
|
||||
p_skeleton->set_bone_parent(r_bone,p_parent);
|
||||
|
@ -170,6 +174,34 @@ void ColladaImport::_pre_process_lights(Collada::Node *p_node) {
|
|||
_pre_process_lights(p_node->children[i]);
|
||||
}
|
||||
|
||||
Error ColladaImport::_create_scene_skeletons(Collada::Node *p_node) {
|
||||
|
||||
|
||||
if (p_node->type==Collada::Node::TYPE_SKELETON) {
|
||||
|
||||
Skeleton *sk = memnew( Skeleton );
|
||||
int bone = 0;
|
||||
|
||||
for(int i=0;i<p_node->children.size();i++) {
|
||||
|
||||
_populate_skeleton(sk,p_node->children[i],bone,-1);
|
||||
}
|
||||
sk->localize_rests(); //after creating skeleton, rests must be localized...!
|
||||
skeleton_map[p_node]=sk;
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<p_node->children.size();i++) {
|
||||
|
||||
Error err = _create_scene_skeletons(p_node->children[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
|
||||
|
||||
Spatial * node=NULL;
|
||||
|
@ -297,15 +329,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
|
|||
} break;
|
||||
case Collada::Node::TYPE_SKELETON: {
|
||||
|
||||
Skeleton *sk = memnew( Skeleton );
|
||||
int bone = 0;
|
||||
|
||||
for(int i=0;i<p_node->children.size();i++) {
|
||||
|
||||
_populate_skeleton(sk,p_node->children[i],bone,-1);
|
||||
}
|
||||
sk->localize_rests(); //after creating skeleton, rests must be localized...!
|
||||
|
||||
ERR_FAIL_COND_V(!skeleton_map.has(p_node),ERR_CANT_CREATE);
|
||||
Skeleton *sk = skeleton_map[p_node];
|
||||
node=sk;
|
||||
} break;
|
||||
|
||||
|
@ -1502,6 +1527,9 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
|
|||
ERR_FAIL_COND_V( skeletons.empty(), ERR_INVALID_DATA );
|
||||
|
||||
String skname = skeletons[0];
|
||||
if (!node_map.has(skname)) {
|
||||
print_line("no node for skeleton "+skname);
|
||||
}
|
||||
ERR_FAIL_COND_V( !node_map.has(skname), ERR_INVALID_DATA );
|
||||
NodeMap nmsk = node_map[skname];
|
||||
Skeleton *sk = nmsk.node->cast_to<Skeleton>();
|
||||
|
@ -1518,8 +1546,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
|
|||
meshid=morph->mesh;
|
||||
}
|
||||
|
||||
if (apply_mesh_xform_to_vertices) {
|
||||
apply_xform=collada.fix_transform(p_node->default_transform);
|
||||
node->set_transform(Transform());
|
||||
} else {
|
||||
apply_xform=Transform();
|
||||
}
|
||||
|
||||
Collada::SkinControllerData::Source *joint_src=NULL;
|
||||
|
||||
|
@ -1615,6 +1647,16 @@ Error ColladaImport::load(const String& p_path,int p_flags,bool p_force_make_tan
|
|||
|
||||
}
|
||||
//import scene
|
||||
|
||||
for(int i=0;i<vs.root_nodes.size();i++) {
|
||||
|
||||
Error err = _create_scene_skeletons(vs.root_nodes[i]);
|
||||
if (err!=OK) {
|
||||
memdelete(scene);
|
||||
ERR_FAIL_COND_V(err,err);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<vs.root_nodes.size();i++) {
|
||||
|
||||
Error err = _create_scene(vs.root_nodes[i],scene);
|
||||
|
|
|
@ -1171,7 +1171,7 @@ class DaeExporter:
|
|||
|
||||
|
||||
def export_node(self,node,il):
|
||||
if (not self.is_node_valid(node)):
|
||||
if (not node in self.valid_nodes):
|
||||
return
|
||||
bpy.context.scene.objects.active = node
|
||||
|
||||
|
@ -1191,7 +1191,6 @@ class DaeExporter:
|
|||
elif (node.type=="LAMP"):
|
||||
self.export_lamp_node(node,il)
|
||||
|
||||
self.valid_nodes.append(node)
|
||||
for x in node.children:
|
||||
self.export_node(x,il)
|
||||
|
||||
|
@ -1203,6 +1202,7 @@ class DaeExporter:
|
|||
return False
|
||||
if (self.config["use_active_layers"]):
|
||||
valid=False
|
||||
print("NAME: "+node.name)
|
||||
for i in range(20):
|
||||
if (node.layers[i] and self.scene.layers[i]):
|
||||
valid=True
|
||||
|
@ -1222,8 +1222,21 @@ class DaeExporter:
|
|||
self.writel(S_NODES,0,'<library_visual_scenes>')
|
||||
self.writel(S_NODES,1,'<visual_scene id="'+self.scene_name+'" name="scene">')
|
||||
|
||||
#validate nodes
|
||||
for obj in self.scene.objects:
|
||||
if (obj.parent==None):
|
||||
if (obj in self.valid_nodes):
|
||||
continue
|
||||
if (self.is_node_valid(obj)):
|
||||
n = obj
|
||||
while (n!=None):
|
||||
if (not n in self.valid_nodes):
|
||||
self.valid_nodes.append(n)
|
||||
n=n.parent
|
||||
|
||||
|
||||
|
||||
for obj in self.scene.objects:
|
||||
if (obj in self.valid_nodes and obj.parent==None):
|
||||
self.export_node(obj,2)
|
||||
|
||||
self.writel(S_NODES,1,'</visual_scene>')
|
||||
|
|
|
@ -2,7 +2,6 @@ short_name="godot"
|
|||
name="Godot Engine"
|
||||
major=1
|
||||
minor=0
|
||||
revision="$Rev: 3917 $"
|
||||
status="beta1"
|
||||
status="rc1"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue