diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/node_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/polygon_2d.cpp | 4 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 61 | ||||
-rw-r--r-- | scene/animation/tween.h | 5 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 6 | ||||
-rw-r--r-- | scene/gui/range.cpp | 4 | ||||
-rw-r--r-- | scene/main/canvas_layer.cpp | 4 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 6 |
8 files changed, 55 insertions, 37 deletions
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 7252602a93..7de72dc41d 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -443,7 +443,7 @@ void Node2D::_bind_methods() { ADD_GROUP("Transform", ""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_rotation", "get_rotation"); - ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rotation_degrees", PROPERTY_HINT_RANGE, "-1080,1080,0.1,or_lesser,or_greater", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", 0), "set_transform", "get_transform"); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index c9e5408f06..34f4ccc03e 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -29,8 +29,10 @@ /*************************************************************************/ #include "polygon_2d.h" + #include "core/math/geometry.h" #include "skeleton_2d.h" + Dictionary Polygon2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = offset; @@ -646,7 +648,7 @@ void Polygon2D::_bind_methods() { ADD_GROUP("Texture", "texture_"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_offset"), "set_texture_offset", "get_texture_offset"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_scale"), "set_texture_scale", "get_texture_scale"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1"), "set_texture_rotation_degrees", "get_texture_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation_degrees", PROPERTY_HINT_RANGE, "-1080,1080,0.1,or_lesser,or_greater"), "set_texture_rotation_degrees", "get_texture_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation", PROPERTY_HINT_NONE, "", 0), "set_texture_rotation", "get_texture_rotation"); ADD_GROUP("Skeleton", ""); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "skeleton", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Skeleton2D"), "set_skeleton", "get_skeleton"); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index ac8751f2bb..58be636e44 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -204,7 +204,7 @@ void Tween::_bind_methods() { ClassDB::bind_method(D_METHOD("resume", "object", "key"), &Tween::resume, DEFVAL("")); ClassDB::bind_method(D_METHOD("resume_all"), &Tween::resume_all); ClassDB::bind_method(D_METHOD("remove", "object", "key"), &Tween::remove, DEFVAL("")); - ClassDB::bind_method(D_METHOD("_remove", "object", "key", "first_only"), &Tween::_remove); + ClassDB::bind_method(D_METHOD("_remove_by_uid", "uid"), &Tween::_remove_by_uid); ClassDB::bind_method(D_METHOD("remove_all"), &Tween::remove_all); ClassDB::bind_method(D_METHOD("seek", "time"), &Tween::seek); ClassDB::bind_method(D_METHOD("tell"), &Tween::tell); @@ -615,7 +615,7 @@ void Tween::_tween_process(float p_delta) { emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false)); // not repeat mode, remove completed action if (!repeat) - call_deferred("_remove", object, data.concatenated_key, true); + call_deferred("_remove_by_uid", data.uid); } else if (!repeat) all_finished = all_finished && data.finish; } @@ -778,15 +778,9 @@ bool Tween::resume_all() { } bool Tween::remove(Object *p_object, StringName p_key) { - _remove(p_object, p_key, false); - return true; -} - -void Tween::_remove(Object *p_object, StringName p_key, bool first_only) { - if (pending_update != 0) { - call_deferred("_remove", p_object, p_key, first_only); - return; + call_deferred("remove", p_object, p_key); + return true; } List<List<InterpolateData>::Element *> for_removal; for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { @@ -797,14 +791,33 @@ void Tween::_remove(Object *p_object, StringName p_key, bool first_only) { continue; if (object == p_object && (data.concatenated_key == p_key || p_key == "")) { for_removal.push_back(E); - if (first_only) { - break; - } } } for (List<List<InterpolateData>::Element *>::Element *E = for_removal.front(); E; E = E->next()) { interpolates.erase(E->get()); } + return true; +} + +void Tween::_remove_by_uid(int uid) { + if (pending_update != 0) { + call_deferred("_remove_by_uid", uid); + return; + } + + for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { + if (uid == E->get().uid) { + E->erase(); + break; + } + } +} + +void Tween::_push_interpolate_data(InterpolateData &p_data) { + pending_update++; + p_data.uid = ++uid; + interpolates.push_back(p_data); + pending_update--; } bool Tween::remove_all() { @@ -815,6 +828,7 @@ bool Tween::remove_all() { } set_active(false); interpolates.clear(); + uid = 0; return true; } @@ -1027,7 +1041,7 @@ bool Tween::interpolate_property(Object *p_object, NodePath p_property, Variant if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) return false; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1070,7 +1084,7 @@ bool Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) return false; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1122,9 +1136,7 @@ bool Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c data.arg[3] = p_arg4; data.arg[4] = p_arg5; - pending_update++; - interpolates.push_back(data); - pending_update--; + _push_interpolate_data(data); return true; } @@ -1175,9 +1187,7 @@ bool Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S data.arg[3] = p_arg4; data.arg[4] = p_arg5; - pending_update++; - interpolates.push_back(data); - pending_update--; + _push_interpolate_data(data); return true; } @@ -1232,7 +1242,7 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini data.ease_type = p_ease_type; data.delay = p_delay; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1283,7 +1293,7 @@ bool Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi data.ease_type = p_ease_type; data.delay = p_delay; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1341,7 +1351,7 @@ bool Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) return false; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1396,7 +1406,7 @@ bool Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) return false; - interpolates.push_back(data); + _push_interpolate_data(data); return true; } @@ -1407,6 +1417,7 @@ Tween::Tween() { repeat = false; speed_scale = 1; pending_update = 0; + uid = 0; } Tween::~Tween() { diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 9997349c64..aa47c00717 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -100,6 +100,7 @@ private: real_t delay; int args; Variant arg[5]; + int uid; }; String autoplay; @@ -107,6 +108,7 @@ private: bool repeat; float speed_scale; mutable int pending_update; + int uid; List<InterpolateData> interpolates; @@ -131,7 +133,8 @@ private: bool _apply_tween_value(InterpolateData &p_data, Variant &value); void _tween_process(float p_delta); - void _remove(Object *p_object, StringName p_key, bool first_only); + void _remove_by_uid(int uid); + void _push_interpolate_data(InterpolateData &p_data); protected: bool _set(const StringName &p_name, const Variant &p_value); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index cdc6b868ec..e81813d7a5 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1071,6 +1071,9 @@ void PopupMenu::activate_item(int p_item) { pop = Object::cast_to<PopupMenu>(next); } + emit_signal("id_pressed", id); + emit_signal("index_pressed", p_item); + // Hides popup by default; unless otherwise specified // by using set_hide_on_item_selection and set_hide_on_checkable_item_selection @@ -1084,9 +1087,6 @@ void PopupMenu::activate_item(int p_item) { return; hide(); - - emit_signal("id_pressed", id); - emit_signal("index_pressed", p_item); } void PopupMenu::remove_item(int p_idx) { diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 4062e48640..09d8664240 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -260,8 +260,8 @@ void Range::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "ratio", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_as_ratio", "get_as_ratio"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exp_edit"), "set_exp_ratio", "is_ratio_exp"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rounded"), "set_use_rounded_values", "is_using_rounded_values"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "allow_greater"), "set_allow_greater", "is_greater_allowed"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "allow_lesser"), "set_allow_lesser", "is_lesser_allowed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_greater"), "set_allow_greater", "is_greater_allowed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_lesser"), "set_allow_lesser", "is_lesser_allowed"); } void Range::set_use_rounded_values(bool p_enable) { diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 8414210952..a2e890e7a7 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -248,12 +248,10 @@ void CanvasLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_custom_viewport"), &CanvasLayer::get_custom_viewport); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasLayer::get_canvas); - //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_RANGE, "-128,128,1"), "set_layer", "get_layer"); - //ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_RANGE),"set_transform","get_transform") ; ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation_degrees", PROPERTY_HINT_RANGE, "-1080,1080,0.1,or_lesser,or_greater", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 2f663431de..96edb17eea 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -621,7 +621,11 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla memdelete(f); - if (bytes != total_size - ofs) { + int expected = total_size - ofs; + if (bytes < expected) { + //this is a compatibility workaround for older format, which saved less mipmaps. It is still recommended the image is reimported. + zeromem(w.ptr() + bytes, (expected - bytes)); + } else if (bytes != expected) { ERR_FAIL_V(ERR_FILE_CORRUPT); } } |