Skip to content

Commit

Permalink
-fix bug in cache for atlas import/export
Browse files Browse the repository at this point in the history
-fix some menus
-fixed bug in out transition curves
-detect and remove file:/// in collada
-remove multiscript for now
-remove dependencies on mouse in OS, moved to Input
-avoid fscache from screwing up (fix might make it slower, but it works)
-funcref was missing, it's there now
  • Loading branch information
reduz committed Mar 14, 2014
1 parent a65edb4 commit 31ce3c5
Show file tree
Hide file tree
Showing 136 changed files with 10,782 additions and 1,576 deletions.
58 changes: 55 additions & 3 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ uint32_t _OS::get_ticks_msec() const {
return OS::get_singleton()->get_ticks_msec();
}


bool _OS::can_use_threads() const {

return OS::get_singleton()->can_use_threads();
}

bool _OS::can_draw() const {

return OS::get_singleton()->can_draw();
Expand Down Expand Up @@ -488,6 +494,27 @@ float _OS::get_frames_per_second() const {
return OS::get_singleton()->get_frames_per_second();
}

Error _OS::native_video_play(String p_path) {

return OS::get_singleton()->native_video_play(p_path);
};

bool _OS::native_video_is_playing() {

return OS::get_singleton()->native_video_is_playing();
};

void _OS::native_video_pause() {

OS::get_singleton()->native_video_pause();
};

void _OS::native_video_stop() {

OS::get_singleton()->native_video_stop();
};


String _OS::get_custom_level() const {

return OS::get_singleton()->get_custom_level();
Expand All @@ -496,7 +523,7 @@ _OS *_OS::singleton=NULL;

void _OS::_bind_methods() {

ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&_OS::get_mouse_pos);
//ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&_OS::get_mouse_pos);
//ObjectTypeDB::bind_method(_MD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled);

ObjectTypeDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard);
Expand Down Expand Up @@ -550,7 +577,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn);
ObjectTypeDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose);

ObjectTypeDB::bind_method(_MD("get_mouse_button_state"),&_OS::get_mouse_button_state);
ObjectTypeDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads);

//ObjectTypeDB::bind_method(_MD("get_mouse_button_state"),&_OS::get_mouse_button_state);

ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file);
ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file);
Expand All @@ -568,6 +597,12 @@ void _OS::_bind_methods() {

ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size);

ObjectTypeDB::bind_method(_MD("native_video_play"),&_OS::native_video_play);
ObjectTypeDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing);
ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop);
ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause);


