diff options
Diffstat (limited to 'modules')
38 files changed, 385 insertions, 823 deletions
diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp index 0b680b4fda..73d1c01e33 100644 --- a/modules/chibi/event_stream_chibi.cpp +++ b/modules/chibi/event_stream_chibi.cpp @@ -298,9 +298,9 @@ void CPSampleManagerImpl::unlock_data(CPSample_ID p_id){ sd->locks--; if (sd->locks==0) { - sd->w=DVector<uint8_t>::Write(); + sd->w=PoolVector<uint8_t>::Write(); AudioServer::get_singleton()->sample_set_data(sd->rid,sd->lock); - sd->lock=DVector<uint8_t>(); + sd->lock=PoolVector<uint8_t>(); } } diff --git a/modules/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h index 9c6c883f61..0244ee0a95 100644 --- a/modules/chibi/event_stream_chibi.h +++ b/modules/chibi/event_stream_chibi.h @@ -54,8 +54,8 @@ class CPSampleManagerImpl : public CPSampleManager { int loop_begin; int loop_end; int locks; - DVector<uint8_t> lock; - DVector<uint8_t>::Write w; + PoolVector<uint8_t> lock; + PoolVector<uint8_t>::Write w; CPSample_Loop_Type loop_type; }; diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h index b0465d8524..3bf86d1aeb 100644 --- a/modules/cscript/godot_c.h +++ b/modules/cscript/godot_c.h @@ -123,8 +123,8 @@ void GDAPI godot_array_free(godot_array p_array); #define INPUT_EVENT_TYPE_KEY 1 #define INPUT_EVENT_TYPE_MOUSE_MOTION 2 #define INPUT_EVENT_TYPE_MOUSE_BUTTON 3 -#define INPUT_EVENT_TYPE_JOYSTICK_MOTION 4 -#define INPUT_EVENT_TYPE_JOYSTICK_BUTTON 5 +#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4 +#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5 #define INPUT_EVENT_TYPE_SCREEN_TOUCH 6 #define INPUT_EVENT_TYPE_SCREEN_DRAG 7 #define INPUT_EVENT_TYPE_ACTION 8 @@ -166,12 +166,12 @@ int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_even int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event); int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event); -int GDAPI godot_input_event_joystick_motion_get_axis(godot_input_event p_event); -float GDAPI godot_input_event_joystick_motion_get_axis_value(godot_input_event p_event); +int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event); +float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event); -int GDAPI godot_input_event_joystick_button_get_button_index(godot_input_event p_event); -godot_bool GDAPI godot_input_event_joystick_button_is_pressed(godot_input_event p_event); -float GDAPI godot_input_event_joystick_button_get_pressure(godot_input_event p_event); +int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event); +godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event); +float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event); int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event); diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 598b2aab0e..1de98a6b1f 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -223,7 +223,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, // print_line("found format: "+String(dds_format_info[dds_format].name)); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; const DDSFormatInfo &info=dds_format_info[dds_format]; uint32_t w = width; @@ -247,9 +247,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else if (info.palette) { @@ -281,7 +281,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size + 256*colsize ); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); for(int i=0;i<256;i++) { @@ -296,7 +296,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else { //uncompressed generic... @@ -316,7 +316,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, size=size*2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); @@ -449,7 +449,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 4bbdc0a60a..845084fef7 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -37,10 +37,10 @@ static void _decompress_etc(Image *p_img) { int imgw = p_img->get_width(); int imgh = p_img->get_height(); - DVector<uint8_t> src=p_img->get_data(); - DVector<uint8_t> dst; + PoolVector<uint8_t> src=p_img->get_data(); + PoolVector<uint8_t> dst; - DVector<uint8_t>::Read r = src.read(); + PoolVector<uint8_t>::Read r = src.read(); int mmc=p_img->get_mipmap_count(); @@ -49,7 +49,7 @@ static void _decompress_etc(Image *p_img) { dst.resize(dst.size()+imgw*imgh*3); const uint8_t *srcbr=&r[p_img->get_mipmap_offset(i)]; - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); uint8_t *wptr = &w[dst.size()-imgw*imgh*3]; @@ -91,7 +91,7 @@ static void _decompress_etc(Image *p_img) { } - r=DVector<uint8_t>::Read(); + r=PoolVector<uint8_t>::Read(); //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps())); *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst); if (p_img->has_mipmaps()) @@ -117,9 +117,9 @@ static void _compress_etc(Image *p_img) { img.generate_mipmaps(); // force mipmaps, so it works on most hardware - DVector<uint8_t> res_data; - DVector<uint8_t> dst_data; - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t> res_data; + PoolVector<uint8_t> dst_data; + PoolVector<uint8_t>::Read r = img.get_data().read(); int mc=0; @@ -134,7 +134,7 @@ static void _compress_etc(Image *p_img) { const uint8_t *src = &r[img.get_mipmap_offset(i)]; int mmsize = MAX(bw,1)*MAX(bh,1)*8; dst_data.resize(dst_data.size()+mmsize); - DVector<uint8_t>::Write w=dst_data.write(); + PoolVector<uint8_t>::Write w=dst_data.write(); uint8_t *dst = &w[dst_data.size()-mmsize]; diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index f8af141979..42c9937b8f 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -43,13 +43,13 @@ RES ResourceFormatPKM::load(const String &p_path, const String& p_original_path, h.origWidth = f->get_16(); h.origHeight = f->get_16(); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; uint32_t size = h.texWidth * h.texHeight / 2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); int mipmaps = h.format; int width = h.origWidth; diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index fbd81a61bf..d3c3dac1fd 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -2155,6 +2155,27 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base case GDParser::COMPLETION_PARENT_FUNCTION: { } break; + case GDParser::COMPLETION_GET_NODE: { + + if (p_owner) { + List<String> opts; + p_owner->get_argument_options("get_node",0,&opts); + + for (List<String>::Element *E=opts.front();E;E=E->next()) { + + String opt = E->get().strip_edges(); + if (opt.begins_with("\"") && opt.ends_with("\"")) { + String idopt=opt.substr(1,opt.length()-2); + if (idopt.replace("/","_").is_valid_identifier()) { + options.insert(idopt); + } else { + options.insert(opt); + } + } + } + + } + } break; case GDParser::COMPLETION_METHOD: isfunction=true; case GDParser::COMPLETION_INDEX: { @@ -2370,8 +2391,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base "# Key", "# MouseMotion", "# MouseButton", - "# JoystickMotion", - "# JoystickButton", + "# JoypadMotion", + "# JoypadButton", "# ScreenTouch", "# ScreenDrag", "# Action" diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 74b804b206..64578e5f5c 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -35,6 +35,7 @@ #include "os/os.h" #include "variant_parser.h" #include "io/marshalls.h" +#include "io/json.h" const char *GDFunctions::get_func_name(Function p_func) { @@ -103,6 +104,9 @@ const char *GDFunctions::get_func_name(Function p_func) { "load", "inst2dict", "dict2inst", + "validate_json", + "parse_json", + "to_json", "hash", "Color8", "print_stack", @@ -846,6 +850,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va if (p_args[0]->get_type()!=Variant::STRING) { r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; + r_error.expected=Variant::STRING; r_ret=Variant(); } else { r_ret=ResourceLoader::load(*p_args[0]); @@ -1024,6 +1029,57 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va } } break; + case VALIDATE_JSON: { + + VALIDATE_ARG_COUNT(1); + + if (p_args[0]->get_type()!=Variant::STRING) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::STRING; + r_ret=Variant(); + return; + } + + String errs; + int errl; + + Error err = JSON::parse(*p_args[0],r_ret,errs,errl); + + if (err!=OK) { + r_ret=itos(errl)+":"+errs; + } else { + r_ret=""; + } + + } break; + case PARSE_JSON: { + + VALIDATE_ARG_COUNT(1); + + if (p_args[0]->get_type()!=Variant::STRING) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::STRING; + r_ret=Variant(); + return; + } + + String errs; + int errl; + + Error err = JSON::parse(*p_args[0],r_ret,errs,errl); + + if (err!=OK) { + r_ret=Variant(); + } + + } break; + case TO_JSON: { + VALIDATE_ARG_COUNT(1); + + r_ret = JSON::print(*p_args[0]); + } break; case HASH: { VALIDATE_ARG_COUNT(1); @@ -1510,6 +1566,24 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type=Variant::OBJECT; return mi; } break; + case VALIDATE_JSON: { + + MethodInfo mi("validate_json:Variant",PropertyInfo(Variant::STRING,"json")); + mi.return_val.type=Variant::STRING; + return mi; + } break; + case PARSE_JSON: { + + MethodInfo mi("parse_json:Variant",PropertyInfo(Variant::STRING,"json")); + mi.return_val.type=Variant::NIL; + return mi; + } break; + case TO_JSON: { + + MethodInfo mi("to_json",PropertyInfo(Variant::NIL,"var:Variant")); + mi.return_val.type=Variant::STRING; + return mi; + } break; case HASH: { MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:Variant")); diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index fb04527060..ab708e3ebe 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h @@ -97,6 +97,9 @@ public: RESOURCE_LOAD, INST2DICT, DICT2INST, + VALIDATE_JSON, + PARSE_JSON, + TO_JSON, HASH, COLOR8, PRINT_STACK, diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index bc9d3fa4f4..adf13e0a3b 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -265,6 +265,98 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ tokenizer->advance(); expr=subexpr; + } else if (tokenizer->get_token()==GDTokenizer::TK_DOLLAR) { + tokenizer->advance(); + + String path; + + bool need_identifier=true; + bool done=false; + + while(!done) { + + switch(tokenizer->get_token()) { + case GDTokenizer::TK_CURSOR: { + completion_cursor=StringName(); + completion_type=COMPLETION_GET_NODE; + completion_class=current_class; + completion_function=current_function; + completion_line=tokenizer->get_token_line(); + completion_cursor=path; + completion_argument=0; + completion_block=current_block; + completion_found=true; + tokenizer->advance(); + } break; + case GDTokenizer::TK_CONSTANT: { + + if (!need_identifier) { + done=true; + break; + } + + if (tokenizer->get_token_constant().get_type()!=Variant::STRING) { + _set_error("Expected string constant or identifier after '$' or '/'."); + return NULL; + } + + path+=String(tokenizer->get_token_constant()); + tokenizer->advance(); + need_identifier=false; + + } break; + case GDTokenizer::TK_IDENTIFIER: { + if (!need_identifier) { + done=true; + break; + } + + path+=String(tokenizer->get_token_identifier()); + tokenizer->advance(); + need_identifier=false; + + } break; + case GDTokenizer::TK_OP_DIV: { + + if (need_identifier) { + done=true; + break; + } + + path+="/"; + tokenizer->advance(); + need_identifier=true; + + } break; + default: { + done=true; + break; + } + } + } + + if (path=="") { + _set_error("Path expected after $."); + return NULL; + + } + + OperatorNode *op = alloc_node<OperatorNode>(); + op->op=OperatorNode::OP_CALL; + + op->arguments.push_back(alloc_node<SelfNode>()); + + IdentifierNode *funcname = alloc_node<IdentifierNode>(); + funcname->name="get_node"; + + op->arguments.push_back(funcname); + + ConstantNode *nodepath = alloc_node<ConstantNode>(); + nodepath->value = NodePath(StringName(path)); + op->arguments.push_back(nodepath); + + expr=op; + } else if (tokenizer->get_token()==GDTokenizer::TK_CURSOR) { tokenizer->advance(); continue; //no point in cursor in the middle of expression @@ -2576,7 +2668,7 @@ void GDParser::_parse_class(ClassNode *p_class) { if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") { - current_export.hint=PROPERTY_HINT_ALL_FLAGS; + //current_export.hint=PROPERTY_HINT_ALL_FLAGS; tokenizer->advance(); if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) { diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 1b4a37f67e..e8f5f0f981 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -376,6 +376,7 @@ public: enum CompletionType { COMPLETION_NONE, COMPLETION_BUILT_IN_TYPE_CONSTANT, + COMPLETION_GET_NODE, COMPLETION_FUNCTION, COMPLETION_IDENTIFIER, COMPLETION_PARENT_FUNCTION, diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b205a0a890..0b81780b0c 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -111,14 +111,29 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj /* STEP 2, INITIALIZE AND CONSRTUCT */ +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->lock(); +#endif + instances.insert(instance->owner); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->unlock(); +#endif + initializer->call(instance,p_args,p_argcount,r_error); if (r_error.error!=Variant::CallError::CALL_OK) { instance->script=Ref<GDScript>(); instance->owner->set_script_instance(NULL); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->lock(); +#endif instances.erase(p_owner); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->unlock(); +#endif + ERR_FAIL_COND_V(r_error.error!=Variant::CallError::CALL_OK, NULL); //error constructing } @@ -405,7 +420,16 @@ ScriptInstance* GDScript::instance_create(Object *p_this) { } bool GDScript::instance_has(const Object *p_this) const { - return instances.has((Object*)p_this); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->lock(); +#endif + bool hasit = instances.has((Object*)p_this); + +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->unlock(); +#endif + + return hasit; } bool GDScript::has_source_code() const { @@ -596,8 +620,16 @@ void GDScript::_set_subclass_path(Ref<GDScript>& p_sc,const String& p_path) { Error GDScript::reload(bool p_keep_state) { +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->lock(); +#endif + bool has_instances = instances.size(); + +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->unlock(); +#endif - ERR_FAIL_COND_V(!p_keep_state && instances.size(),ERR_ALREADY_IN_USE); + ERR_FAIL_COND_V(!p_keep_state && has_instances,ERR_ALREADY_IN_USE); String basedir=path; @@ -830,7 +862,7 @@ Error GDScript::load_byte_code(const String& p_path) { Error GDScript::load_source_code(const String& p_path) { - DVector<uint8_t> sourcef; + PoolVector<uint8_t> sourcef; Error err; FileAccess *f=FileAccess::open(p_path,FileAccess::READ,&err); if (err) { @@ -840,7 +872,7 @@ Error GDScript::load_source_code(const String& p_path) { int len = f->get_len(); sourcef.resize(len+1); - DVector<uint8_t>::Write w = sourcef.write(); + PoolVector<uint8_t>::Write w = sourcef.write(); int r = f->get_buffer(w.ptr(),len); f->close(); memdelete(f); @@ -1423,7 +1455,15 @@ GDInstance::GDInstance() { GDInstance::~GDInstance() { if (script.is_valid() && owner) { - script->instances.erase(owner); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->lock(); +#endif + + script->instances.erase(owner); +#ifndef NO_THREADS + GDScriptLanguage::singleton->lock->unlock(); +#endif + } } diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 7e572589c7..dec191c01e 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -294,11 +294,13 @@ class GDScriptLanguage : public ScriptLanguage { void _add_global(const StringName& p_name,const Variant& p_value); +friend class GDInstance; Mutex *lock; + friend class GDScript; SelfList<GDScript>::List script_list; diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 427b0cbf04..2b306a92fc 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -460,6 +460,9 @@ void GDTokenizerText::_advance() { case ':': _make_token(TK_COLON); //for methods maybe but now useless. break; + case '$': + _make_token(TK_DOLLAR); //for the get_node() shortener + break; case '^': { if (GETCHAR(1)=='=') { _make_token(TK_OP_ASSIGN_BIT_XOR); @@ -728,14 +731,14 @@ void GDTokenizerText::_advance() { INCPOS(str.length()); if (hexa_found) { - int val = str.hex_to_int(); + int64_t val = str.hex_to_int64(); _make_constant(val); } else if (period_found || exponent_found) { - real_t val = str.to_double(); + double val = str.to_double(); //print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val)); _make_constant(val); } else { - int val = str.to_int(); + int64_t val = str.to_int64(); _make_constant(val); } @@ -1057,7 +1060,7 @@ void GDTokenizerText::advance(int p_amount) { ////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BYTECODE_VERSION 11 +#define BYTECODE_VERSION 12 Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) { diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index 38b677ca7a..18e5547d36 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -123,6 +123,7 @@ public: TK_PERIOD, TK_QUESTION_MARK, TK_COLON, + TK_DOLLAR, TK_NEWLINE, TK_CONST_PI, TK_ERROR, diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 84d8250033..b934e7ab1b 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -61,9 +61,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name=="theme/bake") { set_bake(p_value); /* } else if (name=="cells") { - DVector<int> cells = p_value; + PoolVector<int> cells = p_value; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount&1,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -86,9 +86,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { baked=d["baked"]; if (d.has("cells")) { - DVector<int> cells = d["cells"]; + PoolVector<int> cells = d["cells"]; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount%3,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -183,10 +183,10 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<int> cells; + PoolVector<int> cells; cells.resize(cell_map.size()*3); { - DVector<int>::Write w = cells.write(); + PoolVector<int>::Write w = cells.write(); int i=0; for (Map<IndexKey,Cell>::Element *E=cell_map.front();E;E=E->next(),i++) { @@ -665,7 +665,7 @@ void GridMap::_octant_update(const OctantKey &p_key) { VS::get_singleton()->mesh_clear(g.collision_debug); } - DVector<Vector3> col_debug; + PoolVector<Vector3> col_debug; /* * foreach item in this octant, @@ -863,15 +863,15 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) continue; Array a = ii.mesh->surface_get_arrays(i); - DVector<Vector3> av=a[VS::ARRAY_VERTEX]; + PoolVector<Vector3> av=a[VS::ARRAY_VERTEX]; int avs = av.size(); - DVector<Vector3>::Read vr = av.read(); + PoolVector<Vector3>::Read vr = av.read(); - DVector<int> ai=a[VS::ARRAY_INDEX]; + PoolVector<int> ai=a[VS::ARRAY_INDEX]; int ais=ai.size(); if (ais) { - DVector<int>::Read ir=ai.read(); + PoolVector<int>::Read ir=ai.read(); for(int j=0;j<ais;j++) { p_prebake->push_back(xform.xform(vr[ir[j]])); @@ -1667,7 +1667,7 @@ void GridMap::bake_geometry() { } - DVector<Vector3> vv; + PoolVector<Vector3> vv; vv.fill_with(vertices); //print_line("TOTAL VERTICES: "+itos(vv.size())); tmesh = Ref<TriangleMesh>( memnew( TriangleMesh )); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 08f2c4fbbc..d8409af634 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1126,7 +1126,7 @@ void GridMapEditor::_update_areas_display() { RID mesh = VisualServer::get_singleton()->mesh_create(); - DVector<Plane> planes; + PoolVector<Plane> planes; for(int i=0;i<3;i++) { Vector3 axis; @@ -1257,7 +1257,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { settings_vbc = memnew(VBoxContainer); settings_vbc->set_custom_minimum_size(Size2(200, 0)); settings_dialog->add_child(settings_vbc); - settings_dialog->set_child_rect(settings_vbc); settings_pick_distance = memnew(SpinBox); settings_pick_distance->set_max(10000.0f); @@ -1267,7 +1266,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance); clip_mode=CLIP_DISABLED; - options->get_popup()->connect("item_pressed", this,"_menu_option"); + options->get_popup()->connect("id_pressed", this,"_menu_option"); HBoxContainer *hb = memnew( HBoxContainer ); add_child(hb); @@ -1343,8 +1342,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { //selection mesh create - DVector<Vector3> lines; - DVector<Vector3> triangles; + PoolVector<Vector3> lines; + PoolVector<Vector3> triangles; for (int i=0;i<6;i++) { diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 9709c0c706..1152d42e1b 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -56,11 +56,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ const int dst_bpl = image_width * comps; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(dst_bpl * image_height); - DVector<uint8_t>::Write dw = data.write(); + PoolVector<uint8_t>::Write dw = data.write(); jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr(); @@ -88,7 +88,7 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ else fmt=Image::FORMAT_RGBA8; - dw = DVector<uint8_t>::Write(); + dw = PoolVector<uint8_t>::Write(); p_image->create(image_width,image_height,0,fmt,data); return OK; @@ -99,12 +99,12 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { - DVector<uint8_t> src_image; + PoolVector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); src_image.resize(src_image_len); - DVector<uint8_t>::Write w = src_image.write(); + PoolVector<uint8_t>::Write w = src_image.write(); f->get_buffer(&w[0],src_image_len); @@ -113,7 +113,7 @@ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); return err; diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub deleted file mode 100644 index 76b7cbea7a..0000000000 --- a/modules/mpc/SCsub +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python - -Import('env') -Import('env_modules') - -env_mpc = env_modules.Clone() - -# Thirdparty source files -if (env['builtin_libmpcdec'] != 'no'): - thirdparty_dir = "#thirdparty/libmpcdec/" - thirdparty_sources = [ - "huffman.c", - "mpc_bits_reader.c", - "mpc_decoder.c", - "mpc_demux.c", - "mpc_reader.c", - "requant.c", - "streaminfo.c", - "synth_filter.c", - ] - - thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - - env_mpc.add_source_files(env.modules_sources, thirdparty_sources) - env_mpc.Append(CPPPATH=[thirdparty_dir]) - -# Godot source files -env_mpc.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp deleted file mode 100644 index d8572d3b5d..0000000000 --- a/modules/mpc/audio_stream_mpc.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/*************************************************************************/ -/* audio_stream_mpc.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "audio_stream_mpc.h" - - -Error AudioStreamPlaybackMPC::_open_file() { - - if (f) { - memdelete(f); - f=NULL; - } - Error err; - //printf("mpc open file %ls\n", file.c_str()); - f=FileAccess::open(file,FileAccess::READ,&err); - - if (err) { - f=NULL; - ERR_FAIL_V(err); - return err; - } - - //printf("file size is %i\n", f->get_len()); - //f->seek_end(0); - streamlen=f->get_len(); - //f->seek(0); - if (streamlen<=0) { - memdelete(f); - f=NULL; - ERR_FAIL_V(ERR_INVALID_DATA); - } - - data_ofs=0; - if (preload) { - - data.resize(streamlen); - DVector<uint8_t>::Write w = data.write(); - f->get_buffer(&w[0],streamlen); - memdelete(f); - f=NULL; - - } - - return OK; -} - -void AudioStreamPlaybackMPC::_close_file() { - - if (f) { - memdelete(f); - f=NULL; - } - data.resize(0); - streamlen=0; - data_ofs=0; -} - -int AudioStreamPlaybackMPC::_read_file(void *p_dst,int p_bytes) { - - if (f) - return f->get_buffer((uint8_t*)p_dst,p_bytes); - - DVector<uint8_t>::Read r = data.read(); - if (p_bytes+data_ofs > streamlen) { - p_bytes=streamlen-data_ofs; - } - - copymem(p_dst,&r[data_ofs],p_bytes); - //print_line("read file: "+itos(p_bytes)); - data_ofs+=p_bytes; - return p_bytes; -} - -bool AudioStreamPlaybackMPC::_seek_file(int p_pos){ - - if (p_pos<0 || p_pos>streamlen) - return false; - - if (f) { - f->seek(p_pos); - return true; - } - - //print_line("read file to: "+itos(p_pos)); - data_ofs=p_pos; - return true; - -} -int AudioStreamPlaybackMPC::_tell_file() const{ - - if (f) - return f->get_pos(); - - //print_line("tell file, get: "+itos(data_ofs)); - return data_ofs; - -} - -int AudioStreamPlaybackMPC::_sizeof_file() const{ - - //print_line("sizeof file, get: "+itos(streamlen)); - return streamlen; -} - -bool AudioStreamPlaybackMPC::_canseek_file() const{ - - //print_line("canseek file, get true"); - return true; -} - -///////////////////// - -mpc_int32_t AudioStreamPlaybackMPC::_mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes) { - - AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data; - return smpc->_read_file(p_dst,p_bytes); -} - -mpc_bool_t AudioStreamPlaybackMPC::_mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset) { - - AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data; - return smpc->_seek_file(p_offset); - -} -mpc_int32_t AudioStreamPlaybackMPC::_mpc_tell(mpc_reader *p_reader) { - - AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data; - return smpc->_tell_file(); - -} -mpc_int32_t AudioStreamPlaybackMPC::_mpc_get_size(mpc_reader *p_reader) { - - AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data; - return smpc->_sizeof_file(); - - -} -mpc_bool_t AudioStreamPlaybackMPC::_mpc_canseek(mpc_reader *p_reader) { - - AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data; - return smpc->_canseek_file(); -} - - - - -int AudioStreamPlaybackMPC::mix(int16_t* p_bufer,int p_frames) { - - if (!active || paused) - return 0; - - int todo=p_frames; - - while(todo>MPC_DECODER_BUFFER_LENGTH/si.channels) { - - mpc_frame_info frame; - - frame.buffer=sample_buffer; - - mpc_status err = mpc_demux_decode(demux, &frame); - if (frame.bits!=-1) { - - int16_t *dst_buff = p_bufer; - -#ifdef MPC_FIXED_POINT - - for( int i = 0; i < frame.samples * si.channels; i++) { - int tmp = sample_buffer[i] >> MPC_FIXED_POINT_FRACTPART; - if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1); - if (tmp < -(1 << 15)) tmp = -(1 << 15); - dst_buff[i] = tmp; - } -#else - for( int i = 0; i < frame.samples * si.channels; i++) { - - int tmp = Math::fast_ftoi(sample_buffer[i]*32767.0); - if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1); - if (tmp < -(1 << 15)) tmp = -(1 << 15); - dst_buff[i] = tmp; - - } - -#endif - - int frames = frame.samples; - p_bufer+=si.channels*frames; - todo-=frames; - } else { - - if (err != MPC_STATUS_OK) { - - stop(); - ERR_PRINT("Error decoding MPC"); - break; - } else { - - //finished - if (!loop) { - stop(); - break; - } else { - - - loops++; - mpc_demux_exit(demux); - _seek_file(0); - demux = mpc_demux_init(&reader); - //do loop somehow - - } - } - } - } - - return p_frames-todo; -} - -Error AudioStreamPlaybackMPC::_reload() { - - ERR_FAIL_COND_V(demux!=NULL, ERR_FILE_ALREADY_IN_USE); - - Error err = _open_file(); - ERR_FAIL_COND_V(err!=OK,ERR_CANT_OPEN); - - demux = mpc_demux_init(&reader); - ERR_FAIL_COND_V(!demux,ERR_CANT_CREATE); - mpc_demux_get_info(demux, &si); - - return OK; -} - -void AudioStreamPlaybackMPC::set_file(const String& p_file) { - - file=p_file; - - Error err = _open_file(); - ERR_FAIL_COND(err!=OK); - demux = mpc_demux_init(&reader); - ERR_FAIL_COND(!demux); - mpc_demux_get_info(demux, &si); - stream_min_size=MPC_DECODER_BUFFER_LENGTH*2/si.channels; - stream_rate=si.sample_freq; - stream_channels=si.channels; - - mpc_demux_exit(demux); - demux=NULL; - _close_file(); - -} - - -String AudioStreamPlaybackMPC::get_file() const { - - return file; -} - - -void AudioStreamPlaybackMPC::play(float p_offset) { - - - if (active) - stop(); - active=false; - - Error err = _open_file(); - ERR_FAIL_COND(err!=OK); - if (_reload()!=OK) - return; - active=true; - loops=0; - -} - -void AudioStreamPlaybackMPC::stop() { - - - if (!active) - return; - if (demux) { - mpc_demux_exit(demux); - demux=NULL; - } - _close_file(); - active=false; - -} -bool AudioStreamPlaybackMPC::is_playing() const { - - return active; -} - - -void AudioStreamPlaybackMPC::set_loop(bool p_enable) { - - loop=p_enable; -} -bool AudioStreamPlaybackMPC::has_loop() const { - - return loop; -} - -float AudioStreamPlaybackMPC::get_length() const { - - return 0; -} - -String AudioStreamPlaybackMPC::get_stream_name() const { - - return ""; -} - -int AudioStreamPlaybackMPC::get_loop_count() const { - - return 0; -} - -float AudioStreamPlaybackMPC::get_pos() const { - - return 0; -} -void AudioStreamPlaybackMPC::seek_pos(float p_time) { - - -} - - -void AudioStreamPlaybackMPC::_bind_methods() { - - ClassDB::bind_method(_MD("set_file","name"),&AudioStreamPlaybackMPC::set_file); - ClassDB::bind_method(_MD("get_file"),&AudioStreamPlaybackMPC::get_file); - - ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"file",PROPERTY_HINT_FILE,"mpc"), _SCS("set_file"), _SCS("get_file")); - -} - -AudioStreamPlaybackMPC::AudioStreamPlaybackMPC() { - - preload=false; - f=NULL; - streamlen=0; - data_ofs=0; - active=false; - paused=false; - loop=false; - demux=NULL; - reader.data=this; - reader.read=_mpc_read; - reader.seek=_mpc_seek; - reader.tell=_mpc_tell; - reader.get_size=_mpc_get_size; - reader.canseek=_mpc_canseek; - loops=0; - -} - -AudioStreamPlaybackMPC::~AudioStreamPlaybackMPC() { - - stop(); - - if (f) - memdelete(f); -} - - - -RES ResourceFormatLoaderAudioStreamMPC::load(const String &p_path, const String& p_original_path, Error *r_error) { - if (r_error) - *r_error=OK; //streamed so it will always work.. - AudioStreamMPC *mpc_stream = memnew(AudioStreamMPC); - mpc_stream->set_file(p_path); - return Ref<AudioStreamMPC>(mpc_stream); -} - -void ResourceFormatLoaderAudioStreamMPC::get_recognized_extensions(List<String> *p_extensions) const { - - p_extensions->push_back("mpc"); -} -bool ResourceFormatLoaderAudioStreamMPC::handles_type(const String& p_type) const { - - return (p_type=="AudioStream") || (p_type=="AudioStreamMPC"); -} - -String ResourceFormatLoaderAudioStreamMPC::get_resource_type(const String &p_path) const { - - if (p_path.extension().to_lower()=="mpc") - return "AudioStreamMPC"; - return ""; -} - diff --git a/modules/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h deleted file mode 100644 index e7d677aa8c..0000000000 --- a/modules/mpc/audio_stream_mpc.h +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************/ -/* audio_stream_mpc.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef AUDIO_STREAM_MPC_H -#define AUDIO_STREAM_MPC_H - -#include "io/resource_loader.h" -#include "os/file_access.h" -#include "os/thread_safe.h" -#include "scene/resources/audio_stream.h" - -#include <mpc/mpcdec.h> - -class AudioStreamPlaybackMPC : public AudioStreamPlayback { - - GDCLASS( AudioStreamPlaybackMPC, AudioStreamPlayback ); - - bool preload; - FileAccess *f; - String file; - DVector<uint8_t> data; - int data_ofs; - int streamlen; - - - bool active; - bool paused; - bool loop; - int loops; - - // mpc - mpc_reader reader; - mpc_demux* demux; - mpc_streaminfo si; - MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; - - static mpc_int32_t _mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes); - static mpc_bool_t _mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset); - static mpc_int32_t _mpc_tell(mpc_reader *p_reader); - static mpc_int32_t _mpc_get_size(mpc_reader *p_reader); - static mpc_bool_t _mpc_canseek(mpc_reader *p_reader); - - int stream_min_size; - int stream_rate; - int stream_channels; - -protected: - Error _open_file(); - void _close_file(); - int _read_file(void *p_dst,int p_bytes); - bool _seek_file(int p_pos); - int _tell_file() const; - int _sizeof_file() const; - bool _canseek_file() const; - - - Error _reload(); - static void _bind_methods(); - -public: - - void set_file(const String& p_file); - String get_file() const; - - virtual void play(float p_offset=0); - virtual void stop(); - virtual bool is_playing() const; - - - virtual void set_loop(bool p_enable); - virtual bool has_loop() const; - - virtual float get_length() const; - - virtual String get_stream_name() const; - - virtual int get_loop_count() const; - - virtual float get_pos() const; - virtual void seek_pos(float p_time); - - virtual int get_channels() const { return stream_channels; } - virtual int get_mix_rate() const { return stream_rate; } - - virtual int get_minimum_buffer_size() const { return stream_min_size; } - virtual int mix(int16_t* p_bufer,int p_frames); - - virtual void set_loop_restart_time(float p_time) { } - - AudioStreamPlaybackMPC(); - ~AudioStreamPlaybackMPC(); -}; - -class AudioStreamMPC : public AudioStream { - - GDCLASS( AudioStreamMPC, AudioStream ); - - String file; -public: - - Ref<AudioStreamPlayback> instance_playback() { - Ref<AudioStreamPlaybackMPC> pb = memnew( AudioStreamPlaybackMPC ); - pb->set_file(file); - return pb; - } - - void set_file(const String& p_file) { file=p_file; } - - -}; - -class ResourceFormatLoaderAudioStreamMPC : public ResourceFormatLoader { -public: - virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String& p_type) const; - virtual String get_resource_type(const String &p_path) const; - -}; - -#endif // AUDIO_STREAM_MPC_H diff --git a/modules/mpc/config.py b/modules/mpc/config.py deleted file mode 100644 index fb920482f5..0000000000 --- a/modules/mpc/config.py +++ /dev/null @@ -1,7 +0,0 @@ - -def can_build(platform): - return True - - -def configure(env): - pass diff --git a/modules/mpc/register_types.cpp b/modules/mpc/register_types.cpp deleted file mode 100644 index df058916bb..0000000000 --- a/modules/mpc/register_types.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************/ -/* register_types.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "register_types.h" - -#include "audio_stream_mpc.h" - -static ResourceFormatLoaderAudioStreamMPC* mpc_stream_loader = NULL; - -void register_mpc_types() { - - mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC ); - ResourceLoader::add_resource_format_loader(mpc_stream_loader); - ClassDB::register_class<AudioStreamMPC>(); -} - -void unregister_mpc_types() { - - memdelete( mpc_stream_loader ); -} diff --git a/modules/mpc/register_types.h b/modules/mpc/register_types.h deleted file mode 100644 index d1e692f254..0000000000 --- a/modules/mpc/register_types.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************/ -/* register_types.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -void register_mpc_types(); -void unregister_mpc_types(); diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index f9fc19b2cc..6caaf10334 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -31,11 +31,11 @@ #include "scene/resources/bit_mask.h" -static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { +static bool _get_token(FileAccessRef& f,uint8_t &saved,PoolVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { int token_max = r_token.size(); - DVector<uint8_t>::Write w; + PoolVector<uint8_t>::Write w; if (token_max) w=r_token.write(); int ofs=0; @@ -53,7 +53,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token } if (f->eof_reached()) { if (ofs) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); return true; } else { @@ -81,7 +81,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token if (ofs && !p_single_chunk) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); saved=b; @@ -98,7 +98,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token resized=true; } if (resized) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(token_max); w=r_token.write(); } @@ -109,10 +109,10 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token return false; } -static int _get_number_from_token(DVector<uint8_t>& r_token) { +static int _get_number_from_token(PoolVector<uint8_t>& r_token) { int len = r_token.size(); - DVector<uint8_t>::Read r = r_token.read(); + PoolVector<uint8_t>::Read r = r_token.read(); return String::to_int((const char*)r.ptr(),len); } @@ -133,7 +133,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E if (!f) _RETURN(ERR_CANT_OPEN); - DVector<uint8_t> token; + PoolVector<uint8_t> token; if (!_get_token(f,saved,token)) { _RETURN(ERR_PARSE_ERROR); @@ -186,7 +186,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { @@ -210,7 +210,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); int bitwidth = width; if (bitwidth % 8) bitwidth+=8-(bitwidth%8); diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 0b07e05410..9f8db98e05 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -99,13 +99,13 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E print_line("surfcount: "+itos(surfcount)); */ - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(surfsize); ERR_FAIL_COND_V(data.size()==0,RES()); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(&w[0],surfsize); err = f->get_error(); ERR_FAIL_COND_V(err!=OK,RES()); @@ -151,7 +151,7 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E } - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); int tex_flags=Texture::FLAG_FILTER|Texture::FLAG_REPEAT; @@ -209,10 +209,10 @@ static void _compress_pvrtc4(Image * p_img) { Image new_img; new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4); - DVector<uint8_t> data=new_img.get_data(); + PoolVector<uint8_t> data=new_img.get_data(); { - DVector<uint8_t>::Write wr=data.write(); - DVector<uint8_t>::Read r=img.get_data().read(); + PoolVector<uint8_t>::Write wr=data.write(); + PoolVector<uint8_t>::Read r=img.get_data().read(); for(int i=0;i<=new_img.get_mipmap_count();i++) { @@ -677,13 +677,13 @@ static void _pvrtc_decompress(Image* p_img) { bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A ); - DVector<uint8_t> data = p_img->get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = p_img->get_data(); + PoolVector<uint8_t>::Read r = data.read(); - DVector<uint8_t> newdata; + PoolVector<uint8_t> newdata; newdata.resize( p_img->get_width() * p_img->get_height() * 4); - DVector<uint8_t>::Write w=newdata.write(); + PoolVector<uint8_t>::Write w=newdata.write(); decompress_pvrtc((PVRTCBlock*)r.ptr(),_2bit,p_img->get_width(),p_img->get_height(),0,(unsigned char*)w.ptr()); @@ -691,8 +691,8 @@ static void _pvrtc_decompress(Image* p_img) { // print_line(itos(w[i])); //} - w=DVector<uint8_t>::Write(); - r=DVector<uint8_t>::Read(); + w=PoolVector<uint8_t>::Write(); + r=PoolVector<uint8_t>::Read(); bool make_mipmaps=p_img->has_mipmaps(); Image newimg(p_img->get_width(),p_img->get_height(),false,Image::FORMAT_RGBA8,newdata); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 6cd9048f1b..7410658603 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -66,12 +66,12 @@ void image_compress_squish(Image *p_image) { int mm_count = p_image->get_mipmap_count(); - DVector<uint8_t> data; + PoolVector<uint8_t> data; int target_size = Image::get_image_data_size(w,h,target_format,mm_count); data.resize(target_size); - DVector<uint8_t>::Read rb = p_image->get_data().read(); - DVector<uint8_t>::Write wb = data.write(); + PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + PoolVector<uint8_t>::Write wb = data.write(); int dst_ofs=0; @@ -84,8 +84,8 @@ void image_compress_squish(Image *p_image) { h>>=1; } - rb = DVector<uint8_t>::Read(); - wb = DVector<uint8_t>::Write(); + rb = PoolVector<uint8_t>::Read(); + wb = PoolVector<uint8_t>::Write(); p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index e6bf55185e..b847f17bb7 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -88,7 +88,7 @@ void VideoStreamPlaybackTheora::video_write(void){ { int pixels = size.x * size.y; frame_data.resize(pixels * 4); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); int p = 0; for (int i=0; i<size.y; i++) { @@ -112,7 +112,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); //uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2); @@ -143,7 +143,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 3; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); for(int i=0;i<size.y;i++) { @@ -174,7 +174,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); @@ -208,7 +208,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 2; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index bff9d2538d..0e1f5fa864 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -51,7 +51,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { //Image frames[MAX_FRAMES]; Image::Format format; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; int frames_pending; FileAccess* file; String file_name; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 340db21c32..d030dcc2cb 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -24,8 +24,6 @@ friend class VisualScript; void validate_input_default_values(); protected: - virtual bool _use_builtin_script() const { return false; } - void _notification(int p_what); void ports_changed_notify(); static void _bind_methods(); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 91c22fc02b..c359c02205 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3306,7 +3306,7 @@ VisualScriptEditor::VisualScriptEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/cut_nodes"), EDIT_CUT_NODES); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/paste_nodes"), EDIT_PASTE_NODES); - edit_menu->get_popup()->connect("item_pressed",this,"_menu_option"); + edit_menu->get_popup()->connect("id_pressed",this,"_menu_option"); main_hsplit = memnew( HSplitContainer ); add_child(main_hsplit); @@ -3422,7 +3422,7 @@ VisualScriptEditor::VisualScriptEditor() { edit_signal_edit = memnew( PropertyEditor ); edit_signal_edit->hide_top_label(); edit_signal_dialog->add_child(edit_signal_edit); - edit_signal_dialog->set_child_rect(edit_signal_edit); + edit_signal_edit->edit(signal_editor); edit_variable_dialog = memnew( AcceptDialog ); @@ -3434,7 +3434,7 @@ VisualScriptEditor::VisualScriptEditor() { edit_variable_edit = memnew( PropertyEditor ); edit_variable_edit->hide_top_label(); edit_variable_dialog->add_child(edit_variable_edit); - edit_variable_dialog->set_child_rect(edit_variable_edit); + edit_variable_edit->edit(variable_editor); select_base_type=memnew(CreateDialog); @@ -3446,7 +3446,7 @@ VisualScriptEditor::VisualScriptEditor() { undo_redo = EditorNode::get_singleton()->get_undo_redo(); new_function_menu = memnew( PopupMenu ); - new_function_menu->connect("item_pressed",this,"_override_pressed"); + new_function_menu->connect("id_pressed",this,"_override_pressed"); add_child(new_function_menu); updating_members=false; @@ -3468,7 +3468,7 @@ VisualScriptEditor::VisualScriptEditor() { port_action_popup = memnew( PopupMenu ); add_child(port_action_popup); - port_action_popup->connect("item_pressed",this,"_port_action_menu"); + port_action_popup->connect("id_pressed",this,"_port_action_menu"); } diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index bc980d5b25..0e526f8a42 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -871,9 +871,9 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const } break; - case InputEvent::JOYSTICK_MOTION: { + case InputEvent::JOYPAD_MOTION: { - InputEventJoystickMotion jm = filters[p_port].joy_motion; + InputEventJoypadMotion jm = filters[p_port].joy_motion; text="JoyMotion Axis "+itos(jm.axis>>1); if (jm.axis&1) @@ -882,8 +882,8 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const text+=" < "+rtos(-jm.axis_value); } break; - case InputEvent::JOYSTICK_BUTTON: { - InputEventJoystickButton jb = filters[p_port].joy_button; + case InputEvent::JOYPAD_BUTTON: { + InputEventJoypadButton jb = filters[p_port].joy_button; text="JoyButton "+itos(jb.button_index); if (jb.pressed) @@ -985,13 +985,13 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va if (what=="type") { filters[idx]=InputEvent(); filters[idx].type=InputEvent::Type(int(p_value)); - if (filters[idx].type==InputEvent::JOYSTICK_MOTION) { + if (filters[idx].type==InputEvent::JOYPAD_MOTION) { filters[idx].joy_motion.axis_value=0.5; //for treshold } else if (filters[idx].type==InputEvent::KEY) { filters[idx].key.pressed=true; //put these as true to make it more user friendly } else if (filters[idx].type==InputEvent::MOUSE_BUTTON) { filters[idx].mouse_button.pressed=true; - } else if (filters[idx].type==InputEvent::JOYSTICK_BUTTON) { + } else if (filters[idx].type==InputEvent::JOYPAD_BUTTON) { filters[idx].joy_button.pressed=true; } else if (filters[idx].type==InputEvent::SCREEN_TOUCH) { filters[idx].screen_touch.pressed=true; @@ -1108,7 +1108,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va return true; } break; - case InputEvent::JOYSTICK_MOTION: { + case InputEvent::JOYPAD_MOTION: { if (what=="axis") { filters[idx].joy_motion.axis=int(p_value)<<1|filters[idx].joy_motion.axis; @@ -1124,7 +1124,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va } break; - case InputEvent::JOYSTICK_BUTTON: { + case InputEvent::JOYPAD_BUTTON: { if (what=="button_index") { filters[idx].joy_button.button_index=p_value; @@ -1326,7 +1326,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons return true; } break; - case InputEvent::JOYSTICK_MOTION: { + case InputEvent::JOYPAD_MOTION: { if (what=="axis_index") { r_ret=filters[idx].joy_motion.axis>>1; @@ -1341,7 +1341,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons } break; - case InputEvent::JOYSTICK_BUTTON: { + case InputEvent::JOYPAD_BUTTON: { if (what=="button_index") { r_ret=filters[idx].joy_button.button_index; @@ -1417,8 +1417,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={ "Key", "MouseMotion", "MouseButton", - "JoystickMotion", - "JoystickButton", + "JoypadMotion", + "JoypadButton", "ScreenTouch", "ScreenDrag", "Action" @@ -1489,13 +1489,13 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co p_list->push_back(PropertyInfo(Variant::BOOL,base+"mod_meta")); } break; - case InputEvent::JOYSTICK_MOTION: { + case InputEvent::JOYPAD_MOTION: { p_list->push_back(PropertyInfo(Variant::INT,base+"axis_index")); p_list->push_back(PropertyInfo(Variant::INT,base+"mode",PROPERTY_HINT_ENUM,"Min,Max")); p_list->push_back(PropertyInfo(Variant::REAL,base+"treshold",PROPERTY_HINT_RANGE,"0,1,0.01")); } break; - case InputEvent::JOYSTICK_BUTTON: { + case InputEvent::JOYPAD_BUTTON: { p_list->push_back(PropertyInfo(Variant::INT,base+"button_index")); p_list->push_back(PropertyInfo(Variant::BOOL,base+"pressed")); @@ -1632,10 +1632,10 @@ public: } break; - case InputEvent::JOYSTICK_MOTION: { + case InputEvent::JOYPAD_MOTION: { - InputEventJoystickMotion jm = ie.joy_motion; - InputEventJoystickMotion jm2 = event.joy_motion; + InputEventJoypadMotion jm = ie.joy_motion; + InputEventJoypadMotion jm2 = event.joy_motion; int axis = jm.axis>>1; @@ -1656,9 +1656,9 @@ public: } break; - case InputEvent::JOYSTICK_BUTTON: { - InputEventJoystickButton jb = ie.joy_button; - InputEventJoystickButton jb2 = event.joy_button; + case InputEvent::JOYPAD_BUTTON: { + InputEventJoypadButton jb = ie.joy_button; + InputEventJoypadButton jb2 = event.joy_button; if ( jb.button_index==jb2.button_index && jb.pressed == jb2.pressed diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index bf2b4016c7..9f3ba8a8cb 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -971,8 +971,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={ "Key", "MouseMotion", "MouseButton", - "JoystickMotion", - "JoystickButton", + "JoypadMotion", + "JoypadButton", "ScreenTouch", "ScreenDrag", "Action" diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index e442cd48e7..0ccdfedb81 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -3848,7 +3848,7 @@ void VisualScriptDeconstruct::_bind_methods() { argt+=","+Variant::get_type_name(Variant::Type(i)); } - String iet="None,Key,MouseMotion,MouseButton,JoystickMotion,JoystickButton,ScreenTouch,ScreenDrag,Action"; + String iet="None,Key,MouseMotion,MouseButton,JoypadMotion,JoypadButton,ScreenTouch,ScreenDrag,Action"; ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_ENUM,argt),_SCS("set_deconstruct_type"),_SCS("get_deconstruct_type")); ADD_PROPERTY( PropertyInfo(Variant::INT,"input_type",PROPERTY_HINT_ENUM,iet),_SCS("set_deconstruct_input_type"),_SCS("get_deconstruct_input_type")); diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index eb70c86637..7a06fbf5e8 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -706,8 +706,6 @@ class VisualScriptCustomNode: public VisualScriptNode { protected: - virtual bool _use_builtin_script() const { return true; } - static void _bind_methods(); public: diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 35b215cb52..d132e89690 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -293,7 +293,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) { if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); bool converted = false; if (image.chromaShiftW == 1 && image.chromaShiftH == 1) { diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index a34591d9b9..cb4ef53f6d 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -56,7 +56,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback { double delay_compensation; double time, video_frame_delay, video_pos; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; Ref<ImageTexture> texture; int16_t *pcm; diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 56fc386ef4..3508c6a663 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -36,9 +36,9 @@ #include <webp/decode.h> #include <webp/encode.h> -static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { +static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { - ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>()); + ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>()); Image img=p_image; if (img.detect_alpha()) @@ -47,8 +47,8 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { img.convert(Image::FORMAT_RGB8); Size2 s(img.get_width(),img.get_height()); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); uint8_t *dst_buff=NULL; size_t dst_size=0; @@ -59,25 +59,25 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff); } - ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>()); - DVector<uint8_t> dst; + ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>()); + PoolVector<uint8_t> dst; dst.resize(4+dst_size); - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); w[0]='W'; w[1]='E'; w[2]='B'; w[3]='P'; copymem(&w[4],dst_buff,dst_size); free(dst_buff); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); return dst; } -static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { +static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) { int size = p_buffer.size()-4; ERR_FAIL_COND_V(size<=0,Image()); - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image()); WebPBitstreamFeatures features; @@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //print_line("height: "+itos(features.height)); //print_line("alpha: "+itos(features.has_alpha)); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; if (features.has_alpha) { @@ -107,7 +107,7 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,Image()); - dst_w = DVector<uint8_t>::Write(); + dst_w = PoolVector<uint8_t>::Write(); return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); @@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { uint32_t size = f->get_len(); - DVector<uint8_t> src_image; + PoolVector<uint8_t> src_image; src_image.resize(size); WebPBitstreamFeatures features; - DVector<uint8_t>::Write src_w = src_image.write(); + PoolVector<uint8_t>::Write src_w = src_image.write(); f->get_buffer(src_w.ptr(),size); ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF); @@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { print_line("height: "+itos(features.height)); print_line("alpha: "+itos(features.has_alpha)); - src_w = DVector<uint8_t>::Write(); + src_w = PoolVector<uint8_t>::Write(); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Read src_r = src_image.read(); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Read src_r = src_image.read(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; @@ -158,8 +158,8 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT); - src_r = DVector<uint8_t>::Read(); - dst_w = DVector<uint8_t>::Write(); + src_r = PoolVector<uint8_t>::Read(); + dst_w = PoolVector<uint8_t>::Write(); *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); |