summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/path_editor_plugin.cpp12
-rw-r--r--tools/editor/plugins/path_editor_plugin.h6
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp29
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h4
4 files changed, 21 insertions, 30 deletions
diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp
index b99e632604..3c4428bdb0 100644
--- a/tools/editor/plugins/path_editor_plugin.cpp
+++ b/tools/editor/plugins/path_editor_plugin.cpp
@@ -267,17 +267,15 @@ PathSpatialGizmo::PathSpatialGizmo(Path* p_path){
}
-bool PathEditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
+Ref<SpatialEditorGizmo> PathEditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
- if (p_spatial->cast_to<Path>()) {
+ if (p_spatial->cast_to<Path>()) {
- Ref<PathSpatialGizmo> psg = memnew( PathSpatialGizmo(p_spatial->cast_to<Path>()));
- p_spatial->set_gizmo(psg);
- return true;
+ return memnew( PathSpatialGizmo(p_spatial->cast_to<Path>()));
}
- return false;
+ return Ref<SpatialEditorGizmo>();
}
bool PathEditorPlugin::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) {
@@ -538,7 +536,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true);
path_thin_material->set_flag(Material::FLAG_UNSHADED,true);
- SpatialEditor::get_singleton()->add_gizmo_plugin(this);
+// SpatialEditor::get_singleton()->add_gizmo_plugin(this);
sep = memnew( VSeparator);
sep->hide();
diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h
index 18bad23bd1..0afd957af7 100644
--- a/tools/editor/plugins/path_editor_plugin.h
+++ b/tools/editor/plugins/path_editor_plugin.h
@@ -32,9 +32,9 @@
#include "tools/editor/spatial_editor_gizmos.h"
#include "scene/3d/path.h"
-class PathSpatialGizmo : public SpatialGizmoTool {
+class PathSpatialGizmo : public EditorSpatialGizmo {
- OBJ_TYPE(PathSpatialGizmo,SpatialGizmoTool);
+ OBJ_TYPE(PathSpatialGizmo,EditorSpatialGizmo);
Path* path;
mutable Vector3 original;
@@ -83,7 +83,7 @@ public:
virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event);
// virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
- virtual bool create_spatial_gizmo(Spatial* p_spatial);
+ 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);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index bc57fd7e44..1f264a2337 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3655,35 +3655,32 @@ void SpatialEditor::_request_gizmo(Object* p_obj) {
Spatial *sp=p_obj->cast_to<Spatial>();
if (!sp)
return;
- if (editor->get_edited_scene() && (sp==editor->get_edited_scene() || sp->get_owner()==editor->get_edited_scene())) {
+ if (editor->get_edited_scene() && (sp==editor->get_edited_scene() || sp->get_owner()==editor->get_edited_scene() || editor->get_edited_scene()->is_editable_instance(sp->get_owner()))) {
- Ref<SpatialEditorGizmo> seg = gizmos->get_gizmo(sp);
+ Ref<SpatialEditorGizmo> seg;
- if (seg.is_valid()) {
- sp->set_gizmo(seg);
- }
-
- for (List<EditorPlugin*>::Element *E=gizmo_plugins.front();E;E=E->next()) {
+ for(int i=0;i<EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count();i++) {
- if (E->get()->create_spatial_gizmo(sp)) {
+ seg = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i)->create_spatial_gizmo(sp);
+ if (seg.is_valid())
+ break;
+ }
- seg = sp->get_gizmo();
- if (sp==selected && seg.is_valid()) {
+ if (!seg.is_valid()) {
+ seg = gizmos->get_gizmo(sp);
+ }
- seg->set_selected(true);
- selected->update_gizmo();
- }
- return;
- }
+ if (seg.is_valid()) {
+ sp->set_gizmo(seg);
}
+
if (seg.is_valid() && sp==selected) {
seg->set_selected(true);
selected->update_gizmo();
}
}
-
}
void SpatialEditor::_toggle_maximize_view(Object* p_viewport) {
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index b0e366b140..af1b6919a2 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -457,8 +457,6 @@ private:
Ref<Environment> viewport_environment;
- List<EditorPlugin*> gizmo_plugins;
-
Spatial *selected;
void _request_gizmo(Object* p_obj);
@@ -518,8 +516,6 @@ public:
UndoRedo *get_undo_redo() { return undo_redo; }
- void add_gizmo_plugin(EditorPlugin* p_plugin) { gizmo_plugins.push_back(p_plugin); }
-
void add_control_to_menu_panel(Control *p_control);
VSplitContainer *get_shader_split();