This commit is contained in:
Juan Linietsky 2015-06-30 11:59:33 -03:00
commit b4d5f7e154
13 changed files with 72 additions and 6 deletions

View file

@ -1149,6 +1149,12 @@ Error Globals::_save_settings_text(const String& p_file,const Map<String,List<St
return OK;
}
Error Globals::_save_custom_bnd(const String &p_file) { // add other params as dictionary and array?
return save_custom(p_file);
};
Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const Set<String>& p_ignore_masks) {
ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER);
@ -1361,6 +1367,9 @@ void Globals::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton);
ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object);
ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack);
ObjectTypeDB::bind_method(_MD("save_custom"),&Globals::_save_custom_bnd);
}
Globals::Globals() {

View file

@ -86,6 +86,7 @@ protected:
List<Singleton> singletons;
Error _save_custom_bnd(const String& p_file);
bool _load_resource_pack(const String& p_pack);

View file

@ -5,10 +5,12 @@
#include "print_string.h"
#define COMP_MAGIC 0x43454447
#include "core/variant.h"
#include <stdio.h>
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base,const Vector<uint8_t>& p_key,Mode p_mode) {
print_line("open and parse!");
//print_line("open and parse!");
ERR_FAIL_COND_V(file!=NULL,ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_key.size()!=32,ERR_INVALID_PARAMETER);

View file

@ -32,6 +32,7 @@
static PrintHandlerList *print_handler_list=NULL;
bool _print_line_enabled=true;
bool _print_error_enabled = true;
void add_print_handler(PrintHandlerList *p_handler) {

View file

@ -52,6 +52,7 @@ void add_print_handler(PrintHandlerList *p_handler);
void remove_print_handler(PrintHandlerList *p_handler);
extern bool _print_line_enabled;
extern bool _print_error_enabled;
extern void print_line(String p_string);
#endif

View file

@ -21,7 +21,7 @@ void AudioStreamSpeex::update() {
//printf("update, loops %i, read ofs %i\n", (int)loops, read_ofs);
//printf("playing %i, paused %i\n", (int)playing, (int)paused);
if (!playing || paused || !data.size())
if (!active || !playing || paused || !data.size())
return;
/*

View file

@ -57,8 +57,14 @@
#include <errno.h>
#include <assert.h>
#include "globals.h"
extern bool _print_error_enabled;
void OS_Unix::print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type) {
if (!_print_error_enabled)
return;
if (p_rationale && p_rationale[0]) {
print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_rationale);

View file

@ -605,6 +605,9 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
if (bool(Globals::get_singleton()->get("application/disable_stdout"))) {
quiet_stdout=true;
}
if (bool(Globals::get_singleton()->get("application/disable_stderr"))) {
_print_error_enabled = false;
};
if (quiet_stdout)
_print_line_enabled=false;

View file

@ -1977,9 +1977,17 @@ void GDScript::_bind_methods() {
ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo("new"));
ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
}
Vector<uint8_t> GDScript::get_as_byte_code() const {
GDTokenizerBuffer tokenizer;
return tokenizer.parse_code_string(source);
};
Error GDScript::load_byte_code(const String& p_path) {

View file

@ -349,6 +349,8 @@ public:
Error load_source_code(const String& p_path);
Error load_byte_code(const String& p_path);
Vector<uint8_t> get_as_byte_code() const;
virtual ScriptLanguage *get_language() const;
GDScript();

View file

@ -138,6 +138,29 @@ static int frame_count = 0;
Main::setup2();
++frame_count;
// this might be necessary before here
for (NSString* key in [[NSBundle mainBundle] infoDictionary]) {
NSObject* value = [xyz objectForKey:key];
String ukey = String::utf8([key UTF8String]);
// we need a NSObject to Variant conversor
if ([value isKindOfClass:[NSString class]]) {
NSString* str = (NSString*)value;
String uval = String::utf8([str UTF8String]);
Globals::get_singleton()->set("Info.plist/"+ukey, uval);
} else if ([value isKindOfClass:[NSNumber class]]) {
NSNumber* n = (NSNumber*)value;
double dval = [n doubleValue];
Globals::get_singleton()->set("Info.plist/"+ukey, dval);
};
// do stuff
}
} break;
/*
case 3: {

View file

@ -1718,7 +1718,7 @@ void Animation::clear() {
bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0,const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err,float p_alowed_angular_err,float p_max_optimizable_angle) {
bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0,const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err,float p_alowed_angular_err,float p_max_optimizable_angle,const Vector3& p_norm) {
real_t c = (t1.time-t0.time)/(t2.time-t0.time);
@ -1754,6 +1754,9 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0,const
return false; //beyond allowed error for colinearity
}
if (p_norm!=Vector3() && Math::acos(pd.normalized().dot(p_norm))>p_alowed_angular_err)
return false;
t[0] = (d1-d0)/(d2-d0);
}
}
@ -1905,16 +1908,21 @@ void Animation::_transform_track_optimize(int p_idx,float p_alowed_linear_err,fl
bool prev_erased=false;
TKey<TransformKey> first_erased;
Vector3 norm;
for(int i=1;i<tt->transforms.size()-1;i++) {
TKey<TransformKey> &t0 = tt->transforms[i-1];
TKey<TransformKey> &t1 = tt->transforms[i];
TKey<TransformKey> &t2 = tt->transforms[i+1];
bool erase = _transform_track_optimize_key(t0,t1,t2,p_alowed_linear_err,p_alowed_angular_err,p_max_optimizable_angle);
bool erase = _transform_track_optimize_key(t0,t1,t2,p_alowed_linear_err,p_alowed_angular_err,p_max_optimizable_angle,norm);
if (erase && !prev_erased) {
norm=(t2.value.loc-t1.value.loc).normalized();
}
if (prev_erased && !_transform_track_optimize_key(t0,first_erased,t2,p_alowed_linear_err,p_alowed_angular_err,p_max_optimizable_angle)) {
if (prev_erased && !_transform_track_optimize_key(t0,first_erased,t2,p_alowed_linear_err,p_alowed_angular_err,p_max_optimizable_angle,norm)) {
//avoid error to go beyond first erased key
erase=false;
}
@ -1932,9 +1940,11 @@ void Animation::_transform_track_optimize(int p_idx,float p_alowed_linear_err,fl
} else {
prev_erased=false;
norm=Vector3();
}
// print_line(itos(i)+" could be eliminated: "+rtos(tr));
//}
}

View file

@ -204,7 +204,7 @@ private:
return idxr;
}
bool _transform_track_optimize_key(const TKey<TransformKey> &t0,const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err,float p_alowed_angular_err,float p_max_optimizable_angle);
bool _transform_track_optimize_key(const TKey<TransformKey> &t0,const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err,float p_alowed_angular_err,float p_max_optimizable_angle,const Vector3& p_norm);
void _transform_track_optimize(int p_idx, float p_allowed_err=0.05, float p_alowed_angular_err=0.01,float p_max_optimizable_angle=Math_PI*0.125);
protected: