summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp6
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp4
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp8
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp6
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp6
-rw-r--r--editor/plugins/animation_tree_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp36
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp6
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.cpp1
-rw-r--r--editor/plugins/curve_editor_plugin.cpp6
-rw-r--r--editor/plugins/editor_preview_plugins.cpp6
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp24
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/material_editor_plugin.cpp390
-rw-r--r--editor/plugins/material_editor_plugin.h71
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h1
-rw-r--r--editor/plugins/particles_editor_plugin.cpp5
-rw-r--r--editor/plugins/particles_editor_plugin.h1
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/path_editor_plugin.cpp26
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp7
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp12
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp52
-rw-r--r--editor/plugins/spatial_editor_plugin.h6
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp4
-rw-r--r--editor/plugins/theme_editor_plugin.cpp4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp4
38 files changed, 135 insertions, 607 deletions
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 10c19d8173..4b1e710705 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -30,7 +30,7 @@
#include "animation_blend_space_1d_editor.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 6dbba2ba80..c4f8cdc3d7 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -31,10 +31,10 @@
#include "animation_blend_space_2d_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 66142a1e05..4d27a5cea4 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "animation_blend_tree_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
#include "editor/editor_inspector.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 9ab5436de8..bd7b58f65a 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -30,12 +30,12 @@
#include "animation_player_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
#include "editor/animation_track_editor.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
// For onion skinning
#include "editor/plugins/canvas_item_editor_plugin.h"
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 0788921910..d00c06bd12 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -31,10 +31,10 @@
#include "animation_state_machine_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 90e5adc680..24787a78e9 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -35,10 +35,10 @@
#include "animation_blend_tree_editor_plugin.h"
#include "animation_state_machine_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_tree_player_editor_plugin.cpp b/editor/plugins/animation_tree_player_editor_plugin.cpp
index 36d10ab99e..c79e3a436d 100644
--- a/editor/plugins/animation_tree_player_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_player_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "animation_tree_player_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
#include "scene/main/viewport.h"
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index 454a5d72f2..06ca5833e2 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "audio_stream_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void AudioStreamEditor::_notification(int p_what) {
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 72248b62a3..042f085e98 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -30,15 +30,15 @@
#include "canvas_item_editor_plugin.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/script_editor_debugger.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "project_settings.h"
#include "scene/2d/light_2d.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h"
@@ -667,7 +667,7 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retreive_lock
List<CanvasItem *> selection;
for (Map<Node *, Object *>::Element *E = editor_selection->get_selection().front(); E; E = E->next()) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key());
- if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (!retreive_locked || !canvas_item->has_meta("_edit_lock_"))) {
+ if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (retreive_locked || !canvas_item->has_meta("_edit_lock_"))) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (se) {
selection.push_back(canvas_item);
@@ -1625,7 +1625,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if ((b->get_alt() || tool == TOOL_MOVE) && selection.size() > 0) {
- drag_type = DRAG_ALL;
+ drag_type = DRAG_MOVE;
drag_from = transform.affine_inverse().xform(b->get_position());
drag_selection = selection;
_save_canvas_item_state(drag_selection);
@@ -1634,7 +1634,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
}
- if (drag_type == DRAG_ALL) {
+ if (drag_type == DRAG_MOVE) {
// Move the nodes
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection, true);
@@ -1674,7 +1674,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
// Confirm the move (only if it was moved)
- if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_ALL)) {
+ if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_MOVE)) {
if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
_commit_canvas_item_state(drag_selection, TTR("Move CanvasItem"), true);
}
@@ -1863,7 +1863,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Drag the node(s) if requested
List<CanvasItem *> selection = _get_edited_canvas_items();
- drag_type = DRAG_ALL;
+ drag_type = DRAG_MOVE;
drag_selection = selection;
drag_from = click;
_save_canvas_item_state(drag_selection);
@@ -1894,7 +1894,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Drag the node(s) if requested
List<CanvasItem *> selection = _get_edited_canvas_items();
- drag_type = DRAG_ALL;
+ drag_type = DRAG_MOVE;
drag_selection = selection;
drag_from = click;
_save_canvas_item_state(drag_selection);
@@ -2073,7 +2073,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
case DRAG_BOTTOM_LEFT:
c = CURSOR_BDIAGSIZE;
break;
- case DRAG_ALL:
+ case DRAG_MOVE:
c = CURSOR_MOVE;
break;
case DRAG_PAN:
@@ -2317,7 +2317,7 @@ void CanvasItemEditor::_draw_selection() {
// Draw the previous position if we are dragging the node
if (show_helpers &&
- (drag_type == DRAG_ALL || drag_type == DRAG_ROTATE ||
+ (drag_type == DRAG_MOVE || drag_type == DRAG_ROTATE ||
drag_type == DRAG_LEFT || drag_type == DRAG_RIGHT || drag_type == DRAG_TOP || drag_type == DRAG_BOTTOM ||
drag_type == DRAG_TOP_LEFT || drag_type == DRAG_TOP_RIGHT || drag_type == DRAG_BOTTOM_LEFT || drag_type == DRAG_BOTTOM_RIGHT)) {
const Transform2D pre_drag_xform = transform * se->pre_drag_xform;
@@ -2478,7 +2478,7 @@ void CanvasItemEditor::_draw_selection() {
case DRAG_TOP_LEFT:
case DRAG_BOTTOM_LEFT:
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
- case DRAG_ALL:
+ case DRAG_MOVE:
start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
_draw_margin_at_position(control->get_margin(MARGIN_LEFT), parent_transform.xform((start + end) / 2), MARGIN_TOP);
@@ -2492,7 +2492,7 @@ void CanvasItemEditor::_draw_selection() {
case DRAG_TOP_RIGHT:
case DRAG_BOTTOM_RIGHT:
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
- case DRAG_ALL:
+ case DRAG_MOVE:
start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
_draw_margin_at_position(control->get_margin(MARGIN_RIGHT), parent_transform.xform((start + end) / 2), MARGIN_BOTTOM);
@@ -2506,7 +2506,7 @@ void CanvasItemEditor::_draw_selection() {
case DRAG_TOP_LEFT:
case DRAG_TOP_RIGHT:
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
- case DRAG_ALL:
+ case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
end = start - Vector2(0, control->get_margin(MARGIN_TOP));
_draw_margin_at_position(control->get_margin(MARGIN_TOP), parent_transform.xform((start + end) / 2), MARGIN_LEFT);
@@ -2520,7 +2520,7 @@ void CanvasItemEditor::_draw_selection() {
case DRAG_BOTTOM_LEFT:
case DRAG_BOTTOM_RIGHT:
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
- case DRAG_ALL:
+ case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
_draw_margin_at_position(control->get_margin(MARGIN_BOTTOM), parent_transform.xform((start + end) / 2), MARGIN_RIGHT);
@@ -2540,7 +2540,7 @@ void CanvasItemEditor::_draw_selection() {
case DRAG_BOTTOM_RIGHT:
case DRAG_BOTTOM:
case DRAG_BOTTOM_LEFT:
- case DRAG_ALL:
+ case DRAG_MOVE:
if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) {
Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size());
viewport->draw_rect(parent_transform.xform(rect), color_base, false);
@@ -2750,7 +2750,7 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans
_draw_invisible_nodes_positions(p_node->get_child(i), parent_xform, canvas_xform);
}
- if (canvas_item && !canvas_item->_edit_use_rect() && !editor_selection->is_selected(canvas_item)) {
+ if (canvas_item && !canvas_item->_edit_use_rect() && (!editor_selection->is_selected(canvas_item) || canvas_item->get_meta("_edit_lock_"))) {
Transform2D xform = transform * canvas_xform * parent_xform;
// Draw the node's position
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 2c943385ad..dd6c94eb60 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -188,7 +188,7 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_ANCHOR_BOTTOM_RIGHT,
DRAG_ANCHOR_BOTTOM_LEFT,
DRAG_ANCHOR_ALL,
- DRAG_ALL,
+ DRAG_MOVE,
DRAG_ROTATE,
DRAG_PIVOT,
DRAG_V_GUIDE,
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 5109379add..805a7d3835 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "collision_polygon_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/3d/camera.h"
#include "spatial_editor_plugin.h"
diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp
index dc7176a6cc..8d3ebc5052 100644
--- a/editor/plugins/cpu_particles_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_editor_plugin.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "cpu_particles_editor_plugin.h"
+
#include "editor/plugins/spatial_editor_plugin.h"
void CPUParticlesEditor::_node_removed(Node *p_node) {
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index f5bdf77973..79169d3183 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "curve_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
-#include "core_string_names.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/core_string_names.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
CurveEditor::CurveEditor() {
_selected_point = -1;
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 9acbceec92..72a746e95b 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -30,12 +30,12 @@
#include "editor_preview_plugins.h"
+#include "core/io/file_access_memory.h"
+#include "core/io/resource_loader.h"
+#include "core/os/os.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "io/file_access_memory.h"
-#include "io/resource_loader.h"
-#include "os/os.h"
#include "scene/resources/bit_mask.h"
#include "scene/resources/dynamic_font.h"
#include "scene/resources/material.h"
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index 1f0b4e9e97..7b5de9c009 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -30,7 +30,7 @@
#include "item_list_editor_plugin.h"
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
bool ItemListPlugin::_set(const StringName &p_name, const Variant &p_value) {
@@ -278,18 +278,20 @@ void ItemListEditor::_add_pressed() {
void ItemListEditor::_delete_pressed() {
- TreeItem *ti = tree->get_selected();
-
- if (!ti)
+ if (selected_idx == -1)
return;
- if (ti->get_parent() != tree->get_root())
+ String current_selected = (String)property_editor->get_selected_path();
+
+ if (current_selected == "")
return;
- int idx = ti->get_text(0).to_int();
+ // FIXME: Currently relying on selecting a *property* to derive what item to delete
+ // e.g. you select "1/enabled" to delete item 1.
+ // This should be fixed so that you can delete by selecting the item section header,
+ // or a delete button on that header.
- if (selected_idx == -1)
- return;
+ int idx = current_selected.get_slice("/", 0).to_int();
item_plugins[selected_idx]->erase(idx);
}
@@ -382,13 +384,9 @@ ItemListEditor::ItemListEditor() {
hbc->add_child(del_button);
del_button->connect("pressed", this, "_delete_button");
- property_editor = memnew(PropertyEditor);
- property_editor->hide_top_label();
- property_editor->set_subsection_selectable(true);
+ property_editor = memnew(EditorInspector);
vbc->add_child(property_editor);
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
-
- tree = property_editor->get_property_tree();
}
ItemListEditor::~ItemListEditor() {
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index d6a071b9b9..3dc3775f83 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -32,9 +32,9 @@
#define ITEM_LIST_EDITOR_PLUGIN_H
#include "canvas_item_editor_plugin.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
-
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/popup_menu.h"
@@ -210,7 +210,7 @@ class ItemListEditor : public HBoxContainer {
ToolButton *toolbar_button;
AcceptDialog *dialog;
- PropertyEditor *property_editor;
+ EditorInspector *property_editor;
Tree *tree;
Button *add_button;
Button *del_button;
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 3351e5918f..4f8a307cc1 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -31,8 +31,8 @@
#include "light_occluder_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
void LightOccluder2DEditor::_notification(int p_what) {
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index f282d391ff..5e59a73061 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -28,397 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
-// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
-
#include "material_editor_plugin.h"
-#include "scene/3d/particles.h"
-
-#if 0
-
-#include "scene/main/viewport.h"
-
-void MaterialEditor::_gui_input(InputEvent p_event) {
-
-
-}
-
-void MaterialEditor::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_PHYSICS_PROCESS) {
-
- }
-
-
- if (p_what==NOTIFICATION_READY) {
-
- //get_scene()->connect("node_removed",this,"_node_removed");
-
- if (first_enter) {
- //it's in propertyeditor so.. could be moved around
-
- light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1","EditorIcons"));
- light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off","EditorIcons"));
- light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2","EditorIcons"));
- light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off","EditorIcons"));
-
- sphere_switch->set_normal_texture(get_icon("MaterialPreviewSphereOff","EditorIcons"));
- sphere_switch->set_pressed_texture(get_icon("MaterialPreviewSphere","EditorIcons"));
- box_switch->set_normal_texture(get_icon("MaterialPreviewCubeOff","EditorIcons"));
- box_switch->set_pressed_texture(get_icon("MaterialPreviewCube","EditorIcons"));
-
- first_enter=false;
- }
-
- }
-
- if (p_what==NOTIFICATION_DRAW) {
-
-
- Ref<Texture> checkerboard = get_icon("Checkerboard","EditorIcons");
- Size2 size = get_size();
-
- draw_texture_rect(checkerboard,Rect2(Point2(),size),true);
-
- }
-}
-
-
-
-void MaterialEditor::edit(Ref<Material> p_material) {
-
- material=p_material;
-
- if (!material.is_null()) {
- sphere_mesh->surface_set_material(0,material);
- box_mesh->surface_set_material(0,material);
- } else {
-
- hide();
- }
-
-}
-
-
-void MaterialEditor::_button_pressed(Node* p_button) {
-
- if (p_button==light_1_switch) {
- light1->set_enabled(!light_1_switch->is_pressed());
- }
-
- if (p_button==light_2_switch) {
- light2->set_enabled(!light_2_switch->is_pressed());
- }
-
- if (p_button==box_switch) {
- box_instance->show();
- sphere_instance->hide();
- box_switch->set_pressed(true);
- sphere_switch->set_pressed(false);
- }
-
- if (p_button==sphere_switch) {
- box_instance->hide();
- sphere_instance->show();
- box_switch->set_pressed(false);
- sphere_switch->set_pressed(true);
- }
-
-}
-
-void MaterialEditor::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_gui_input"),&MaterialEditor::_gui_input);
- ClassDB::bind_method(D_METHOD("_button_pressed"),&MaterialEditor::_button_pressed);
-
-}
-
-MaterialEditor::MaterialEditor() {
-
- viewport = memnew( Viewport );
- Ref<World> world;
- world.instance();
- viewport->set_world(world); //use own world
- add_child(viewport);
- viewport->set_disable_input(true);
-
- camera = memnew( Camera );
- camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
- camera->set_perspective(45,0.1,10);
- viewport->add_child(camera);
-
- light1 = memnew( DirectionalLight );
- light1->set_transform(Transform().looking_at(Vector3(-1,-1,-1),Vector3(0,1,0)));
- viewport->add_child(light1);
-
- light2 = memnew( DirectionalLight );
- light2->set_transform(Transform().looking_at(Vector3(0,1,0),Vector3(0,0,1)));
- light2->set_color(Light::COLOR_DIFFUSE,Color(0.7,0.7,0.7));
- light2->set_color(Light::COLOR_SPECULAR,Color(0.7,0.7,0.7));
- viewport->add_child(light2);
-
- sphere_instance = memnew( MeshInstance );
- viewport->add_child(sphere_instance);
-
- box_instance = memnew( MeshInstance );
- viewport->add_child(box_instance);
-
- Transform box_xform;
- box_xform.basis.rotate(Vector3(1,0,0),Math::deg2rad(25));
- box_xform.basis = box_xform.basis * Matrix3().rotated(Vector3(0,1,0),Math::deg2rad(25));
- box_xform.basis.scale(Vector3(0.8,0.8,0.8));
- box_instance->set_transform(box_xform);
-
- {
-
- sphere_mesh.instance();
-
-
- int lats=32;
- int lons=32;
- float radius=1.0;
-
- PoolVector<Vector3> vertices;
- PoolVector<Vector3> normals;
- PoolVector<Vector2> uvs;
- PoolVector<float> tangents;
- Matrix3 tt = Matrix3(Vector3(0,1,0),Math_PI*0.5);
-
- for(int i = 1; i <= lats; i++) {
- double lat0 = Math_PI * (-0.5 + (double) (i - 1) / lats);
- double z0 = Math::sin(lat0);
- double zr0 = Math::cos(lat0);
-
- double lat1 = Math_PI * (-0.5 + (double) i / lats);
- double z1 = Math::sin(lat1);
- double zr1 = Math::cos(lat1);
-
- for(int j = lons; j >= 1; j--) {
-
- double lng0 = 2 * Math_PI * (double) (j - 1) / lons;
- double x0 = Math::cos(lng0);
- double y0 = Math::sin(lng0);
-
- double lng1 = 2 * Math_PI * (double) (j) / lons;
- double x1 = Math::cos(lng1);
- double y1 = Math::sin(lng1);
-
-
- Vector3 v[4]={
- Vector3(x1 * zr0, z0, y1 *zr0),
- Vector3(x1 * zr1, z1, y1 *zr1),
- Vector3(x0 * zr1, z1, y0 *zr1),
- Vector3(x0 * zr0, z0, y0 *zr0)
- };
-
-#define ADD_POINT(m_idx) \
- normals.push_back(v[m_idx]); \
- vertices.push_back(v[m_idx] * radius); \
- { \
- Vector2 uv(Math::atan2(v[m_idx].x, v[m_idx].z), Math::atan2(-v[m_idx].y, v[m_idx].z)); \
- uv /= Math_PI; \
- uv *= 4.0; \
- uv = uv * 0.5 + Vector2(0.5, 0.5); \
- uvs.push_back(uv); \
- } \
- { \
- Vector3 t = tt.xform(v[m_idx]); \
- tangents.push_back(t.x); \
- tangents.push_back(t.y); \
- tangents.push_back(t.z); \
- tangents.push_back(1.0); \
- }
-
-
-
- ADD_POINT(0);
- ADD_POINT(1);
- ADD_POINT(2);
-
- ADD_POINT(2);
- ADD_POINT(3);
- ADD_POINT(0);
- }
- }
-
- Array arr;
- arr.resize(VS::ARRAY_MAX);
- arr[VS::ARRAY_VERTEX]=vertices;
- arr[VS::ARRAY_NORMAL]=normals;
- arr[VS::ARRAY_TANGENT]=tangents;
- arr[VS::ARRAY_TEX_UV]=uvs;
-
- sphere_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,arr);
-
- sphere_instance->set_mesh(sphere_mesh);
-
- }
- {
-
-
- box_mesh.instance();
-
- PoolVector<Vector3> vertices;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector3> uvs;
-
- int vtx_idx=0;
-#define ADD_VTX(m_idx) \
- ; \
- vertices.push_back(face_points[m_idx]); \
- normals.push_back(normal_points[m_idx]); \
- tangents.push_back(normal_points[m_idx][1]); \
- tangents.push_back(normal_points[m_idx][2]); \
- tangents.push_back(normal_points[m_idx][0]); \
- tangents.push_back(1.0); \
- uvs.push_back(Vector3(uv_points[m_idx * 2 + 0], uv_points[m_idx * 2 + 1], 0)); \
- vtx_idx++;\
-
- for (int i=0;i<6;i++) {
-
-
- Vector3 face_points[4];
- Vector3 normal_points[4];
- float uv_points[8]={0,0,0,1,1,1,1,0};
-
- for (int j=0;j<4;j++) {
-
- float v[3];
- v[0]=1.0;
- v[1]=1-2*((j>>1)&1);
- v[2]=v[1]*(1-2*(j&1));
-
- for (int k=0;k<3;k++) {
-
- if (i<3)
- face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1);
- else
- face_points[3-j][(i+k)%3]=v[k]*(i>=3?-1:1);
- }
- normal_points[j]=Vector3();
- normal_points[j][i%3]=(i>=3?-1:1);
- }
-
- //tri 1
- ADD_VTX(0);
- ADD_VTX(1);
- ADD_VTX(2);
- //tri 2
- ADD_VTX(2);
- ADD_VTX(3);
- ADD_VTX(0);
-
- }
-
-
-
- Array d;
- d.resize(VS::ARRAY_MAX);
- d[VisualServer::ARRAY_NORMAL]= normals ;
- d[VisualServer::ARRAY_TANGENT]= tangents ;
- d[VisualServer::ARRAY_TEX_UV]= uvs ;
- d[VisualServer::ARRAY_VERTEX]= vertices ;
-
- PoolVector<int> indices;
- indices.resize(vertices.size());
- for(int i=0;i<vertices.size();i++)
- indices.set(i,i);
- d[VisualServer::ARRAY_INDEX]=indices;
-
- box_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d);
- box_instance->set_mesh(box_mesh);
- box_instance->hide();
-
-
-
- }
-
- set_custom_minimum_size(Size2(1,150)*EDSCALE);
-
- HBoxContainer *hb = memnew( HBoxContainer );
- add_child(hb);
- hb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
-
- VBoxContainer *vb_shape = memnew( VBoxContainer );
- hb->add_child(vb_shape);
-
- sphere_switch = memnew( TextureButton );
- sphere_switch->set_toggle_mode(true);
- sphere_switch->set_pressed(true);
- vb_shape->add_child(sphere_switch);
- sphere_switch->connect("pressed",this,"_button_pressed",varray(sphere_switch));
-
- box_switch = memnew( TextureButton );
- box_switch->set_toggle_mode(true);
- box_switch->set_pressed(false);
- vb_shape->add_child(box_switch);
- box_switch->connect("pressed",this,"_button_pressed",varray(box_switch));
-
- hb->add_spacer();
-
- VBoxContainer *vb_light = memnew( VBoxContainer );
- hb->add_child(vb_light);
-
- light_1_switch = memnew( TextureButton );
- light_1_switch->set_toggle_mode(true);
- vb_light->add_child(light_1_switch);
- light_1_switch->connect("pressed",this,"_button_pressed",varray(light_1_switch));
-
- light_2_switch = memnew( TextureButton );
- light_2_switch->set_toggle_mode(true);
- vb_light->add_child(light_2_switch);
- light_2_switch->connect("pressed",this,"_button_pressed",varray(light_2_switch));
-
- first_enter=true;
-
-}
-
-
-void MaterialEditorPlugin::edit(Object *p_object) {
-
- Material * s = Object::cast_to<Material>(p_object);
- if (!s)
- return;
-
- material_editor->edit(Ref<Material>(s));
-}
-
-bool MaterialEditorPlugin::handles(Object *p_object) const {
-
- return p_object->is_type("Material");
-}
-
-void MaterialEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
- material_editor->show();
- //material_editor->set_process(true);
- } else {
-
- material_editor->hide();
- //material_editor->set_process(false);
- }
-
-}
-
-MaterialEditorPlugin::MaterialEditorPlugin(EditorNode *p_node) {
-
- editor=p_node;
- material_editor = memnew( MaterialEditor );
- add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM,material_editor);
- material_editor->hide();
-
-
-
-}
-
-
-MaterialEditorPlugin::~MaterialEditorPlugin()
-{
-}
-#endif
+#include "scene/resources/particles_material.h"
String SpatialMaterialConversionPlugin::converts_to() const {
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 31a927d83f..c06d95e700 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -32,77 +32,6 @@
#define MATERIAL_EDITOR_PLUGIN_H
#include "editor/property_editor.h"
-// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
-// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
-#if 0
-
-#include "editor/editor_node.h"
-#include "editor/editor_plugin.h"
-#include "scene/3d/camera.h"
-#include "scene/3d/light.h"
-#include "scene/3d/mesh_instance.h"
-#include "scene/resources/material.h"
-
-class MaterialEditor : public Control {
-
- GDCLASS(MaterialEditor, Control);
-
-
- Viewport *viewport;
- MeshInstance *sphere_instance;
- MeshInstance *box_instance;
- DirectionalLight *light1;
- DirectionalLight *light2;
- Camera *camera;
-
- Ref<Mesh> sphere_mesh;
- Ref<Mesh> box_mesh;
-
- TextureButton *sphere_switch;
- TextureButton *box_switch;
-
- TextureButton *light_1_switch;
- TextureButton *light_2_switch;
-
-
- Ref<Material> material;
-
-
- void _button_pressed(Node* p_button);
- bool first_enter;
-
-protected:
- void _notification(int p_what);
- void _gui_input(InputEvent p_event);
- static void _bind_methods();
-public:
-
- void edit(Ref<Material> p_material);
- MaterialEditor();
-};
-
-
-class MaterialEditorPlugin : public EditorPlugin {
-
- GDCLASS( MaterialEditorPlugin, EditorPlugin );
-
- MaterialEditor *material_editor;
- EditorNode *editor;
-
-public:
-
- virtual String get_name() const { return "Material"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
- virtual void make_visible(bool p_visible);
-
- MaterialEditorPlugin(EditorNode *p_node);
- ~MaterialEditorPlugin();
-
-};
-
-#endif
class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin)
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index ae5d510502..5dcbca2ed6 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "particles_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
-#include "io/image_loader.h"
-#include "scene/3d/particles.h"
+#include "core/io/image_loader.h"
#include "scene/gui/separator.h"
+#include "scene/resources/particles_material.h"
void Particles2DEditorPlugin::edit(Object *p_object) {
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index 2b6123141b..71ca8ef499 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -34,7 +34,6 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/collision_polygon_2d.h"
-
#include "scene/2d/particles_2d.h"
#include "scene/gui/box_container.h"
#include "scene/gui/file_dialog.h"
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 3c381158a4..6b41946918 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -29,9 +29,12 @@
/*************************************************************************/
#include "particles_editor_plugin.h"
+
+#include "core/io/resource_loader.h"
#include "editor/plugins/spatial_editor_plugin.h"
-#include "io/resource_loader.h"
#include "scene/3d/cpu_particles.h"
+#include "scene/resources/particles_material.h"
+
bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vector3> &normals) {
bool use_normals = emission_fill->get_selected() == 1;
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index 622ce6e8a9..830d30d98f 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -43,6 +43,7 @@
class ParticlesEditorBase : public Control {
GDCLASS(ParticlesEditorBase, Control)
+
protected:
Spatial *base_node;
Panel *panel;
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 33e182faef..96c1ad2f2b 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "path_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
void Path2DEditor::_notification(int p_what) {
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index ef7ecb0fb0..df6c40ed02 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -30,7 +30,7 @@
#include "path_editor_plugin.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/resources/curve.h"
#include "spatial_editor_plugin.h"
@@ -215,8 +215,8 @@ void PathSpatialGizmo::redraw() {
clear();
- Ref<SpatialMaterial> path_material = gizmo_plugin->get_material("path_material");
- Ref<SpatialMaterial> path_thin_material = gizmo_plugin->get_material("path_thin_material");
+ Ref<SpatialMaterial> path_material = gizmo_plugin->get_material("path_material", this);
+ Ref<SpatialMaterial> path_thin_material = gizmo_plugin->get_material("path_thin_material", this);
Ref<SpatialMaterial> handles_material = gizmo_plugin->get_material("handles");
Ref<Curve3D> c = path->get_curve();
@@ -641,24 +641,8 @@ String PathSpatialGizmoPlugin::get_name() const {
PathSpatialGizmoPlugin::PathSpatialGizmoPlugin() {
Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8));
-
- Ref<SpatialMaterial> path_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
- path_color.a = 0.8;
- path_material->set_albedo(path_color);
- path_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- path_material->set_line_width(3);
- path_material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
- path_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
-
- Ref<SpatialMaterial> path_thin_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
+ create_material("path_material", path_color);
path_color.a = 0.4;
- path_thin_material->set_albedo(path_color);
- path_thin_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- path_thin_material->set_line_width(1);
- path_thin_material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
- path_thin_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
-
- add_material("path_material", path_material);
- add_material("path_thin_material", path_thin_material);
+ create_material("path_thin_material", path_color);
create_handle_material("handles");
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index a437cd5362..e0c8cf41ff 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "polygon_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/2d/skeleton_2d.h"
Node2D *Polygon2DEditor::_get_node() const {
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index c6e8ec1a2b..da6aa48f9c 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "resource_preloader_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 70f1789a86..f90863c735 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -504,6 +504,13 @@ void ScriptEditor::_open_recent_script(int p_idx) {
return;
}
// if it's a path then its most likely a deleted file not help
+ } else if (path.find("::") != -1) {
+ // built-in script
+ Ref<Script> script = ResourceLoader::load(path);
+ if (script.is_valid()) {
+ edit(script, true);
+ return;
+ }
} else if (!path.is_resource_file()) {
_help_class_open(path);
return;
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 737f17358b..120755b5af 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -31,6 +31,7 @@
#ifndef SCRIPT_EDITOR_PLUGIN_H
#define SCRIPT_EDITOR_PLUGIN_H
+#include "core/script_language.h"
#include "editor/code_editor.h"
#include "editor/editor_help.h"
#include "editor/editor_plugin.h"
@@ -44,7 +45,6 @@
#include "scene/gui/tree.h"
#include "scene/main/timer.h"
#include "scene/resources/text_file.h"
-#include "script_language.h"
class ScriptEditorQuickOpen : public ConfirmationDialog {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 66705f85bf..82c2e07940 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -30,10 +30,10 @@
#include "script_text_editor.h"
+#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/script_editor_debugger.h"
-#include "os/keyboard.h"
Vector<String> ScriptTextEditor::get_functions() {
@@ -1475,9 +1475,9 @@ ScriptTextEditor::ScriptTextEditor() {
convert_case->set_name("convert_case");
edit_menu->get_popup()->add_child(convert_case);
edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE);
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE);
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
+ convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KEY_MASK_SHIFT | KEY_F4), EDIT_TO_UPPERCASE);
+ convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KEY_MASK_SHIFT | KEY_F5), EDIT_TO_LOWERCASE);
+ convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", this, "_edit_option");
highlighters["Standard"] = NULL;
@@ -1568,10 +1568,6 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Goto Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Goto Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
- ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Convert To Uppercase"), KEY_MASK_SHIFT | KEY_F4);
- ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Convert To Lowercase"), KEY_MASK_SHIFT | KEY_F3);
- ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F2);
-
ED_SHORTCUT("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_MASK_CMD | KEY_G);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index cfc322d2c1..e86424ee51 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -30,23 +30,25 @@
#include "spatial_editor_plugin.h"
-#include "camera_matrix.h"
+#include "core/math/camera_matrix.h"
#include "core/os/input.h"
-
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
+#include "core/sort.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/script_editor_debugger.h"
#include "editor/spatial_editor_gizmos.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "project_settings.h"
#include "scene/3d/camera.h"
+#include "scene/3d/collision_shape.h"
+#include "scene/3d/mesh_instance.h"
+#include "scene/3d/physics_body.h"
#include "scene/3d/visual_instance.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/surface_tool.h"
-#include "sort.h"
#define DISTANCE_DEFAULT 4
@@ -274,7 +276,7 @@ void SpatialEditorViewport::_select_clicked(bool p_append, bool p_single) {
_select(sp, clicked_wants_append, true);
}
-void SpatialEditorViewport::_select(Spatial *p_node, bool p_append, bool p_single) {
+void SpatialEditorViewport::_select(Node *p_node, bool p_append, bool p_single) {
if (!p_append) {
editor_selection->clear();
@@ -340,12 +342,10 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
continue;
if (dist < closest_dist) {
- //make sure that whathever is selected is editable
- Node *owner = spat->get_owner();
- if (owner != edited_scene && !edited_scene->is_editable_instance(owner)) {
- item = owner;
- } else {
- item = Object::cast_to<Node>(spat);
+
+ item = Object::cast_to<Node>(spat);
+ while (item->get_owner() && item->get_owner() != edited_scene && !edited_scene->is_editable_instance(item->get_owner())) {
+ item = item->get_owner();
}
closest = item->get_instance_id();
@@ -496,7 +496,7 @@ void SpatialEditorViewport::_select_region() {
}
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario());
- Vector<Spatial *> selected;
+ Vector<Node *> selected;
Node *edited_scene = get_tree()->get_edited_scene_root();
@@ -506,12 +506,12 @@ void SpatialEditorViewport::_select_region() {
if (!sp)
continue;
- Spatial *root_sp = sp;
- while (root_sp && root_sp != edited_scene && root_sp->get_owner() != edited_scene && !edited_scene->is_editable_instance(root_sp->get_owner())) {
- root_sp = Object::cast_to<Spatial>(root_sp->get_owner());
+ Node *item = Object::cast_to<Node>(sp);
+ while (item->get_owner() && item->get_owner() != edited_scene && !edited_scene->is_editable_instance(item->get_owner())) {
+ item = item->get_owner();
}
- if (selected.find(root_sp) != -1) continue;
+ if (selected.find(item) != -1) continue;
Ref<EditorSpatialGizmo> seg = sp->get_gizmo();
@@ -519,7 +519,7 @@ void SpatialEditorViewport::_select_region() {
continue;
if (seg->intersect_frustum(camera, frustum)) {
- selected.push_back(root_sp);
+ selected.push_back(item);
}
}
@@ -3911,8 +3911,9 @@ void _update_all_gizmos(Node *p_node) {
}
}
-void SpatialEditor::update_all_gizmos() {
- _update_all_gizmos(SceneTree::get_singleton()->get_root());
+void SpatialEditor::update_all_gizmos(Node *p_node) {
+ if (!p_node) p_node = SceneTree::get_singleton()->get_root();
+ _update_all_gizmos(p_node);
}
Object *SpatialEditor::_get_editor_data(Object *p_what) {
@@ -5379,7 +5380,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
ED_SHORTCUT("spatial_editor/tool_move", TTR("Tool Move"), KEY_W);
ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Tool Rotate"), KEY_E);
ED_SHORTCUT("spatial_editor/tool_scale", TTR("Tool Scale"), KEY_R);
- ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap To Floor"), KEY_PAGEDOWN);
ED_SHORTCUT("spatial_editor/freelook_toggle", TTR("Toggle Freelook"), KEY_MASK_SHIFT + KEY_F);
@@ -5390,7 +5390,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
hbc_menu->add_child(transform_menu);
p = transform_menu->get_popup();
- p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap object to floor")), MENU_SNAP_TO_FLOOR);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap object to floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog...")), MENU_TRANSFORM_DIALOG);
@@ -5662,7 +5662,7 @@ SpatialEditorPlugin::~SpatialEditorPlugin() {
void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color &p_color, bool p_billboard, bool p_on_top, bool p_use_vertex_color) {
- Color instanced_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instanced", Color(0.7, 0.7, 0.7, 0.5));
+ Color instanced_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instanced", Color(0.7, 0.7, 0.7, 0.6));
Vector<Ref<SpatialMaterial> > mats;
@@ -5704,7 +5704,7 @@ void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color
void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const Ref<Texture> &p_texture, bool p_on_top, const Color &p_albedo) {
- Color instanced_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instanced", Color(0.7, 0.7, 0.7, 0.5));
+ Color instanced_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instanced", Color(0.7, 0.7, 0.7, 0.6));
Vector<Ref<SpatialMaterial> > icons;
@@ -5717,7 +5717,7 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const
Color color = instanced ? instanced_color : p_albedo;
if (!selected) {
- color.a *= 0.3;
+ color.a *= 0.85;
}
icon->set_albedo(color);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 5850c0dbf1..0e35ba8517 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -127,9 +127,7 @@ public:
virtual void redraw();
virtual void free();
- //TODO remove (?)
virtual bool is_editable() const;
- virtual bool can_draw() const;
void set_hidden(bool p_hidden);
void set_plugin(EditorSpatialGizmoPlugin *p_gizmo);
@@ -226,7 +224,7 @@ private:
void _compute_edit(const Point2 &p_point);
void _clear_selected();
void _select_clicked(bool p_append, bool p_single);
- void _select(Spatial *p_node, bool p_append, bool p_single);
+ void _select(Node *p_node, bool p_append, bool p_single);
ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = NULL, bool p_alt_select = false);
void _find_items_at_pos(const Point2 &p_pos, bool &r_includes_current, Vector<_RayResult> &results, bool p_alt_select = false);
Vector3 _get_ray_pos(const Vector2 &p_pos) const;
@@ -677,7 +675,7 @@ public:
Ref<ArrayMesh> get_scale_plane_gizmo(int idx) const { return scale_plane_gizmo[idx]; }
void update_transform_gizmo();
- void update_all_gizmos();
+ void update_all_gizmos(Node *p_node = NULL);
void snap_selected_nodes_to_floor();
void select_gizmo_highlight_axis(int p_axis);
void set_custom_camera(Node *p_camera) { custom_camera = p_camera; }
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index fcbbee2b9c..30246147c2 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "sprite_frames_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
#include "scene/3d/sprite_3d.h"
void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index e891850870..140d37fdb5 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "texture_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4390b94ece..33e1f7c6a3 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -31,8 +31,8 @@
#include "texture_region_editor_plugin.h"
#include "core/core_string_names.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "scene/gui/check_box.h"
/**
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 92b95963f9..acee1a6942 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "theme_editor_plugin.h"
-#include "os/file_access.h"
-#include "version.h"
+#include "core/os/file_access.h"
+#include "core/version.h"
void ThemeEditor::edit(const Ref<Theme> &p_theme) {
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 58c3fd015e..a0adbfccff 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "tile_map_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/gui/split_container.h"
void TileMapEditor::_notification(int p_what) {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index ee31e1409c..cefed193ca 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "visual_shader_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
#include "editor/editor_properties.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"