diff --git a/core/object.cpp b/core/object.cpp index 0f9b112ad24..3bb917bd384 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -532,8 +532,6 @@ void Object::get_property_list(List *p_list,bool p_reversed) const _get_property_listv(p_list,p_reversed); - if (!_use_builtin_script()) - return; if (!is_class("Script")) // can still be set, but this is for userfriendlyness p_list->push_back( PropertyInfo( Variant::OBJECT, "script/script", PROPERTY_HINT_RESOURCE_TYPE, "Script",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_STORE_IF_NONZERO)); diff --git a/core/object.h b/core/object.h index 7c74f705189..b6754860821 100644 --- a/core/object.h +++ b/core/object.h @@ -432,7 +432,7 @@ friend void postinitialize_handler(Object*); protected: - virtual bool _use_builtin_script() const { return false; } + virtual void _initialize_classv() { initialize_class(); } virtual bool _setv(const StringName& p_name,const Variant &p_property) { return false; }; virtual bool _getv(const StringName& p_name,Variant &r_property) const { return false; }; diff --git a/core/resource.h b/core/resource.h index 11f2c5ee2a9..40b6dd78a05 100644 --- a/core/resource.h +++ b/core/resource.h @@ -62,7 +62,7 @@ class ResourceImportMetadata : public Reference { StringArray _get_options() const; protected: - virtual bool _use_builtin_script() const { return false; } + static void _bind_methods(); public: diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 340db21c320..d030dcc2cb1 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -24,8 +24,6 @@ friend class VisualScript; void validate_input_default_values(); protected: - virtual bool _use_builtin_script() const { return false; } - void _notification(int p_what); void ports_changed_notify(); static void _bind_methods(); diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index eb70c866377..7a06fbf5e86 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -706,8 +706,6 @@ class VisualScriptCustomNode: public VisualScriptNode { protected: - virtual bool _use_builtin_script() const { return true; } - static void _bind_methods(); public: diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 7507ab0952b..a4b07d9a138 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -532,7 +532,7 @@ void Control::_notification(int p_notification) { _update_canvas_item_transform(); VisualServer::get_singleton()->canvas_item_set_custom_rect( get_canvas_item(),!data.disable_visibility_clip, Rect2(Point2(),get_size())); - + VisualServer::get_singleton()->canvas_item_set_clip( get_canvas_item(), data.clip_contents ); //emit_signal(SceneStringNames::get_singleton()->draw); } break; @@ -2340,6 +2340,16 @@ void Control::get_argument_options(const StringName& p_function,int p_idx,Listcanvas_item_set_clip(get_canvas_item(),true); if (is_using_snap()) { //draw grid @@ -1337,7 +1336,7 @@ GraphEdit::GraphEdit() { setting_scroll_ofs=false; just_disconected=false; - + set_clip_contents(true); } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 5a9b1173da3..ece6171b6e1 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -788,7 +788,6 @@ void ItemList::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { - VS::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); Ref bg = get_stylebox("bg"); int mw = scroll_bar->get_minimum_size().x; @@ -1402,6 +1401,7 @@ ItemList::ItemList() { allow_rmb_select=false; icon_scale = 1.0f; + set_clip_contents(true); } ItemList::~ItemList() { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 3d350b2230a..dda9e4b128f 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -70,8 +70,9 @@ void Label::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { - if (clip || autowrap) + if (clip || autowrap) { VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); + } if (word_cache_dirty) regenerate_word_cache(); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 2e68b19f780..790b7500eae 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -687,8 +687,6 @@ void RichTextLabel::_notification(int p_what) { RID ci=get_canvas_item(); Size2 size = get_size(); - VisualServer::get_singleton()->canvas_item_set_clip(ci,true); - if (has_focus()) { VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci,true); draw_style_box(get_stylebox("focus"),Rect2(Point2(),size)); @@ -2046,6 +2044,7 @@ RichTextLabel::RichTextLabel() { visible_characters=-1; + set_clip_contents(true); } RichTextLabel::~RichTextLabel() { diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 966bad76042..43c214b0be8 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -261,7 +261,6 @@ void ScrollContainer::_notification(int p_what) { update_scrollbars(); - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); } if (p_what==NOTIFICATION_FIXED_PROCESS) { @@ -434,6 +433,29 @@ void ScrollContainer::set_h_scroll(int p_pos) { } +String ScrollContainer::get_configuration_warning() const { + + int found=0; + + for(int i=0;icast_to(); + if (!c) + continue; + if (c->is_set_as_toplevel()) + continue; + if (c == h_scroll || c == v_scroll) + continue; + + found++; + } + + if (found!=1) + return TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox,HBox,etc), or a Control and set the custom minimum size manually."); + else + return ""; +} + void ScrollContainer::_bind_methods() { @@ -474,6 +496,6 @@ ScrollContainer::ScrollContainer() { scroll_h=true; scroll_v=true; - + set_clip_contents(true); }; diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h index 69d842a662d..114cd06306f 100644 --- a/scene/gui/scroll_container.h +++ b/scene/gui/scroll_container.h @@ -86,6 +86,9 @@ public: bool is_v_scroll_enabled() const; virtual bool clips_input() const; + + virtual String get_configuration_warning() const; + ScrollContainer(); }; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 16175e9f4b3..f4f1fd8b9c1 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2760,8 +2760,6 @@ void Tree::_notification(int p_what) { update_scrollbars(); RID ci = get_canvas_item(); - VisualServer::get_singleton()->canvas_item_set_clip(ci,true); - Ref bg = cache.bg; Ref bg_focus = get_stylebox("bg_focus"); @@ -3730,6 +3728,8 @@ Tree::Tree() { force_select_on_already_selected=false; allow_rmb_select=false; + + set_clip_contents(true); } diff --git a/scene/main/node.h b/scene/main/node.h index 5c8cde51921..117ce646452 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -146,7 +146,6 @@ private: void _print_tree(const Node *p_node); - virtual bool _use_builtin_script() const { return true; } Node *_get_node(const NodePath& p_path) const; Node *_get_child_by_name(const StringName& p_name) const; diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index e08091f7c02..696b3d34776 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -1090,7 +1090,6 @@ void AnimationKeyEditor::_track_pos_draw() { void AnimationKeyEditor::_track_editor_draw() { - VisualServer::get_singleton()->canvas_item_set_clip(track_editor->get_canvas_item(),true); if (animation.is_valid() && animation->get_track_count()) { if (selected_track < 0) @@ -4312,6 +4311,7 @@ AnimationKeyEditor::AnimationKeyEditor() { add_constant_override("separation",get_constant("separation","VBoxContainer")); + track_editor->set_clip_contents(true); } diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 7c6db39841b..378265ace83 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -947,7 +947,6 @@ void AnimationTreeEditor::_notification(int p_what) { _update_scrollbars(); //VisualServer::get_singleton()->canvas_item_add_rect(get_canvas_item(),Rect2(Point2(),get_size()),Color(0,0,0,1)); get_stylebox("bg","Tree")->draw(get_canvas_item(),Rect2(Point2(),get_size())); - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); for(List::Element *E=order.front();E;E=E->next()) { @@ -1485,6 +1484,7 @@ AnimationTreeEditor::AnimationTreeEditor() { filter_button->set_text(TTR("Filters..")); filter_button->connect("pressed", this,"_edit_filters"); + set_clip_contents(true); } diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 54f1d06a4ff..7fecd60484e 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1962,7 +1962,6 @@ void CanvasItemEditor::_viewport_draw() { Ref lock = get_icon("Lock","EditorIcons"); Ref group = get_icon("Group","EditorIcons"); - VisualServer::get_singleton()->canvas_item_set_clip(ci,true); bool single = get_single_item()!=NULL; @@ -3344,6 +3343,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport = memnew( CanvasItemEditorViewport(p_editor, this) ); vp_base->add_child(viewport); viewport->set_area_as_parent_rect(); + viewport->set_clip_contents(true); h_scroll = memnew( HScrollBar ); v_scroll = memnew( VScrollBar ); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 1b94b6b1ef9..cde6912a178 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -684,7 +684,6 @@ void Polygon2DEditor::_uv_draw() { mtx.elements[2]=-uv_draw_ofs; mtx.scale_basis(Vector2(uv_draw_zoom,uv_draw_zoom)); - VS::get_singleton()->canvas_item_set_clip(uv_edit_draw->get_canvas_item(),true); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),mtx); uv_edit_draw->draw_texture(base_tex,Point2()); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),Matrix32()); @@ -984,6 +983,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { error = memnew( AcceptDialog); add_child(error); + uv_edit_draw->set_clip_contents(true); + } diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 478442b0c4d..fd3e8fb0f32 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -61,7 +61,6 @@ void TextureRegionEditor::_region_draw() mtx.elements[2]=-draw_ofs; mtx.scale_basis(Vector2(draw_zoom,draw_zoom)); - VS::get_singleton()->canvas_item_set_clip(edit_draw->get_canvas_item(),true); VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),mtx); edit_draw->draw_texture(base_tex,Point2()); VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),Matrix32()); @@ -925,6 +924,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor) draw_zoom=1.0; updating_scroll=false; + edit_draw->set_clip_contents(true); + } void TextureRegionEditorPlugin::edit(Object *p_node)