diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdnative/godot/godot_dictionary.cpp | 8 | ||||
-rw-r--r-- | modules/gdnative/godot/godot_dictionary.h | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_function.cpp | 34 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 1 | ||||
-rw-r--r-- | modules/visual_script/visual_script_flow_control.cpp | 8 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 2 |
6 files changed, 49 insertions, 6 deletions
diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp index 12c40f0564..a14a86248b 100644 --- a/modules/gdnative/godot/godot_dictionary.cpp +++ b/modules/gdnative/godot/godot_dictionary.cpp @@ -124,11 +124,17 @@ void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p } godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) { - Array *self = (Array *)p_self; + Dictionary *self = (Dictionary *)p_self; const Variant *key = (const Variant *)p_key; return (godot_variant *)&self->operator[](*key); } +godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return (godot_variant *)self->next(key); +} + godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) { const Dictionary *self = (const Dictionary *)p_self; const Dictionary *b = (const Dictionary *)p_b; diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h index 0325670b15..4ded0d38da 100644 --- a/modules/gdnative/godot/godot_dictionary.h +++ b/modules/gdnative/godot/godot_dictionary.h @@ -74,6 +74,8 @@ void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); +godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key); + godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index e8a8e20927..795371af60 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -1428,8 +1428,24 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount state.result = arg; Variant ret = function->call(NULL, NULL, 0, r_error, &state); + + bool completed = true; + + // If the return value is a GDFunctionState reference, + // then the function did yield again after resuming. + if (ret.is_ref()) { + GDFunctionState *gdfs = ret.operator Object *()->cast_to<GDFunctionState>(); + if (gdfs && gdfs->function == function) + completed = false; + } + function = NULL; //cleaned up; state.result = Variant(); + + if (completed) { + emit_signal("completed", ret); + } + return ret; } @@ -1468,8 +1484,24 @@ Variant GDFunctionState::resume(const Variant &p_arg) { state.result = p_arg; Variant::CallError err; Variant ret = function->call(NULL, NULL, 0, err, &state); + + bool completed = true; + + // If the return value is a GDFunctionState reference, + // then the function did yield again after resuming. + if (ret.is_ref()) { + GDFunctionState *gdfs = ret.operator Object *()->cast_to<GDFunctionState>(); + if (gdfs && gdfs->function == function) + completed = false; + } + function = NULL; //cleaned up; state.result = Variant(); + + if (completed) { + emit_signal("completed", ret); + } + return ret; } @@ -1478,6 +1510,8 @@ void GDFunctionState::_bind_methods() { ClassDB::bind_method(D_METHOD("resume:Variant", "arg"), &GDFunctionState::resume, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDFunctionState::is_valid, DEFVAL(false)); ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDFunctionState::_signal_callback, MethodInfo("_signal_callback")); + + ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::NIL, "result"))); } GDFunctionState::GDFunctionState() { diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 9d3da8227c..8c2c2ea345 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -380,6 +380,7 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) { ii.multimesh->set_mesh(ii.mesh); ii.multimesh_instance = VS::get_singleton()->instance_create(); VS::get_singleton()->instance_set_base(ii.multimesh_instance, ii.multimesh->get_rid()); + VS::get_singleton()->instance_geometry_set_flag(ii.multimesh_instance, VS::INSTANCE_FLAG_USE_BAKED_LIGHT, true); g.items[p_item] = ii; } diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 28622bed47..b53a21c53b 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -944,7 +944,7 @@ bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_va filters[idx] = Ref<InputEvent>(); filters[idx].type = Ref<InputEvent>::Type(int(p_value)); if (filters[idx].type == Ref<InputEvent>::JOYPAD_MOTION) { - filters[idx].joy_motion.axis_value = 0.5; //for treshold + filters[idx].joy_motion.axis_value = 0.5; //for threshold } else if (filters[idx].type == Ref<InputEvent>::KEY) { filters[idx]->is_pressed() = true; //put these as true to make it more user friendly } else if (filters[idx].type == Ref<InputEvent>::MOUSE_BUTTON) { @@ -1071,7 +1071,7 @@ bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_va filters[idx].joy_motion.axis = int(p_value) << 1 | filters[idx].joy_motion.axis; } else if (what == "mode") { filters[idx].joy_motion.axis |= int(p_value); - } else if (what == "treshold") { + } else if (what == "threshold") { filters[idx].joy_motion.axis_value = p_value; } else { return false; @@ -1281,7 +1281,7 @@ bool VisualScriptInputFilter::_get(const StringName &p_name, Variant &r_ret) con r_ret = filters[idx].joy_motion.axis >> 1; } else if (what == "mode") { r_ret = filters[idx].joy_motion.axis & 1; - } else if (what == "treshold") { + } else if (what == "threshold") { r_ret = filters[idx].joy_motion.axis_value; } else { return false; @@ -1434,7 +1434,7 @@ void VisualScriptInputFilter::_get_property_list(List<PropertyInfo> *p_list) con 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")); + p_list->push_back(PropertyInfo(Variant::REAL, base + "threshold", PROPERTY_HINT_RANGE, "0,1,0.01")); } break; case Ref<InputEvent>::JOYPAD_BUTTON: { p_list->push_back(PropertyInfo(Variant::INT, base + "button_index")); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index f707471405..5f24bcc2c3 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1076,7 +1076,7 @@ void VisualScriptConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("get_constant_type"), &VisualScriptConstant::get_constant_type); ClassDB::bind_method(D_METHOD("set_constant_value", "value"), &VisualScriptConstant::set_constant_value); - ClassDB::bind_method(D_METHOD("get_constant_value"), &VisualScriptConstant::get_constant_value); + ClassDB::bind_method(D_METHOD("get_constant_value:Variant"), &VisualScriptConstant::get_constant_value); String argt = "Null"; for (int i = 1; i < Variant::VARIANT_MAX; i++) { |