Skip to content

Commit

Permalink
Add GDScript template to RichTextEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMser authored and YuriSizov committed Apr 18, 2023
1 parent 3db4035 commit 2330ffb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/gdscript/editor/script_templates/RichTextEffect/default.gd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions modules/gdscript/gdscript_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
}

Expand Down

0 comments on commit 2330ffb

Please sign in to comment.