summaryrefslogtreecommitdiffstats
path: root/editor/plugins/ot_features_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-04-25 15:51:31 +0200
committerGitHub <noreply@github.com>2022-04-25 15:51:31 +0200
commit63a052d96b9bb924f20c816c0ddeac8111bab5c6 (patch)
treeccc5df2302bba60afde6151fef538aeea8b2159e /editor/plugins/ot_features_plugin.cpp
parent5e599d7c22b01fce5c344e9022cfed03f7e180a5 (diff)
parentbe611c1c0592d4aaa9c58f227a9c33301acd544b (diff)
downloadredot-engine-63a052d96b9bb924f20c816c0ddeac8111bab5c6.tar.gz
Merge pull request #60386 from bruvzg/label3d
Diffstat (limited to 'editor/plugins/ot_features_plugin.cpp')
-rw-r--r--editor/plugins/ot_features_plugin.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/editor/plugins/ot_features_plugin.cpp b/editor/plugins/ot_features_plugin.cpp
index 936eb747b0..ffa74173be 100644
--- a/editor/plugins/ot_features_plugin.cpp
+++ b/editor/plugins/ot_features_plugin.cpp
@@ -30,6 +30,8 @@
#include "ot_features_plugin.h"
+#include "scene/3d/label_3d.h"
+
void OpenTypeFeaturesEditor::_value_changed(double val) {
if (setting) {
return;
@@ -116,7 +118,25 @@ void OpenTypeFeaturesAdd::setup(Object *p_object) {
bool have_ss = false;
bool have_cv = false;
bool have_cu = false;
- Dictionary features = Object::cast_to<Control>(edited_object)->get_theme_font(SNAME("font"))->get_feature_list();
+
+ Ref<Font> font;
+
+ Control *ctrl = Object::cast_to<Control>(edited_object);
+ if (ctrl != nullptr) {
+ font = ctrl->get_theme_font(SNAME("font"));
+ } else {
+ Label3D *l3d = Object::cast_to<Label3D>(edited_object);
+ if (l3d != nullptr) {
+ font = l3d->_get_font_or_default();
+ }
+ }
+
+ if (font.is_null()) {
+ return;
+ }
+
+ Dictionary features = font->get_feature_list();
+
for (const Variant *ftr = features.next(nullptr); ftr != nullptr; ftr = features.next(ftr)) {
String ftr_name = TS->tag_to_name(*ftr);
if (ftr_name.begins_with("stylistic_set_")) {
@@ -185,7 +205,7 @@ OpenTypeFeaturesAdd::OpenTypeFeaturesAdd() {
/*************************************************************************/
bool EditorInspectorPluginOpenTypeFeatures::can_handle(Object *p_object) {
- return (Object::cast_to<Control>(p_object) != nullptr);
+ return (Object::cast_to<Control>(p_object) != nullptr) || (Object::cast_to<Label3D>(p_object) != nullptr);
}
bool EditorInspectorPluginOpenTypeFeatures::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {