diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/SCsub | 2 | ||||
-rw-r--r-- | core/bind/SCsub | 2 | ||||
-rw-r--r-- | core/io/SCsub | 2 | ||||
-rw-r--r-- | core/io/json.cpp | 12 | ||||
-rw-r--r-- | core/math/SCsub | 2 | ||||
-rw-r--r-- | core/math/quat.h | 2 | ||||
-rw-r--r-- | core/os/SCsub | 2 | ||||
-rw-r--r-- | core/os/os.cpp | 11 | ||||
-rw-r--r-- | core/variant_call.cpp | 2 | ||||
-rw-r--r-- | core/variant_op.cpp | 18 |
10 files changed, 34 insertions, 21 deletions
diff --git a/core/SCsub b/core/SCsub index d04041141c..4ce91c794f 100644 --- a/core/SCsub +++ b/core/SCsub @@ -63,5 +63,3 @@ SConscript('bind/SCsub'); lib = env.Library("core",env.core_sources) env.Prepend(LIBS=[lib]) - - diff --git a/core/bind/SCsub b/core/bind/SCsub index c6ba1fa537..7b4a6acbc0 100644 --- a/core/bind/SCsub +++ b/core/bind/SCsub @@ -3,5 +3,3 @@ Import('env') env.add_source_files(env.core_sources,"*.cpp") Export('env') - - diff --git a/core/io/SCsub b/core/io/SCsub index 5aecb4b915..3ff9b355a4 100644 --- a/core/io/SCsub +++ b/core/io/SCsub @@ -5,5 +5,3 @@ env.add_source_files(env.core_sources,"*.c") #env.core_sources.append("io/fastlz.c") Export('env') - - diff --git a/core/io/json.cpp b/core/io/json.cpp index 14890abd26..22c99d0465 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -177,9 +177,6 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke case 'n': res=10; break; case 'f': res=12; break; case 'r': res=13; break; - case '\"': res='\"'; break; - case '\\': res='\\'; break; - case '/': res='/'; break; //wtf case 'u': { //hexnumbarh - oct is deprecated @@ -218,10 +215,13 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke } break; + //case '\"': res='\"'; break; + //case '\\': res='\\'; break; + //case '/': res='/'; break; default: { - - r_err_str="Invalid escape sequence"; - return ERR_PARSE_ERROR; + res = next; + //r_err_str="Invalid escape sequence"; + //return ERR_PARSE_ERROR; } break; } diff --git a/core/math/SCsub b/core/math/SCsub index c6ba1fa537..7b4a6acbc0 100644 --- a/core/math/SCsub +++ b/core/math/SCsub @@ -3,5 +3,3 @@ Import('env') env.add_source_files(env.core_sources,"*.cpp") Export('env') - - diff --git a/core/math/quat.h b/core/math/quat.h index de4aedaeec..f161e35074 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -73,7 +73,7 @@ public: -x * v.x - y * v.y - z * v.z); } - _FORCE_INLINE_ Vector3 xform(const Vector3& v) { + _FORCE_INLINE_ Vector3 xform(const Vector3& v) const { Quat q = *this * v; q *= this->inverse(); diff --git a/core/os/SCsub b/core/os/SCsub index c6ba1fa537..7b4a6acbc0 100644 --- a/core/os/SCsub +++ b/core/os/SCsub @@ -3,5 +3,3 @@ Import('env') env.add_source_files(env.core_sources,"*.cpp") Export('env') - - diff --git a/core/os/os.cpp b/core/os/os.cpp index ee9f12b79d..8caf95e4d1 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -61,9 +61,16 @@ void OS::debug_break() { void OS::print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type) { + const char* err_type; + switch(p_type) { + case ERR_ERROR: err_type="**ERROR**"; break; + case ERR_WARNING: err_type="**WARNING**"; break; + case ERR_SCRIPT: err_type="**SCRIPT ERROR**"; break; + } + if (p_rationale && *p_rationale) - print("**ERROR**: %s\n ",p_rationale); - print("**ERROR**: At: %s:%i:%s() - %s\n",p_file,p_line,p_function,p_code); + print("%s: %s\n ",err_type,p_rationale); + print("%s: At: %s:%i:%s() - %s\n",err_type,p_file,p_line,p_function,p_code); } void OS::print(const char* p_format, ...) { diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 222618ffa0..7bbb18225d 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -409,6 +409,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Quat,normalized); VCALL_LOCALMEM0R(Quat,inverse); VCALL_LOCALMEM1R(Quat,dot); + VCALL_LOCALMEM1R(Quat,xform); VCALL_LOCALMEM2R(Quat,slerp); VCALL_LOCALMEM2R(Quat,slerpni); VCALL_LOCALMEM4R(Quat,cubic_slerp); @@ -1361,6 +1362,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(QUAT,QUAT,Quat,normalized,varray()); ADDFUNC0(QUAT,QUAT,Quat,inverse,varray()); ADDFUNC1(QUAT,REAL,Quat,dot,QUAT,"b",varray()); + ADDFUNC1(QUAT,VECTOR3,Quat,xform,VECTOR3,"v",varray()); ADDFUNC2(QUAT,QUAT,Quat,slerp,QUAT,"b",REAL,"t",varray()); ADDFUNC2(QUAT,QUAT,Quat,slerpni,QUAT,"b",REAL,"t",varray()); ADDFUNC4(QUAT,QUAT,Quat,cubic_slerp,QUAT,"b",QUAT,"pre_a",QUAT,"post_b",REAL,"t",varray()); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 1cdf6d7319..eabd647837 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -586,7 +586,21 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& } break; DEFAULT_OP_LOCALMEM_NUM(*,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); - DEFAULT_OP_FAIL(QUAT); + case QUAT: { + + switch(p_b.type) { + case VECTOR3: { + + _RETURN( reinterpret_cast<const Quat*>(p_a._data._mem)->xform( *(const Vector3*)p_b._data._mem) ); + } break; + case QUAT: { + + _RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) * *reinterpret_cast<const Quat*>(p_b._data._mem) ); + } break; + }; + r_valid=false; + return; + } break; DEFAULT_OP_FAIL(_AABB); case MATRIX3: { @@ -2573,7 +2587,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { String idx=p_index; const String *str=reinterpret_cast<const String*>(_data._mem); - return str->find("idx")!=-1; + return str->find(idx)!=-1; } } break; |