Skip to content

Commit

Permalink
Merge pull request #98132 from aaronfranke/editor-plugin-get-plugin-i…
Browse files Browse the repository at this point in the history
…con-name

Rename internal EditorPlugin icon/name to match exposed methods
  • Loading branch information
Repiteo committed Dec 16, 2024
2 parents 4d4c229 + 0ab3dc2 commit 02e196e
Show file tree
Hide file tree
Showing 67 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion editor/editor_audio_buses.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class AudioBusesEditorPlugin : public EditorPlugin {
EditorAudioBuses *audio_bus_editor = nullptr;

public:
virtual String get_name() const override { return "SampleLibrary"; }
virtual String get_plugin_name() const override { return "SampleLibrary"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_node) override;
virtual bool handles(Object *p_node) const override;
Expand Down
6 changes: 3 additions & 3 deletions editor/editor_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Vector<EditorPlugin *> EditorData::get_handling_sub_editors(Object *p_object) {

EditorPlugin *EditorData::get_editor_by_name(const String &p_name) {
for (int i = editor_plugins.size() - 1; i > -1; i--) {
if (editor_plugins[i]->get_name() == p_name) {
if (editor_plugins[i]->get_plugin_name() == p_name) {
return editor_plugins[i];
}
}
Expand Down Expand Up @@ -320,7 +320,7 @@ Dictionary EditorData::get_editor_plugin_states() const {
if (state.is_empty()) {
continue;
}
metadata[editor_plugins[i]->get_name()] = state;
metadata[editor_plugins[i]->get_plugin_name()] = state;
}

return metadata;
Expand Down Expand Up @@ -348,7 +348,7 @@ void EditorData::set_editor_plugin_states(const Dictionary &p_states) {
String name = E->get();
int idx = -1;
for (int i = 0; i < editor_plugins.size(); i++) {
if (editor_plugins[i]->get_name() == name) {
if (editor_plugins[i]->get_plugin_name() == name) {
idx = i;
break;
}
Expand Down
20 changes: 10 additions & 10 deletions editor/editor_main_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ void EditorMainScreen::_notification(int p_what) {
for (int i = 0; i < buttons.size(); i++) {
Button *tb = buttons[i];
EditorPlugin *p_editor = editor_table[i];
Ref<Texture2D> icon = p_editor->get_icon();
Ref<Texture2D> icon = p_editor->get_plugin_icon();

if (icon.is_valid()) {
tb->set_button_icon(icon);
} else if (has_theme_icon(p_editor->get_name(), EditorStringName(EditorIcons))) {
tb->set_button_icon(get_theme_icon(p_editor->get_name(), EditorStringName(EditorIcons)));
} else if (has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) {
tb->set_button_icon(get_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons)));
}
}
} break;
Expand Down Expand Up @@ -198,7 +198,7 @@ void EditorMainScreen::select(int p_index) {
EditorData &editor_data = EditorNode::get_editor_data();
int plugin_count = editor_data.get_editor_plugin_count();
for (int i = 0; i < plugin_count; i++) {
editor_data.get_editor_plugin(i)->notify_main_screen_changed(selected_plugin->get_name());
editor_data.get_editor_plugin(i)->notify_main_screen_changed(selected_plugin->get_plugin_name());
}

EditorNode::get_singleton()->update_distraction_free_mode();
Expand Down Expand Up @@ -236,12 +236,12 @@ void EditorMainScreen::add_main_plugin(EditorPlugin *p_editor) {
Button *tb = memnew(Button);
tb->set_toggle_mode(true);
tb->set_theme_type_variation("MainScreenButton");
tb->set_name(p_editor->get_name());
tb->set_text(p_editor->get_name());
tb->set_name(p_editor->get_plugin_name());
tb->set_text(p_editor->get_plugin_name());

Ref<Texture2D> icon = p_editor->get_icon();
if (icon.is_null() && has_theme_icon(p_editor->get_name(), EditorStringName(EditorIcons))) {
icon = get_editor_theme_icon(p_editor->get_name());
Ref<Texture2D> icon = p_editor->get_plugin_icon();
if (icon.is_null() && has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) {
icon = get_editor_theme_icon(p_editor->get_plugin_name());
}
if (icon.is_valid()) {
tb->set_button_icon(icon);
Expand All @@ -260,7 +260,7 @@ void EditorMainScreen::remove_main_plugin(EditorPlugin *p_editor) {
// Remove the main editor button and update the bindings of
// all buttons behind it to point to the correct main window.
for (int i = buttons.size() - 1; i >= 0; i--) {
if (p_editor->get_name() == buttons[i]->get_text()) {
if (p_editor->get_plugin_name() == buttons[i]->get_text()) {
if (buttons[i]->is_pressed()) {
select(EDITOR_SCRIPT);
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2629,7 +2629,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
if (main_plugin && !skip_main_plugin) {
// Special case if use of external editor is true.
Resource *current_res = Object::cast_to<Resource>(current_obj);
if (main_plugin->get_name() == "Script" && current_res && !current_res->is_built_in() && (bool(EDITOR_GET("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
if (main_plugin->get_plugin_name() == "Script" && current_res && !current_res->is_built_in() && (bool(EDITOR_GET("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
if (!changing_scene) {
main_plugin->edit(current_obj);
}
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/abstract_polygon_2d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class AbstractPolygon2DEditorPlugin : public EditorPlugin {
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { polygon_editor->forward_canvas_draw_over_viewport(p_overlay); }

bool has_main_screen() const override { return false; }
virtual String get_name() const override { return klass; }
virtual String get_plugin_name() const override { return klass; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
Expand Down
6 changes: 3 additions & 3 deletions editor/plugins/animation_player_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class AnimationPlayerEditorPlugin : public EditorPlugin {
virtual Dictionary get_state() const override { return anim_editor->get_state(); }
virtual void set_state(const Dictionary &p_state) override { anim_editor->set_state(p_state); }

virtual String get_name() const override { return "Anim"; }
virtual String get_plugin_name() const override { return "Anim"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down Expand Up @@ -333,7 +333,7 @@ class AnimationTrackKeyEditEditorPlugin : public EditorPlugin {
bool has_main_screen() const override { return false; }
virtual bool handles(Object *p_object) const override;

virtual String get_name() const override { return "AnimationTrackKeyEdit"; }
virtual String get_plugin_name() const override { return "AnimationTrackKeyEdit"; }

AnimationTrackKeyEditEditorPlugin();
};
Expand All @@ -359,7 +359,7 @@ class AnimationMarkerKeyEditEditorPlugin : public EditorPlugin {
bool has_main_screen() const override { return false; }
virtual bool handles(Object *p_object) const override;

virtual String get_name() const override { return "AnimationMarkerKeyEdit"; }
virtual String get_plugin_name() const override { return "AnimationMarkerKeyEdit"; }

AnimationMarkerKeyEditEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_tree_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class AnimationTreeEditorPlugin : public EditorPlugin {
Button *button = nullptr;

public:
virtual String get_name() const override { return "AnimationTree"; }
virtual String get_plugin_name() const override { return "AnimationTree"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/asset_library_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class AssetLibraryEditorPlugin : public EditorPlugin {
public:
static bool is_available();

virtual String get_name() const override { return "AssetLib"; }
virtual String get_plugin_name() const override { return "AssetLib"; }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override {}
virtual bool handles(Object *p_object) const override { return false; }
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/audio_stream_randomizer_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AudioStreamRandomizerEditorPlugin : public EditorPlugin {
void _move_stream_array_element(Object *p_undo_redo, Object *p_edited, const String &p_array_prefix, int p_from_index, int p_to_pos);

public:
virtual String get_name() const override { return "AudioStreamRandomizer"; }
virtual String get_plugin_name() const override { return "AudioStreamRandomizer"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/bone_map_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class BoneMapEditorPlugin : public EditorPlugin {
GDCLASS(BoneMapEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "BoneMap"; }
virtual String get_plugin_name() const override { return "BoneMap"; }
BoneMapEditorPlugin();
};

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/camera_3d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Camera3DEditorPlugin : public EditorPlugin {
GDCLASS(Camera3DEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "Camera3D"; }
virtual String get_plugin_name() const override { return "Camera3D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/canvas_item_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ class CanvasItemEditorPlugin : public EditorPlugin {
void _notification(int p_what);

public:
virtual String get_name() const override { return "2D"; }
virtual String get_plugin_name() const override { return "2D"; }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/cast_2d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Cast2DEditorPlugin : public EditorPlugin {
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override { return cast_2d_editor->forward_canvas_gui_input(p_event); }
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { cast_2d_editor->forward_canvas_draw_over_viewport(p_overlay); }

virtual String get_name() const override { return "Cast2D"; }
virtual String get_plugin_name() const override { return "Cast2D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/collision_shape_2d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin {
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override { return collision_shape_2d_editor->forward_canvas_gui_input(p_event); }
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { collision_shape_2d_editor->forward_canvas_draw_over_viewport(p_overlay); }

virtual String get_name() const override { return "CollisionShape2D"; }
virtual String get_plugin_name() const override { return "CollisionShape2D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_obj) override;
virtual bool handles(Object *p_obj) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/control_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class ControlEditorPlugin : public EditorPlugin {
ControlEditorToolbar *toolbar = nullptr;

public:
virtual String get_name() const override { return "Control"; }
virtual String get_plugin_name() const override { return "Control"; }

ControlEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/curve_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class CurveEditorPlugin : public EditorPlugin {
public:
CurveEditorPlugin();

virtual String get_name() const override { return "Curve"; }
virtual String get_plugin_name() const override { return "Curve"; }
};

class CurvePreviewGenerator : public EditorResourcePreviewGenerator {
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/debugger_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DebuggerEditorPlugin : public EditorPlugin {
void _menu_option(int p_option);

public:
virtual String get_name() const override { return "Debugger"; }
virtual String get_plugin_name() const override { return "Debugger"; }
bool has_main_screen() const override { return false; }

DebuggerEditorPlugin(PopupMenu *p_menu);
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ void EditorPlugin::forward_3d_force_draw_over_viewport(Control *p_overlay) {
GDVIRTUAL_CALL(_forward_3d_force_draw_over_viewport, p_overlay);
}

String EditorPlugin::get_name() const {
String EditorPlugin::get_plugin_name() const {
String name;
GDVIRTUAL_CALL(_get_plugin_name, name);
return name;
}

const Ref<Texture2D> EditorPlugin::get_icon() const {
const Ref<Texture2D> EditorPlugin::get_plugin_icon() const {
Ref<Texture2D> icon;
GDVIRTUAL_CALL(_get_plugin_icon, icon);
return icon;
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ class EditorPlugin : public Node {
virtual void forward_3d_draw_over_viewport(Control *p_overlay);
virtual void forward_3d_force_draw_over_viewport(Control *p_overlay);

virtual String get_name() const;
virtual const Ref<Texture2D> get_icon() const;
virtual String get_plugin_name() const;
virtual const Ref<Texture2D> get_plugin_icon() const;
virtual String get_plugin_version() const;
virtual void set_plugin_version(const String &p_version);
virtual bool has_main_screen() const;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/font_config_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class FontEditorPlugin : public EditorPlugin {
public:
FontEditorPlugin();

virtual String get_name() const override { return "Font"; }
virtual String get_plugin_name() const override { return "Font"; }
};

#endif // FONT_CONFIG_PLUGIN_H
2 changes: 1 addition & 1 deletion editor/plugins/game_view_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class GameViewPlugin : public EditorPlugin {
void _notification(int p_what);

public:
virtual String get_name() const override { return "Game"; }
virtual String get_plugin_name() const override { return "Game"; }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override {}
virtual bool handles(Object *p_object) const override { return false; }
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GPUParticlesCollisionSDF3DEditorPlugin : public EditorPlugin {
void _notification(int p_what);

public:
virtual String get_name() const override { return "GPUParticlesCollisionSDF3D"; }
virtual String get_plugin_name() const override { return "GPUParticlesCollisionSDF3D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/gradient_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class GradientEditorPlugin : public EditorPlugin {
GDCLASS(GradientEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "Gradient"; }
virtual String get_plugin_name() const override { return "Gradient"; }

GradientEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/input_event_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class InputEventEditorPlugin : public EditorPlugin {
GDCLASS(InputEventEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "InputEvent"; }
virtual String get_plugin_name() const override { return "InputEvent"; }

InputEventEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/lightmap_gi_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LightmapGIEditorPlugin : public EditorPlugin {
static void _bind_methods();

public:
virtual String get_name() const override { return "LightmapGI"; }
virtual String get_plugin_name() const override { return "LightmapGI"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/material_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class MaterialEditorPlugin : public EditorPlugin {
GDCLASS(MaterialEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "Material"; }
virtual String get_plugin_name() const override { return "Material"; }

MaterialEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/mesh_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class MeshEditorPlugin : public EditorPlugin {
GDCLASS(MeshEditorPlugin, EditorPlugin);

public:
virtual String get_name() const override { return "Mesh"; }
virtual String get_plugin_name() const override { return "Mesh"; }

MeshEditorPlugin();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/mesh_instance_3d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class MeshInstance3DEditorPlugin : public EditorPlugin {
MeshInstance3DEditor *mesh_editor = nullptr;

public:
virtual String get_name() const override { return "MeshInstance3D"; }
virtual String get_plugin_name() const override { return "MeshInstance3D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/mesh_library_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MeshLibraryEditorPlugin : public EditorPlugin {
MeshLibraryEditor *mesh_library_editor = nullptr;

public:
virtual String get_name() const override { return "MeshLibrary"; }
virtual String get_plugin_name() const override { return "MeshLibrary"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_node) override;
virtual bool handles(Object *p_node) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/multimesh_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MultiMeshEditorPlugin : public EditorPlugin {
MultiMeshEditor *multimesh_editor = nullptr;

public:
virtual String get_name() const override { return "MultiMesh"; }
virtual String get_plugin_name() const override { return "MultiMesh"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/navigation_link_2d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class NavigationLink2DEditorPlugin : public EditorPlugin {
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override { return editor->forward_canvas_gui_input(p_event); }
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { editor->forward_canvas_draw_over_viewport(p_overlay); }

virtual String get_name() const override { return "NavigationLink2D"; }
virtual String get_plugin_name() const override { return "NavigationLink2D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/navigation_obstacle_3d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class NavigationObstacle3DEditorPlugin : public EditorPlugin {

virtual EditorPlugin::AfterGUIInput forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) override;

virtual String get_name() const override { return "NavigationObstacle3D"; }
virtual String get_plugin_name() const override { return "NavigationObstacle3DEditor"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/node_3d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ class Node3DEditorPlugin : public EditorPlugin {

public:
Node3DEditor *get_spatial_editor() { return spatial_editor; }
virtual String get_name() const override { return "3D"; }
virtual String get_plugin_name() const override { return "3D"; }
bool has_main_screen() const override { return true; }
virtual void make_visible(bool p_visible) override;
virtual void edit(Object *p_object) override;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/occluder_instance_3d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class OccluderInstance3DEditorPlugin : public EditorPlugin {
static void _bind_methods();

public:
virtual String get_name() const override { return "OccluderInstance3D"; }
virtual String get_plugin_name() const override { return "OccluderInstance3D"; }
bool has_main_screen() const override { return false; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
Expand Down
Loading

0 comments on commit 02e196e

Please sign in to comment.