summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.cpp4
-rw-r--r--editor/animation_editor.h2
-rw-r--r--editor/asset_library_editor_plugin.cpp103
-rw-r--r--editor/asset_library_editor_plugin.h6
-rw-r--r--editor/call_dialog.cpp20
-rw-r--r--editor/code_editor.cpp8
-rw-r--r--editor/collada/collada.h2
-rw-r--r--editor/dependency_editor.h2
-rw-r--r--editor/editor_autoload_settings.h8
-rw-r--r--editor/editor_data.cpp8
-rw-r--r--editor/editor_dir_dialog.cpp10
-rw-r--r--editor/editor_export.cpp61
-rw-r--r--editor/editor_export.h6
-rw-r--r--editor/editor_file_system.cpp21
-rw-r--r--editor/editor_file_system.h2
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_help.h4
-rw-r--r--editor/editor_name_dialog.cpp2
-rw-r--r--editor/editor_node.cpp90
-rw-r--r--editor/editor_node.h6
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_resource_preview.h4
-rw-r--r--editor/editor_settings.cpp8
-rw-r--r--editor/editor_settings.h2
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/icons/2x/icon_editor_control_anchor.pngbin0 -> 855 bytes
-rw-r--r--editor/icons/icon_GUI_scroll_grabber_pressed.pngbin0 -> 233 bytes
-rw-r--r--editor/icons/icon_editor_control_anchor.pngbin0 -> 472 bytes
-rw-r--r--editor/icons/source/icon_GUI_scroll_grabber_pressed.svg83
-rw-r--r--editor/icons/source/icon_editor_control_anchor.svg98
-rw-r--r--editor/import/editor_import_collada.cpp36
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.cpp2
-rw-r--r--editor/output_strings.cpp6
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.h6
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp20
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h6
-rw-r--r--editor/plugins/camera_editor_plugin.cpp2
-rw-r--r--editor/plugins/camera_editor_plugin.h4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp391
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h19
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp8
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp345
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.h18
-rw-r--r--editor/plugins/gi_probe_editor_plugin.h4
-rw-r--r--editor/plugins/gradient_editor_plugin.h4
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.h4
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/line_2d_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.h4
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.h4
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h4
-rw-r--r--editor/plugins/particles_editor_plugin.h4
-rw-r--r--editor/plugins/path_2d_editor_plugin.h4
-rw-r--r--editor/plugins/path_editor_plugin.h4
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h4
-rw-r--r--editor/plugins/rich_text_editor_plugin.h4
-rw-r--r--editor/plugins/sample_editor_plugin.cpp8
-rw-r--r--editor/plugins/sample_library_editor_plugin.cpp6
-rw-r--r--editor/plugins/sample_player_editor_plugin.cpp14
-rw-r--r--editor/plugins/script_editor_plugin.h10
-rw-r--r--editor/plugins/shader_editor_plugin.h6
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp16
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h4
-rw-r--r--editor/plugins/texture_editor_plugin.h4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp8
-rw-r--r--editor/plugins/texture_region_editor_plugin.h4
-rw-r--r--editor/plugins/tile_map_editor_plugin.h4
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/project_manager.cpp3
-rw-r--r--editor/property_editor.cpp31
-rw-r--r--editor/property_editor.h6
-rw-r--r--editor/resources_dock.h2
-rw-r--r--editor/scene_tree_dock.h2
-rw-r--r--editor/scene_tree_editor.h2
-rw-r--r--editor/script_create_dialog.h2
-rw-r--r--editor/spatial_editor_gizmos.h4
88 files changed, 1122 insertions, 535 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 3675948b1d..1571131aee 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1299,7 +1299,7 @@ void AnimationKeyEditor::_track_editor_draw() {
Object *obj = NULL;
RES res;
- Node *node = root->get_node_and_resource(animation->track_get_path(idx), res);
+ Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res) : (Node *)NULL;
if (res.is_valid()) {
obj = res.ptr();
@@ -1324,7 +1324,7 @@ void AnimationKeyEditor::_track_editor_draw() {
te->draw_texture(type_icon[animation->track_get_type(idx)], ofs + Point2(0, y + (h - type_icon[0]->get_height()) / 2).floor());
NodePath np = animation->track_get_path(idx);
- Node *n = root->get_node(np);
+ Node *n = root ? root->get_node(np) : (Node *)NULL;
Color ncol = color;
if (n && editor_selection->is_selected(n))
ncol = track_select_color;
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
index 88cc446853..9eacafb021 100644
--- a/editor/animation_editor.h
+++ b/editor/animation_editor.h
@@ -278,7 +278,7 @@ class AnimationKeyEditor : public VBoxContainer {
void _track_name_changed(const String &p_name);
void _track_menu_selected(int p_idx);
void _confirm_insert_list();
- int _confirm_insert(InsertData p_id, int p_at_track = -1);
+ int _confirm_insert(InsertData p_id, int p_last_track = -1);
void _query_insert(const InsertData &p_id);
void _update_menu();
bool insert_queue;
diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp
index 2a22cde2fb..0a2799c51f 100644
--- a/editor/asset_library_editor_plugin.cpp
+++ b/editor/asset_library_editor_plugin.cpp
@@ -189,7 +189,14 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
} break;
}
}
-
+void EditorAssetLibraryItemDescription::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
+ desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
+ } break;
+ }
+}
void EditorAssetLibraryItemDescription::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_image"), &EditorAssetLibraryItemDescription::set_image);
ClassDB::bind_method(D_METHOD("_link_click"), &EditorAssetLibraryItemDescription::_link_click);
@@ -274,23 +281,21 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300, 0));
- PanelContainer *desc_bg = memnew(PanelContainer);
+ desc_bg = memnew(PanelContainer);
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew(RichTextLabel);
description->connect("meta_clicked", this, "_link_click");
desc_bg->add_child(description);
- desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
preview = memnew(TextureRect);
preview->set_custom_minimum_size(Size2(640, 345));
hbox->add_child(preview);
- PanelContainer *previews_bg = memnew(PanelContainer);
+ previews_bg = memnew(PanelContainer);
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0, 85));
- previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
previews = memnew(ScrollContainer);
previews_bg->add_child(previews);
@@ -525,53 +530,62 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
////////////////////////////////////////////////////////////////////////////////
void EditorAssetLibrary::_notification(int p_what) {
- if (p_what == NOTIFICATION_READY) {
- TextureRect *tf = memnew(TextureRect);
- tf->set_texture(get_icon("Error", "EditorIcons"));
- reverse->set_icon(get_icon("Updown", "EditorIcons"));
+ switch (p_what) {
+ case NOTIFICATION_READY: {
- error_hb->add_child(tf);
- error_label->raise();
- }
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(get_icon("Error", "EditorIcons"));
+ reverse->set_icon(get_icon("Updown", "EditorIcons"));
- if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (is_visible()) {
- _repository_changed(0); // Update when shown for the first time
- }
- }
+ error_hb->add_child(tf);
+ error_label->raise();
+ } break;
- if (p_what == NOTIFICATION_PROCESS) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
- HTTPClient::Status s = request->get_http_client_status();
- bool visible = s != HTTPClient::STATUS_DISCONNECTED;
+ if (is_visible()) {
+ _repository_changed(0); // Update when shown for the first time
+ }
+ } break;
- if (visible != load_status->is_visible()) {
- load_status->set_visible(visible);
- }
+ case NOTIFICATION_PROCESS: {
- if (visible) {
- switch (s) {
+ HTTPClient::Status s = request->get_http_client_status();
+ bool visible = s != HTTPClient::STATUS_DISCONNECTED;
- case HTTPClient::STATUS_RESOLVING: {
- load_status->set_value(0.1);
- } break;
- case HTTPClient::STATUS_CONNECTING: {
- load_status->set_value(0.2);
- } break;
- case HTTPClient::STATUS_REQUESTING: {
- load_status->set_value(0.3);
- } break;
- case HTTPClient::STATUS_BODY: {
- load_status->set_value(0.4);
- } break;
- default: {}
+ if (visible != load_status->is_visible()) {
+ load_status->set_visible(visible);
}
- }
- bool no_downloads = downloads_hb->get_child_count() == 0;
- if (no_downloads == downloads_scroll->is_visible()) {
- downloads_scroll->set_visible(!no_downloads);
- }
+ if (visible) {
+ switch (s) {
+
+ case HTTPClient::STATUS_RESOLVING: {
+ load_status->set_value(0.1);
+ } break;
+ case HTTPClient::STATUS_CONNECTING: {
+ load_status->set_value(0.2);
+ } break;
+ case HTTPClient::STATUS_REQUESTING: {
+ load_status->set_value(0.3);
+ } break;
+ case HTTPClient::STATUS_BODY: {
+ load_status->set_value(0.4);
+ } break;
+ default: {}
+ }
+ }
+
+ bool no_downloads = downloads_hb->get_child_count() == 0;
+ if (no_downloads == downloads_scroll->is_visible()) {
+ downloads_scroll->set_visible(!no_downloads);
+ }
+
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
+ } break;
}
}
@@ -1360,9 +1374,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
/////////
- PanelContainer *library_scroll_bg = memnew(PanelContainer);
+ library_scroll_bg = memnew(PanelContainer);
library_main->add_child(library_scroll_bg);
- library_scroll_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL);
library_scroll = memnew(ScrollContainer);
diff --git a/editor/asset_library_editor_plugin.h b/editor/asset_library_editor_plugin.h
index 9e4a240101..fa768ec96a 100644
--- a/editor/asset_library_editor_plugin.h
+++ b/editor/asset_library_editor_plugin.h
@@ -89,6 +89,8 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
RichTextLabel *description;
ScrollContainer *previews;
HBoxContainer *preview_hb;
+ PanelContainer *previews_bg;
+ PanelContainer *desc_bg;
struct Preview {
int id;
@@ -110,9 +112,10 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
Ref<Texture> icon;
void _link_click(const String &p_url);
- void _preview_click(int p_index);
+ void _preview_click(int p_id);
protected:
+ void _notification(int p_what);
static void _bind_methods();
public:
@@ -179,6 +182,7 @@ class EditorAssetLibrary : public PanelContainer {
void _asset_open();
void _asset_file_selected(const String &p_file);
+ PanelContainer *library_scroll_bg;
ScrollContainer *library_scroll;
VBoxContainer *library_vb;
LineEdit *filter;
diff --git a/editor/call_dialog.cpp b/editor/call_dialog.cpp
index 8cf9ed6ef4..32b9fc1254 100644
--- a/editor/call_dialog.cpp
+++ b/editor/call_dialog.cpp
@@ -253,8 +253,8 @@ CallDialog::CallDialog() {
call->set_anchor( MARGIN_TOP, ANCHOR_END );
call->set_anchor( MARGIN_RIGHT, ANCHOR_END );
call->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
- call->set_begin( Point2( 70, 29 ) );
- call->set_end( Point2( 15, 15 ) );
+ call->set_begin( Point2( -70, -29 ) );
+ call->set_end( Point2( -15, -15 ) );
call->set_text(TTR("Call"));
add_child(call);
@@ -262,8 +262,8 @@ CallDialog::CallDialog() {
cancel = memnew( Button );
cancel->set_anchor( MARGIN_TOP, ANCHOR_END );
cancel->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
- cancel->set_begin( Point2( 15, 29 ) );
- cancel->set_end( Point2( 70, 15 ) );
+ cancel->set_begin( Point2( -15, 29 ) );
+ cancel->set_end( Point2( 70, -15 ) );
cancel->set_text(TTR("Close"));
add_child(cancel);
@@ -272,7 +272,7 @@ CallDialog::CallDialog() {
tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
tree->set_begin( Point2( 20,50 ) );
- tree->set_margin(MARGIN_BOTTOM, 44 );
+ tree->set_margin(MARGIN_BOTTOM, -44 );
tree->set_margin(MARGIN_RIGHT, 0.5 );
tree->set_select_mode( Tree::SELECT_ROW );
add_child(tree);
@@ -282,10 +282,10 @@ CallDialog::CallDialog() {
property_editor = memnew( PropertyEditor );
- property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 );
+ property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 );
property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 );
//property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 );
- property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 );
+ property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, -90 );
property_editor->get_scene_tree()->set_hide_root( true );
property_editor->hide_top_label();
@@ -305,15 +305,15 @@ CallDialog::CallDialog() {
return_label = memnew( Label );
//return_label->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.53 );
- return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 85 );
+ return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -85 );
return_label->set_text(TTR("Return:"));
add_child(return_label);
return_value = memnew( LineEdit );
//return_value->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 );
- return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 );
- return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 65 );
+ return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 );
+ return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -65 );
add_child(return_value);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 2e406fb23d..07c0945114 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -70,7 +70,7 @@ GotoLineDialog::GotoLineDialog() {
line = memnew(LineEdit);
line->set_anchor(MARGIN_RIGHT, ANCHOR_END);
line->set_begin(Point2(15, 22));
- line->set_end(Point2(15, 35));
+ line->set_end(Point2(-15, 35));
add_child(line);
register_text_enter(line);
text_editor = NULL;
@@ -887,7 +887,7 @@ FindReplaceDialog::FindReplaceDialog() {
replace_text = memnew(LineEdit);
replace_text->set_anchor(MARGIN_RIGHT, ANCHOR_END);
replace_text->set_begin(Point2(15, 132));
- replace_text->set_end(Point2(15, 135));
+ replace_text->set_end(Point2(-15, 135));
//replace_text->set_self_opacity(0.7);
replace_mc->add_child(replace_text);
@@ -937,8 +937,8 @@ FindReplaceDialog::FindReplaceDialog() {
skip->set_anchor(MARGIN_TOP, ANCHOR_END);
skip->set_anchor(MARGIN_RIGHT, ANCHOR_END);
skip->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- skip->set_begin(Point2(70, button_margin));
- skip->set_end(Point2(10, margin));
+ skip->set_begin(Point2(-70, -button_margin));
+ skip->set_end(Point2(-10, -margin));
skip->set_text(TTR("Skip"));
add_child(skip);
skip->connect("pressed", this, "_skip_pressed");
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index 8945e14cce..f94f9ed197 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -613,7 +613,7 @@ private: // private stuff
void _parse_curve_geometry(XMLParser &parser, String p_id, String p_name);
void _parse_skin_controller(XMLParser &parser, String p_id);
- void _parse_morph_controller(XMLParser &parser, String id);
+ void _parse_morph_controller(XMLParser &parser, String p_id);
void _parse_controller(XMLParser &parser);
Node *_parse_visual_instance_geometry(XMLParser &parser);
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index e7344bbf13..5fdd2b72a8 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -106,7 +106,7 @@ class DependencyErrorDialog : public ConfirmationDialog {
void custom_action(const String &);
public:
- void show(const String &p_for, const Vector<String> &report);
+ void show(const String &p_for_file, const Vector<String> &report);
DependencyErrorDialog();
};
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 4a2e5b48e2..9f8e3526b4 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -66,7 +66,7 @@ class EditorAutoloadSettings : public VBoxContainer {
EditorLineEditFileChooser *autoload_add_path;
LineEdit *autoload_add_name;
- bool _autoload_name_is_valid(const String &p_string, String *r_error = NULL);
+ bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL);
void _autoload_add();
void _autoload_selected();
@@ -74,9 +74,9 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
void _autoload_file_callback(const String &p_path);
- Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
- bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
- void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
+ Variant get_drag_data_fw(const Point2 &p_point, Control *p_control);
+ bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const;
+ void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control);
protected:
void _notification(int p_what);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index e788fe2c13..51fb1554c1 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -633,13 +633,13 @@ Vector<EditorData::EditedScene> EditorData::get_edited_scenes() const {
return out_edited_scenes_list;
}
-void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) {
+void EditorData::set_edited_scene_version(uint64_t version, int p_scene_idx) {
ERR_FAIL_INDEX(current_edited_scene, edited_scene.size());
- if (scene_idx < 0) {
+ if (p_scene_idx < 0) {
edited_scene[current_edited_scene].version = version;
} else {
- ERR_FAIL_INDEX(scene_idx, edited_scene.size());
- edited_scene[scene_idx].version = version;
+ ERR_FAIL_INDEX(p_scene_idx, edited_scene.size());
+ edited_scene[p_scene_idx].version = version;
}
}
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 9f8331febd..b64f5f1c69 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -112,19 +112,19 @@ void EditorDirDialog::_notification(int p_what) {
}
}
-void EditorDirDialog::_item_collapsed(Object *_p_item) {
+void EditorDirDialog::_item_collapsed(Object *p_item) {
- TreeItem *p_item = _p_item->cast_to<TreeItem>();
+ TreeItem *item = p_item->cast_to<TreeItem>();
- if (updating || p_item->is_collapsed())
+ if (updating || item->is_collapsed())
return;
- TreeItem *ci = p_item->get_children();
+ TreeItem *ci = item->get_children();
while (ci) {
String p = ci->get_metadata(0);
if (p == "") {
- String pp = p_item->get_metadata(0);
+ String pp = item->get_metadata(0);
ci->set_metadata(0, pp.plus_file(ci->get_text(0)));
_update_dir(ci);
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 36fd86d88f..fe1dfa281c 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -37,7 +37,6 @@
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "io/zip_io.h"
-#include "os/dir_access.h"
#include "os/file_access.h"
#include "project_settings.h"
#include "script_language.h"
@@ -420,6 +419,63 @@ void EditorExportPlatform::_export_find_dependencies(const String &p_path, Set<S
}
}
+void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude) {
+
+ da->list_dir_begin();
+ String cur_dir = da->get_current_dir().replace("\\", "/");
+ if (!cur_dir.ends_with("/"))
+ cur_dir += "/";
+
+ Vector<String> dirs;
+ String f;
+ while ((f = da->get_next()) != "") {
+ if (da->current_is_dir())
+ dirs.push_back(f);
+ else {
+ String fullpath = cur_dir + f;
+ for (int i = 0; i < p_filters.size(); ++i) {
+ if (fullpath.matchn(p_filters[i])) {
+ if (!exclude) {
+ r_list.insert(fullpath);
+ } else {
+ r_list.erase(fullpath);
+ }
+ }
+ }
+ }
+ }
+
+ da->list_dir_end();
+
+ for (int i = 0; i < dirs.size(); ++i) {
+ String dir = dirs[i];
+ if (dir.begins_with("."))
+ continue;
+ da->change_dir(dir);
+ _edit_files_with_filter(da, p_filters, r_list, exclude);
+ da->change_dir("..");
+ }
+}
+
+void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) {
+
+ if (p_filter == "")
+ return;
+ Vector<String> split = p_filter.split(",");
+ Vector<String> filters;
+ for (int i = 0; i < split.size(); i++) {
+ String f = split[i].strip_edges();
+ if (f.empty())
+ continue;
+ filters.push_back(f);
+ }
+
+ DirAccess *da = DirAccess::open("res://");
+ ERR_FAIL_NULL(da);
+ _edit_files_with_filter(da, filters, r_list, exclude);
+ memdelete(da);
+}
+
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata) {
Ref<EditorExportPlatform> platform = p_preset->get_platform();
@@ -449,6 +505,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
}
+ _edit_filter_list(paths, p_preset->get_include_filter(), false);
+ _edit_filter_list(paths, p_preset->get_exclude_filter(), true);
+
//store everything in the export medium
int idx = 0;
int total = paths.size();
diff --git a/editor/editor_export.h b/editor/editor_export.h
index dc4b198575..df42b0d95d 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -30,6 +30,7 @@
#ifndef EDITOR_EXPORT_H
#define EDITOR_EXPORT_H
+#include "os/dir_access.h"
#include "resource.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
@@ -157,6 +158,9 @@ private:
static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
+ void _edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude);
+ void _edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude);
+
protected:
bool exists_export_template(String template_file_name, String *err) const;
String find_export_template(String template_file_name, String *err = NULL) const;
@@ -290,7 +294,7 @@ public:
void set_name(const String &p_name);
void set_os_name(const String &p_name);
- void set_logo(const Ref<Texture> &p_loco);
+ void set_logo(const Ref<Texture> &p_logo);
void set_release_64(const String &p_file);
void set_release_32(const String &p_file);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index eeb2f5ae8a..2f4ac02703 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -339,6 +339,7 @@ bool EditorFileSystem::_update_scan_actions() {
int idx = ia.dir->find_file_index(ia.file);
ERR_CONTINUE(idx == -1);
+ _delete_internal_files(ia.dir->files[idx]->file);
memdelete(ia.dir->files[idx]);
ia.dir->files.remove(idx);
@@ -598,6 +599,10 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
fi->type = fc->type;
fi->modified_time = fc->modification_time;
fi->import_modified_time = fc->import_modification_time;
+ if (fc->type == String()) {
+ fi->type = ResourceLoader::get_resource_type(path);
+ //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?)
+ }
} else {
@@ -615,6 +620,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
}
fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path);
+ print_line("import extension tried resource type for " + path + " and its " + fi->type);
fi->modified_time = 0;
fi->import_modified_time = 0;
@@ -633,6 +639,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
fi->import_modified_time = 0;
} else {
fi->type = ResourceLoader::get_resource_type(path);
+ print_line("regular import tried resource type for " + path + " and its " + fi->type);
fi->modified_time = mt;
fi->import_modified_time = 0;
}
@@ -832,6 +839,19 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
}
}
+void EditorFileSystem::_delete_internal_files(String p_file) {
+ if (FileAccess::exists(p_file + ".import")) {
+ List<String> paths;
+ ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths);
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ for (List<String>::Element *E = paths.front(); E; E = E->next()) {
+ da->remove(E->get());
+ }
+ da->remove(p_file + ".import");
+ memdelete(da);
+ }
+}
+
void EditorFileSystem::_thread_func_sources(void *_userdata) {
EditorFileSystem *efs = (EditorFileSystem *)_userdata;
@@ -1186,6 +1206,7 @@ void EditorFileSystem::update_file(const String &p_file) {
if (!FileAccess::exists(p_file)) {
//was removed
+ _delete_internal_files(p_file);
memdelete(fs->files[cpos]);
fs->files.remove(cpos);
call_deferred("emit_signal", "filesystem_changed"); //update later
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 3522a1ab1d..f98758fd03 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -168,6 +168,8 @@ class EditorFileSystem : public Node {
void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress);
+ void _delete_internal_files(String p_file);
+
Set<String> valid_extensions;
Set<String> import_extensions;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f80c4ee0e2..8b1f558c0a 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1788,7 +1788,7 @@ void EditorHelpBit::_bind_methods() {
void EditorHelpBit::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
+ add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles"));
}
}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index de30b543fc..e0d68605ab 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -137,7 +137,7 @@ class EditorHelp : public VBoxContainer {
void _help_callback(const String &p_topic);
- void _add_text(const String &p_text);
+ void _add_text(const String &p_bbcode);
bool scroll_locked;
//void _button_pressed(int p_idx);
@@ -189,7 +189,7 @@ class EditorHelpBit : public Panel {
RichTextLabel *rich_text;
void _go_to_help(String p_what);
- void _meta_clicked(String p_what);
+ void _meta_clicked(String p_select);
protected:
static void _bind_methods();
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp
index 6ebfcbf313..74bb526ccc 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_name_dialog.cpp
@@ -87,6 +87,6 @@ EditorNameDialog::EditorNameDialog() {
makevb->add_child(name);
name->set_margin(MARGIN_TOP, 5);
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
- name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5);
+ name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
name->connect("gui_input", this, "_line_gui_input");
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 730ba3cacc..242648d4a9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -364,10 +364,28 @@ void EditorNode::_fs_changed() {
E->get()->invalidate();
}
- if (export_defer.platform != "") {
+ if (export_defer.preset != "") {
+ Ref<EditorExportPreset> preset;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ preset = EditorExport::get_singleton()->get_export_preset(i);
+ if (preset->get_name() == export_defer.preset) {
+ break;
+ }
+ }
+ if (preset.is_null()) {
+ String err = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ Ref<EditorExportPlatform> platform = preset->get_platform();
+ if (platform.is_null()) {
+ String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ }
+ }
- //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
- export_defer.platform = "";
+ export_defer.preset = "";
}
{
@@ -701,34 +719,34 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
ERR_FAIL_COND(err != OK);
}
-bool EditorNode::_find_and_save_resource(RES res, Map<RES, bool> &processed, int32_t flags) {
+bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
- if (res.is_null())
+ if (p_res.is_null())
return false;
- if (processed.has(res)) {
+ if (processed.has(p_res)) {
- return processed[res];
+ return processed[p_res];
}
- bool changed = res->is_edited();
- res->set_edited(false);
+ bool changed = p_res->is_edited();
+ p_res->set_edited(false);
- bool subchanged = _find_and_save_edited_subresources(res.ptr(), processed, flags);
+ bool subchanged = _find_and_save_edited_subresources(p_res.ptr(), processed, flags);
- //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
+ //print_line("checking if edited: "+p_res->get_type()+" :: "+p_res->get_name()+" :: "+p_res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
- if (res->get_path().is_resource_file()) {
+ if (p_res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
- print_line("Also saving modified external resource: " + res->get_path());
- ResourceSaver::save(res->get_path(), res, flags);
+ print_line("Also saving modified external resource: " + p_res->get_path());
+ ResourceSaver::save(p_res->get_path(), p_res, flags);
}
- processed[res] = false; //because it's a file
+ processed[p_res] = false; //because it's a file
return false;
} else {
- processed[res] = changed;
+ processed[p_res] = changed;
return changed;
}
}
@@ -1214,7 +1232,7 @@ void EditorNode::_dialog_action(String p_file) {
ml = Ref<MeshLibrary>(memnew(MeshLibrary));
}
- //MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true);
+ MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
Error err = ResourceSaver::save(p_file, ml);
if (err) {
@@ -1285,7 +1303,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err == ERR_CANT_OPEN) {
config.instance(); // new config
@@ -1296,7 +1314,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_docks_to_config(config, p_file);
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -1313,7 +1331,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK || !config->has_section(p_file)) {
show_warning(TTR("Layout name not found!"));
@@ -1327,7 +1345,7 @@ void EditorNode::_dialog_action(String p_file) {
config->set_value(p_file, E->get(), Variant());
}
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -3774,9 +3792,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
singleton->progress_dialog->add_task(p_task, p_label, p_steps);
}
-void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {
+void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_redraw);
+ singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
}
void EditorNode::progress_end_task(const String &p_task) {
@@ -3844,9 +3862,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
-Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
+Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
- export_defer.platform = p_platform;
+ export_defer.preset = preset;
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
@@ -4313,7 +4331,7 @@ void EditorNode::_update_layouts_menu() {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4361,7 +4379,7 @@ void EditorNode::_layout_menu_option(int p_id) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4907,13 +4925,19 @@ void EditorNode::dim_editor(bool p_dimming) {
static int dim_count = 0;
bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup");
if (p_dimming) {
- if (dim_ui && dim_count == 0)
- _start_dimming(true);
- dim_count++;
+ if (dim_ui) {
+ if (dim_count == 0) {
+ _start_dimming(true);
+ }
+ dim_count++;
+ }
} else {
- dim_count--;
- if (dim_count < 1)
+ if (dim_count == 1) {
_start_dimming(false);
+ dim_count = 0;
+ } else if (dim_ui && dim_count > 0) {
+ dim_count--;
+ }
}
}
@@ -6058,7 +6082,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));
add_editor_plugin(memnew(MeshInstanceEditorPlugin(this)));
add_editor_plugin(memnew(AnimationTreeEditorPlugin(this)));
- //add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) );
+ add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
add_editor_plugin(memnew(StyleBoxEditorPlugin(this)));
add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index a440aaa1e6..cf6ef33325 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -539,7 +539,7 @@ private:
}
struct ExportDefer {
- String platform;
+ String preset;
String path;
bool debug;
String password;
@@ -581,7 +581,7 @@ private:
void _update_top_menu_visibility();
void _update_layouts_menu();
- void _layout_menu_option(int p_idx);
+ void _layout_menu_option(int p_id);
void _toggle_search_bar(bool p_pressed);
void _clear_search_box();
@@ -742,7 +742,7 @@ public:
void show_warning(const String &p_text, const String &p_title = "Warning!");
- Error export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
+ Error export_preset(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
static void register_editor_types();
static void unregister_editor_types();
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 0baa373b42..77c5501b25 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -134,7 +134,7 @@ public:
virtual void make_visible(bool p_visible);
virtual void selected_notify() {} //notify that it was raised by the user, not the editor
virtual void edit(Object *p_object);
- virtual bool handles(Object *p_node) const;
+ virtual bool handles(Object *p_object) const;
virtual Dictionary get_state() const; //save editor state so it can't be reloaded when reloading scene
virtual void set_state(const Dictionary &p_state); //restore editor state (likely was saved with the scene)
virtual void clear(); // clear any temporary data in te editor, reset it (likely new scene or load another scene)
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 1bfa094a38..cedd571194 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -115,8 +115,8 @@ public:
static EditorResourcePreview *get_singleton();
//callback function is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
- void queue_resource_preview(const String &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
- void queue_edited_resource_preview(const Ref<Resource> &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
+ void queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
+ void queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 07af60d634..70367f1e07 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -843,9 +843,9 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
hints[p_hint.name] = p_hint;
}
-void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites) {
+void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) {
- favorite_dirs = p_favorites;
+ favorite_dirs = p_favorites_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"), FileAccess::WRITE);
if (f) {
for (int i = 0; i < favorite_dirs.size(); i++)
@@ -859,9 +859,9 @@ Vector<String> EditorSettings::get_favorite_dirs() const {
return favorite_dirs;
}
-void EditorSettings::set_recent_dirs(const Vector<String> &p_recent) {
+void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
- recent_dirs = p_recent;
+ recent_dirs = p_recent_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"), FileAccess::WRITE);
if (f) {
for (int i = 0; i < recent_dirs.size(); i++)
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index d5adb84b63..a99d7e0ad5 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -145,7 +145,7 @@ public:
void add_property_hint(const PropertyInfo &p_hint);
- void set_favorite_dirs(const Vector<String> &p_favorite_dirs);
+ void set_favorite_dirs(const Vector<String> &p_favorites_dirs);
Vector<String> get_favorite_dirs() const;
void set_recent_dirs(const Vector<String> &p_recent_dirs);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 7b1a6a8e27..7c422eb26e 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -455,6 +455,7 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_icon("increment", "HScrollBar", empty_icon);
theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
@@ -466,6 +467,7 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_icon("increment", "VScrollBar", empty_icon);
theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 77898aa6c2..2ec0c38815 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -158,7 +158,7 @@ private:
void _favorites_pressed();
void _open_pressed();
- void _dir_rmb_pressed(const Vector2 &local_mouse_pos);
+ void _dir_rmb_pressed(const Vector2 &p_pos);
void _search_changed(const String &p_text);
void _files_list_rmb_select(int p_item, const Vector2 &p_pos);
diff --git a/editor/icons/2x/icon_editor_control_anchor.png b/editor/icons/2x/icon_editor_control_anchor.png
new file mode 100644
index 0000000000..838f85b763
--- /dev/null
+++ b/editor/icons/2x/icon_editor_control_anchor.png
Binary files differ
diff --git a/editor/icons/icon_GUI_scroll_grabber_pressed.png b/editor/icons/icon_GUI_scroll_grabber_pressed.png
new file mode 100644
index 0000000000..a46d242ddd
--- /dev/null
+++ b/editor/icons/icon_GUI_scroll_grabber_pressed.png
Binary files differ
diff --git a/editor/icons/icon_editor_control_anchor.png b/editor/icons/icon_editor_control_anchor.png
new file mode 100644
index 0000000000..158dd62a7b
--- /dev/null
+++ b/editor/icons/icon_editor_control_anchor.png
Binary files differ
diff --git a/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg
new file mode 100644
index 0000000000..852e985c4c
--- /dev/null
+++ b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="12"
+ height="12"
+ viewBox="0 0 12 11.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="icon_GUI_scroll_grabber_pressed.svg"
+ inkscape:export-filename="D:\HDD Documents\Other Projects\godot\editor\icons\icon_GUI_scroll_grabber_pressed.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="69.166667"
+ inkscape:cx="3.7445783"
+ inkscape:cy="6"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:snap-nodes="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4136"
+ empspacing="4" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3623)">
+ <circle
+ style="opacity:1;fill:#afafaf;fill-opacity:0.72941178;stroke:none;stroke-width:2.24999642000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4239"
+ cx="6"
+ cy="1046.3623"
+ r="2.9999952"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/icon_scroll_grabber_hl.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96"
+ d="m 8.9999952,1046.3623 c 0,1.6569 -1.3431436,3 -2.9999952,3 -1.6568516,0 -2.9999952,-1.3431 -2.9999952,-3 0,-1.6568 1.3431436,-3 2.9999952,-3 1.6568516,0 2.9999952,1.3432 2.9999952,3 z" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_editor_control_anchor.svg b/editor/icons/source/icon_editor_control_anchor.svg
new file mode 100644
index 0000000000..473b69d060
--- /dev/null
+++ b/editor/icons/source/icon_editor_control_anchor.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/gilles/godot/editor/icons/icon_editor_control_anchor.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96"
+ sodipodi:docname="icon_editor_control_anchor.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627416"
+ inkscape:cx="0.71312079"
+ inkscape:cy="11.175116"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1356"
+ inkscape:window-height="742"
+ inkscape:window-x="4"
+ inkscape:window-y="20"
+ inkscape:window-maximized="0"
+ inkscape:pagecheckerboard="true"
+ showguides="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:#a5efac;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
+ d="M 8.8320312 6.1445312 A 4 4.0000234 0 0 1 6.140625 8.8300781 L 16 16 L 8.8320312 6.1445312 z "
+ transform="translate(0,1036.3622)"
+ id="path7188" />
+ <ellipse
+ r="2"
+ style="opacity:1;fill:#6e6e6e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="ellipse4152"
+ cx="3"
+ cy="1039.3622" />
+ <ellipse
+ style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.53333384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="path31"
+ cx="4"
+ cy="1040.3622"
+ rx="4"
+ ry="4.0000091" />
+ <circle
+ style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.5333333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="path31-3"
+ cx="5"
+ cy="1041.3622"
+ r="0" />
+ </g>
+</svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 3626c6be59..a75147a3a9 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -87,8 +87,8 @@ struct ColladaImport {
Error _create_scene_skeletons(Collada::Node *p_node);
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
Error _create_resources(Collada::Node *p_node);
- Error _create_material(const String &p_material);
- Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false);
+ Error _create_material(const String &p_target);
+ Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false);
Error load(const String &p_path, int p_flags, bool p_force_make_tangents = false);
void _fix_param_animation_tracks();
void create_animation(int p_clip, bool p_make_tracks_in_all_bones, bool p_import_value_tracks);
@@ -390,7 +390,7 @@ Error ColladaImport::_create_material(const String &p_target) {
}
}
} else {
- //material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
+ material->set_albedo(effect.diffuse.color);
}
// SPECULAR
@@ -591,7 +591,7 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c
}
}
-Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) {
+Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) {
bool local_xform_mirror = p_local_xform.basis.determinant() < 0;
@@ -714,35 +714,35 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
bool has_weights = false;
- if (skin_controller) {
+ if (p_skin_controller) {
const Collada::SkinControllerData::Source *weight_src = NULL;
int weight_ofs = 0;
- if (skin_controller->weights.sources.has("WEIGHT")) {
+ if (p_skin_controller->weights.sources.has("WEIGHT")) {
- String weight_id = skin_controller->weights.sources["WEIGHT"].source;
- weight_ofs = skin_controller->weights.sources["WEIGHT"].offset;
- if (skin_controller->sources.has(weight_id)) {
+ String weight_id = p_skin_controller->weights.sources["WEIGHT"].source;
+ weight_ofs = p_skin_controller->weights.sources["WEIGHT"].offset;
+ if (p_skin_controller->sources.has(weight_id)) {
- weight_src = &skin_controller->sources[weight_id];
+ weight_src = &p_skin_controller->sources[weight_id];
}
}
int joint_ofs = 0;
- if (skin_controller->weights.sources.has("JOINT")) {
+ if (p_skin_controller->weights.sources.has("JOINT")) {
- joint_ofs = skin_controller->weights.sources["JOINT"].offset;
+ joint_ofs = p_skin_controller->weights.sources["JOINT"].offset;
}
//should be OK, given this was pre-checked.
int index_ofs = 0;
- int wstride = skin_controller->weights.sources.size();
- for (int w_i = 0; w_i < skin_controller->weights.sets.size(); w_i++) {
+ int wstride = p_skin_controller->weights.sources.size();
+ for (int w_i = 0; w_i < p_skin_controller->weights.sets.size(); w_i++) {
- int amount = skin_controller->weights.sets[w_i];
+ int amount = p_skin_controller->weights.sets[w_i];
Vector<Collada::Vertex::Weight> weights;
@@ -751,13 +751,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
Collada::Vertex::Weight w;
int read_from = index_ofs + a_i * wstride;
- ERR_FAIL_INDEX_V(read_from + wstride - 1, skin_controller->weights.indices.size(), ERR_INVALID_DATA);
- int weight_index = skin_controller->weights.indices[read_from + weight_ofs];
+ ERR_FAIL_INDEX_V(read_from + wstride - 1, p_skin_controller->weights.indices.size(), ERR_INVALID_DATA);
+ int weight_index = p_skin_controller->weights.indices[read_from + weight_ofs];
ERR_FAIL_INDEX_V(weight_index, weight_src->array.size(), ERR_INVALID_DATA);
w.weight = weight_src->array[weight_index];
- int bone_index = skin_controller->weights.indices[read_from + joint_ofs];
+ int bone_index = p_skin_controller->weights.indices[read_from + joint_ofs];
if (bone_index == -1)
continue; //ignore this weight (refers to bind shape)
ERR_FAIL_INDEX_V(bone_index, bone_remap.size(), ERR_INVALID_DATA);
diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp
index aa96f731ce..1890ca906a 100644
--- a/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -1307,7 +1307,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
//confirm_import->set_child_rect(cvb);
PanelContainer *pc = memnew( PanelContainer );
- pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+ pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal","TextEdit"));
//ec->add_child(pc);
missing_files = memnew( RichTextLabel );
cvb->add_margin_child(TTR("The Following Files are Missing:"),pc,true);
diff --git a/editor/output_strings.cpp b/editor/output_strings.cpp
index eb2fc62f03..8c9f8386ef 100644
--- a/editor/output_strings.cpp
+++ b/editor/output_strings.cpp
@@ -38,15 +38,15 @@ void OutputStrings::update_scrollbars() {
v_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END);
v_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- v_scroll->set_begin(Point2(vmin.width, 0));
+ v_scroll->set_begin(Point2(-vmin.width, 0));
v_scroll->set_end(Point2(0, 0));
h_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END);
h_scroll->set_anchor(MARGIN_TOP, ANCHOR_END);
h_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- h_scroll->set_begin(Point2(0, hmin.y));
- h_scroll->set_end(Point2(vmin.x, 0));
+ h_scroll->set_begin(Point2(0, -hmin.y));
+ h_scroll->set_end(Point2(-vmin.x, 0));
margin.y = hmin.y;
margin.x = vmin.x;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index c4e79bf263..ecae272b6d 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1246,7 +1246,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
set_focus_mode(FOCUS_ALL);
player = NULL;
- add_style_override("panel", get_stylebox("panel", "Panel"));
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
Label *l;
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index ceaa73569a..bcf40f52d3 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -155,7 +155,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_player_changed(Object *p_pl);
void _animation_key_editor_seek(float p_pos, bool p_drag);
- void _animation_key_editor_anim_len_changed(float p_new);
+ void _animation_key_editor_anim_len_changed(float p_len);
void _animation_key_editor_anim_step_changed(float p_len);
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
@@ -198,8 +198,8 @@ public:
virtual String get_name() const { return "Anim"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
AnimationPlayerEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 156a74144c..6e24d4d2cb 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -676,16 +676,16 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2 &
return CLICK_NONE;
}
-Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node, bool p_input, int p_slot) {
+Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node_id, bool p_input, int p_slot) {
Ref<StyleBox> style = get_stylebox("panel", "PopupMenu");
Ref<Font> font = get_font("font", "PopupMenu");
Ref<Texture> slot_icon = get_icon("NodeRealSlot", "EditorIcons");
- Size2 size = get_node_size(p_node);
- Point2 pos = anim_tree->node_get_pos(p_node);
+ Size2 size = get_node_size(p_node_id);
+ Point2 pos = anim_tree->node_get_pos(p_node_id);
- if (click_type == CLICK_NODE && click_node == p_node) {
+ if (click_type == CLICK_NODE && click_node == p_node_id) {
pos += click_motion - click_pos;
if (pos.x < 5)
@@ -1371,7 +1371,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
edit_option = memnew(OptionButton);
edit_option->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_option->set_margin(MARGIN_RIGHT, 10);
+ edit_option->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_option);
edit_option->connect("item_selected", this, "_edit_dialog_changedf");
edit_option->hide();
@@ -1379,7 +1379,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
for (int i = 0; i < 2; i++) {
edit_scroll[i] = memnew(HSlider);
edit_scroll[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_scroll[i]->set_margin(MARGIN_RIGHT, 10);
+ edit_scroll[i]->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_scroll[i]);
edit_scroll[i]->hide();
edit_scroll[i]->connect("value_changed", this, "_edit_dialog_changedf");
@@ -1387,7 +1387,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
for (int i = 0; i < 4; i++) {
edit_line[i] = memnew(LineEdit);
edit_line[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_line[i]->set_margin(MARGIN_RIGHT, 10);
+ edit_line[i]->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_line[i]);
edit_line[i]->hide();
edit_line[i]->connect("text_changed", this, "_edit_dialog_changeds");
@@ -1399,14 +1399,14 @@ AnimationTreeEditor::AnimationTreeEditor() {
edit_button = memnew(Button);
edit_button->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_button->set_margin(MARGIN_RIGHT, 10);
+ edit_button->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_button);
edit_button->hide();
edit_button->connect("pressed", this, "_edit_oneshot_start");
edit_check = memnew(CheckButton);
edit_check->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_check->set_margin(MARGIN_RIGHT, 10);
+ edit_check->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_check);
edit_check->hide();
edit_check->connect("pressed", this, "_edit_dialog_changed");
@@ -1428,7 +1428,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
filter_button = memnew(Button);
filter_button->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- filter_button->set_margin(MARGIN_RIGHT, 10);
+ filter_button->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(filter_button);
filter_button->hide();
filter_button->set_text(TTR("Filters.."));
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index 785f042dd9..972c6c9b47 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -160,7 +160,7 @@ protected:
public:
virtual Size2 get_minimum_size() const;
- void edit(AnimationTreePlayer *p_player);
+ void edit(AnimationTreePlayer *p_anim_tree);
AnimationTreeEditor();
};
@@ -175,8 +175,8 @@ class AnimationTreeEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "AnimTree"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
AnimationTreeEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp
index b8f8464bae..8e625c4a73 100644
--- a/editor/plugins/camera_editor_plugin.cpp
+++ b/editor/plugins/camera_editor_plugin.cpp
@@ -88,7 +88,7 @@ CameraEditor::CameraEditor() {
preview->set_toggle_mode(true);
preview->set_anchor(MARGIN_LEFT, Control::ANCHOR_END);
preview->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
- preview->set_margin(MARGIN_LEFT, 60);
+ preview->set_margin(MARGIN_LEFT, -60);
preview->set_margin(MARGIN_RIGHT, 0);
preview->set_margin(MARGIN_TOP, 0);
preview->set_margin(MARGIN_BOTTOM, 10);
diff --git a/editor/plugins/camera_editor_plugin.h b/editor/plugins/camera_editor_plugin.h
index f4b26fcdac..a0f98687cb 100644
--- a/editor/plugins/camera_editor_plugin.h
+++ b/editor/plugins/camera_editor_plugin.h
@@ -68,8 +68,8 @@ class CameraEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Camera"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CameraEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index c19f0ff4db..9e57e53a24 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -709,8 +709,8 @@ CanvasItem *CanvasItemEditor::get_single_item() {
return single_item;
}
-CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_click, Vector2 &r_point) {
-
+CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
+ // Returns a drag type if a resize handle is clicked
CanvasItem *canvas_item = get_single_item();
ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
@@ -775,6 +775,90 @@ CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_cli
return DRAG_NONE;
}
+float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_opposite_anchor) {
+ bool snapped = false;
+ float dist, dist_min = 0.0;
+ float radius = 0.05 / zoom;
+ float basic_anchors[3] = { 0.0, 0.5, 1.0 };
+ for (int i = 0; i < 3; i++) {
+ if ((dist = fabs(p_anchor - basic_anchors[i])) < radius) {
+ if (!snapped || dist <= dist_min) {
+ p_anchor = basic_anchors[i];
+ dist_min = dist;
+ snapped = true;
+ }
+ }
+ }
+ if (p_opposite_anchor >= 0 && (dist = fabs(p_anchor - p_opposite_anchor)) < radius) {
+ if (!snapped || dist <= dist_min) {
+ p_anchor = p_opposite_anchor;
+ dist_min = dist;
+ snapped = true;
+ }
+ }
+ if (p_snapped)
+ *p_snapped = snapped;
+ return p_anchor;
+}
+
+Vector2 CanvasItemEditor::_anchor_to_position(Control *p_control, Vector2 anchor) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+
+ Transform2D parent_transform = p_control->get_transform().affine_inverse();
+ Size2 parent_size = p_control->get_parent_area_size();
+
+ return parent_transform.xform(Vector2(parent_size.x * anchor.x, parent_size.y * anchor.y));
+}
+
+Vector2 CanvasItemEditor::_position_to_anchor(Control *p_control, Vector2 position) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+ Size2 parent_size = p_control->get_parent_area_size();
+
+ return p_control->get_transform().xform(position) / parent_size;
+}
+
+CanvasItemEditor::DragType CanvasItemEditor::_get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
+ // Returns a drag type if an anchor handle is clicked
+ CanvasItem *canvas_item = get_single_item();
+ ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
+
+ Control *control = canvas_item->cast_to<Control>();
+ ERR_FAIL_COND_V(!control, DRAG_NONE);
+
+ Vector2 anchor_pos[4];
+ anchor_pos[0] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_TOP));
+ anchor_pos[1] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_TOP));
+ anchor_pos[2] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_BOTTOM));
+ anchor_pos[3] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_BOTTOM));
+
+ Rect2 anchor_rects[4];
+ for (int i = 0; i < 4; i++) {
+ anchor_pos[i] = (transform * control->get_global_transform_with_canvas()).xform(_anchor_to_position(control, anchor_pos[i]));
+ anchor_rects[i] = Rect2(anchor_pos[i], anchor_handle->get_size());
+ anchor_rects[i].position -= anchor_handle->get_size() * Vector2(i == 0 || i == 3, i <= 1);
+ }
+
+ DragType dragger[] = {
+ DRAG_ANCHOR_TOP_LEFT,
+ DRAG_ANCHOR_TOP_RIGHT,
+ DRAG_ANCHOR_BOTTOM_RIGHT,
+ DRAG_ANCHOR_BOTTOM_LEFT,
+ };
+
+ for (int i = 0; i < 4; i++) {
+ if (anchor_rects[i].has_point(p_click)) {
+ r_point = transform.affine_inverse().xform(anchor_pos[i]);
+ if ((anchor_pos[0] == anchor_pos[2]) && (anchor_pos[0].distance_to(p_click) < anchor_handle->get_size().length() / 3.0)) {
+ return DRAG_ANCHOR_ALL;
+ } else {
+ return dragger[i];
+ }
+ }
+ }
+
+ return DRAG_NONE;
+}
+
void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) {
List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -863,9 +947,9 @@ void CanvasItemEditor::incend(float &beg, float &end, float inc, float minsize,
}
}
-void CanvasItemEditor::_append_canvas_item(CanvasItem *c) {
+void CanvasItemEditor::_append_canvas_item(CanvasItem *p_item) {
- editor_selection->add_node(c);
+ editor_selection->add_node(p_item);
}
void CanvasItemEditor::_snap_changed() {
@@ -1265,6 +1349,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (b) {
bool ik_found = false;
+
bool first = true;
while (b) {
@@ -1336,8 +1421,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
}
- // Drag
- drag = _find_drag_type(click, drag_point_from);
+ // Drag resize handles
+ drag = _get_resize_handle_drag_type(click, drag_point_from);
if (drag != DRAG_NONE) {
drag_from = transform.affine_inverse().xform(click);
se->undo_state = canvas_item->edit_get_state();
@@ -1347,6 +1432,16 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
se->undo_pivot = canvas_item->cast_to<Control>()->get_pivot_offset();
return;
}
+
+ // Drag anchor handles
+ if (canvas_item->cast_to<Control>()) {
+ drag = _get_anchor_handle_drag_type(click, drag_point_from);
+ if (drag != DRAG_NONE) {
+ drag_from = transform.affine_inverse().xform(click);
+ se->undo_state = canvas_item->edit_get_state();
+ return;
+ }
+ }
}
}
@@ -1423,9 +1518,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
if (drag == DRAG_NONE) {
-
if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
-
+ // Pan the viewport
Point2i relative;
if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
@@ -1441,7 +1535,6 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
List<Node *> &selection = editor_selection->get_selected_node_list();
-
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
@@ -1470,7 +1563,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
if (drag == DRAG_ROTATE) {
-
+ // Rotate the node
Vector2 center = canvas_item->get_global_transform_with_canvas().get_origin();
{
Node2D *node = canvas_item->cast_to<Node2D>();
@@ -1499,10 +1592,47 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
}
+ Control *control = canvas_item->cast_to<Control>();
+ if (control) {
+ // Drag and snap the anchor
+ Vector2 anchor = _position_to_anchor(control, canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto - drag_from + drag_point_from));
+
+ switch (drag) {
+ case DRAG_ANCHOR_TOP_LEFT:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_TOP_RIGHT:
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_BOTTOM_RIGHT:
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_BOTTOM_LEFT:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_ALL:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x));
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x));
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y));
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y));
+ continue;
+ break;
+ }
+ }
+
bool uniform = m->get_shift();
bool symmetric = m->get_alt();
- dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0));
+ if (drag == DRAG_ALL || drag == DRAG_NODE_2D)
+ dto -= drag_from - drag_point_from;
if (uniform && (drag == DRAG_ALL || drag == DRAG_NODE_2D)) {
if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) {
@@ -1528,76 +1658,75 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
// Keep the height/width ratio of the item
float aspect = local_rect.size.aspect();
switch (drag) {
- case DRAG_LEFT: {
+ case DRAG_LEFT:
drag_vector.y = -drag_vector.x / aspect;
- } break;
- case DRAG_RIGHT: {
+ break;
+ case DRAG_RIGHT:
drag_vector.y = drag_vector.x / aspect;
- } break;
- case DRAG_TOP: {
+ break;
+ case DRAG_TOP:
drag_vector.x = -drag_vector.y * aspect;
- } break;
- case DRAG_BOTTOM: {
+ break;
+ case DRAG_BOTTOM:
drag_vector.x = drag_vector.y * aspect;
- } break;
+ break;
case DRAG_BOTTOM_LEFT:
- case DRAG_TOP_RIGHT: {
+ case DRAG_TOP_RIGHT:
if (aspect > 1.0) { // width > height, take x as reference
drag_vector.y = -drag_vector.x / aspect;
} else { // height > width, take y as reference
drag_vector.x = -drag_vector.y * aspect;
}
- } break;
+ break;
case DRAG_BOTTOM_RIGHT:
- case DRAG_TOP_LEFT: {
+ case DRAG_TOP_LEFT:
if (aspect > 1.0) { // width > height, take x as reference
drag_vector.y = drag_vector.x / aspect;
} else { // height > width, take y as reference
drag_vector.x = drag_vector.y * aspect;
}
- } break;
+ break;
}
} else {
switch (drag) {
case DRAG_RIGHT:
- case DRAG_LEFT: {
+ case DRAG_LEFT:
drag_vector.y = 0;
- } break;
+ break;
case DRAG_TOP:
- case DRAG_BOTTOM: {
+ case DRAG_BOTTOM:
drag_vector.x = 0;
- } break;
+ break;
}
}
switch (drag) {
- case DRAG_ALL: {
+ case DRAG_ALL:
begin += drag_vector;
end += drag_vector;
- } break;
+ break;
case DRAG_RIGHT:
case DRAG_BOTTOM:
- case DRAG_BOTTOM_RIGHT: {
+ case DRAG_BOTTOM_RIGHT:
incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
-
- case DRAG_TOP_LEFT: {
+ break;
+ case DRAG_TOP_LEFT:
incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
-
+ break;
case DRAG_TOP:
- case DRAG_TOP_RIGHT: {
+ case DRAG_TOP_RIGHT:
incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
- } break;
+ break;
case DRAG_LEFT:
- case DRAG_BOTTOM_LEFT: {
+ case DRAG_BOTTOM_LEFT:
incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
- case DRAG_PIVOT: {
+ break;
+
+ case DRAG_PIVOT:
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -1607,15 +1736,13 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
canvas_item->cast_to<Control>()->set_pivot_offset(se->undo_pivot + drag_vector);
}
continue;
- } break;
- case DRAG_NODE_2D: {
+ break;
+ case DRAG_NODE_2D:
ERR_FAIL_COND(!canvas_item->cast_to<Node2D>());
canvas_item->cast_to<Node2D>()->set_global_position(dto);
continue;
- } break;
-
- default: {}
+ break;
}
if (!dragging_bone) {
@@ -1768,6 +1895,30 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
}
+void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side) {
+ if (p_value != 0) {
+ Color color = Color(0.8, 0.8, 0.8, 0.5);
+ Ref<Font> font = get_font("font", "Label");
+ String str = vformat("%.1f %%", p_value * 100.0);
+ Size2 text_size = font->get_string_size(str);
+ switch (p_side) {
+ case MARGIN_LEFT:
+ p_position += Vector2(-text_size.x - 5, text_size.y / 2);
+ break;
+ case MARGIN_TOP:
+ p_position += Vector2(-text_size.x / 2, -5);
+ break;
+ case MARGIN_RIGHT:
+ p_position += Vector2(5, text_size.y / 2);
+ break;
+ case MARGIN_BOTTOM:
+ p_position += Vector2(-text_size.x / 2, text_size.y + 5);
+ break;
+ }
+ viewport->draw_string(font, p_position, str, color);
+ }
+}
+
void CanvasItemEditor::_viewport_draw() {
// TODO fetch the viewport?
@@ -1870,13 +2021,99 @@ void CanvasItemEditor::_viewport_draw() {
pivot_found = true;
}
}
- if (canvas_item->cast_to<Control>()) {
- Vector2 pivot_ofs = canvas_item->cast_to<Control>()->get_pivot_offset();
+
+ Control *control = canvas_item->cast_to<Control>();
+ if (control) {
+ Vector2 pivot_ofs = control->get_pivot_offset();
if (pivot_ofs != Vector2()) {
viewport->draw_texture(pivot, xform.xform(pivot_ofs) + (-pivot->get_size() / 2).floor());
}
can_move_pivot = true;
pivot_found = true;
+
+ if (tool == TOOL_SELECT) {
+ float anchors_values[4];
+ anchors_values[0] = control->get_anchor(MARGIN_LEFT);
+ anchors_values[1] = control->get_anchor(MARGIN_TOP);
+ anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
+ anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+
+ // Draw the anchors
+ Vector2 anchors[4];
+ Vector2 anchors_pos[4];
+ for (int i = 0; i < 4; i++) {
+ anchors[i] = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]);
+ anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i]));
+ }
+
+ // Get which anchor is dragged
+ int dragged_anchor = -1;
+ switch (drag) {
+ case DRAG_ANCHOR_ALL:
+ case DRAG_ANCHOR_TOP_LEFT:
+ dragged_anchor = 0;
+ break;
+ case DRAG_ANCHOR_TOP_RIGHT:
+ dragged_anchor = 1;
+ break;
+ case DRAG_ANCHOR_BOTTOM_RIGHT:
+ dragged_anchor = 2;
+ break;
+ case DRAG_ANCHOR_BOTTOM_LEFT:
+ dragged_anchor = 3;
+ break;
+ }
+
+ if (dragged_anchor >= 0) {
+ // Draw the 4 lines when dragged
+ bool snapped;
+ Color color_snapped = Color(0.64, 0.93, 0.67, 0.5);
+ Color color_base = Color(0.8, 0.8, 0.8, 0.5);
+
+ Vector2 corners_pos[4];
+ for (int i = 0; i < 4; i++) {
+ corners_pos[i] = xform.xform(_anchor_to_position(control, Vector2((i == 0 || i == 3) ? ANCHOR_BEGIN : ANCHOR_END, (i <= 1) ? ANCHOR_BEGIN : ANCHOR_END)));
+ }
+
+ Vector2 line_starts[4];
+ Vector2 line_ends[4];
+ for (int i = 0; i < 4; i++) {
+ float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i];
+ line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val);
+ line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val);
+ _anchor_snap(anchors_values[i], &snapped);
+ viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1);
+ }
+
+ // Display the percentages next to the lines
+ float percent_val;
+ percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4));
+
+ percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
+ }
+
+ Rect2 anchor_rects[4];
+ anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
+ anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
+ anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
+ anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
+
+ for (int i = 0; i < 4; i++) {
+ anchor_handle->draw_rect(ci, anchor_rects[i]);
+ }
+ }
}
if (tool == TOOL_SELECT) {
@@ -2063,19 +2300,27 @@ void CanvasItemEditor::_notification(int p_what) {
continue;
Rect2 r = canvas_item->get_item_rect();
-
Transform2D xform = canvas_item->get_transform();
+ float anchors[4];
Vector2 pivot;
if (canvas_item->cast_to<Control>()) {
pivot = canvas_item->cast_to<Control>()->get_pivot_offset();
+ anchors[MARGIN_LEFT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_LEFT);
+ anchors[MARGIN_RIGHT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_RIGHT);
+ anchors[MARGIN_TOP] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_TOP);
+ anchors[MARGIN_BOTTOM] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_BOTTOM);
}
- if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot) {
+ if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
viewport->update();
se->prev_rect = r;
se->prev_xform = xform;
se->prev_pivot = pivot;
+ se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
+ se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
+ se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP];
+ se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM];
}
}
@@ -2121,6 +2366,7 @@ void CanvasItemEditor::_notification(int p_what) {
pan_button->set_icon(get_icon("ToolPan", "EditorIcons"));
pivot_button->set_icon(get_icon("EditPivot", "EditorIcons"));
select_handle = get_icon("EditorHandle", "EditorIcons");
+ anchor_handle = get_icon("EditorControlAnchor", "EditorIcons");
lock_button->set_icon(get_icon("Lock", "EditorIcons"));
unlock_button->set_icon(get_icon("Unlock", "EditorIcons"));
group_button->set_icon(get_icon("Group", "EditorIcons"));
@@ -2335,7 +2581,7 @@ void CanvasItemEditor::_update_scroll(float) {
viewport->update();
}
-void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom) {
+void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
List<Node *> &selection = editor_selection->get_selected_node_list();
undo_redo->create_action(TTR("Change Anchors"));
@@ -2343,10 +2589,7 @@ void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorTy
Control *c = E->get()->cast_to<Control>();
- undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, p_left);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, p_top);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, p_right);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, p_bottom);
+ undo_redo->add_do_method(c, "set_anchors_preset", p_preset);
undo_redo->add_undo_method(c, "set_anchor", MARGIN_LEFT, c->get_anchor(MARGIN_LEFT));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_TOP, c->get_anchor(MARGIN_TOP));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_RIGHT, c->get_anchor(MARGIN_RIGHT));
@@ -2364,10 +2607,7 @@ void CanvasItemEditor::_set_full_rect() {
Control *c = E->get()->cast_to<Control>();
- undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, ANCHOR_BEGIN);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, ANCHOR_BEGIN);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, ANCHOR_END);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, ANCHOR_END);
+ undo_redo->add_do_method(c, "set_anchors_preset", PRESET_WIDE);
undo_redo->add_do_method(c, "set_margin", MARGIN_LEFT, 0);
undo_redo->add_do_method(c, "set_margin", MARGIN_TOP, 0);
undo_redo->add_do_method(c, "set_margin", MARGIN_RIGHT, 0);
@@ -2588,53 +2828,52 @@ void CanvasItemEditor::_popup_callback(int p_op) {
//space_selected_items< proj_vector2_y, compare_items_y >();
} break;
case ANCHOR_ALIGN_TOP_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_LEFT);
} break;
case ANCHOR_ALIGN_TOP_RIGHT: {
- _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_RIGHT);
} break;
case ANCHOR_ALIGN_BOTTOM_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_LEFT);
} break;
case ANCHOR_ALIGN_BOTTOM_RIGHT: {
- _set_anchor(ANCHOR_END, ANCHOR_END, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_RIGHT);
} break;
case ANCHOR_ALIGN_CENTER_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER_LEFT);
} break;
case ANCHOR_ALIGN_CENTER_RIGHT: {
-
- _set_anchor(ANCHOR_END, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER_RIGHT);
} break;
case ANCHOR_ALIGN_CENTER_TOP: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_CENTER_TOP);
} break;
case ANCHOR_ALIGN_CENTER_BOTTOM: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER, ANCHOR_END);
+ _set_anchors_preset(PRESET_CENTER_BOTTOM);
} break;
case ANCHOR_ALIGN_CENTER: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER);
} break;
case ANCHOR_ALIGN_TOP_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_WIDE);
} break;
case ANCHOR_ALIGN_LEFT_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END);
+ _set_anchors_preset(PRESET_LEFT_WIDE);
} break;
case ANCHOR_ALIGN_RIGHT_WIDE: {
- _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_RIGHT_WIDE);
} break;
case ANCHOR_ALIGN_BOTTOM_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_WIDE);
} break;
case ANCHOR_ALIGN_VCENTER_WIDE: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END);
+ _set_anchors_preset(PRESET_VCENTER_WIDE);
} break;
case ANCHOR_ALIGN_HCENTER_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_HCENTER_WIDE);
} break;
case ANCHOR_ALIGN_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_WIDE);
} break;
case ANCHOR_ALIGN_WIDE_FIT: {
_set_full_rect();
@@ -3369,7 +3608,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
dialog_val = memnew(SpinBox);
dialog_val->set_anchor(MARGIN_RIGHT, ANCHOR_END);
dialog_val->set_begin(Point2(15, 25));
- dialog_val->set_end(Point2(10, 25));
+ dialog_val->set_end(Point2(-10, 25));
value_dialog->add_child(dialog_val);
dialog_val->connect("value_changed", this, "_dialog_value_changed");
select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture));
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 4383be251c..9b027fda60 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -57,6 +57,7 @@ public:
float prev_rot;
Rect2 prev_rect;
Vector2 prev_pivot;
+ float prev_anchors[4];
CanvasItemEditorSelectedItem() { prev_rot = 0; }
};
@@ -143,11 +144,15 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_BOTTOM_RIGHT,
DRAG_BOTTOM,
DRAG_BOTTOM_LEFT,
+ DRAG_ANCHOR_TOP_LEFT,
+ DRAG_ANCHOR_TOP_RIGHT,
+ DRAG_ANCHOR_BOTTOM_RIGHT,
+ DRAG_ANCHOR_BOTTOM_LEFT,
+ DRAG_ANCHOR_ALL,
DRAG_ALL,
DRAG_ROTATE,
DRAG_PIVOT,
DRAG_NODE_2D,
-
};
enum KeyMoveMODE {
@@ -300,6 +305,7 @@ class CanvasItemEditor : public VBoxContainer {
#endif
Ref<StyleBoxTexture> select_sb;
Ref<Texture> select_handle;
+ Ref<Texture> anchor_handle;
int handle_len;
bool _is_part_of_subscene(CanvasItem *p_item);
@@ -325,8 +331,13 @@ class CanvasItemEditor : public VBoxContainer {
void _key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE p_move_mode);
void _list_select(const Ref<InputEventMouseButton> &b);
- DragType _find_drag_type(const Point2 &p_click, Vector2 &r_point);
+ DragType _get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
void _prepare_drag(const Point2 &p_click_pos);
+ DragType _get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
+
+ float _anchor_snap(float anchor, bool *snapped = NULL, float p_opposite_anchor = -1);
+ Vector2 _anchor_to_position(Control *p_control, Vector2 anchor);
+ Vector2 _position_to_anchor(Control *p_control, Vector2 position);
void _popup_callback(int p_op);
bool updating_scroll;
@@ -355,12 +366,14 @@ class CanvasItemEditor : public VBoxContainer {
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side);
+
void _viewport_gui_input(const Ref<InputEvent> &p_event);
void _viewport_draw();
void _focus_selection(int p_op);
- void _set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom);
+ void _set_anchors_preset(Control::LayoutPreset p_preset);
void _set_full_rect();
HSplitContainer *palette_split;
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h
index 382c0d6c37..b2f32d8491 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -97,8 +97,8 @@ public:
virtual String get_name() const { return "CollisionPolygon2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CollisionPolygon2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h
index 3a8428fc62..9f8b52d7f2 100644
--- a/editor/plugins/collision_polygon_editor_plugin.h
+++ b/editor/plugins/collision_polygon_editor_plugin.h
@@ -109,8 +109,8 @@ public:
virtual String get_name() const { return "CollisionPolygon"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CollisionPolygonEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 9a6ee8153e..fb2aa16383 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -585,12 +585,12 @@ void CollisionShape2DEditorPlugin::make_visible(bool visible) {
}
}
-CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_node) {
+CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_editor) {
- editor = p_node;
+ editor = p_editor;
- collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_node));
- p_node->get_gui_base()->add_child(collision_shape_2d_editor);
+ collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_editor));
+ p_editor->get_gui_base()->add_child(collision_shape_2d_editor);
}
CollisionShape2DEditorPlugin::~CollisionShape2DEditorPlugin() {
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index 17149ef868..b26b2aec4f 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "cube_grid_theme_editor_plugin.h"
-#if 0
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/main.h"
@@ -39,214 +38,236 @@
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
-void MeshLibraryEditor::edit(const Ref<MeshLibrary>& p_theme) {
+void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_theme) {
- theme=p_theme;
+ theme = p_theme;
if (theme.is_valid())
- menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),!theme->has_meta("_editor_source_scene"));
-
+ menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), !theme->has_meta("_editor_source_scene"));
}
void MeshLibraryEditor::_menu_confirm() {
+ switch (option) {
- switch(option) {
-
- case MENU_OPTION_REMOVE_ITEM: {
+ case MENU_OPTION_REMOVE_ITEM: {
- theme->remove_item(to_erase);
- } break;
- case MENU_OPTION_UPDATE_FROM_SCENE: {
+ theme->remove_item(to_erase);
+ } break;
+ case MENU_OPTION_UPDATE_FROM_SCENE: {
String existing = theme->get_meta("_editor_source_scene");
- ERR_FAIL_COND(existing=="");
+ ERR_FAIL_COND(existing == "");
_import_scene_cbk(existing);
- } break;
- default: {};
+ } break;
+ default: {};
}
-
}
-
void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, bool p_merge) {
if (!p_merge)
p_library->clear();
-
- for(int i=0;i<p_scene->get_child_count();i++) {
-
+ for (int i = 0; i < p_scene->get_child_count(); i++) {
Node *child = p_scene->get_child(i);
if (!child->cast_to<MeshInstance>()) {
- if (child->get_child_count()>0) {
- child=child->get_child(0);
+ if (child->get_child_count() > 0) {
+ child = child->get_child(0);
if (!child->cast_to<MeshInstance>()) {
continue;
}
} else
continue;
-
-
}
MeshInstance *mi = child->cast_to<MeshInstance>();
- Ref<Mesh> mesh=mi->get_mesh();
+ Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_null())
- continue;
+ continue;
int id = p_library->find_item_name(mi->get_name());
- if (id<0) {
+ if (id < 0) {
- id=p_library->get_last_unused_item_id();
+ id = p_library->get_last_unused_item_id();
p_library->create_item(id);
- p_library->set_item_name(id,mi->get_name());
+ p_library->set_item_name(id, mi->get_name());
}
-
- p_library->set_item_mesh(id,mesh);
+ p_library->set_item_mesh(id, mesh);
Ref<Shape> collision;
+ for (int j = 0; j < mi->get_child_count(); j++) {
- for(int j=0;j<mi->get_child_count();j++) {
-#if 1
Node *child2 = mi->get_child(j);
if (!child2->cast_to<StaticBody>())
continue;
+
StaticBody *sb = child2->cast_to<StaticBody>();
- if (sb->get_shape_count()==0)
- continue;
- collision=sb->get_shape(0);
- if (!collision.is_null())
- break;
-#endif
+ List<uint32_t> shapes;
+ sb->get_shape_owners(&shapes);
+
+ for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
+ if (sb->is_shape_owner_disabled(E->get())) continue;
+
+ //Transform shape_transform = sb->shape_owner_get_transform(E->get());
+
+ //shape_transform.set_origin(shape_transform.get_origin() - phys_offset);
+
+ for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
+
+ collision = sb->shape_owner_get_shape(E->get(), k);
+ if (collision.is_valid())
+ break;
+ /* TileSet::ShapeData shape_data;
+ shape_data.shape = shape;
+ shape_data.shape_transform = shape_transform;
+ shape_data.one_way_collision = one_way;
+ collisions.push_back(shape_data);*/
+ }
+ if (collision.is_valid())
+ break;
+ }
}
if (!collision.is_null()) {
- p_library->set_item_shape(id,collision);
+ p_library->set_item_shape(id, collision);
}
Ref<NavigationMesh> navmesh;
- for(int j=0;j<mi->get_child_count();j++) {
- Node *child2 = mi->get_child(j);
- if (!child2->cast_to<NavigationMeshInstance>())
- continue;
- NavigationMeshInstance *sb = child2->cast_to<NavigationMeshInstance>();
- navmesh=sb->get_navigation_mesh();
- if (!navmesh.is_null())
- break;
+ for (int j = 0; j < mi->get_child_count(); j++) {
+ Node *child2 = mi->get_child(j);
+ if (!child2->cast_to<NavigationMeshInstance>())
+ continue;
+ NavigationMeshInstance *sb = child2->cast_to<NavigationMeshInstance>();
+ navmesh = sb->get_navigation_mesh();
+ if (!navmesh.is_null())
+ break;
}
- if(!navmesh.is_null()){
+ if (!navmesh.is_null()) {
p_library->set_item_navmesh(id, navmesh);
}
- }
-
- //generate previews!
-
- if (1) {
- Vector<int> ids = p_library->get_item_list();
- RID vp = VS::get_singleton()->viewport_create();
- VS::ViewportRect vr;
- vr.x=0;
- vr.y=0;
- vr.width=EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
- vr.height=EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
- VS::get_singleton()->viewport_set_rect(vp,vr);
- VS::get_singleton()->viewport_set_as_render_target(vp,true);
- VS::get_singleton()->viewport_set_render_target_update_mode(vp,VS::RENDER_TARGET_UPDATE_ALWAYS);
- RID scen = VS::get_singleton()->scenario_create();
- VS::get_singleton()->viewport_set_scenario(vp,scen);
- RID cam = VS::get_singleton()->camera_create();
- VS::get_singleton()->camera_set_transform(cam, Transform() );
- VS::get_singleton()->viewport_attach_camera(vp,cam);
- RID light = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
- RID lightinst = VS::get_singleton()->instance_create2(light,scen);
- VS::get_singleton()->camera_set_orthogonal(cam,1.0,0.01,1000.0);
-
-
- EditorProgress ep("mlib",TTR("Creating Mesh Library"),ids.size());
-
- for(int i=0;i<ids.size();i++) {
-
- int id=ids[i];
+ }
+
+ //generate previews!
+
+ if (1) {
+ Vector<int> ids = p_library->get_item_list();
+ RID vp = VS::get_singleton()->viewport_create();
+ int size = EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
+
+ RID scenario = VS::get_singleton()->scenario_create();
+
+ RID viewport = VS::get_singleton()->viewport_create();
+ VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ALWAYS);
+ VS::get_singleton()->viewport_set_vflip(viewport, true);
+ VS::get_singleton()->viewport_set_scenario(viewport, scenario);
+ VS::get_singleton()->viewport_set_size(viewport, size, size);
+ VS::get_singleton()->viewport_set_transparent_background(viewport, true);
+ VS::get_singleton()->viewport_set_active(viewport, true);
+ RID viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
+
+ RID camera = VS::get_singleton()->camera_create();
+ VS::get_singleton()->viewport_attach_camera(viewport, camera);
+ VS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
+ //VS::get_singleton()->camera_set_perspective(camera,45,0.1,10);
+ VS::get_singleton()->camera_set_orthogonal(camera, 1.0, 0.01, 1000.0);
+
+ RID light = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
+ RID light_instance = VS::get_singleton()->instance_create2(light, scenario);
+ VS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
+
+ RID light2 = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
+ VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
+ //VS::get_singleton()->light_set_color(light2, VS::LIGHT_COLOR_SPECULAR, Color(0.0, 0.0, 0.0));
+ RID light_instance2 = VS::get_singleton()->instance_create2(light2, scenario);
+
+ VS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
+
+ //sphere = VS::get_singleton()->mesh_create();
+ RID mesh_instance = VS::get_singleton()->instance_create();
+ VS::get_singleton()->instance_set_scenario(mesh_instance, scenario);
+
+ EditorProgress ep("mlib", TTR("Creating Mesh Library"), ids.size());
+
+ for (int i = 0; i < ids.size(); i++) {
+
+ int id = ids[i];
Ref<Mesh> mesh = p_library->get_item_mesh(id);
if (!mesh.is_valid())
continue;
- AABB aabb= mesh->get_aabb();
- print_line("aabb: "+aabb);
- Vector3 ofs = aabb.pos + aabb.size*0.5;
- aabb.pos-=ofs;
+ Rect3 aabb = mesh->get_aabb();
+ print_line("aabb: " + aabb);
+ Vector3 ofs = aabb.position + aabb.size * 0.5;
+ aabb.position -= ofs;
Transform xform;
- xform.basis=Matrix3().rotated(Vector3(0,1,0),-Math_PI*0.25);
- xform.basis = Matrix3().rotated(Vector3(1,0,0),Math_PI*0.25)*xform.basis;
- AABB rot_aabb = xform.xform(aabb);
- print_line("rot_aabb: "+rot_aabb);
- float m = MAX(rot_aabb.size.x,rot_aabb.size.y)*0.5;
- if (m==0)
+ xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25);
+ xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis;
+ Rect3 rot_aabb = xform.xform(aabb);
+ print_line("rot_aabb: " + rot_aabb);
+ float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
+ if (m == 0)
continue;
- m=1.0/m;
- m*=0.5;
- print_line("scale: "+rtos(m));
- xform.basis.scale(Vector3(m,m,m));
- xform.origin=-xform.basis.xform(ofs); //-ofs*m;
- xform.origin.z-=rot_aabb.size.z*2;
- RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(),scen);
- VS::get_singleton()->instance_set_transform(inst,xform);
- ep.step(TTR("Thumbnail.."),i);
- VS::get_singleton()->viewport_queue_screen_capture(vp);
+ m = 1.0 / m;
+ m *= 0.5;
+ print_line("scale: " + rtos(m));
+ xform.basis.scale(Vector3(m, m, m));
+ xform.origin = -xform.basis.xform(ofs); //-ofs*m;
+ xform.origin.z -= rot_aabb.size.z * 2;
+ RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
+ VS::get_singleton()->instance_set_transform(inst, xform);
+ ep.step(TTR("Thumbnail.."), i);
+ Main::iteration();
Main::iteration();
- Image img = VS::get_singleton()->viewport_get_screen_capture(vp);
- ERR_CONTINUE(img.empty());
- Ref<ImageTexture> it( memnew( ImageTexture ));
+ Ref<Image> img = VS::get_singleton()->texture_get_data(viewport_texture);
+ ERR_CONTINUE(!img.is_valid() || img->empty());
+ Ref<ImageTexture> it(memnew(ImageTexture));
it->create_from_image(img);
- p_library->set_item_preview(id,it);
+ p_library->set_item_preview(id, it);
//print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height()));
VS::get_singleton()->free(inst);
- }
+ }
- VS::get_singleton()->free(lightinst);
- VS::get_singleton()->free(light);
- VS::get_singleton()->free(vp);
- VS::get_singleton()->free(cam);
- VS::get_singleton()->free(scen);
+ VS::get_singleton()->free(mesh_instance);
+ VS::get_singleton()->free(viewport);
+ VS::get_singleton()->free(light);
+ VS::get_singleton()->free(light_instance);
+ VS::get_singleton()->free(light2);
+ VS::get_singleton()->free(light_instance2);
+ VS::get_singleton()->free(camera);
+ VS::get_singleton()->free(scenario);
}
-
-
}
-
-void MeshLibraryEditor::_import_scene_cbk(const String& p_str) {
-
+void MeshLibraryEditor::_import_scene_cbk(const String &p_str) {
print_line("Impot Callback!");
- Ref<PackedScene> ps = ResourceLoader::load(p_str,"PackedScene");
+ Ref<PackedScene> ps = ResourceLoader::load(p_str, "PackedScene");
ERR_FAIL_COND(ps.is_null());
Node *scene = ps->instance();
- _import_scene(scene,theme,option==MENU_OPTION_UPDATE_FROM_SCENE);
+ _import_scene(scene, theme, option == MENU_OPTION_UPDATE_FROM_SCENE);
memdelete(scene);
- theme->set_meta("_editor_source_scene",p_str);
- menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),false);
-
+ theme->set_meta("_editor_source_scene", p_str);
+ menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), false);
}
-Error MeshLibraryEditor::update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml,bool p_merge) {
+Error MeshLibraryEditor::update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge) {
- _import_scene(p_base_scene,ml,p_merge);
+ _import_scene(p_base_scene, ml, p_merge);
return OK;
}
-
void MeshLibraryEditor::_menu_cbk(int p_option) {
- option=p_option;
- switch(p_option) {
+ option = p_option;
+ switch (p_option) {
case MENU_OPTION_ADD_ITEM: {
@@ -255,86 +276,84 @@ void MeshLibraryEditor::_menu_cbk(int p_option) {
case MENU_OPTION_REMOVE_ITEM: {
String p = editor->get_property_editor()->get_selected_path();
- if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/")>=3) {
+ if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/") >= 3) {
- to_erase = p.get_slice("/",3).to_int();
- cd->set_text(vformat(TTR("Remove item %d?"),to_erase));
- cd->popup_centered(Size2(300,60));
+ to_erase = p.get_slice("/", 3).to_int();
+ cd->set_text(vformat(TTR("Remove item %d?"), to_erase));
+ cd->popup_centered(Size2(300, 60));
}
} break;
case MENU_OPTION_IMPORT_FROM_SCENE: {
file->popup_centered_ratio();
} break;
- case MENU_OPTION_UPDATE_FROM_SCENE: {
+ case MENU_OPTION_UPDATE_FROM_SCENE: {
- cd->set_text("Update from existing scene?:\n"+String(theme->get_meta("_editor_source_scene")));
- cd->popup_centered(Size2(500,60));
- } break;
+ cd->set_text("Update from existing scene?:\n" + String(theme->get_meta("_editor_source_scene")));
+ cd->popup_centered(Size2(500, 60));
+ } break;
}
}
-
void MeshLibraryEditor::_bind_methods() {
- ClassDB::bind_method("_menu_cbk",&MeshLibraryEditor::_menu_cbk);
- ClassDB::bind_method("_menu_confirm",&MeshLibraryEditor::_menu_confirm);
- ClassDB::bind_method("_import_scene_cbk",&MeshLibraryEditor::_import_scene_cbk);
+ ClassDB::bind_method("_menu_cbk", &MeshLibraryEditor::_menu_cbk);
+ ClassDB::bind_method("_menu_confirm", &MeshLibraryEditor::_menu_confirm);
+ ClassDB::bind_method("_import_scene_cbk", &MeshLibraryEditor::_import_scene_cbk);
}
MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
- file = memnew( EditorFileDialog );
+ file = memnew(EditorFileDialog);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
//not for now?
List<String> extensions;
- ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
+ ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
file->clear_filters();
file->set_title(TTR("Import Scene"));
- for(int i=0;i<extensions.size();i++) {
+ for (int i = 0; i < extensions.size(); i++) {
- file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper());
+ file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}
add_child(file);
- file->connect("file_selected",this,"_import_scene_cbk");
+ file->connect("file_selected", this, "_import_scene_cbk");
- Panel *panel = memnew( Panel );
+ Panel *panel = memnew(Panel);
panel->set_area_as_parent_rect();
add_child(panel);
- MenuButton * options = memnew( MenuButton );
+ MenuButton *options = memnew(MenuButton);
panel->add_child(options);
- options->set_position(Point2(1,1));
+ options->set_position(Point2(1, 1));
options->set_text("Theme");
- options->get_popup()->add_item(TTR("Add Item"),MENU_OPTION_ADD_ITEM);
- options->get_popup()->add_item(TTR("Remove Selected Item"),MENU_OPTION_REMOVE_ITEM);
+ options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
+ options->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM);
options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Import from Scene"),MENU_OPTION_IMPORT_FROM_SCENE);
- options->get_popup()->add_item(TTR("Update from Scene"),MENU_OPTION_UPDATE_FROM_SCENE);
- options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),true);
- options->get_popup()->connect("id_pressed", this,"_menu_cbk");
- menu=options;
- editor=p_editor;
+ options->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE);
+ options->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE);
+ options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true);
+ options->get_popup()->connect("id_pressed", this, "_menu_cbk");
+ menu = options;
+ editor = p_editor;
cd = memnew(ConfirmationDialog);
add_child(cd);
- cd->get_ok()->connect("pressed", this,"_menu_confirm");
-
+ cd->get_ok()->connect("pressed", this, "_menu_confirm");
}
void MeshLibraryEditorPlugin::edit(Object *p_node) {
if (p_node && p_node->cast_to<MeshLibrary>()) {
- theme_editor->edit( p_node->cast_to<MeshLibrary>() );
+ theme_editor->edit(p_node->cast_to<MeshLibrary>());
theme_editor->show();
} else
theme_editor->hide();
}
-bool MeshLibraryEditorPlugin::handles(Object *p_node) const{
+bool MeshLibraryEditorPlugin::handles(Object *p_node) const {
- return p_node->is_type("MeshLibrary");
+ return p_node->is_class("MeshLibrary");
}
-void MeshLibraryEditorPlugin::make_visible(bool p_visible){
+void MeshLibraryEditorPlugin::make_visible(bool p_visible) {
if (p_visible)
theme_editor->show();
@@ -344,15 +363,13 @@ void MeshLibraryEditorPlugin::make_visible(bool p_visible){
MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
- EDITOR_DEF("editors/grid_map/preview_size",64);
- theme_editor = memnew( MeshLibraryEditor(p_node) );
+ EDITOR_DEF("editors/grid_map/preview_size", 64);
+ theme_editor = memnew(MeshLibraryEditor(p_node));
p_node->get_viewport()->add_child(theme_editor);
theme_editor->set_area_as_parent_rect();
- theme_editor->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
- theme_editor->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_BEGIN );
- theme_editor->set_end( Point2(0,22) );
+ theme_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
+ theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
+ theme_editor->set_end(Point2(0, 22));
theme_editor->hide();
-
}
-#endif
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.h b/editor/plugins/cube_grid_theme_editor_plugin.h
index ed5875a999..6fe5fc4235 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.h
+++ b/editor/plugins/cube_grid_theme_editor_plugin.h
@@ -33,10 +33,9 @@
#include "editor/editor_node.h"
#include "scene/resources/mesh_library.h"
-#if 0
class MeshLibraryEditor : public Control {
- GDCLASS( MeshLibraryEditor, Control );
+ GDCLASS(MeshLibraryEditor, Control);
Ref<MeshLibrary> theme;
@@ -55,7 +54,7 @@ class MeshLibraryEditor : public Control {
};
int option;
- void _import_scene_cbk(const String& p_str);
+ void _import_scene_cbk(const String &p_str);
void _menu_cbk(int p_option);
void _menu_confirm();
@@ -63,25 +62,22 @@ class MeshLibraryEditor : public Control {
protected:
static void _bind_methods();
-public:
- void edit(const Ref<MeshLibrary>& p_theme);
- static Error update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml,bool p_merge=true);
+public:
+ void edit(const Ref<MeshLibrary> &p_theme);
+ static Error update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge = true);
MeshLibraryEditor(EditorNode *p_editor);
};
-
-
class MeshLibraryEditorPlugin : public EditorPlugin {
- GDCLASS( MeshLibraryEditorPlugin, EditorPlugin );
+ GDCLASS(MeshLibraryEditorPlugin, EditorPlugin);
MeshLibraryEditor *theme_editor;
EditorNode *editor;
public:
-
virtual String get_name() const { return "MeshLibrary"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
@@ -89,8 +85,6 @@ public:
virtual void make_visible(bool p_visible);
MeshLibraryEditorPlugin(EditorNode *p_node);
-
};
#endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H
-#endif
diff --git a/editor/plugins/gi_probe_editor_plugin.h b/editor/plugins/gi_probe_editor_plugin.h
index b8f63e0b2e..e4151d4b8c 100644
--- a/editor/plugins/gi_probe_editor_plugin.h
+++ b/editor/plugins/gi_probe_editor_plugin.h
@@ -52,8 +52,8 @@ protected:
public:
virtual String get_name() const { return "GIProbe"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GIProbeEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index c319a13a01..1acf5f7e57 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -50,8 +50,8 @@ protected:
public:
virtual String get_name() const { return "ColorRamp"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GradientEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index bc009b3d7a..3bfe2c88e0 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -243,8 +243,8 @@ class ItemListEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "ItemList"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ItemListEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h
index d6579fc94c..435d650a69 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -101,8 +101,8 @@ public:
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
LightOccluder2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 4a7ad74fbe..41327fb07e 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -54,9 +54,9 @@ void Line2DEditor::_notification(int p_what) {
}
}
-Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpoint, bool alt) {
+Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpos, bool alt) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
+ return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpos)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpos)));
}
int Line2DEditor::get_point_index_at(Vector2 gpos) {
diff --git a/editor/plugins/line_2d_editor_plugin.h b/editor/plugins/line_2d_editor_plugin.h
index 3a1f841556..f2979e4330 100644
--- a/editor/plugins/line_2d_editor_plugin.h
+++ b/editor/plugins/line_2d_editor_plugin.h
@@ -101,8 +101,8 @@ public:
virtual String get_name() const { return "Line2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Line2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 72d93c4126..305d24ba07 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -81,8 +81,8 @@ class MeshEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Mesh"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MeshEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/mesh_instance_editor_plugin.h b/editor/plugins/mesh_instance_editor_plugin.h
index d80ffa071d..614dcac0b9 100644
--- a/editor/plugins/mesh_instance_editor_plugin.h
+++ b/editor/plugins/mesh_instance_editor_plugin.h
@@ -82,8 +82,8 @@ class MeshInstanceEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "MeshInstance"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MeshInstanceEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index 9520cc5297..a9689cce56 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -381,7 +381,7 @@ MultiMeshEditor::MultiMeshEditor() {
populate_amount = memnew(SpinBox);
populate_amount->set_anchor(MARGIN_RIGHT, ANCHOR_END);
populate_amount->set_begin(Point2(20, 232));
- populate_amount->set_end(Point2(5, 237));
+ populate_amount->set_end(Point2(-5, 237));
populate_amount->set_min(1);
populate_amount->set_max(65536);
populate_amount->set_value(128);
diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h
index 0c633a4f60..a93fa73a2e 100644
--- a/editor/plugins/multimesh_editor_plugin.h
+++ b/editor/plugins/multimesh_editor_plugin.h
@@ -95,8 +95,8 @@ class MultiMeshEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "MultiMesh"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MultiMeshEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 62a83983fd..6ec9b14cc1 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -102,8 +102,8 @@ public:
virtual String get_name() const { return "NavigationPolygonInstance"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
NavigationPolygonEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index cea60fbeaf..ccfec1a25f 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -87,8 +87,8 @@ protected:
public:
virtual String get_name() const { return "Particles2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Particles2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index e9f9f43468..a6e14266c7 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -102,8 +102,8 @@ class ParticlesEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Particles"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ParticlesEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 70911444ad..61ff700118 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -112,8 +112,8 @@ public:
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Path2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/path_editor_plugin.h b/editor/plugins/path_editor_plugin.h
index 651dcdaa78..43df9d460f 100644
--- a/editor/plugins/path_editor_plugin.h
+++ b/editor/plugins/path_editor_plugin.h
@@ -83,8 +83,8 @@ public:
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual String get_name() const { return "Path"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
PathEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 0901cc9082..4fcb1d81c2 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -152,8 +152,8 @@ public:
virtual String get_name() const { return "Polygon2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Polygon2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 2703da12fe..ccefbc1843 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -362,7 +362,7 @@ void ResourcePreloaderEditor::_bind_methods() {
ResourcePreloaderEditor::ResourcePreloaderEditor() {
- //add_style_override("panel", get_stylebox("panel","Panel"));
+ //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index 1f54620ba4..6e4726748d 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -91,8 +91,8 @@ class ResourcePreloaderEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "ResourcePreloader"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ResourcePreloaderEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/rich_text_editor_plugin.h b/editor/plugins/rich_text_editor_plugin.h
index 8d42adc236..2665db2993 100644
--- a/editor/plugins/rich_text_editor_plugin.h
+++ b/editor/plugins/rich_text_editor_plugin.h
@@ -79,8 +79,8 @@ class RichTextEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "RichText"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
RichTextEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp
index 739a8abb53..1d6417e2d5 100644
--- a/editor/plugins/sample_editor_plugin.cpp
+++ b/editor/plugins/sample_editor_plugin.cpp
@@ -360,20 +360,20 @@ SampleEditor::SampleEditor() {
player = memnew(SamplePlayer);
add_child(player);
- add_style_override("panel", get_stylebox("panel","Panel"));
+ add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
library = Ref<SampleLibrary>(memnew(SampleLibrary));
player->set_sample_library(library);
sample_texframe = memnew( TextureRect );
add_child(sample_texframe);
sample_texframe->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
- sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
+ sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5);
sample_texframe->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30);
- sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5);
+ sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5);
info_label = memnew( Label );
sample_texframe->add_child(info_label);
info_label->set_area_as_parent_rect();
- info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15);
+ info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15);
info_label->set_margin(MARGIN_BOTTOM,4);
info_label->set_margin(MARGIN_RIGHT,4);
info_label->set_align(Label::ALIGN_RIGHT);
diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp
index 5ccfde15ff..3deb634491 100644
--- a/editor/plugins/sample_library_editor_plugin.cpp
+++ b/editor/plugins/sample_library_editor_plugin.cpp
@@ -432,7 +432,7 @@ SampleLibraryEditor::SampleLibraryEditor() {
player = memnew(SamplePlayer);
add_child(player);
- add_style_override("panel", get_stylebox("panel","Panel"));
+ add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
load = memnew( Button );
@@ -452,9 +452,9 @@ SampleLibraryEditor::SampleLibraryEditor() {
tree->set_columns(6);
add_child(tree);
tree->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
- tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
+ tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5);
tree->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30);
- tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5);
+ tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5);
tree->set_column_titles_visible(true);
tree->set_column_title(0,TTR("Name"));
tree->set_column_title(1,TTR("Preview"));
diff --git a/editor/plugins/sample_player_editor_plugin.cpp b/editor/plugins/sample_player_editor_plugin.cpp
index 25f1fe9e17..ea9b646a9b 100644
--- a/editor/plugins/sample_player_editor_plugin.cpp
+++ b/editor/plugins/sample_player_editor_plugin.cpp
@@ -120,8 +120,8 @@ SamplePlayerEditor::SamplePlayerEditor() {
play->set_position(Point2( 5, 5 ));
play->set_toggle_mode(true);
- play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,250);
- play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,230);
+ play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-250);
+ play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-230);
play->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
play->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
@@ -131,15 +131,15 @@ SamplePlayerEditor::SamplePlayerEditor() {
stop->set_position(Point2( 35, 5 ));
stop->set_toggle_mode(true);
- stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,220);
- stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,200);
+ stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-220);
+ stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-200);
stop->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
stop->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
add_child(stop);
samples = memnew( OptionButton );
- samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,190);
- samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,5);
+ samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-190);
+ samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-5);
samples->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
samples->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
add_child(samples);
@@ -182,7 +182,7 @@ SamplePlayerEditorPlugin::SamplePlayerEditorPlugin(EditorNode *p_node) {
sample_player_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
sample_player_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
- sample_player_editor->set_margin(MARGIN_LEFT,250);
+ sample_player_editor->set_margin(MARGIN_LEFT,-250);
sample_player_editor->set_margin(MARGIN_RIGHT,0);
sample_player_editor->set_margin(MARGIN_TOP,0);
sample_player_editor->set_margin(MARGIN_BOTTOM,10);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d8a9415df1..4614a41605 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -65,7 +65,7 @@ protected:
static void _bind_methods();
public:
- void popup(const Vector<String> &p_base, bool p_dontclear = false);
+ void popup(const Vector<String> &p_functions, bool p_dontclear = false);
ScriptEditorQuickOpen();
};
@@ -223,14 +223,14 @@ class ScriptEditor : public PanelContainer {
EditorHelpIndex *help_index;
void _tab_changed(int p_which);
- void _menu_option(int p_optin);
+ void _menu_option(int p_option);
Tree *disk_changed_list;
ConfirmationDialog *disk_changed;
bool restoring_layout;
- String _get_debug_tooltip(const String &p_text, Node *_ste);
+ String _get_debug_tooltip(const String &p_text, Node *_se);
void _resave_scripts(const String &p_str);
void _reload_scripts();
@@ -392,8 +392,8 @@ class ScriptEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Script"; }
bool has_main_screen() const { return true; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
virtual void selected_notify();
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 38d5c3e3a6..8625267a63 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -92,7 +92,7 @@ class ShaderEditor : public VBoxContainer {
ShaderTextEditor *shader_editor;
- void _menu_option(int p_optin);
+ void _menu_option(int p_option);
void _params_changed();
mutable Ref<Shader> shader;
@@ -130,8 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Shader"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
virtual void selected_notify();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index a549f09cb1..5faacf7a67 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -267,6 +267,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
int selected_handle = -1;
Vector<Spatial *> subscenes = Vector<Spatial *>();
+ Vector<Vector3> subscenes_positions = Vector<Vector3>();
for (int i = 0; i < instances.size(); i++) {
@@ -284,13 +285,16 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
if ((!seg.is_valid()) || found_gizmos.has(seg)) {
Node *subscene_candidate = spat;
+ Vector3 source_click_spatial_pos = spat->get_global_transform().origin;
- while (subscene_candidate->get_owner() != editor->get_edited_scene())
+ while ((subscene_candidate->get_owner() != NULL) && (subscene_candidate->get_owner() != editor->get_edited_scene()))
subscene_candidate = subscene_candidate->get_owner();
spat = subscene_candidate->cast_to<Spatial>();
- if (spat && (spat->get_filename() != ""))
+ if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL)) {
subscenes.push_back(spat);
+ subscenes_positions.push_back(source_click_spatial_pos);
+ }
continue;
}
@@ -324,7 +328,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
for (int idx_subscene = 0; idx_subscene < subscenes.size(); idx_subscene++) {
Spatial *subscene = subscenes.get(idx_subscene);
- float dist = ray.cross(subscene->get_global_transform().origin - pos).length();
+ float dist = ray.cross(subscenes_positions.get(idx_subscene) - pos).length();
if ((dist < 0) || (dist > 1.2))
continue;
@@ -410,7 +414,7 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_incl
results.sort();
}
-Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) {
+Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
CameraMatrix cm;
cm.set_perspective(get_fov(), get_size().aspect(), get_znear(), get_zfar());
@@ -423,7 +427,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) {
camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
camera_transform.translate(0, 0, cursor.distance);
- return camera_transform.xform(Vector3(((p_pos.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_pos.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear()));
+ return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear()));
}
void SpatialEditorViewport::_select_region() {
@@ -2485,7 +2489,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
preview_camera = memnew(Button);
preview_camera->set_toggle_mode(true);
- preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90 * EDSCALE);
+ preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
preview_camera->set_text("preview");
surface->add_child(preview_camera);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index e9857f8b0c..2fd72739df 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -245,7 +245,7 @@ private:
void _draw();
void _smouseenter();
- void _sinput(const Ref<InputEvent> &p_ie);
+ void _sinput(const Ref<InputEvent> &p_event);
void _update_freelook(real_t delta);
SpatialEditor *spatial_editor;
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 6a010062f2..0f008552d0 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -714,7 +714,7 @@ void SpriteFramesEditor::_bind_methods() {
SpriteFramesEditor::SpriteFramesEditor() {
- //add_style_override("panel", get_stylebox("panel","Panel"));
+ //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
split = memnew(HSplitContainer);
add_child(split);
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index c9081c599a..c0eb1ec3d0 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -121,8 +121,8 @@ class SpriteFramesEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "SpriteFrames"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
SpriteFramesEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index 13f8dd7fbd..2b5e7ed629 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -61,8 +61,8 @@ class TextureEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Texture"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
TextureEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4cd18b090a..d878bba427 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -898,12 +898,12 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
edit_draw->set_clip_contents(true);
}
-void TextureRegionEditorPlugin::edit(Object *p_node) {
- region_editor->edit(p_node);
+void TextureRegionEditorPlugin::edit(Object *p_object) {
+ region_editor->edit(p_object);
}
-bool TextureRegionEditorPlugin::handles(Object *p_obj) const {
- return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Rect") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture");
+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");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index cb0b9fc372..265d46cb08 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -139,8 +139,8 @@ class TextureRegionEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "TextureRegion"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
void set_state(const Dictionary &p_state);
Dictionary get_state() const;
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 981d5c66a1..a12c56814a 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -197,8 +197,8 @@ public:
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
TileMapEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 3563f70d0b..bed4727bb9 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -147,12 +147,12 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
}
}
-void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
+void TileSetEditor::_import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge) {
if (!p_merge)
p_library->clear();
- _import_node(scene, p_library);
+ _import_node(p_scene, p_library);
}
void TileSetEditor::_menu_confirm() {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index b77544befa..dc0c888eea 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -848,6 +848,7 @@ void ProjectManager::_load_recent_projects() {
VBoxContainer *vb = memnew(VBoxContainer);
vb->set_name("project");
+ vb->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(vb);
Control *ec = memnew(Control);
ec->set_custom_minimum_size(Size2(0, 1));
@@ -855,12 +856,14 @@ void ProjectManager::_load_recent_projects() {
Label *title = memnew(Label(project_name));
title->add_font_override("font", gui_base->get_font("large", "Fonts"));
title->add_color_override("font_color", font_color);
+ title->set_clip_text(true);
vb->add_child(title);
Label *fpath = memnew(Label(path));
fpath->set_name("path");
vb->add_child(fpath);
fpath->set_modulate(Color(1, 1, 1, 0.5));
fpath->add_color_override("font_color", font_color);
+ fpath->set_clip_text(true);
scroll_childs->add_child(hb);
}
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 53d94cdb18..d6c1407b62 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -434,13 +434,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
} else if (hint == PROPERTY_HINT_EXP_EASING) {
easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5 * EDSCALE);
+ easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5 * EDSCALE);
easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 30 * EDSCALE);
+ easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -30 * EDSCALE);
type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 25 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 7 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -3 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -25 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -7 * EDSCALE);
type_button->set_text(TTR("Preset.."));
type_button->get_popup()->clear();
type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR);
@@ -523,8 +523,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
action_buttons[0]->set_anchor(MARGIN_TOP, ANCHOR_END);
action_buttons[0]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
action_buttons[0]->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- action_buttons[0]->set_begin(Point2(70 * EDSCALE, button_margin - 5 * EDSCALE));
- action_buttons[0]->set_end(Point2(margin, margin));
+ action_buttons[0]->set_begin(Point2(-70 * EDSCALE, -button_margin + 5 * EDSCALE));
+ action_buttons[0]->set_end(Point2(-margin, -margin));
action_buttons[0]->set_text(TTR("Close"));
action_buttons[0]->show();
@@ -2474,11 +2474,14 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
String allowed_type = d["hint_text"];
+ print_line("allowed type " + allowed_type);
+
Dictionary drag_data = p_drag_data;
if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
Ref<Resource> res = drag_data["resource"];
for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
String at = allowed_type.get_slice(",", i).strip_edges();
+ print_line("RES vs " + at);
if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
return true;
}
@@ -2489,13 +2492,18 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
Vector<String> files = drag_data["files"];
+ print_line("fileS: " + String(Variant(files)));
if (files.size() == 1) {
String file = files[0];
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
+
+ print_line("file: " + file);
+ print_line("type: " + ftype);
if (ftype != "") {
for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
String at = allowed_type.get_slice(",", i).strip_edges();
+ print_line("FILE vs " + at);
if (ClassDB::is_parent_class(ftype, at)) {
return true;
}
@@ -4183,9 +4191,9 @@ void PropertyEditor::set_keying(bool p_active) {
update_tree();
}
-void PropertyEditor::_draw_flags(Object *t, const Rect2 &p_rect) {
+void PropertyEditor::_draw_flags(Object *p_object, const Rect2 &p_rect) {
- TreeItem *ti = t->cast_to<TreeItem>();
+ TreeItem *ti = p_object->cast_to<TreeItem>();
if (!ti)
return;
@@ -4766,12 +4774,11 @@ double PropertyValueEvaluator::eval(const String &p_text) {
return _default_eval(p_text);
}
- ScriptInstance *script_instance = script->instance_create(this);
+ ScriptInstance *script_instance = script->instance_create(obj);
if (!script_instance)
return _default_eval(p_text);
Variant::CallError call_err;
- script_instance->call("set_this", obj);
double result = script_instance->call("e", NULL, 0, call_err);
if (call_err.error == Variant::CallError::CALL_OK) {
return result;
@@ -4788,7 +4795,7 @@ void PropertyValueEvaluator::edit(Object *p_obj) {
}
String PropertyValueEvaluator::_build_script(const String &p_text) {
- String script_text = "tool\nvar this\nfunc set_this(p_this):\n\tthis=p_this\nfunc e():\n\treturn ";
+ String script_text = "tool\nextends Object\nfunc e():\n\treturn ";
script_text += p_text.strip_edges();
script_text += "\n";
return script_text;
diff --git a/editor/property_editor.h b/editor/property_editor.h
index cc507d248f..3dd09268ec 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -217,8 +217,8 @@ class PropertyEditor : public Control {
TreeItem *find_item(TreeItem *p_item, const String &p_name);
- virtual void _changed_callback(Object *p_changed, const char *p_what);
- virtual void _changed_callbacks(Object *p_changed, const String &p_callback);
+ virtual void _changed_callback(Object *p_changed, const char *p_prop);
+ virtual void _changed_callbacks(Object *p_changed, const String &p_prop);
void _check_reload_status(const String &p_name, TreeItem *item);
@@ -228,7 +228,7 @@ class PropertyEditor : public Control {
friend class ProjectExportDialog;
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = "");
- void _draw_flags(Object *ti, const Rect2 &p_rect);
+ void _draw_flags(Object *p_object, const Rect2 &p_rect);
bool _might_be_in_instance();
bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
diff --git a/editor/resources_dock.h b/editor/resources_dock.h
index f58f8e4c54..e5470b1a3c 100644
--- a/editor/resources_dock.h
+++ b/editor/resources_dock.h
@@ -73,7 +73,7 @@ class ResourcesDock : public VBoxContainer {
bool block_add;
int current_action;
- void _file_action(const String &p_action);
+ void _file_action(const String &p_path);
void _delete(Object *p_item, int p_column, int p_id);
void _resource_selected();
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 5872c5a25d..5a6bc94125 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -189,7 +189,7 @@ public:
void import_subscene();
void set_edited_scene(Node *p_scene);
- void instance(const String &p_path);
+ void instance(const String &p_file);
void instance_scenes(const Vector<String> &p_files, Node *p_parent = NULL);
void set_selected(Node *p_node, bool p_emit_selected = false);
void fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath> > *p_renames);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index c6283af7b5..c666b6a8d5 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -101,7 +101,7 @@ class SceneTreeEditor : public Control {
static void _bind_methods();
void _cell_button_pressed(Object *p_item, int p_column, int p_id);
- void _cell_multi_selected(Object *p_object, int p_cel, bool p_selected);
+ void _cell_multi_selected(Object *p_object, int p_cell, bool p_selected);
void _update_selection(TreeItem *item);
void _node_script_changed(Node *p_node);
void _node_visibility_changed(Node *p_node);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index f503b878f5..c8f199b53a 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -74,7 +74,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
void _path_changed(const String &p_path = String());
void _lang_changed(int l = 0);
void _built_in_pressed();
- bool _validate(const String &p_strin);
+ bool _validate(const String &p_string);
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0);
diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h
index 469a2d594a..28feee3fcc 100644
--- a/editor/spatial_editor_gizmos.h
+++ b/editor/spatial_editor_gizmos.h
@@ -278,7 +278,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void redraw();
- ReflectionProbeGizmo(ReflectionProbe *p_notifier = NULL);
+ ReflectionProbeGizmo(ReflectionProbe *p_probe = NULL);
};
class GIProbeGizmo : public EditorSpatialGizmo {
@@ -294,7 +294,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void redraw();
- GIProbeGizmo(GIProbe *p_notifier = NULL);
+ GIProbeGizmo(GIProbe *p_probe = NULL);
};
class CollisionShapeSpatialGizmo : public EditorSpatialGizmo {