Print a warning if a 3D editor gizmo has no name defined

Unnamed gizmos should be avoided, so this should help editor plugin
authors resolve issues with gizmo naming if they forgot to override
the function.

(cherry picked from commit e5406ba952)
This commit is contained in:
Hugo Locurcio 2021-09-17 00:26:51 +02:00 committed by Rémi Verschelde
parent e902ee06ef
commit da68feb0ca
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -6947,7 +6947,8 @@ String EditorSpatialGizmoPlugin::get_name() const {
if (get_script_instance() && get_script_instance()->has_method("get_name")) { if (get_script_instance() && get_script_instance()->has_method("get_name")) {
return get_script_instance()->call("get_name"); return get_script_instance()->call("get_name");
} }
return TTR("Nameless gizmo"); WARN_PRINT_ONCE("A 3D editor gizmo has no name defined (it will appear as \"Unnamed Gizmo\" in the \"View > Gizmos\" menu). To resolve this, override the `get_name()` function to return a String in the script that extends EditorSpatialGizmoPlugin.");
return TTR("Unnamed Gizmo");
} }
int EditorSpatialGizmoPlugin::get_priority() const { int EditorSpatialGizmoPlugin::get_priority() const {