diff options
-rw-r--r-- | editor/plugins/path_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/path_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 127 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.h | 5 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 84 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.h | 21 | ||||
-rw-r--r-- | modules/csg/csg_gizmos.cpp | 4 | ||||
-rw-r--r-- | modules/csg/csg_gizmos.h | 1 |
8 files changed, 202 insertions, 45 deletions
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 6efa76ef80..88dc258c5f 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -638,6 +638,10 @@ String PathSpatialGizmoPlugin::get_name() const { return "Path"; } +int PathSpatialGizmoPlugin::get_priority() const { + return -1; +} + PathSpatialGizmoPlugin::PathSpatialGizmoPlugin() { Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8)); diff --git a/editor/plugins/path_editor_plugin.h b/editor/plugins/path_editor_plugin.h index ce3d3799d4..5482d09377 100644 --- a/editor/plugins/path_editor_plugin.h +++ b/editor/plugins/path_editor_plugin.h @@ -62,6 +62,7 @@ protected: public: String get_name() const; + int get_priority() const; PathSpatialGizmoPlugin(); }; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index ed11d26f25..776110b3b2 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4117,10 +4117,10 @@ Dictionary SpatialEditor::get_state() const { d["zfar"] = get_zfar(); Dictionary gizmos_status; - for (int i = 0; i < gizmo_plugins.size(); i++) { - if (!gizmo_plugins[i]->can_be_hidden()) continue; + for (int i = 0; i < gizmo_plugins_by_name.size(); i++) { + if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; int state = gizmos_menu->get_item_state(gizmos_menu->get_item_index(i)); - String name = gizmo_plugins[i]->get_name(); + String name = gizmo_plugins_by_name[i]->get_name(); gizmos_status[name] = state; } @@ -4205,32 +4205,19 @@ void SpatialEditor::set_state(const Dictionary &p_state) { List<Variant> keys; gizmos_status.get_key_list(&keys); - for (int j = 0; j < gizmo_plugins.size(); ++j) { - if (!gizmo_plugins[j]->can_be_hidden()) continue; - int state = EditorSpatialGizmoPlugin::ON_TOP; + for (int j = 0; j < gizmo_plugins_by_name.size(); ++j) { + if (!gizmo_plugins_by_name[j]->can_be_hidden()) continue; + int state = EditorSpatialGizmoPlugin::VISIBLE; for (int i = 0; i < keys.size(); i++) { - if (gizmo_plugins.write[j]->get_name() == keys[i]) { + if (gizmo_plugins_by_name.write[j]->get_name() == keys[i]) { state = gizmos_status[keys[i]]; + break; } } - const int idx = gizmos_menu->get_item_index(j); - - gizmos_menu->set_item_multistate(idx, state); - gizmo_plugins.write[j]->set_state(state); - - switch (state) { - case EditorSpatialGizmoPlugin::VISIBLE: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_visible")); - break; - case EditorSpatialGizmoPlugin::ON_TOP: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_xray")); - break; - case EditorSpatialGizmoPlugin::HIDDEN: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_hidden")); - break; - } + gizmo_plugins_by_name.write[j]->set_state(state); } + _update_gizmos_menu(); } } @@ -4344,7 +4331,7 @@ void SpatialEditor::_menu_gizmo_toggled(int p_option) { break; } - gizmo_plugins.write[p_option]->set_state(state); + gizmo_plugins_by_name.write[p_option]->set_state(state); update_all_gizmos(); } @@ -4840,30 +4827,46 @@ void SpatialEditor::_init_indicators() { _generate_selection_box(); } -struct _GizmoPluginComparator { - - bool operator()(const Ref<EditorSpatialGizmoPlugin> &p_a, const Ref<EditorSpatialGizmoPlugin> &p_b) const { - return p_a->get_name() < p_b->get_name(); - } -}; - void SpatialEditor::_update_gizmos_menu() { gizmos_menu->clear(); - gizmo_plugins.sort_custom<_GizmoPluginComparator>(); - for (int i = 0; i < gizmo_plugins.size(); ++i) { - if (!gizmo_plugins[i]->can_be_hidden()) continue; - String plugin_name = gizmo_plugins[i]->get_name(); - gizmos_menu->add_multistate_item(TTR(plugin_name), 3, EditorSpatialGizmoPlugin::VISIBLE, i); - gizmos_menu->set_item_icon(gizmos_menu->get_item_index(i), gizmos_menu->get_icon("visibility_visible")); + for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) { + if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; + String plugin_name = gizmo_plugins_by_name[i]->get_name(); + const int plugin_state = gizmo_plugins_by_name[i]->get_state(); + gizmos_menu->add_multistate_item(TTR(plugin_name), 3, plugin_state, i); + const int idx = gizmos_menu->get_item_index(i); + switch (plugin_state) { + case EditorSpatialGizmoPlugin::VISIBLE: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_visible")); + break; + case EditorSpatialGizmoPlugin::ON_TOP: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_xray")); + break; + case EditorSpatialGizmoPlugin::HIDDEN: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_hidden")); + break; + } } } void SpatialEditor::_update_gizmos_menu_theme() { - for (int i = 0; i < gizmo_plugins.size(); ++i) { - if (!gizmo_plugins[i]->can_be_hidden()) continue; - gizmos_menu->set_item_icon(gizmos_menu->get_item_index(i), gizmos_menu->get_icon("visibility_visible")); + for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) { + if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; + const int plugin_state = gizmo_plugins_by_name[i]->get_state(); + const int idx = gizmos_menu->get_item_index(i); + switch (plugin_state) { + case EditorSpatialGizmoPlugin::VISIBLE: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_visible")); + break; + case EditorSpatialGizmoPlugin::ON_TOP: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_xray")); + break; + case EditorSpatialGizmoPlugin::HIDDEN: + gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_hidden")); + break; + } } } @@ -5225,8 +5228,8 @@ void SpatialEditor::_request_gizmo(Object *p_obj) { Ref<EditorSpatialGizmo> seg; - for (int i = 0; i < gizmo_plugins.size(); ++i) { - seg = gizmo_plugins.write[i]->get_gizmo(sp); + for (int i = 0; i < gizmo_plugins_by_priority.size(); ++i) { + seg = gizmo_plugins_by_priority.write[i]->get_gizmo(sp); if (seg.is_valid()) { sp->set_gizmo(seg); @@ -5751,15 +5754,39 @@ void SpatialEditorPlugin::snap_cursor_to_plane(const Plane &p_plane) { spatial_editor->snap_cursor_to_plane(p_plane); } +struct _GizmoPluginPriorityComparator { + + bool operator()(const Ref<EditorSpatialGizmoPlugin> &p_a, const Ref<EditorSpatialGizmoPlugin> &p_b) const { + if (p_a->get_priority() == p_b->get_priority()) { + return p_a->get_name() < p_b->get_name(); + } + return p_a->get_priority() > p_b->get_priority(); + } +}; + +struct _GizmoPluginNameComparator { + + bool operator()(const Ref<EditorSpatialGizmoPlugin> &p_a, const Ref<EditorSpatialGizmoPlugin> &p_b) const { + return p_a->get_name() < p_b->get_name(); + } +}; + void SpatialEditor::add_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> p_plugin) { ERR_FAIL_NULL(p_plugin.ptr()); - gizmo_plugins.push_back(p_plugin); + + gizmo_plugins_by_priority.push_back(p_plugin); + gizmo_plugins_by_priority.sort_custom<_GizmoPluginPriorityComparator>(); + + gizmo_plugins_by_name.push_back(p_plugin); + gizmo_plugins_by_name.sort_custom<_GizmoPluginNameComparator>(); + _update_gizmos_menu(); SpatialEditor::get_singleton()->update_all_gizmos(); } void SpatialEditor::remove_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> p_plugin) { - gizmo_plugins.erase(p_plugin); + gizmo_plugins_by_priority.erase(p_plugin); + gizmo_plugins_by_name.erase(p_plugin); _update_gizmos_menu(); } @@ -5912,6 +5939,13 @@ String EditorSpatialGizmoPlugin::get_name() const { return TTR("Nameless gizmo"); } +int EditorSpatialGizmoPlugin::get_priority() const { + if (get_script_instance() && get_script_instance()->has_method("get_priority")) { + return get_script_instance()->call("get_priority"); + } + return 0; +} + Ref<EditorSpatialGizmo> EditorSpatialGizmoPlugin::get_gizmo(Spatial *p_spatial) { if (get_script_instance() && get_script_instance()->has_method("get_gizmo")) { @@ -5944,6 +5978,7 @@ void EditorSpatialGizmoPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("get_material", "name", "gizmo"), &EditorSpatialGizmoPlugin::get_material); //, DEFVAL(Ref<EditorSpatialGizmo>())); BIND_VMETHOD(MethodInfo(Variant::STRING, "get_name")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "get_priority")); BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_be_hidden")); BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_selectable_when_hidden")); @@ -6043,6 +6078,10 @@ void EditorSpatialGizmoPlugin::set_state(int p_state) { } } +int EditorSpatialGizmoPlugin::get_state() const { + return current_state; +} + void EditorSpatialGizmoPlugin::unregister_gizmo(EditorSpatialGizmo *p_gizmo) { current_gizmos.erase(p_gizmo); } diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 6256b8b055..4a9d34a7f7 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -639,7 +639,8 @@ private: static SpatialEditor *singleton; void _node_removed(Node *p_node); - Vector<Ref<EditorSpatialGizmoPlugin> > gizmo_plugins; + Vector<Ref<EditorSpatialGizmoPlugin> > gizmo_plugins_by_priority; + Vector<Ref<EditorSpatialGizmoPlugin> > gizmo_plugins_by_name; void _register_all_gizmos(); @@ -782,6 +783,7 @@ public: Ref<SpatialMaterial> get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo = Ref<EditorSpatialGizmo>()); virtual String get_name() const; + virtual int get_priority() const; virtual bool can_be_hidden() const; virtual bool is_selectable_when_hidden() const; @@ -794,6 +796,7 @@ public: Ref<EditorSpatialGizmo> get_gizmo(Spatial *p_spatial); void set_state(int p_state); + int get_state() const; void unregister_gizmo(EditorSpatialGizmo *p_gizmo); EditorSpatialGizmoPlugin(); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 0a8e7ea779..2e06a903aa 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -805,6 +805,10 @@ String LightSpatialGizmoPlugin::get_name() const { return "Lights"; } +int LightSpatialGizmoPlugin::get_priority() const { + return -1; +} + String LightSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { if (p_idx == 0) @@ -1062,6 +1066,10 @@ String AudioStreamPlayer3DSpatialGizmoPlugin::get_name() const { return "AudioStreamPlayer3D"; } +int AudioStreamPlayer3DSpatialGizmoPlugin::get_priority() const { + return -1; +} + String AudioStreamPlayer3DSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { return "Emission Radius"; @@ -1202,6 +1210,10 @@ String CameraSpatialGizmoPlugin::get_name() const { return "Camera"; } +int CameraSpatialGizmoPlugin::get_priority() const { + return -1; +} + String CameraSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { Camera *camera = Object::cast_to<Camera>(p_gizmo->get_spatial_node()); @@ -1425,6 +1437,10 @@ String MeshInstanceSpatialGizmoPlugin::get_name() const { return "MeshInstance"; } +int MeshInstanceSpatialGizmoPlugin::get_priority() const { + return -1; +} + bool MeshInstanceSpatialGizmoPlugin::can_be_hidden() const { return false; } @@ -1458,6 +1474,10 @@ String Sprite3DSpatialGizmoPlugin::get_name() const { return "Sprite3D"; } +int Sprite3DSpatialGizmoPlugin::get_priority() const { + return -1; +} + bool Sprite3DSpatialGizmoPlugin::can_be_hidden() const { return false; } @@ -1517,6 +1537,10 @@ String Position3DSpatialGizmoPlugin::get_name() const { return "Position3D"; } +int Position3DSpatialGizmoPlugin::get_priority() const { + return -1; +} + void Position3DSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->clear(); @@ -1540,6 +1564,10 @@ String SkeletonSpatialGizmoPlugin::get_name() const { return "Skeleton"; } +int SkeletonSpatialGizmoPlugin::get_priority() const { + return -1; +} + void SkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Skeleton *skel = Object::cast_to<Skeleton>(p_gizmo->get_spatial_node()); @@ -1743,6 +1771,10 @@ String PhysicalBoneSpatialGizmoPlugin::get_name() const { return "PhysicalBones"; } +int PhysicalBoneSpatialGizmoPlugin::get_priority() const { + return -1; +} + void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->clear(); @@ -1982,6 +2014,10 @@ String RayCastSpatialGizmoPlugin::get_name() const { return "RayCast"; } +int RayCastSpatialGizmoPlugin::get_priority() const { + return -1; +} + void RayCastSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { RayCast *raycast = Object::cast_to<RayCast>(p_gizmo->get_spatial_node()); @@ -2031,6 +2067,10 @@ String SpringArmSpatialGizmoPlugin::get_name() const { return "SpringArm"; } +int SpringArmSpatialGizmoPlugin::get_priority() const { + return -1; +} + ///// VehicleWheelSpatialGizmoPlugin::VehicleWheelSpatialGizmoPlugin() { @@ -2047,6 +2087,10 @@ String VehicleWheelSpatialGizmoPlugin::get_name() const { return "VehicleWheel"; } +int VehicleWheelSpatialGizmoPlugin::get_priority() const { + return -1; +} + void VehicleWheelSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { VehicleWheel *car_wheel = Object::cast_to<VehicleWheel>(p_gizmo->get_spatial_node()); @@ -2117,6 +2161,10 @@ String SoftBodySpatialGizmoPlugin::get_name() const { return "SoftBody"; } +int SoftBodySpatialGizmoPlugin::get_priority() const { + return -1; +} + bool SoftBodySpatialGizmoPlugin::is_selectable_when_hidden() const { return true; } @@ -2189,6 +2237,10 @@ String VisibilityNotifierGizmoPlugin::get_name() const { return "VisibilityNotifier"; } +int VisibilityNotifierGizmoPlugin::get_priority() const { + return -1; +} + String VisibilityNotifierGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { switch (p_idx) { @@ -2339,6 +2391,10 @@ String ParticlesGizmoPlugin::get_name() const { return "Particles"; } +int ParticlesGizmoPlugin::get_priority() const { + return -1; +} + bool ParticlesGizmoPlugin::is_selectable_when_hidden() const { return true; } @@ -2498,6 +2554,10 @@ String ReflectionProbeGizmoPlugin::get_name() const { return "ReflectionProbe"; } +int ReflectionProbeGizmoPlugin::get_priority() const { + return -1; +} + String ReflectionProbeGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { switch (p_idx) { @@ -2674,6 +2734,10 @@ String GIProbeGizmoPlugin::get_name() const { return "GIProbe"; } +int GIProbeGizmoPlugin::get_priority() const { + return -1; +} + String GIProbeGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { switch (p_idx) { @@ -2908,6 +2972,10 @@ String BakedIndirectLightGizmoPlugin::get_name() const { return "BakedLightmap"; } +int BakedIndirectLightGizmoPlugin::get_priority() const { + return -1; +} + void BakedIndirectLightGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { BakedLightmap *baker = Object::cast_to<BakedLightmap>(p_gizmo->get_spatial_node()); @@ -2965,6 +3033,10 @@ String CollisionShapeSpatialGizmoPlugin::get_name() const { return "CollisionShape"; } +int CollisionShapeSpatialGizmoPlugin::get_priority() const { + return -1; +} + String CollisionShapeSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { const CollisionShape *cs = Object::cast_to<CollisionShape>(p_gizmo->get_spatial_node()); @@ -3557,6 +3629,10 @@ String CollisionPolygonSpatialGizmoPlugin::get_name() const { return "CollisionPolygon"; } +int CollisionPolygonSpatialGizmoPlugin::get_priority() const { + return -1; +} + void CollisionPolygonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { CollisionPolygon *polygon = Object::cast_to<CollisionPolygon>(p_gizmo->get_spatial_node()); @@ -3601,6 +3677,10 @@ String NavigationMeshSpatialGizmoPlugin::get_name() const { return "NavigationMeshInstance"; } +int NavigationMeshSpatialGizmoPlugin::get_priority() const { + return -1; +} + void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { NavigationMeshInstance *navmesh = Object::cast_to<NavigationMeshInstance>(p_gizmo->get_spatial_node()); @@ -3961,6 +4041,10 @@ String JointSpatialGizmoPlugin::get_name() const { return "Joints"; } +int JointSpatialGizmoPlugin::get_priority() const { + return -1; +} + void JointSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Joint *joint = Object::cast_to<Joint>(p_gizmo->get_spatial_node()); diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index 0d89fb0f03..3661df4bad 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -43,6 +43,7 @@ class LightSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -60,6 +61,7 @@ class AudioStreamPlayer3DSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -77,6 +79,7 @@ class CameraSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -94,6 +97,7 @@ class MeshInstanceSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; bool can_be_hidden() const; void redraw(EditorSpatialGizmo *p_gizmo); @@ -107,6 +111,7 @@ class Sprite3DSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; bool can_be_hidden() const; void redraw(EditorSpatialGizmo *p_gizmo); @@ -123,6 +128,7 @@ class Position3DSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); Position3DSpatialGizmoPlugin(); @@ -135,6 +141,7 @@ class SkeletonSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); SkeletonSpatialGizmoPlugin(); @@ -147,6 +154,7 @@ class PhysicalBoneSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); PhysicalBoneSpatialGizmoPlugin(); @@ -172,6 +180,7 @@ class RayCastSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); RayCastSpatialGizmoPlugin(); @@ -184,6 +193,7 @@ class SpringArmSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); SpringArmSpatialGizmoPlugin(); @@ -196,6 +206,7 @@ class VehicleWheelSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); VehicleWheelSpatialGizmoPlugin(); @@ -208,6 +219,7 @@ class SoftBodySpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; bool is_selectable_when_hidden() const; void redraw(EditorSpatialGizmo *p_gizmo); @@ -226,6 +238,7 @@ class VisibilityNotifierGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -243,6 +256,7 @@ class ParticlesGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; bool is_selectable_when_hidden() const; void redraw(EditorSpatialGizmo *p_gizmo); @@ -261,6 +275,7 @@ class ReflectionProbeGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -278,6 +293,7 @@ class GIProbeGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -295,6 +311,7 @@ class BakedIndirectLightGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -312,6 +329,7 @@ class CollisionShapeSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; @@ -328,6 +346,7 @@ class CollisionPolygonSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); CollisionPolygonSpatialGizmoPlugin(); }; @@ -347,6 +366,7 @@ class NavigationMeshSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); NavigationMeshSpatialGizmoPlugin(); @@ -374,6 +394,7 @@ class JointSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); static void CreatePinJointGizmo(const Transform &p_offset, Vector<Vector3> &r_cursor_points); diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 3044887ef5..d4069b901f 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -283,6 +283,10 @@ String CSGShapeSpatialGizmoPlugin::get_name() const { return "CSGShapes"; } +int CSGShapeSpatialGizmoPlugin::get_priority() const { + return -1; +} + bool CSGShapeSpatialGizmoPlugin::is_selectable_when_hidden() const { return true; } diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h index b208c39938..0915d05111 100644 --- a/modules/csg/csg_gizmos.h +++ b/modules/csg/csg_gizmos.h @@ -42,6 +42,7 @@ class CSGShapeSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { public: bool has_gizmo(Spatial *p_spatial); String get_name() const; + int get_priority() const; bool is_selectable_when_hidden() const; void redraw(EditorSpatialGizmo *p_gizmo); |