diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/canvas_item.h | 2 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 9 | ||||
-rw-r--r-- | scene/2d/tile_map.h | 2 | ||||
-rw-r--r-- | scene/gui/button_array.cpp | 20 | ||||
-rw-r--r-- | scene/gui/button_array.h | 4 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 4 | ||||
-rw-r--r-- | scene/gui/scroll_bar.cpp | 2 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 18 | ||||
-rw-r--r-- | scene/main/node.cpp | 6 | ||||
-rw-r--r-- | scene/main/node.h | 1 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 21 |
11 files changed, 66 insertions, 23 deletions
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 7849a66185..58397c1fb0 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -193,7 +193,7 @@ public: void update(); - void set_blend_mode(BlendMode p_blend_mode); + virtual void set_blend_mode(BlendMode p_blend_mode); BlendMode get_blend_mode() const; virtual void set_light_mask(int p_light_mask); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 1a4f88c30e..cc904e4d04 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -352,6 +352,7 @@ void TileMap::_update_dirty_quadrants() { xform.set_origin( q.pos ); vs->canvas_item_set_transform( canvas_item, xform ); vs->canvas_item_set_light_mask(canvas_item,get_light_mask()); + vs->canvas_item_set_blend_mode(canvas_item,VS::MaterialBlendMode(get_blend_mode())); q.canvas_items.push_back(canvas_item); @@ -1190,6 +1191,14 @@ void TileMap::set_light_mask(int p_light_mask) { } } +void TileMap::set_blend_mode(BlendMode p_blend_mode) { + + CanvasItem::set_blend_mode(p_blend_mode); + _recreate_quadrants(); + +} + + void TileMap::_bind_methods() { diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index b48fdde43f..7501d49aa5 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -255,6 +255,8 @@ public: void set_occluder_light_mask(int p_mask); int get_occluder_light_mask() const; + void set_blend_mode(BlendMode p_blend_mode); + virtual void set_light_mask(int p_light_mask); void clear(); diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp index df1872380d..4acac1d48e 100644 --- a/scene/gui/button_array.cpp +++ b/scene/gui/button_array.cpp @@ -267,9 +267,9 @@ void ButtonArray::_notification(int p_what) { } else { if (hover==i) draw_style_box(style_hover,r); - else + else if (!flat) draw_style_box(style_normal,r); - sbsize=style_selected->get_minimum_size(); + sbsize=style_normal->get_minimum_size(); sbofs=style_normal->get_offset(); f=font_normal; c=color_normal; @@ -388,6 +388,17 @@ ButtonArray::Align ButtonArray::get_align() const { return align; } +void ButtonArray::set_flat(bool p_flat) { + + flat=p_flat; + update(); +} + +bool ButtonArray::is_flat() const { + + return flat; +} + void ButtonArray::add_button(const String& p_text,const String& p_tooltip) { @@ -525,6 +536,8 @@ void ButtonArray::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_button_tooltip","button_idx"),&ButtonArray::get_button_tooltip); ObjectTypeDB::bind_method(_MD("get_button_icon:Texture","button_idx"),&ButtonArray::get_button_icon); ObjectTypeDB::bind_method(_MD("get_button_count"),&ButtonArray::get_button_count); + ObjectTypeDB::bind_method(_MD("set_flat","enabled"),&ButtonArray::set_flat); + ObjectTypeDB::bind_method(_MD("is_flat"),&ButtonArray::is_flat); ObjectTypeDB::bind_method(_MD("get_selected"),&ButtonArray::get_selected); ObjectTypeDB::bind_method(_MD("get_hovered"),&ButtonArray::get_hovered); ObjectTypeDB::bind_method(_MD("set_selected","button_idx"),&ButtonArray::set_selected); @@ -539,6 +552,8 @@ void ButtonArray::_bind_methods() { BIND_CONSTANT( ALIGN_FILL ); BIND_CONSTANT( ALIGN_EXPAND_FILL ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flat" ), _SCS("set_flat"),_SCS("is_flat") ); + ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::INT,"button_idx"))); } @@ -549,5 +564,6 @@ ButtonArray::ButtonArray(Orientation p_orientation) { selected=-1; set_focus_mode(FOCUS_ALL); hover=-1; + flat=false; min_button_size = -1; } diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h index 62997a8e36..81be3e41c3 100644 --- a/scene/gui/button_array.h +++ b/scene/gui/button_array.h @@ -59,6 +59,7 @@ private: int selected; int hover; + bool flat; double min_button_size; Vector<Button> buttons; @@ -79,6 +80,9 @@ public: void set_align(Align p_align); Align get_align() const; + void set_flat(bool p_flat); + bool is_flat() const; + void add_button(const String& p_button,const String& p_tooltip=""); void add_icon_button(const Ref<Texture>& p_icon,const String& p_button="",const String& p_tooltip=""); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index d6535ef511..5ced54b825 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -296,7 +296,7 @@ void ColorPicker::_hsv_draw(int p_wich,Control* c) void ColorPicker::_uv_input(const InputEvent &ev) { if (ev.type == InputEvent::MOUSE_BUTTON) { const InputEventMouseButton &bev = ev.mouse_button; - if (bev.pressed) { + if (bev.pressed && bev.button_index==BUTTON_LEFT) { changing_color = true; float x = CLAMP((float)bev.x,0,256); float y = CLAMP((float)bev.y,0,256); @@ -329,7 +329,7 @@ void ColorPicker::_uv_input(const InputEvent &ev) { void ColorPicker::_w_input(const InputEvent &ev) { if (ev.type == InputEvent::MOUSE_BUTTON) { const InputEventMouseButton &bev = ev.mouse_button; - if (bev.pressed) { + if (bev.pressed && bev.button_index==BUTTON_LEFT) { changing_color = true; h=1-((float)bev.y)/256.0; diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index d8365feb24..9a214b5efc 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -832,7 +832,7 @@ ScrollBar::ScrollBar(Orientation p_orientation) if (focus_by_default) set_focus_mode( FOCUS_ALL ); - + set_step(0); } diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 9417c25424..11a4adbf7b 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -92,6 +92,9 @@ void SpinBox::_range_click_timeout() { void SpinBox::_input_event(const InputEvent& p_event) { + if (!is_editable()) { + return; + } if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed) { const InputEventMouseButton &mb=p_event.mouse_button; @@ -110,19 +113,24 @@ void SpinBox::_input_event(const InputEvent& p_event) { range_click_timer->set_one_shot(true); range_click_timer->start(); + line_edit->grab_focus(); } break; case BUTTON_RIGHT: { set_val( (up?get_max():get_min()) ); - + line_edit->grab_focus(); } break; case BUTTON_WHEEL_UP: { - - set_val( get_val() + get_step() ); + if (line_edit->has_focus()) { + set_val( get_val() + get_step() ); + accept_event(); + } } break; case BUTTON_WHEEL_DOWN: { - - set_val( get_val() - get_step() ); + if (line_edit->has_focus()) { + set_val( get_val() - get_step() ); + accept_event(); + } } break; } } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f4fb48682c..78a5cb7302 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -172,7 +172,10 @@ void Node::_propagate_ready() { data.children[i]->_propagate_ready(); } data.blocked--; - notification(NOTIFICATION_READY); + if(!data.ready_notified) { + data.ready_notified=true; + notification(NOTIFICATION_READY); + } } @@ -2999,6 +3002,7 @@ Node::Node() { data.fixed_process=false; data.idle_process=false; data.inside_tree=false; + data.ready_notified=false; data.owner=NULL; data.OW=NULL; diff --git a/scene/main/node.h b/scene/main/node.h index f18dc81195..7b1444f607 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -103,6 +103,7 @@ private: StringName name; SceneTree *tree; bool inside_tree; + bool ready_notified; #ifdef TOOLS_ENABLED NodePath import_path; //path used when imported, used by scene editors to keep tracking #endif diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 4c759bddef..439b5fa66f 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -899,10 +899,9 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref // HButtonArray - - t->set_stylebox("normal","HButtonArray", make_stylebox( button_normal_png,4,4,4,4,0,4,22,4) ); - t->set_stylebox("selected","HButtonArray", make_stylebox( button_pressed_png,4,4,4,4,0,4,22,4) ); - t->set_stylebox("hover","HButtonArray", make_stylebox( button_hover_png,4,4,4,4) ); + t->set_stylebox("normal","HButtonArray", sb_button_normal); + t->set_stylebox("selected","HButtonArray", sb_button_pressed); + t->set_stylebox("hover","HButtonArray", sb_button_hover); t->set_font("font","HButtonArray", default_font); t->set_font("font_selected","HButtonArray", default_font); @@ -910,17 +909,17 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref t->set_color("font_color","HButtonArray", control_font_color_low ); t->set_color("font_color_selected","HButtonArray", control_font_color_hover ); - t->set_constant("icon_separator","HButtonArray", 4 *scale ); - t->set_constant("button_separator","HButtonArray", 8 *scale ); + t->set_constant("icon_separator","HButtonArray", 2 *scale ); + t->set_constant("button_separator","HButtonArray", 4 *scale ); t->set_stylebox("focus","HButtonArray", focus ); // VButtonArray - t->set_stylebox("normal","VButtonArray", make_stylebox( button_normal_png,4,4,4,4,0,4,22,4) ); - t->set_stylebox("selected","VButtonArray", make_stylebox( button_pressed_png,4,4,4,4,0,4,22,4) ); - t->set_stylebox("hover","VButtonArray", make_stylebox( button_hover_png,4,4,4,4) ); + t->set_stylebox("normal","VButtonArray", sb_button_normal); + t->set_stylebox("selected","VButtonArray", sb_button_pressed); + t->set_stylebox("hover","VButtonArray", sb_button_hover); t->set_font("font","VButtonArray", default_font); t->set_font("font_selected","VButtonArray", default_font); @@ -928,8 +927,8 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref t->set_color("font_color","VButtonArray", control_font_color_low ); t->set_color("font_color_selected","VButtonArray", control_font_color_hover ); - t->set_constant("icon_separator","VButtonArray", 4 *scale); - t->set_constant("button_separator","VButtonArray", 8 *scale); + t->set_constant("icon_separator","VButtonArray", 2 *scale); + t->set_constant("button_separator","VButtonArray", 4 *scale); t->set_stylebox("focus","VButtonArray", focus ); |