diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 84 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/collision_polygon_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/light_occluder_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/mesh_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/navigation_polygon_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/path_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/resource_preloader_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/texture_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 2 |
16 files changed, 49 insertions, 74 deletions
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 4dd877a6ee..22d23e1c72 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -1419,13 +1419,13 @@ void AnimationTreeEditorPlugin::make_visible(bool p_visible) { //editor->animation_panel_make_visible(true); button->show(); editor->make_bottom_panel_item_visible(anim_tree_editor); - anim_tree_editor->set_fixed_process(true); + anim_tree_editor->set_physics_process(true); } else { if (anim_tree_editor->is_visible_in_tree()) editor->hide_bottom_panel(); button->hide(); - anim_tree_editor->set_fixed_process(false); + anim_tree_editor->set_physics_process(false); } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index b6b112b905..1aa24c8172 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1219,50 +1219,26 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event) if (b->get_button_index() == BUTTON_WHEEL_DOWN) { // Scroll or pan down if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) { - v_scroll->set_value(v_scroll->get_value() + int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor()); - + _update_scroll(0); + viewport->update(); } else { - - if (zoom < MIN_ZOOM) - return; - - float prev_zoom = zoom; - zoom = zoom * (1 - (0.05 * b->get_factor())); - { - Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()); - ofs = ofs / prev_zoom - ofs / zoom; - h_scroll->set_value(h_scroll->get_value() + ofs.x); - v_scroll->set_value(v_scroll->get_value() + ofs.y); - } + _zoom_on_position(zoom * (1 - (0.05 * b->get_factor())), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position())); } - _update_scroll(0); - viewport->update(); return; } if (b->get_button_index() == BUTTON_WHEEL_UP) { // Scroll or pan up if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) { - v_scroll->set_value(v_scroll->get_value() - int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor()); - + _update_scroll(0); + viewport->update(); } else { - if (zoom > MAX_ZOOM) return; - - float prev_zoom = zoom; - zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95); - { - Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()); - ofs = ofs / prev_zoom - ofs / zoom; - h_scroll->set_value(h_scroll->get_value() + ofs.x); - v_scroll->set_value(v_scroll->get_value() + ofs.y); - } + _zoom_on_position(zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position())); } - _update_scroll(0); - viewport->update(); return; } @@ -2668,13 +2644,13 @@ void CanvasItemEditor::_draw_viewport() { all_group = false; } else { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_lock_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) { all_locked = false; break; } } for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_group_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) { all_group = false; break; } @@ -2704,11 +2680,12 @@ void CanvasItemEditor::_draw_viewport() { over_plugin_list->forward_draw_over_canvas(transform, viewport); } _draw_focus(); + _draw_bones(); } void CanvasItemEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels")); @@ -3068,31 +3045,32 @@ void CanvasItemEditor::_set_full_rect() { undo_redo->commit_action(); } -void CanvasItemEditor::_zoom_minus() { - if (zoom < MIN_ZOOM) +void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) { + if (p_zoom < MIN_ZOOM || p_zoom > MAX_ZOOM) return; - zoom /= 2.0; + + float prev_zoom = zoom; + zoom = p_zoom; + Point2 ofs = p_position; + ofs = ofs / prev_zoom - ofs / zoom; + h_scroll->set_value(h_scroll->get_value() + ofs.x); + v_scroll->set_value(v_scroll->get_value() + ofs.y); _update_scroll(0); viewport->update(); viewport_base->update(); } +void CanvasItemEditor::_zoom_minus() { + _zoom_on_position(zoom / 2.0, viewport_scrollable->get_size() / 2.0); +} + void CanvasItemEditor::_zoom_reset() { - zoom = 1; - _update_scroll(0); - viewport->update(); - viewport_base->update(); + _zoom_on_position(1.0, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_zoom_plus() { - if (zoom > MAX_ZOOM) - return; - - zoom *= 2.0; - _update_scroll(0); - viewport->update(); - viewport_base->update(); + _zoom_on_position(zoom * 2.0, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_toggle_snap(bool p_status) { @@ -4032,14 +4010,14 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) { if (p_visible) { canvas_item_editor->show(); - canvas_item_editor->set_fixed_process(true); + canvas_item_editor->set_physics_process(true); VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false); canvas_item_editor->viewport_base->grab_focus(); } else { canvas_item_editor->hide(); - canvas_item_editor->set_fixed_process(false); + canvas_item_editor->set_physics_process(false); VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), true); } } @@ -4181,7 +4159,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_property(child, property, texture); // make visible for certain node type - if (default_type == "Patch9Rect") { + if (default_type == "NinePatchRect") { editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size); } else if (default_type == "Polygon2D") { PoolVector<Vector2> list; @@ -4199,7 +4177,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & } Transform2D trans = canvas->get_canvas_transform(); Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos; - if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") { + if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") { target_position -= texture_size / 2; } // there's nothing to be used as source position so snapping will work as absolute if enabled @@ -4275,7 +4253,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { child = memnew(TouchScreenButton); else if (default_type == "TextureRect") child = memnew(TextureRect); - else if (default_type == "Patch9Rect") + else if (default_type == "NinePatchRect") child = memnew(NinePatchRect); else child = memnew(Sprite); // default @@ -4437,7 +4415,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TouchScreenButton"); // Control types.push_back("TextureRect"); - types.push_back("Patch9Rect"); + types.push_back("NinePatchRect"); target_node = NULL; editor = p_node; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index af834507e0..bb4e584f2a 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -387,6 +387,7 @@ class CanvasItemEditor : public VBoxContainer { void _set_anchors_preset(Control::LayoutPreset p_preset); void _set_full_rect(); + void _zoom_on_position(float p_zoom, Point2 p_position = Point2()); void _zoom_minus(); void _zoom_reset(); void _zoom_plus(); diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 38f95d8278..4501136e19 100644 --- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -45,7 +45,7 @@ void CollisionPolygon2DEditor::_notification(int p_what) { get_tree()->connect("node_removed", this, "_node_removed"); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { } break; } diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp index e6b921c539..ed0bc60d2f 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -46,7 +46,7 @@ void LightOccluder2DEditor::_notification(int p_what) { create_poly->connect("confirmed", this, "_create_poly"); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { } break; } diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index b96e10e81a..6b613c1bcc 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -44,7 +44,7 @@ void MaterialEditor::_gui_input(InputEvent p_event) { void MaterialEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_FIXED_PROCESS) { + if (p_what==NOTIFICATION_PHYSICS_PROCESS) { } diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index b775636764..74618aecc2 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -47,7 +47,7 @@ void MeshEditor::_gui_input(Ref<InputEvent> p_event) { void MeshEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { } if (p_what == NOTIFICATION_READY) { diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index de8d4f9618..69e553eefb 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -46,7 +46,7 @@ void NavigationPolygonEditor::_notification(int p_what) { create_nav->connect("confirmed", this, "_create_nav"); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { } break; } diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 1160e90384..df10ac8929 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -46,7 +46,7 @@ void Path2DEditor::_notification(int p_what) { //button_edit->set_pressed(true); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { } break; } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 8c4e1b8f27..af2349983d 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -58,7 +58,7 @@ void Polygon2DEditor::_notification(int p_what) { get_tree()->connect("node_removed", this, "_node_removed"); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { } break; } diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index da4a3f84d6..d421b3798b 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -38,7 +38,7 @@ void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) { void ResourcePreloaderEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { } if (p_what == NOTIFICATION_ENTER_TREE) { @@ -248,7 +248,7 @@ void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) { } else { hide(); - set_fixed_process(false); + set_physics_process(false); } } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 47443b81ce..b66e9598f9 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1557,11 +1557,7 @@ ScriptTextEditor::ScriptTextEditor() { static ScriptEditorBase *create_editor(const Ref<Script> &p_script) { - if (p_script->has_source_code()) { - return memnew(ScriptTextEditor); - } - - return NULL; + return memnew(ScriptTextEditor); } void ScriptTextEditor::register_editor() { diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 7b2361242f..425390723c 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1938,7 +1938,7 @@ void SpatialEditorViewport::_notification(int p_what) { last_message = message; } - message_time -= get_fixed_process_delta_time(); + message_time -= get_physics_process_delta_time(); if (message_time < 0) surface->update(); } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index b9cb1788f0..3b6eeb61d6 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -39,7 +39,7 @@ void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) { void SpriteFramesEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { } if (p_what == NOTIFICATION_ENTER_TREE) { @@ -535,7 +535,7 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) { } else { hide(); - //set_fixed_process(false); + //set_physics_process(false); } } diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 90dc4cf993..855e857d80 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -38,7 +38,7 @@ void TextureEditor::_gui_input(Ref<InputEvent> p_event) { void TextureEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { } if (p_what == NOTIFICATION_READY) { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 3370ce51fd..0a7f3ff8f9 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -907,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) { } bool TextureRegionEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); + return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) { |