summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRedMser <redmser.jj2@gmail.com>2022-09-29 15:38:55 +0200
committerYuri Sizov <yuris@humnom.net>2023-04-18 14:02:04 +0200
commit2330ffb5a15b64f540a03bec6615aeadeb62ff3b (patch)
treeed18a3ba9508a8049c12a0f6b0f29f062982046e
parent3db40355a0232bd8f22faa64f09a8b3c122106ff (diff)
downloadredot-engine-2330ffb5a15b64f540a03bec6615aeadeb62ff3b.tar.gz
Add GDScript template to RichTextEffect
-rw-r--r--modules/gdscript/editor/script_templates/RichTextEffect/default.gd17
-rw-r--r--modules/gdscript/gdscript_editor.cpp2
2 files changed, 19 insertions, 0 deletions
diff --git a/modules/gdscript/editor/script_templates/RichTextEffect/default.gd b/modules/gdscript/editor/script_templates/RichTextEffect/default.gd
new file mode 100644
index 0000000000..c79eeb91ec
--- /dev/null
+++ b/modules/gdscript/editor/script_templates/RichTextEffect/default.gd
@@ -0,0 +1,17 @@
+# meta-description: Base template for rich text effects
+
+@tool
+class_name _CLASS_
+extends _BASE_
+
+
+# To use this effect:
+# - Enable BBCode on a RichTextLabel.
+# - Register this effect on the label.
+# - Use [_CLASS_ param=2.0]hello[/_CLASS_] in text.
+var bbcode := "_CLASS_"
+
+
+func _process_custom_fx(char_fx: CharFXTransform) -> bool:
+ var param: float = char_fx.env.get("param", 1.0)
+ return true
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 6c03d56f4a..ccdc42f71c 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -73,9 +73,11 @@ Ref<Script> GDScriptLanguage::make_template(const String &p_template, const Stri
.replace(": String", "")
.replace(": Array[String]", "")
.replace(": float", "")
+ .replace(": CharFXTransform", "")
.replace(":=", "=")
.replace(" -> String", "")
.replace(" -> int", "")
+ .replace(" -> bool", "")
.replace(" -> void", "");
}