diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/camera_2d.cpp | 4 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 90 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.h | 8 | ||||
-rw-r--r-- | scene/gui/button.cpp | 4 | ||||
-rw-r--r-- | scene/gui/button_array.cpp | 27 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 54 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 3 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 6 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 18 | ||||
-rw-r--r-- | scene/resources/font.cpp | 239 | ||||
-rw-r--r-- | scene/resources/font.h | 74 | ||||
-rw-r--r-- | scene/resources/theme.cpp | 9 | ||||
-rw-r--r-- | scene/resources/theme.h | 2 |
14 files changed, 350 insertions, 190 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 68d8b09e04..fd8a0ed0f3 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -240,6 +240,10 @@ void Camera2D::_notification(int p_what) { add_to_group(group_name); add_to_group(canvas_group_name); + if(get_tree()->is_editor_hint()) { + set_fixed_process(false); + } + _update_scroll(); first=true; diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index c732dd54cf..211c5961b0 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -139,6 +139,11 @@ bool AnimationTreePlayer::_set(const StringName& p_name, const Variant& p_value) animation_node_set_master_animation(id,node.get_valid("from")); else animation_node_set_animation(id,node.get_valid("animation")); + Array filters= node.get_valid("filter"); + for(int i=0;i<filters.size();i++) { + + animation_node_set_filter_path(id,filters[i],true); + } } break; case NODE_ONESHOT: { @@ -276,6 +281,15 @@ bool AnimationTreePlayer::_get(const StringName& p_name,Variant &r_ret) const { } else { node["animation"]=an->animation; } + Array k; + List<NodePath> keys; + an->filter.get_key_list(&keys); + k.resize(keys.size()); + int i=0; + for(List<NodePath>::Element *E=keys.front();E;E=E->next()) { + k[i++]=E->get(); + } + node["filter"]=k; } break; case NODE_ONESHOT: { OneShotNode *osn = static_cast<OneShotNode*>(n); @@ -439,7 +453,6 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode //transform to seconds... - switch(nb->type) { case NODE_OUTPUT: { @@ -464,7 +477,7 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode an->time=p_time; an->step=0; } else { - an->time+=p_time; + an->time=MAX(0,an->time+p_time); an->step=p_time; } @@ -482,14 +495,12 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode an->skip=true; for (List<AnimationNode::TrackRef>::Element *E=an->tref.front();E;E=E->next()) { - - if (p_filter && p_filter->has(an->animation->track_get_path(E->get().local_track))) { - - if (p_reverse_weight<0) - E->get().weight=0; - else - E->get().weight=p_reverse_weight; - + NodePath track_path = an->animation->track_get_path(E->get().local_track); + if (p_filter && p_filter->has(track_path)) { + E->get().weight = MAX(0, p_reverse_weight); + } else if(an->filter.has(track_path)) { + E->get().weight = 0; + E->get().track->skip = true; } else { E->get().weight=p_weight; } @@ -552,18 +563,17 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode float main_rem; float os_rem; + float os_reverse_weight = p_reverse_weight; if (!osn->filter.empty()) { - - main_rem = _process_node(osn->inputs[0].node,r_prev_anim,(osn->mix?p_weight:p_weight*(1.0-blend)),p_time,p_seek,&osn->filter,p_weight); - os_rem = _process_node(osn->inputs[1].node,r_prev_anim,p_weight*blend,p_time,os_seek,&osn->filter,-1); - - } else { - - main_rem = _process_node(osn->inputs[0].node,r_prev_anim,(osn->mix?p_weight:p_weight*(1.0-blend)),p_time,p_seek); - os_rem = _process_node(osn->inputs[1].node,r_prev_anim,p_weight*blend,p_time,os_seek); + p_filter = &osn->filter; + p_reverse_weight = p_weight; + os_reverse_weight = -1; } + main_rem = _process_node(osn->inputs[0].node,r_prev_anim,(osn->mix?p_weight:p_weight*(1.0-blend)),p_time,p_seek,p_filter,p_reverse_weight); + os_rem = _process_node(osn->inputs[1].node,r_prev_anim,p_weight*blend,p_time,os_seek,p_filter,os_reverse_weight); + if (osn->start) { osn->remaining=os_rem; osn->start=false; @@ -768,6 +778,8 @@ void AnimationTreePlayer::_process_animation(float p_delta) { t.value = t.object->get(t.property); t.value.zero(); + + t.skip = false; } @@ -816,16 +828,9 @@ void AnimationTreePlayer::_process_animation(float p_delta) { if (a->value_track_is_continuous(tr.local_track)) { Variant value = a->value_track_interpolate(tr.local_track,anim_list->time); Variant::blend(tr.track->value,value,blend,tr.track->value); - tr.track->object->set(tr.track->property,tr.track->value); } else { - - List<int> indices; - a->value_track_get_key_indices(tr.local_track,anim_list->time,anim_list->step,&indices); - for(List<int>::Element *E=indices.front();E;E=E->next()) { - - Variant value = a->track_get_key_value(tr.local_track,E->get()); - tr.track->object->set(tr.track->property,value); - } + int index = a->track_find_key(tr.local_track,anim_list->time); + tr.track->value = a->track_get_key_value(tr.local_track, index); } } break; case Animation::TYPE_METHOD: { ///< Call any method on a specific node. @@ -854,11 +859,13 @@ void AnimationTreePlayer::_process_animation(float p_delta) { Track &t = E->get(); - if (!t.object) + if (t.skip || !t.object) continue; - if(t.property) // value track; was applied in step 2 + if(t.property) { // value track + t.object->set(t.property,t.value); continue; + } Transform xform; xform.basis=t.rot; @@ -983,6 +990,24 @@ void AnimationTreePlayer::animation_node_set_master_animation(const StringName& } +void AnimationTreePlayer::animation_node_set_filter_path(const StringName& p_node,const NodePath& p_track_path,bool p_filter) { + + GET_NODE( NODE_ANIMATION, AnimationNode ); + + if (p_filter) + n->filter[p_track_path]=true; + else + n->filter.erase(p_track_path); + +} + +void AnimationTreePlayer::animation_node_set_get_filtered_paths(const StringName& p_node,List<NodePath> *r_paths) const{ + + GET_NODE( NODE_ANIMATION, AnimationNode ); + + n->filter.get_key_list(r_paths); +} + void AnimationTreePlayer::oneshot_node_set_fadein_time(const StringName& p_node,float p_time) { GET_NODE( NODE_ONESHOT, OneShotNode ); @@ -1210,6 +1235,12 @@ String AnimationTreePlayer::animation_node_get_master_animation(const StringName } +bool AnimationTreePlayer::animation_node_is_path_filtered(const StringName& p_node,const NodePath& p_path) const { + + GET_NODE_V(NODE_ANIMATION, AnimationNode, 0 ); + return n->filter.has(p_path); +} + float AnimationTreePlayer::oneshot_node_get_fadein_time(const StringName& p_node) const { @@ -1750,6 +1781,7 @@ void AnimationTreePlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("animation_node_set_master_animation","id","source"),&AnimationTreePlayer::animation_node_set_master_animation); ObjectTypeDB::bind_method(_MD("animation_node_get_master_animation","id"),&AnimationTreePlayer::animation_node_get_master_animation); + ObjectTypeDB::bind_method(_MD("animation_node_set_filter_path","id","path","enable"),&AnimationTreePlayer::animation_node_set_filter_path); ObjectTypeDB::bind_method(_MD("oneshot_node_set_fadein_time","id","time_sec"),&AnimationTreePlayer::oneshot_node_set_fadein_time); ObjectTypeDB::bind_method(_MD("oneshot_node_get_fadein_time","id"),&AnimationTreePlayer::oneshot_node_get_fadein_time); diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 2e44d69aa1..0e78281e4c 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -111,6 +111,7 @@ private: Variant value; + bool skip; }; @@ -162,6 +163,9 @@ private: float step; String from; bool skip; + + HashMap<NodePath,bool> filter; + AnimationNode() { type=NODE_ANIMATION; next=NULL; last_version=0; skip=false; } }; @@ -310,6 +314,10 @@ public: void animation_node_set_master_animation(const StringName& p_node,const String& p_master_animation); String animation_node_get_master_animation(const StringName& p_node) const; + void animation_node_set_filter_path(const StringName& p_node,const NodePath& p_filter,bool p_enable); + void animation_node_set_get_filtered_paths(const StringName& p_node,List<NodePath> *r_paths) const; + bool animation_node_is_path_filtered(const StringName& p_node,const NodePath& p_path) const; + /* ONE SHOT NODE */ void oneshot_node_set_fadein_time(const StringName& p_node,float p_time); diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 0f3f762ba1..0f1622a838 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -227,6 +227,10 @@ void Button::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_text_align"),&Button::get_text_align); ObjectTypeDB::bind_method(_MD("is_flat"),&Button::is_flat); + BIND_CONSTANT( ALIGN_LEFT ); + BIND_CONSTANT( ALIGN_CENTER ); + BIND_CONSTANT( ALIGN_RIGHT ); + ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT_INTL ), _SCS("set_text"),_SCS("get_text") ); ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_button_icon"),_SCS("get_button_icon") ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flat" ), _SCS("set_flat"),_SCS("is_flat") ); diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp index de77b83403..be48296110 100644 --- a/scene/gui/button_array.cpp +++ b/scene/gui/button_array.cpp @@ -362,10 +362,10 @@ ButtonArray::Align ButtonArray::get_align() const { } -void ButtonArray::add_button(const String& p_button) { +void ButtonArray::add_button(const String& p_text) { Button button; - button.text=p_button; + button.text=p_text; buttons.push_back(button); update(); @@ -375,10 +375,10 @@ void ButtonArray::add_button(const String& p_button) { minimum_size_changed(); } -void ButtonArray::add_icon_button(const Ref<Texture>& p_icon,const String& p_button) { +void ButtonArray::add_icon_button(const Ref<Texture>& p_icon,const String& p_text) { Button button; - button.text=p_button; + button.text=p_text; button.icon=p_icon; buttons.push_back(button); if (selected==-1) @@ -396,6 +396,7 @@ void ButtonArray::set_button_text(int p_button, const String& p_text) { minimum_size_changed(); } + void ButtonArray::set_button_icon(int p_button, const Ref<Texture>& p_icon) { ERR_FAIL_INDEX(p_button,buttons.size()); @@ -403,11 +404,13 @@ void ButtonArray::set_button_icon(int p_button, const Ref<Texture>& p_icon) { update(); minimum_size_changed(); } + String ButtonArray::get_button_text(int p_button) const { ERR_FAIL_INDEX_V(p_button,buttons.size(),""); return buttons[p_button].text; } + Ref<Texture> ButtonArray::get_button_icon(int p_button) const { ERR_FAIL_INDEX_V(p_button,buttons.size(),Ref<Texture>()); @@ -470,16 +473,16 @@ void ButtonArray::get_translatable_strings(List<String> *p_strings) const { void ButtonArray::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_button","text"),&ButtonArray::add_button); - ObjectTypeDB::bind_method(_MD("add_icon_button","icon","text"),&ButtonArray::add_icon_button,DEFVAL("")); - ObjectTypeDB::bind_method(_MD("set_button_text","button","text"),&ButtonArray::set_button_text); - ObjectTypeDB::bind_method(_MD("set_button_icon","button","icon"),&ButtonArray::set_button_icon); - ObjectTypeDB::bind_method(_MD("get_button_text","button"),&ButtonArray::get_button_text); - ObjectTypeDB::bind_method(_MD("get_button_icon","button"),&ButtonArray::get_button_icon); + ObjectTypeDB::bind_method(_MD("add_icon_button","icon:Texture","text"),&ButtonArray::add_icon_button,DEFVAL("")); + ObjectTypeDB::bind_method(_MD("set_button_text","button_idx","text"),&ButtonArray::set_button_text); + ObjectTypeDB::bind_method(_MD("set_button_icon","button_idx","icon:Texture"),&ButtonArray::set_button_icon); + ObjectTypeDB::bind_method(_MD("get_button_text","button_idx"),&ButtonArray::get_button_text); + 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("get_selected"),&ButtonArray::get_selected); ObjectTypeDB::bind_method(_MD("get_hovered"),&ButtonArray::get_hovered); - ObjectTypeDB::bind_method(_MD("set_selected","button"),&ButtonArray::set_selected); - ObjectTypeDB::bind_method(_MD("erase_button","button"),&ButtonArray::erase_button); + ObjectTypeDB::bind_method(_MD("set_selected","button_idx"),&ButtonArray::set_selected); + ObjectTypeDB::bind_method(_MD("erase_button","button_idx"),&ButtonArray::erase_button); ObjectTypeDB::bind_method(_MD("clear"),&ButtonArray::clear); ObjectTypeDB::bind_method(_MD("_input_event"),&ButtonArray::_input_event); @@ -490,7 +493,7 @@ void ButtonArray::_bind_methods() { BIND_CONSTANT( ALIGN_FILL ); BIND_CONSTANT( ALIGN_EXPAND_FILL ); - ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::INT,"button"))); + ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::INT,"button_idx"))); } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a30c05527c..2912dcb3ae 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2310,7 +2310,7 @@ void Control::_bind_methods() { BIND_CONSTANT( ANCHOR_BEGIN ); BIND_CONSTANT( ANCHOR_END ); BIND_CONSTANT( ANCHOR_RATIO ); - BIND_CONSTANT( ANCHOR_CENTER ); + BIND_CONSTANT( ANCHOR_CENTER ); BIND_CONSTANT( FOCUS_NONE ); BIND_CONSTANT( FOCUS_CLICK ); BIND_CONSTANT( FOCUS_ALL ); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f7461a736c..41d546c6f7 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2057,7 +2057,17 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { scancode_handled=false; break; } -#ifdef APPLE_STYLE_KEYS +#ifndef APPLE_STYLE_KEYS + if (k.mod.command) { + _scroll_lines_up(); + break; + } +#else + if (k.mod.command && k.mod.alt) { + _scroll_lines_up(); + break; + } + if (k.mod.command) cursor_set_line(0); else @@ -2084,7 +2094,17 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { scancode_handled=false; break; } -#ifdef APPLE_STYLE_KEYS +#ifndef APPLE_STYLE_KEYS + if (k.mod.command) { + _scroll_lines_down(); + break; + } +#else + if (k.mod.command && k.mod.alt) { + _scroll_lines_down(); + break; + } + if (k.mod.command) cursor_set_line(text.size()-1); else @@ -2498,6 +2518,36 @@ void TextEdit::_post_shift_selection() { selection.selecting_text=true; } +void TextEdit::_scroll_lines_up() { + // adjust the vertical scroll + if (get_v_scroll() > 0) { + set_v_scroll(get_v_scroll() - 1); + } + + // adjust the cursor + if (cursor_get_line() >= (get_visible_rows() + get_v_scroll()) && !selection.active) { + cursor_set_line((get_visible_rows() + get_v_scroll()) - 1, false); + } +} + +void TextEdit::_scroll_lines_down() { + // calculate the maximum vertical scroll position + int max_v_scroll = get_line_count() - 1; + if (!scroll_past_end_of_file_enabled) { + max_v_scroll -= get_visible_rows() - 1; + } + + // adjust the vertical scroll + if (get_v_scroll() < max_v_scroll) { + set_v_scroll(get_v_scroll() + 1); + } + + // adjust the cursor + if ((cursor_get_line()) <= get_v_scroll() - 1 && !selection.active) { + cursor_set_line(get_v_scroll(), false); + } +} + /**** TEXT EDIT CORE API ****/ void TextEdit::_base_insert_text(int p_line, int p_char,const String& p_text,int &r_end_line,int &r_end_column) { diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 09c2a4d729..193dd236d1 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -259,6 +259,9 @@ class TextEdit : public Control { void _pre_shift_selection(); void _post_shift_selection(); + void _scroll_lines_up(); + void _scroll_lines_down(); + // void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask); Size2 get_minimum_size(); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 9930aa07f6..1bcb0d4fba 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -570,13 +570,17 @@ void register_scene_types() { ObjectTypeDB::register_type<LargeTexture>(); ObjectTypeDB::register_type<CubeMap>(); ObjectTypeDB::register_type<Animation>(); - ObjectTypeDB::register_type<Font>(); + ObjectTypeDB::register_virtual_type<Font>(); + ObjectTypeDB::register_type<BitmapFont>(); ObjectTypeDB::register_type<StyleBoxEmpty>(); ObjectTypeDB::register_type<StyleBoxTexture>(); ObjectTypeDB::register_type<StyleBoxFlat>(); ObjectTypeDB::register_type<StyleBoxImageMask>(); ObjectTypeDB::register_type<Theme>(); + ObjectTypeDB::add_compatibility_type("Font","BitmapFont"); + + ObjectTypeDB::register_type<PolygonPathFinder>(); ObjectTypeDB::register_type<BitMap>(); ObjectTypeDB::register_type<ColorRamp>(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 005a46c0bc..727c8eee29 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -87,10 +87,10 @@ static Ref<Shader> make_shader(const char*vertex_code,const char*fragment_code,c return shader; } -static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charcount, const int *p_chars,const Ref<Texture> &p_texture) { +static Ref<BitmapFont> make_font(int p_height,int p_ascent, int p_valign, int p_charcount, const int *p_chars,const Ref<Texture> &p_texture) { - Ref<Font> font( memnew( Font ) ); + Ref<BitmapFont> font( memnew( BitmapFont ) ); font->add_texture( p_texture ); for (int i=0;i<p_charcount;i++) { @@ -117,10 +117,10 @@ static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charco return font; } -static Ref<Font> make_font2(int p_height,int p_ascent, int p_charcount, const int *p_char_rects,int p_kerning_count,const int *p_kernings,int p_w, int p_h, const unsigned char *p_img) { +static Ref<BitmapFont> make_font2(int p_height,int p_ascent, int p_charcount, const int *p_char_rects,int p_kerning_count,const int *p_kernings,int p_w, int p_h, const unsigned char *p_img) { - Ref<Font> font( memnew( Font ) ); + Ref<BitmapFont> font( memnew( BitmapFont ) ); DVector<uint8_t> img; img.resize(p_w*p_h*2); @@ -187,10 +187,10 @@ void make_default_theme() { Ref<Theme> t( memnew( Theme ) ); - //Ref<Font> default_font = make_font(_bi_font_normal_height,_bi_font_normal_ascent,_bi_font_normal_valign,_bi_font_normal_charcount,_bi_font_normal_characters,make_icon(font_normal_png)); - Ref<Font> default_font=make_font2(_builtin_normal_font_height,_builtin_normal_font_ascent,_builtin_normal_font_charcount,&_builtin_normal_font_charrects[0][0],_builtin_normal_font_kerning_pair_count,&_builtin_normal_font_kerning_pairs[0][0],_builtin_normal_font_img_width,_builtin_normal_font_img_height,_builtin_normal_font_img_data); - Ref<Font> source_font=make_font2(_builtin_source_font_height,_builtin_source_font_ascent,_builtin_source_font_charcount,&_builtin_source_font_charrects[0][0],_builtin_source_font_kerning_pair_count,&_builtin_source_font_kerning_pairs[0][0],_builtin_source_font_img_width,_builtin_source_font_img_height,_builtin_source_font_img_data); - Ref<Font> large_font=make_font2(_builtin_large_font_height,_builtin_large_font_ascent,_builtin_large_font_charcount,&_builtin_large_font_charrects[0][0],_builtin_large_font_kerning_pair_count,&_builtin_large_font_kerning_pairs[0][0],_builtin_large_font_img_width,_builtin_large_font_img_height,_builtin_large_font_img_data); + //Ref<BitmapFont> default_font = make_font(_bi_font_normal_height,_bi_font_normal_ascent,_bi_font_normal_valign,_bi_font_normal_charcount,_bi_font_normal_characters,make_icon(font_normal_png)); + Ref<BitmapFont> default_font=make_font2(_builtin_normal_font_height,_builtin_normal_font_ascent,_builtin_normal_font_charcount,&_builtin_normal_font_charrects[0][0],_builtin_normal_font_kerning_pair_count,&_builtin_normal_font_kerning_pairs[0][0],_builtin_normal_font_img_width,_builtin_normal_font_img_height,_builtin_normal_font_img_data); + Ref<BitmapFont> source_font=make_font2(_builtin_source_font_height,_builtin_source_font_ascent,_builtin_source_font_charcount,&_builtin_source_font_charrects[0][0],_builtin_source_font_kerning_pair_count,&_builtin_source_font_kerning_pairs[0][0],_builtin_source_font_img_width,_builtin_source_font_img_height,_builtin_source_font_img_data); + Ref<BitmapFont> large_font=make_font2(_builtin_large_font_height,_builtin_large_font_ascent,_builtin_large_font_charcount,&_builtin_large_font_charrects[0][0],_builtin_large_font_kerning_pair_count,&_builtin_large_font_kerning_pairs[0][0],_builtin_large_font_img_width,_builtin_large_font_img_height,_builtin_large_font_img_data); // Font Colors @@ -939,7 +939,7 @@ void make_default_theme() { style->set_default_margin( Margin(),8); } - Ref<Font> f = make_default_font(); + Ref<BitmapFont> f = make_default_font(); Theme::set_default( t ); Theme::set_default_icon( texture ); Theme::set_default_style( style ); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index ef5b7a3eb0..0d8d224037 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -31,7 +31,67 @@ #include "core/os/file_access.h" #include "core/io/resource_loader.h" -void Font::_set_chars(const DVector<int>& p_chars) { + + +void Font::draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate) const { + + float length=get_string_size(p_text).width; + if (length>=p_width) { + draw(p_canvas_item,p_pos,p_text,p_modulate,p_width); + return; + } + + float ofs; + switch(p_align) { + case HALIGN_LEFT: { + ofs=0; + } break; + case HALIGN_CENTER: { + ofs = Math::floor( (p_width-length) / 2.0 ); + } break; + case HALIGN_RIGHT: { + ofs=p_width-length; + } break; + } + draw(p_canvas_item,p_pos+Point2(ofs,0),p_text,p_modulate,p_width); +} + +void Font::draw(RID p_canvas_item, const Point2& p_pos, const String& p_text, const Color& p_modulate,int p_clip_w) const { + + Vector2 ofs; + + for (int i=0;i<p_text.length();i++) { + + int width = get_char_size(p_text[i]).width; + + if (p_clip_w>=0 && (ofs.x+width)>p_clip_w) + break; //clip + + ofs.x+=draw_char(p_canvas_item,p_pos+ofs,p_text[i],p_text[i+1],p_modulate); + } +} + +void Font::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","string","modulate","clip_w"),&Font::draw,DEFVAL(Color(1,1,1)),DEFVAL(-1)); + ObjectTypeDB::bind_method(_MD("get_ascent"),&Font::get_ascent); + ObjectTypeDB::bind_method(_MD("get_descent"),&Font::get_descent); + ObjectTypeDB::bind_method(_MD("get_height"),&Font::get_height); + ObjectTypeDB::bind_method(_MD("is_distance_field_hint"),&Font::is_distance_field_hint); + ObjectTypeDB::bind_method(_MD("get_string_size","string"),&Font::get_string_size); + ObjectTypeDB::bind_method(_MD("draw_char","canvas_item","pos","char","next","modulate"),&Font::draw_char,DEFVAL(-1),DEFVAL(Color(1,1,1))); + +} + + +Font::Font() { + + +} + +///////////////////////////////////////////////////////////////// + +void BitmapFont::_set_chars(const DVector<int>& p_chars) { int len = p_chars.size(); //char 1 charsize 1 texture, 4 rect, 2 align, advance 1 @@ -50,7 +110,7 @@ void Font::_set_chars(const DVector<int>& p_chars) { } -DVector<int> Font::_get_chars() const { +DVector<int> BitmapFont::_get_chars() const { DVector<int> chars; @@ -74,7 +134,7 @@ DVector<int> Font::_get_chars() const { return chars; } -void Font::_set_kernings(const DVector<int>& p_kernings) { +void BitmapFont::_set_kernings(const DVector<int>& p_kernings) { int len=p_kernings.size(); ERR_FAIL_COND(len%3); @@ -89,7 +149,7 @@ void Font::_set_kernings(const DVector<int>& p_kernings) { } } -DVector<int> Font::_get_kernings() const { +DVector<int> BitmapFont::_get_kernings() const { DVector<int> kernings; @@ -104,7 +164,7 @@ DVector<int> Font::_get_kernings() const { } -void Font::_set_textures(const Vector<Variant> & p_textures) { +void BitmapFont::_set_textures(const Vector<Variant> & p_textures) { for(int i=0;i<p_textures.size();i++) { Ref<Texture> tex = p_textures[i]; @@ -114,7 +174,7 @@ void Font::_set_textures(const Vector<Variant> & p_textures) { } -Vector<Variant> Font::_get_textures() const { +Vector<Variant> BitmapFont::_get_textures() const { Vector<Variant> rtextures; for(int i=0;i<textures.size();i++) @@ -122,7 +182,7 @@ Vector<Variant> Font::_get_textures() const { return rtextures; } -Error Font::create_from_fnt(const String& p_string) { +Error BitmapFont::create_from_fnt(const String& p_string) { //fnt format used by angelcode bmfont //http://www.angelcode.com/products/bmfont/ @@ -271,51 +331,51 @@ Error Font::create_from_fnt(const String& p_string) { -void Font::set_height(float p_height) { +void BitmapFont::set_height(float p_height) { height=p_height; } -float Font::get_height() const{ +float BitmapFont::get_height() const{ return height; } -void Font::set_ascent(float p_ascent){ +void BitmapFont::set_ascent(float p_ascent){ ascent=p_ascent; } -float Font::get_ascent() const { +float BitmapFont::get_ascent() const { return ascent; } -float Font::get_descent() const { +float BitmapFont::get_descent() const { return height-ascent; } -void Font::add_texture(const Ref<Texture>& p_texture) { +void BitmapFont::add_texture(const Ref<Texture>& p_texture) { ERR_FAIL_COND( p_texture.is_null()); textures.push_back( p_texture ); } -int Font::get_texture_count() const { +int BitmapFont::get_texture_count() const { return textures.size(); }; -Ref<Texture> Font::get_texture(int p_idx) const { +Ref<Texture> BitmapFont::get_texture(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, textures.size(), Ref<Texture>()); return textures[p_idx]; }; -int Font::get_character_count() const { +int BitmapFont::get_character_count() const { return char_map.size(); }; -Vector<CharType> Font::get_char_keys() const { +Vector<CharType> BitmapFont::get_char_keys() const { Vector<CharType> chars; chars.resize(char_map.size()); @@ -329,7 +389,7 @@ Vector<CharType> Font::get_char_keys() const { return chars; }; -Font::Character Font::get_character(CharType p_char) const { +BitmapFont::Character BitmapFont::get_character(CharType p_char) const { if (!char_map.has(p_char)) { ERR_FAIL_V(Character()); @@ -338,7 +398,7 @@ Font::Character Font::get_character(CharType p_char) const { return char_map[p_char]; }; -void Font::add_char(CharType p_char, int p_texture_idx, const Rect2& p_rect, const Size2& p_align, float p_advance) { +void BitmapFont::add_char(CharType p_char, int p_texture_idx, const Rect2& p_rect, const Size2& p_align, float p_advance) { if (p_advance<0) p_advance=p_rect.size.width; @@ -353,7 +413,7 @@ void Font::add_char(CharType p_char, int p_texture_idx, const Rect2& p_rect, con char_map[p_char]=c; } -void Font::add_kerning_pair(CharType p_A,CharType p_B,int p_kerning) { +void BitmapFont::add_kerning_pair(CharType p_A,CharType p_B,int p_kerning) { KerningPairKey kpk; @@ -369,10 +429,10 @@ void Font::add_kerning_pair(CharType p_A,CharType p_B,int p_kerning) { } } -Vector<Font::KerningPairKey> Font::get_kerning_pair_keys() const { +Vector<BitmapFont::KerningPairKey> BitmapFont::get_kerning_pair_keys() const { - Vector<Font::KerningPairKey> ret; + Vector<BitmapFont::KerningPairKey> ret; ret.resize(kerning_map.size()); int i=0; @@ -385,7 +445,7 @@ Vector<Font::KerningPairKey> Font::get_kerning_pair_keys() const { } -int Font::get_kerning_pair(CharType p_A,CharType p_B) const { +int BitmapFont::get_kerning_pair(CharType p_A,CharType p_B) const { KerningPairKey kpk; kpk.A=p_A; @@ -398,19 +458,19 @@ int Font::get_kerning_pair(CharType p_A,CharType p_B) const { return 0; } -void Font::set_distance_field_hint(bool p_distance_field) { +void BitmapFont::set_distance_field_hint(bool p_distance_field) { distance_field_hint=p_distance_field; emit_changed(); } -bool Font::is_distance_field_hint() const{ +bool BitmapFont::is_distance_field_hint() const{ return distance_field_hint; } -void Font::clear() { +void BitmapFont::clear() { height=1; ascent=0; @@ -426,7 +486,7 @@ Size2 Font::get_string_size(const String& p_string) const { int l = p_string.length(); if (l==0) - return Size2(0,height); + return Size2(0,get_height()); const CharType *sptr = &p_string[0]; for (int i=0;i<l;i++) { @@ -434,48 +494,19 @@ Size2 Font::get_string_size(const String& p_string) const { w+=get_char_size(sptr[i],sptr[i+1]).width; } - return Size2(w,height); + return Size2(w,get_height()); } +void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { -void Font::draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate) const { - - float length=get_string_size(p_text).width; - if (length>=p_width) { - draw(p_canvas_item,p_pos,p_text,p_modulate,p_width); - return; - } - - float ofs; - switch(p_align) { - case HALIGN_LEFT: { - ofs=0; - } break; - case HALIGN_CENTER: { - ofs = Math::floor( (p_width-length) / 2.0 ); - } break; - case HALIGN_RIGHT: { - ofs=p_width-length; - } break; - } - draw(p_canvas_item,p_pos+Point2(ofs,0),p_text,p_modulate,p_width); + fallback=p_fallback; } -void Font::draw(RID p_canvas_item, const Point2& p_pos, const String& p_text, const Color& p_modulate,int p_clip_w) const { +Ref<BitmapFont> BitmapFont::get_fallback() const{ - Vector2 ofs; - - for (int i=0;i<p_text.length();i++) { - - int width = get_char_size(p_text[i]).width; - - if (p_clip_w>=0 && (ofs.x+width)>p_clip_w) - break; //clip - - ofs.x+=draw_char(p_canvas_item,p_pos+ofs,p_text[i],p_text[i+1],p_modulate); - } + return fallback; } -float Font::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { +float BitmapFont::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { const Character * c = char_map.getptr(p_char); @@ -496,58 +527,70 @@ float Font::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_ return get_char_size(p_char,p_next).width; } -void Font::set_fallback(const Ref<Font> &p_fallback) { - fallback=p_fallback; -} +Size2 BitmapFont::get_char_size(CharType p_char,CharType p_next) const { -Ref<Font> Font::get_fallback() const{ + const Character * c = char_map.getptr(p_char); - return fallback; + if (!c) { + if (fallback.is_valid()) + return fallback->get_char_size(p_char,p_next); + return Size2(); + } + + Size2 ret(c->advance,c->rect.size.y); + + if (p_next) { + + KerningPairKey kpk; + kpk.A=p_char; + kpk.B=p_next; + + const Map<KerningPairKey,int>::Element *E=kerning_map.find(kpk); + if (E) { + + ret.width-=E->get(); + } + } + + return ret; } -void Font::_bind_methods() { +void BitmapFont::_bind_methods() { - ObjectTypeDB::bind_method(_MD("create_from_fnt","path"),&Font::create_from_fnt); - ObjectTypeDB::bind_method(_MD("set_height","px"),&Font::set_height); - ObjectTypeDB::bind_method(_MD("get_height"),&Font::get_height); + ObjectTypeDB::bind_method(_MD("create_from_fnt","path"),&BitmapFont::create_from_fnt); + ObjectTypeDB::bind_method(_MD("set_height","px"),&BitmapFont::set_height); - ObjectTypeDB::bind_method(_MD("set_ascent","px"),&Font::set_ascent); - ObjectTypeDB::bind_method(_MD("get_ascent"),&Font::get_ascent); - ObjectTypeDB::bind_method(_MD("get_descent"),&Font::get_descent); + ObjectTypeDB::bind_method(_MD("set_ascent","px"),&BitmapFont::set_ascent); - ObjectTypeDB::bind_method(_MD("add_kerning_pair","char_a","char_b","kerning"),&Font::add_kerning_pair); - ObjectTypeDB::bind_method(_MD("get_kerning_pair","char_a","char_b"),&Font::get_kerning_pair); + ObjectTypeDB::bind_method(_MD("add_kerning_pair","char_a","char_b","kerning"),&BitmapFont::add_kerning_pair); + ObjectTypeDB::bind_method(_MD("get_kerning_pair","char_a","char_b"),&BitmapFont::get_kerning_pair); - ObjectTypeDB::bind_method(_MD("add_texture","texture:Texture"),&Font::add_texture); - ObjectTypeDB::bind_method(_MD("add_char","character","texture","rect","align","advance"),&Font::add_char,DEFVAL(Point2()),DEFVAL(-1)); + ObjectTypeDB::bind_method(_MD("add_texture","texture:Texture"),&BitmapFont::add_texture); + ObjectTypeDB::bind_method(_MD("add_char","character","texture","rect","align","advance"),&BitmapFont::add_char,DEFVAL(Point2()),DEFVAL(-1)); - ObjectTypeDB::bind_method(_MD("get_texture_count"),&Font::get_texture_count); - ObjectTypeDB::bind_method(_MD("get_texture:Texture","idx"),&Font::get_texture); + ObjectTypeDB::bind_method(_MD("get_texture_count"),&BitmapFont::get_texture_count); + ObjectTypeDB::bind_method(_MD("get_texture:Texture","idx"),&BitmapFont::get_texture); - ObjectTypeDB::bind_method(_MD("get_char_size","char","next"),&Font::get_char_size,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_string_size","string"),&Font::get_string_size); + ObjectTypeDB::bind_method(_MD("get_char_size","char","next"),&BitmapFont::get_char_size,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("set_distance_field_hint","enable"),&Font::set_distance_field_hint); - ObjectTypeDB::bind_method(_MD("is_distance_field_hint"),&Font::is_distance_field_hint); + ObjectTypeDB::bind_method(_MD("set_distance_field_hint","enable"),&BitmapFont::set_distance_field_hint); - ObjectTypeDB::bind_method(_MD("clear"),&Font::clear); + ObjectTypeDB::bind_method(_MD("clear"),&BitmapFont::clear); - ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","string","modulate","clip_w"),&Font::draw,DEFVAL(Color(1,1,1)),DEFVAL(-1)); - ObjectTypeDB::bind_method(_MD("draw_char","canvas_item","pos","char","next","modulate"),&Font::draw_char,DEFVAL(-1),DEFVAL(Color(1,1,1))); - ObjectTypeDB::bind_method(_MD("_set_chars"),&Font::_set_chars); - ObjectTypeDB::bind_method(_MD("_get_chars"),&Font::_get_chars); + ObjectTypeDB::bind_method(_MD("_set_chars"),&BitmapFont::_set_chars); + ObjectTypeDB::bind_method(_MD("_get_chars"),&BitmapFont::_get_chars); - ObjectTypeDB::bind_method(_MD("_set_kernings"),&Font::_set_kernings); - ObjectTypeDB::bind_method(_MD("_get_kernings"),&Font::_get_kernings); + ObjectTypeDB::bind_method(_MD("_set_kernings"),&BitmapFont::_set_kernings); + ObjectTypeDB::bind_method(_MD("_get_kernings"),&BitmapFont::_get_kernings); - ObjectTypeDB::bind_method(_MD("_set_textures"),&Font::_set_textures); - ObjectTypeDB::bind_method(_MD("_get_textures"),&Font::_get_textures); + ObjectTypeDB::bind_method(_MD("_set_textures"),&BitmapFont::_set_textures); + ObjectTypeDB::bind_method(_MD("_get_textures"),&BitmapFont::_get_textures); - ObjectTypeDB::bind_method(_MD("set_fallback","fallback"),&Font::set_fallback); - ObjectTypeDB::bind_method(_MD("get_fallback"),&Font::get_fallback); + ObjectTypeDB::bind_method(_MD("set_fallback","fallback"),&BitmapFont::set_fallback); + ObjectTypeDB::bind_method(_MD("get_fallback"),&BitmapFont::get_fallback); ADD_PROPERTY( PropertyInfo( Variant::ARRAY, "textures", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_textures"), _SCS("_get_textures") ); ADD_PROPERTY( PropertyInfo( Variant::INT_ARRAY, "chars", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_chars"), _SCS("_get_chars") ); @@ -556,11 +599,11 @@ void Font::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_height"), _SCS("get_height") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "ascent", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_ascent"), _SCS("get_ascent") ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "distance_field" ), _SCS("set_distance_field_hint"), _SCS("is_distance_field_hint") ); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "fallback", PROPERTY_HINT_RESOURCE_TYPE,"Font" ), _SCS("set_fallback"), _SCS("get_fallback") ); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "fallback", PROPERTY_HINT_RESOURCE_TYPE,"BitmapFont" ), _SCS("set_fallback"), _SCS("get_fallback") ); } -Font::Font() { +BitmapFont::BitmapFont() { clear(); @@ -569,7 +612,7 @@ Font::Font() { } -Font::~Font() { +BitmapFont::~BitmapFont() { clear(); } diff --git a/scene/resources/font.h b/scene/resources/font.h index 03b1ec5191..91f4874932 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -35,9 +35,40 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ + + class Font : public Resource { OBJ_TYPE( Font, Resource ); + +protected: + + static void _bind_methods(); + +public: + + virtual float get_height() const=0; + + virtual float get_ascent() const=0; + virtual float get_descent() const=0; + + virtual Size2 get_char_size(CharType p_char,CharType p_next=0) const=0; + Size2 get_string_size(const String& p_string) const; + + virtual bool is_distance_field_hint() const=0; + + void draw(RID p_canvas_item, const Point2& p_pos, const String& p_text,const Color& p_modulate=Color(1,1,1),int p_clip_w=-1) const; + void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const; + virtual float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const=0; + + Font(); + +}; + + +class BitmapFont : public Font { + + OBJ_TYPE( BitmapFont, Font ); RES_BASE_EXTENSION("fnt"); Vector< Ref<Texture> > textures; @@ -84,7 +115,7 @@ private: void _set_textures(const Vector<Variant> & p_textures); Vector<Variant> _get_textures() const; - Ref<Font> fallback; + Ref<BitmapFont> fallback; protected: static void _bind_methods(); @@ -114,54 +145,23 @@ public: int get_kerning_pair(CharType p_A,CharType p_B) const; Vector<KerningPairKey> get_kerning_pair_keys() const; - inline Size2 get_char_size(CharType p_char,CharType p_next=0) const; - Size2 get_string_size(const String& p_string) const; - + Size2 get_char_size(CharType p_char,CharType p_next=0) const; - void set_fallback(const Ref<Font> &p_fallback); - Ref<Font> get_fallback() const; + void set_fallback(const Ref<BitmapFont> &p_fallback); + Ref<BitmapFont> get_fallback() const; void clear(); void set_distance_field_hint(bool p_distance_field); bool is_distance_field_hint() const; - void draw(RID p_canvas_item, const Point2& p_pos, const String& p_text,const Color& p_modulate=Color(1,1,1),int p_clip_w=-1) const; - void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const; float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; - Font(); - ~Font(); + BitmapFont(); + ~BitmapFont(); }; -Size2 Font::get_char_size(CharType p_char,CharType p_next) const { - - const Character * c = char_map.getptr(p_char); - - if (!c) { - if (fallback.is_valid()) - return fallback->get_char_size(p_char,p_next); - return Size2(); - } - - Size2 ret(c->advance,c->rect.size.y); - - if (p_next) { - - KerningPairKey kpk; - kpk.A=p_char; - kpk.B=p_next; - - const Map<KerningPairKey,int>::Element *E=kerning_map.find(kpk); - if (E) { - - ret.width-=E->get(); - } - } - - return ret; -} diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 74e59b09c3..20405a57b2 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -370,6 +370,13 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const } +void Theme::get_stylebox_types(List<StringName> *p_list) const { + const StringName *key=NULL; + while((key=style_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref<Font>& p_font) { ERR_FAIL_COND(p_font.is_null()); @@ -380,7 +387,6 @@ void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref if (new_value) { _change_notify(); emit_changed();; - } } Ref<Font> Theme::get_font(const StringName& p_name,const StringName& p_type) const { @@ -604,6 +610,7 @@ void Theme::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_stylebox","name","type"),&Theme::has_stylebox); ObjectTypeDB::bind_method(_MD("clear_stylebox","name","type"),&Theme::clear_stylebox); ObjectTypeDB::bind_method(_MD("get_stylebox_list","type"),&Theme::_get_stylebox_list); + ObjectTypeDB::bind_method(_MD("get_stylebox_types"),&Theme::_get_stylebox_types); ObjectTypeDB::bind_method(_MD("set_font","name","type","font:Font"),&Theme::set_font); ObjectTypeDB::bind_method(_MD("get_font:Font","name","type"),&Theme::get_font); diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 36630087f6..9b84d0e8ad 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -65,6 +65,7 @@ protected: DVector<String> _get_icon_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_stylebox_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + DVector<String> _get_stylebox_types(void) const { DVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_font_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_color_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_constant_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } @@ -100,6 +101,7 @@ public: bool has_stylebox(const StringName& p_name,const StringName& p_type) const; void clear_stylebox(const StringName& p_name,const StringName& p_type); void get_stylebox_list(StringName p_type, List<StringName> *p_list) const; + void get_stylebox_types(List<StringName> *p_list) const; void set_font(const StringName& p_name,const StringName& p_type,const Ref<Font>& p_font); Ref<Font> get_font(const StringName& p_name,const StringName& p_type) const; |