diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/physics_body.cpp | 3 | ||||
-rw-r--r-- | scene/gui/label.cpp | 24 | ||||
-rw-r--r-- | scene/gui/patch_9_rect.cpp | 10 | ||||
-rw-r--r-- | scene/gui/patch_9_rect.h | 4 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 4 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 26 | ||||
-rw-r--r-- | scene/main/viewport.h | 15 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 3 | ||||
-rw-r--r-- | scene/resources/material.cpp | 14 | ||||
-rw-r--r-- | scene/resources/material.h | 4 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 30 | ||||
-rw-r--r-- | scene/resources/style_box.h | 12 |
12 files changed, 80 insertions, 69 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index a0a393e8ed..9590394211 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -918,7 +918,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) { if (move(p_motion, col)) { Dictionary d; d["position"] = col.collision; - d["normal"] = col.collision; + d["normal"] = col.normal; d["local_shape"] = col.local_shape; d["travel"] = col.travel; d["remainder"] = col.remainder; @@ -929,6 +929,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) { d["collider"] = Variant(); } + d["collider_velocity"] = col.collider_vel; d["collider_shape_index"] = col.collider_shape; d["collider_metadata"] = col.collider_metadata; diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 5fe3dd0129..5ed5463f65 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -85,7 +85,7 @@ void Label::_notification(int p_what) { Size2 string_size; Size2 size = get_size(); - + Ref<StyleBox> style = get_stylebox("normal"); Ref<Font> font = get_font("font"); Color font_color = get_color("font_color"); Color font_color_shadow = get_color("font_color_shadow"); @@ -93,6 +93,8 @@ void Label::_notification(int p_what) { Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y")); int line_spacing = get_constant("line_spacing"); + style->draw(ci, Rect2(Point2(0, 0), get_size())); + VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(), font.is_valid() && font->is_distance_field_hint()); int font_h = font->get_height() + line_spacing; @@ -193,21 +195,20 @@ void Label::_notification(int p_what) { case ALIGN_FILL: case ALIGN_LEFT: { - x_ofs = 0; + x_ofs = style->get_offset().x; } break; case ALIGN_CENTER: { x_ofs = int(size.width - (taken + spaces * space_w)) / 2; - } break; case ALIGN_RIGHT: { - x_ofs = int(size.width - (taken + spaces * space_w)); - + x_ofs = int(size.width - style->get_margin(MARGIN_RIGHT) - (taken + spaces * space_w)); } break; } - int y_ofs = (line - lines_skipped) * font_h + font->get_ascent(); + int y_ofs = style->get_offset().y; + y_ofs += (line - lines_skipped) * font_h + font->get_ascent(); y_ofs += vbegin + line * vsep; while (from != to) { @@ -288,8 +289,10 @@ void Label::_notification(int p_what) { Size2 Label::get_minimum_size() const { + Size2 min_style = get_stylebox("normal")->get_minimum_size(); + if (autowrap) - return Size2(1, clip ? 1 : minsize.height); + return Size2(1, clip ? 1 : minsize.height) + min_style; else { // don't want to mutable everything @@ -299,7 +302,7 @@ Size2 Label::get_minimum_size() const { Size2 ms = minsize; if (clip) ms.width = 1; - return ms; + return ms + min_style; } } @@ -350,7 +353,7 @@ int Label::get_visible_line_count() const { int line_spacing = get_constant("line_spacing"); int font_h = get_font("font")->get_height() + line_spacing; - int lines_visible = (get_size().y + line_spacing) / font_h; + int lines_visible = (get_size().height - get_stylebox("normal")->get_minimum_size().height + line_spacing) / font_h; if (lines_visible > line_count) lines_visible = line_count; @@ -370,7 +373,8 @@ void Label::regenerate_word_cache() { memdelete(current); } - int width = autowrap ? get_size().width : get_longest_line_width(); + Ref<StyleBox> style = get_stylebox("normal"); + int width = autowrap ? (get_size().width - style->get_minimum_size().width) : get_longest_line_width(); Ref<Font> font = get_font("font"); int current_word_size = 0; diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index 6b2deeb209..92c34dd3f9 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -61,7 +61,7 @@ void NinePatchRect::_bind_methods() { ClassDB::bind_method(D_METHOD("set_region_rect", "rect"), &NinePatchRect::set_region_rect); ClassDB::bind_method(D_METHOD("get_region_rect"), &NinePatchRect::get_region_rect); ClassDB::bind_method(D_METHOD("set_draw_center", "draw_center"), &NinePatchRect::set_draw_center); - ClassDB::bind_method(D_METHOD("get_draw_center"), &NinePatchRect::get_draw_center); + ClassDB::bind_method(D_METHOD("is_draw_center_enabled"), &NinePatchRect::is_draw_center_enabled); ClassDB::bind_method(D_METHOD("set_h_axis_stretch_mode", "mode"), &NinePatchRect::set_h_axis_stretch_mode); ClassDB::bind_method(D_METHOD("get_h_axis_stretch_mode"), &NinePatchRect::get_h_axis_stretch_mode); ClassDB::bind_method(D_METHOD("set_v_axis_stretch_mode", "mode"), &NinePatchRect::set_v_axis_stretch_mode); @@ -70,7 +70,7 @@ void NinePatchRect::_bind_methods() { ADD_SIGNAL(MethodInfo("texture_changed")); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture"); - ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "get_draw_center"); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "is_draw_center_enabled"); ADD_PROPERTYNZ(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect"); ADD_GROUP("Patch Margin", "patch_margin_"); @@ -151,13 +151,13 @@ Rect2 NinePatchRect::get_region_rect() const { return region_rect; } -void NinePatchRect::set_draw_center(bool p_draw) { +void NinePatchRect::set_draw_center(bool p_enabled) { - draw_center = p_draw; + draw_center = p_enabled; update(); } -bool NinePatchRect::get_draw_center() const { +bool NinePatchRect::is_draw_center_enabled() const { return draw_center; } diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h index 4cf93e4c05..808b7a1f5d 100644 --- a/scene/gui/patch_9_rect.h +++ b/scene/gui/patch_9_rect.h @@ -67,8 +67,8 @@ public: void set_region_rect(const Rect2 &p_region_rect); Rect2 get_region_rect() const; - void set_draw_center(bool p_draw); - bool get_draw_center() const; + void set_draw_center(bool p_enabled); + bool is_draw_center_enabled() const; void set_h_axis_stretch_mode(AxisStretchMode p_mode); AxisStretchMode get_h_axis_stretch_mode() const; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 65aeb23609..766b7923d3 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -542,6 +542,10 @@ bool SceneTree::idle(float p_time) { if (env_path != String()) { fallback = ResourceLoader::load(env_path); + if (fallback.is_null()) { + //could not load fallback, set as empty + ProjectSettings::get_singleton()->set("rendering/environment/default_environment", ""); + } } else { fallback.unref(); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 02da926e50..36dbd14b40 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1202,15 +1202,15 @@ bool Viewport::get_vflip() const { return vflip; } -void Viewport::set_clear_on_new_frame(bool p_enable) { +void Viewport::set_clear_mode(ClearMode p_mode) { - clear_on_new_frame = p_enable; - //VisualServer::get_singleton()->viewport_set_clear_on_new_frame(viewport,p_enable); + clear_mode = p_mode; + VS::get_singleton()->viewport_set_clear_mode(viewport, VS::ViewportClearMode(p_mode)); } -bool Viewport::get_clear_on_new_frame() const { +Viewport::ClearMode Viewport::get_clear_mode() const { - return clear_on_new_frame; + return clear_mode; } void Viewport::set_shadow_atlas_size(int p_size) { @@ -1246,12 +1246,6 @@ Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(i return shadow_atlas_quadrant_subdiv[p_quadrant]; } -void Viewport::clear() { - - //clear=true; - //VisualServer::get_singleton()->viewport_clear(viewport); -} - Transform2D Viewport::_get_input_pre_xform() const { Transform2D pre_xf; @@ -2625,10 +2619,9 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_vflip", "enable"), &Viewport::set_vflip); ClassDB::bind_method(D_METHOD("get_vflip"), &Viewport::get_vflip); - ClassDB::bind_method(D_METHOD("set_clear_on_new_frame", "enable"), &Viewport::set_clear_on_new_frame); - ClassDB::bind_method(D_METHOD("get_clear_on_new_frame"), &Viewport::get_clear_on_new_frame); + ClassDB::bind_method(D_METHOD("set_clear_mode", "mode"), &Viewport::set_clear_mode); + ClassDB::bind_method(D_METHOD("get_clear_mode"), &Viewport::get_clear_mode); - ClassDB::bind_method(D_METHOD("clear"), &Viewport::clear); ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &Viewport::set_update_mode); ClassDB::bind_method(D_METHOD("get_update_mode"), &Viewport::get_update_mode); @@ -2705,7 +2698,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw"); ADD_GROUP("Render Target", "render_target_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_v_flip"), "set_vflip", "get_vflip"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_on_new_frame"), "set_clear_on_new_frame", "get_clear_on_new_frame"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,NextFrame"), "set_clear_mode", "get_clear_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_update_mode", PROPERTY_HINT_ENUM, "Disabled,Once,When Visible,Always"), "set_update_mode", "get_update_mode"); ADD_GROUP("Audio Listener", "audio_listener_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_2d"), "set_as_audio_listener_2d", "is_audio_listener_2d"); @@ -2784,7 +2777,7 @@ Viewport::Viewport() { gen_mipmaps = false; vflip = false; - clear_on_new_frame = true; + //clear=true; update_mode = UPDATE_WHEN_VISIBLE; @@ -2828,6 +2821,7 @@ Viewport::Viewport() { usage = USAGE_3D; debug_draw = DEBUG_DRAW_DISABLED; + clear_mode = CLEAR_MODE_ALWAYS; } Viewport::~Viewport() { diff --git a/scene/main/viewport.h b/scene/main/viewport.h index f527fa4f5b..ce2bc991f5 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -140,6 +140,13 @@ public: DEBUG_DRAW_WIREFRAME, }; + enum ClearMode { + + CLEAR_MODE_ALWAYS, + CLEAR_MODE_NEVER, + CLEAR_MODE_ONLY_NEXT_FRAME + }; + private: friend class ViewportTexture; @@ -182,7 +189,7 @@ private: bool transparent_bg; bool vflip; - bool clear_on_new_frame; + ClearMode clear_mode; bool filter; bool gen_mipmaps; @@ -395,9 +402,8 @@ public: void set_vflip(bool p_enable); bool get_vflip() const; - void set_clear_on_new_frame(bool p_enable); - bool get_clear_on_new_frame() const; - void clear(); + void set_clear_mode(ClearMode p_mode); + ClearMode get_clear_mode() const; void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; @@ -466,6 +472,7 @@ VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv); VARIANT_ENUM_CAST(Viewport::MSAA); VARIANT_ENUM_CAST(Viewport::Usage); VARIANT_ENUM_CAST(Viewport::DebugDraw); +VARIANT_ENUM_CAST(Viewport::ClearMode); VARIANT_ENUM_CAST(Viewport::RenderInfo); #endif diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 08de33175a..4ff635edeb 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -408,6 +408,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // Label + theme->set_stylebox("normal", "Label", memnew(StyleBoxEmpty)); theme->set_font("font", "Label", default_font); theme->set_color("font_color", "Label", Color(1, 1, 1)); @@ -525,7 +526,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("slider", "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", "HSlider", focus); + theme->set_stylebox("focus", "VSlider", focus); theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png)); theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png)); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 77563121df..315351d039 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -227,8 +227,8 @@ void SpatialMaterial::init_shaders() { shader_names->uv1_blend_sharpness = "uv1_blend_sharpness"; shader_names->uv2_blend_sharpness = "uv2_blend_sharpness"; - shader_names->particle_h_frames = "particle_h_frames"; - shader_names->particle_v_frames = "particle_v_frames"; + shader_names->particles_anim_h_frames = "particles_anim_h_frames"; + shader_names->particles_anim_v_frames = "particles_anim_v_frames"; shader_names->particles_anim_loop = "particles_anim_loop"; shader_names->depth_min_layers = "depth_min_layers"; shader_names->depth_max_layers = "depth_max_layers"; @@ -503,8 +503,8 @@ void SpatialMaterial::_update_shader() { code += "\tint particle_total_frames = particles_anim_h_frames * particles_anim_v_frames;\n"; code += "\tint particle_frame = int(INSTANCE_CUSTOM.y * float(particle_total_frames));\n"; code += "\tif (particles_anim_loop) particle_frame=clamp(particle_frame,0,particle_total_frames-1); else particle_frame=abs(particle_frame)%particle_total_frames;\n"; - //code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n"; - //code += "\tUV+= UV * vec2(float(particle_frame % particles_anim_h_frames),float(particle_frame / particles_anim_v_frames));\n"; + code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n"; + code += "\tUV += vec2(float(particle_frame % particles_anim_h_frames) / float(particles_anim_h_frames),float(particle_frame / particles_anim_h_frames) / float(particles_anim_v_frames));\n"; //handle rotation // code += "\tmat4 rotation = mat4(" } break; @@ -530,7 +530,7 @@ void SpatialMaterial::_update_shader() { } if (detail_uv == DETAIL_UV_2 && !flags[FLAG_UV2_USE_TRIPLANAR]) { - code += "\tUV2=UV2*uv2_scale+uv2_offset;\n"; + code += "\tUV2=UV2*uv2_scale.xy+uv2_offset.xy;\n"; } if (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR]) { //generate tangent and binormal in world space @@ -1281,7 +1281,7 @@ SpatialMaterial::BillboardMode SpatialMaterial::get_billboard_mode() const { void SpatialMaterial::set_particles_anim_h_frames(int p_frames) { particles_anim_h_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particle_h_frames, p_frames); + VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames); } int SpatialMaterial::get_particles_anim_h_frames() const { @@ -1291,7 +1291,7 @@ int SpatialMaterial::get_particles_anim_h_frames() const { void SpatialMaterial::set_particles_anim_v_frames(int p_frames) { particles_anim_v_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particle_v_frames, p_frames); + VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames); } int SpatialMaterial::get_particles_anim_v_frames() const { diff --git a/scene/resources/material.h b/scene/resources/material.h index b82e8d8cbd..6a0eead708 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -283,8 +283,8 @@ private: StringName uv1_offset; StringName uv2_scale; StringName uv2_offset; - StringName particle_h_frames; - StringName particle_v_frames; + StringName particles_anim_h_frames; + StringName particles_anim_v_frames; StringName particles_anim_loop; StringName depth_min_layers; StringName depth_max_layers; diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index f646e3667d..b8a0a7864e 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -165,13 +165,13 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NinePatchAxisMode(axis_h), VS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid); } -void StyleBoxTexture::set_draw_center(bool p_draw) { +void StyleBoxTexture::set_draw_center(bool p_enabled) { - draw_center = p_draw; + draw_center = p_enabled; emit_changed(); } -bool StyleBoxTexture::get_draw_center() const { +bool StyleBoxTexture::is_draw_center_enabled() const { return draw_center; } @@ -281,7 +281,7 @@ void StyleBoxTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("get_region_rect"), &StyleBoxTexture::get_region_rect); ClassDB::bind_method(D_METHOD("set_draw_center", "enable"), &StyleBoxTexture::set_draw_center); - ClassDB::bind_method(D_METHOD("get_draw_center"), &StyleBoxTexture::get_draw_center); + ClassDB::bind_method(D_METHOD("is_draw_center_enabled"), &StyleBoxTexture::is_draw_center_enabled); ClassDB::bind_method(D_METHOD("set_modulate", "color"), &StyleBoxTexture::set_modulate); ClassDB::bind_method(D_METHOD("get_modulate"), &StyleBoxTexture::get_modulate); @@ -312,7 +312,7 @@ void StyleBoxTexture::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "axis_stretch_vertical", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_v_axis_stretch_mode", "get_v_axis_stretch_mode"); ADD_GROUP("Modulate", "modulate_"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate_color"), "set_modulate", "get_modulate"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "get_draw_center"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "is_draw_center_enabled"); BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_STRETCH); BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_TILE); @@ -460,14 +460,14 @@ float StyleBoxFlat::get_expand_margin_size(Margin p_expand_margin) const { return expand_margin[p_expand_margin]; } -void StyleBoxFlat::set_filled(bool p_filled) { +void StyleBoxFlat::set_draw_center(bool p_enabled) { - filled = p_filled; + draw_center = p_enabled; emit_changed(); } -bool StyleBoxFlat::is_filled() const { +bool StyleBoxFlat::is_draw_center_enabled() const { - return filled; + return draw_center; } void StyleBoxFlat::set_shadow_color(const Color &p_color) { @@ -691,7 +691,7 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { style_rect, adapted_border, inner_color, border_color.read().ptr(), corner_detail); //DRAW INFILL - if (filled) { + if (draw_center) { int temp_vert_offset = verts.size(); int no_border[4] = { 0, 0, 0, 0 }; draw_ring(verts, indices, colors, style_rect, adapted_corner, @@ -724,7 +724,7 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { int aa_border_width[4] = { aa_size, aa_size, aa_size, aa_size }; - if (filled) { + if (draw_center) { if (!blend_border) { //INFILL AA draw_ring(verts, indices, colors, style_rect, adapted_corner, @@ -776,8 +776,8 @@ void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxFlat::set_expand_margin_size_individual); ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxFlat::get_expand_margin_size); - ClassDB::bind_method(D_METHOD("set_filled", "filled"), &StyleBoxFlat::set_filled); - ClassDB::bind_method(D_METHOD("is_filled"), &StyleBoxFlat::is_filled); + ClassDB::bind_method(D_METHOD("set_draw_center", "draw_center"), &StyleBoxFlat::set_draw_center); + ClassDB::bind_method(D_METHOD("is_draw_center_enabled"), &StyleBoxFlat::is_draw_center_enabled); ClassDB::bind_method(D_METHOD("set_shadow_color", "color"), &StyleBoxFlat::set_shadow_color); ClassDB::bind_method(D_METHOD("get_shadow_color"), &StyleBoxFlat::get_shadow_color); @@ -796,7 +796,7 @@ void StyleBoxFlat::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "bg_color"), "set_bg_color", "get_bg_color"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filled"), "set_filled", "is_filled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "is_draw_center_enabled"); ADD_GROUP("Border Width", "border_width_"); ADD_PROPERTYI(PropertyInfo(Variant::INT, "border_width_left", PROPERTY_HINT_RANGE, "0,1024,1"), "set_border_width", "get_border_width", MARGIN_LEFT); @@ -843,7 +843,7 @@ StyleBoxFlat::StyleBoxFlat() { border_color.append(Color(0.8, 0.8, 0.8)); blend_border = false; - filled = true; + draw_center = true; anti_aliased = true; shadow_size = 0; diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index db41333b7e..3d085f7166 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -117,8 +117,8 @@ public: void set_normal_map(RES p_normal_map); RES get_normal_map() const; - void set_draw_center(bool p_draw); - bool get_draw_center() const; + void set_draw_center(bool p_enabled); + bool is_draw_center_enabled() const; virtual Size2 get_center_size() const; void set_h_axis_stretch_mode(AxisStretchMode p_mode); @@ -150,7 +150,7 @@ class StyleBoxFlat : public StyleBox { int expand_margin[4]; int corner_radius[4]; - bool filled; + bool draw_center; bool blend_border; bool anti_aliased; @@ -202,9 +202,9 @@ public: void set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom); float get_expand_margin_size(Margin p_expand_margin) const; - //FILLED - void set_filled(bool p_draw); - bool is_filled() const; + //DRAW CENTER + void set_draw_center(bool p_enabled); + bool is_draw_center_enabled() const; //SHADOW void set_shadow_color(const Color &p_color); |