diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/animation.cpp | 17 | ||||
-rw-r--r-- | scene/resources/audio_stream_sample.cpp | 3 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 4 | ||||
-rw-r--r-- | scene/resources/material.cpp | 9 | ||||
-rw-r--r-- | scene/resources/material.h | 2 | ||||
-rw-r--r-- | scene/resources/shader.cpp | 2 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 2 |
7 files changed, 29 insertions, 10 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 8dcc8d4e14..21e4a85cd1 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1171,9 +1171,7 @@ T Animation::_interpolate(const Vector<TKey<T> > &p_keys, float p_time, Interpol ERR_FAIL_COND_V(idx == -2, T()); - if (p_ok) - *p_ok = true; - + bool result = true; int next = 0; float c = 0; // prepare for all cases of interpolation @@ -1243,10 +1241,19 @@ T Animation::_interpolate(const Vector<TKey<T> > &p_keys, float p_time, Interpol } else if (idx < 0) { - idx = next = 0; + // only allow extending first key to anim start if looping + if (loop) + idx = next = 0; + else + result = false; } } + if (p_ok) + *p_ok = result; + if (!result) + return T(); + float tr = p_keys[idx].transition; if (tr == 0 || idx == next) { @@ -1298,7 +1305,7 @@ Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3 TransformKey tk = _interpolate(tt->transforms, p_time, tt->interpolation, tt->loop_wrap, &ok); - if (!ok) // ?? + if (!ok) return ERR_UNAVAILABLE; if (r_loc) diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 1fd84a860e..fdc3b79db6 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -486,7 +486,8 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const { { PoolVector<uint8_t>::Write w = pv.write(); - copymem(w.ptr(), data, data_bytes); + uint8_t *dataptr = (uint8_t *)data; + copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 923639bc79..ce439fece6 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -512,6 +512,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // HSlider theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "HSlider", focus); @@ -524,6 +525,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // VSlider theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "VSlider", focus); @@ -882,7 +884,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png)); theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png)); theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png)); - theme->set_icon("SnapGrid", "GraphEdit", make_icon(icon_snap_grid_png)); + theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_grid_png)); theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 2936df7a51..898a594498 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1242,6 +1242,15 @@ Ref<Texture> SpatialMaterial::get_texture(TextureParam p_param) const { return textures[p_param]; } +Ref<Texture> SpatialMaterial::get_texture_by_name(StringName p_name) const { + for (int i = 0; i < (int)SpatialMaterial::TEXTURE_MAX; i++) { + TextureParam param = TextureParam(i); + if (p_name == shader_names->texture_names[param]) + return textures[param]; + } + return Ref<Texture>(); +} + void SpatialMaterial::_validate_feature(const String &text, Feature feature, PropertyInfo &property) const { if (property.name.begins_with(text) && property.name != text + "_enabled" && !features[feature]) { property.usage = 0; diff --git a/scene/resources/material.h b/scene/resources/material.h index c0e007ac5f..2425f1a174 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -510,6 +510,8 @@ public: void set_texture(TextureParam p_param, const Ref<Texture> &p_texture); Ref<Texture> get_texture(TextureParam p_param) const; + // Used only for shader material conversion + Ref<Texture> get_texture_by_name(StringName p_name) const; void set_feature(Feature p_feature, bool p_enabled); bool get_feature(Feature p_feature) const; diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index ec41630258..66df7dfda8 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -43,8 +43,6 @@ void Shader::set_code(const String &p_code) { String type = ShaderLanguage::get_shader_type(p_code); - print_line("mode: " + type); - if (type == "canvas_item") { mode = MODE_CANVAS_ITEM; } else if (type == "particles") { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index b8a0a7864e..f4a9abc1ea 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -765,7 +765,7 @@ void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("set_border_blend", "blend"), &StyleBoxFlat::set_border_blend); ClassDB::bind_method(D_METHOD("get_border_blend"), &StyleBoxFlat::get_border_blend); - ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_botton_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); + ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_bottom_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); ClassDB::bind_method(D_METHOD("set_corner_radius_all", "radius"), &StyleBoxFlat::set_corner_radius_all); ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius); |