diff options
Diffstat (limited to 'scene/resources/style_box.cpp')
-rw-r--r-- | scene/resources/style_box.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 8580ffdc5a..59246dfabe 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -141,7 +141,7 @@ void StyleBoxTexture::draw(RID p_canvas_item,const Rect2& p_rect) const { r.pos.y-=expand_margin[MARGIN_TOP]; r.size.x+=expand_margin[MARGIN_LEFT]+expand_margin[MARGIN_RIGHT]; r.size.y+=expand_margin[MARGIN_TOP]+expand_margin[MARGIN_BOTTOM]; - VisualServer::get_singleton()->canvas_item_add_style_box( p_canvas_item,r,region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),draw_center); + VisualServer::get_singleton()->canvas_item_add_style_box( p_canvas_item,r,region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),draw_center,modulate); } void StyleBoxTexture::set_draw_center(bool p_draw) { @@ -193,6 +193,19 @@ Rect2 StyleBoxTexture::get_region_rect() const { } +void StyleBoxTexture::set_modulate(const Color& p_modulate) { + if (modulate==p_modulate) + return; + modulate=p_modulate; + emit_changed(); +} + +Color StyleBoxTexture::get_modulate() const { + + return modulate; +} + + void StyleBoxTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_texture","texture:Texture"),&StyleBoxTexture::set_texture); @@ -210,6 +223,10 @@ void StyleBoxTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_draw_center","enable"),&StyleBoxTexture::set_draw_center); ObjectTypeDB::bind_method(_MD("get_draw_center"),&StyleBoxTexture::get_draw_center); + ObjectTypeDB::bind_method(_MD("set_modulate","color"),&StyleBoxTexture::set_modulate); + ObjectTypeDB::bind_method(_MD("get_modulate"),&StyleBoxTexture::get_modulate); + + ADD_SIGNAL(MethodInfo("texture_changed")); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_texture"),_SCS("get_texture") ); @@ -222,6 +239,7 @@ void StyleBoxTexture::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_RIGHT ); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_TOP ); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_BOTTOM ); + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate/color" ), _SCS("set_modulate"),_SCS("get_modulate")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "draw_center" ) , _SCS("set_draw_center"),_SCS("get_draw_center")); } @@ -234,6 +252,7 @@ StyleBoxTexture::StyleBoxTexture() { expand_margin[i]=0; } draw_center=true; + modulate=Color(1,1,1,1); } StyleBoxTexture::~StyleBoxTexture() { |