BIND_CONSTANT( DAY_SUNDAY );
BIND_CONSTANT( DAY_MONDAY );
BIND_CONSTANT( DAY_TUESDAY );
Expand Down Expand Up @@ -983,8 +1018,22 @@ void _File::store_string(const String& p_string){

f->store_string(p_string);
}
void _File::store_line(const String& p_string){

void _File::store_pascal_string(const String& p_string) {

ERR_FAIL_COND(!f);

f->store_pascal_string(p_string);
};

String _File::get_pascal_string() {

ERR_FAIL_COND_V(!f, "");

return f->get_pascal_string();
};

void _File::store_line(const String& p_string){

ERR_FAIL_COND(!f);
f->store_line(p_string);
Expand Down Expand Up @@ -1083,6 +1132,9 @@ void _File::_bind_methods() {
ObjectTypeDB::bind_method(_MD("store_string","string"),&_File::store_string);
ObjectTypeDB::bind_method(_MD("store_var","value"),&_File::store_var);

ObjectTypeDB::bind_method(_MD("store_pascal_string","string"),&_File::store_pascal_string);
ObjectTypeDB::bind_method(_MD("get_pascal_string"),&_File::get_pascal_string);

ObjectTypeDB::bind_method(_MD("file_exists","path"),&_File::file_exists);

BIND_CONSTANT( READ );
Expand Down
9 changes: 9 additions & 0 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class _OS : public Object {
bool is_video_mode_resizable(int p_screen=0) const;
Array get_fullscreen_mode_list(int p_screen=0) const;

Error native_video_play(String p_path);
bool native_video_is_playing();
void native_video_pause();
void native_video_stop();

void set_iterations_per_second(int p_ips);
int get_iterations_per_second() const;

Expand Down Expand Up @@ -166,6 +171,7 @@ class _OS : public Object {
void delay_msec(uint32_t p_msec) const;
uint32_t get_ticks_msec() const;

bool can_use_threads() const;

bool can_draw() const;

Expand Down Expand Up @@ -280,6 +286,9 @@ class _File : public Reference {
void store_string(const String& p_string);
void store_line(const String& p_string);

virtual void store_pascal_string(const String& p_string);
virtual String get_pascal_string();

Vector<String> get_csv_line() const;


Expand Down
55 changes: 55 additions & 0 deletions core/func_ref.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "func_ref.h"

Variant FuncRef::call_func(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {

if (id==0) {
r_error.error=Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return Variant();
}
Object* obj = ObjectDB::get_instance(id);

if (!obj) {
r_error.error=Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return Variant();
}

return obj->call(function,p_args,p_argcount,r_error);

}

void FuncRef::set_instance(Object *p_obj){

ERR_FAIL_NULL(p_obj);
id=p_obj->get_instance_ID();
}
void FuncRef::set_function(const StringName& p_func){

function=p_func;
}

void FuncRef::_bind_methods() {

{
MethodInfo mi;
mi.name="call";
mi.arguments.push_back( PropertyInfo( Variant::STRING, "method"));
Vector<Variant> defargs;
for(int i=0;i<10;i++) {
mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i)));
defargs.push_back(Variant());
}
ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func",&FuncRef::call_func,mi,defargs);

}

ObjectTypeDB::bind_method(_MD("set_instance","instance"),&FuncRef::set_instance);
ObjectTypeDB::bind_method(_MD("set_function","name"),&FuncRef::set_function);

}


FuncRef::FuncRef(){

id=0;
}

23 changes: 23 additions & 0 deletions core/func_ref.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef FUNC_REF_H
#define FUNC_REF_H

#include "reference.h"

class FuncRef : public Reference{

OBJ_TYPE(FuncRef,Reference);
ObjectID id;
StringName function;

protected:

static void _bind_methods();
public:

Variant call_func(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
void set_instance(Object *p_obj);
void set_function(const StringName& p_func);
FuncRef();
};

#endif // FUNC_REF_H
23 changes: 10 additions & 13 deletions core/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ bool Globals::_get(const StringName& p_name,Variant &r_ret) const {

_THREAD_SAFE_METHOD_

const VariantContainer *v=props.getptr(p_name);
if (!v)
if (!props.has(p_name))
return false;
r_ret=v->variant;
r_ret=props[p_name].variant;
return true;

}
Expand All @@ -188,18 +187,17 @@ void Globals::_get_property_list(List<PropertyInfo> *p_list) const {

_THREAD_SAFE_METHOD_

const String *k=NULL;
Set<_VCSort> vclist;

while ((k=props.next(k))) {
for(Map<StringName,VariantContainer>::Element *E=props.front();E;E=E->next()) {

const VariantContainer *v=props.getptr(*k);
const VariantContainer *v=&E->get();

if (v->hide_from_editor)
continue;

_VCSort vc;
vc.name=*k;
vc.name=E->key();
vc.order=v->order;
vc.type=v->variant.get_type();
if (vc.name.begins_with("input/") || vc.name.begins_with("import/") || vc.name.begins_with("export/") || vc.name.begins_with("/remap") || vc.name.begins_with("/locale") || vc.name.begins_with("/autoload"))
Expand Down Expand Up @@ -1138,24 +1136,23 @@ Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const

ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER);

const String *k=NULL;
Set<_VCSort> vclist;

while ((k=props.next(k))) {
for(Map<StringName,VariantContainer>::Element *G=props.front();G;G=G->next()) {

const VariantContainer *v=props.getptr(*k);
const VariantContainer *v=&G->get();

if (v->hide_from_editor)
continue;

if (p_custom.has(*k))
if (p_custom.has(G->key()))
continue;

bool discard=false;

for(const Set<String>::Element *E=p_ignore_masks.front();E;E=E->next()) {

if ( (*k).match(E->get())) {
if ( String(G->key()).match(E->get())) {
discard=true;
break;
}
Expand All @@ -1165,7 +1162,7 @@ Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const
continue;

_VCSort vc;
vc.name=*k;
vc.name=G->key();//*k;
vc.order=v->order;
vc.type=v->variant.get_type();
vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE;
Expand Down
4 changes: 2 additions & 2 deletions core/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class Globals : public Object {
};

int last_order;
HashMap<String,VariantContainer> props;
Map<StringName,VariantContainer> props;
String resource_path;
HashMap<String,PropertyInfo> custom_prop_info;
Map<StringName,PropertyInfo> custom_prop_info;
bool disable_platform_override;
bool using_datapack;

Expand Down
1 change: 0 additions & 1 deletion core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
uint64_t size = f->get_64();
uint8_t md5[16];
f->get_buffer(md5,16);

PackedData::get_singleton()->add_path(p_path, path, ofs, size, md5,this);
};

Expand Down
Loading

0 comments on commit 31ce3c5

Please sign in to comment.