1/**************************************************************************/
2/* rich_text_effect.cpp */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#include "rich_text_effect.h"
32
33#include "core/object/script_language.h"
34
35CharFXTransform::CharFXTransform() {
36}
37
38CharFXTransform::~CharFXTransform() {
39 environment.clear();
40}
41
42void RichTextEffect::_bind_methods(){
43 GDVIRTUAL_BIND(_process_custom_fx, "char_fx")
44}
45
46Variant RichTextEffect::get_bbcode() const {
47 Variant r;
48 if (get_script_instance()) {
49 if (!get_script_instance()->get("bbcode", r)) {
50 String path = get_script_instance()->get_script()->get_path();
51 r = path.get_file().get_basename();
52 }
53 }
54 return r;
55}
56
57bool RichTextEffect::_process_effect_impl(Ref<CharFXTransform> p_cfx) {
58 bool return_value = false;
59 GDVIRTUAL_CALL(_process_custom_fx, p_cfx, return_value);
60 return return_value;
61}
62
63RichTextEffect::RichTextEffect() {
64}
65
66void CharFXTransform::_bind_methods() {
67 ClassDB::bind_method(D_METHOD("get_range"), &CharFXTransform::get_range);
68 ClassDB::bind_method(D_METHOD("set_range", "range"), &CharFXTransform::set_range);
69
70 ClassDB::bind_method(D_METHOD("get_elapsed_time"), &CharFXTransform::get_elapsed_time);
71 ClassDB::bind_method(D_METHOD("set_elapsed_time", "time"), &CharFXTransform::set_elapsed_time);
72
73 ClassDB::bind_method(D_METHOD("is_visible"), &CharFXTransform::is_visible);
74 ClassDB::bind_method(D_METHOD("set_visibility", "visibility"), &CharFXTransform::set_visibility);
75
76 ClassDB::bind_method(D_METHOD("is_outline"), &CharFXTransform::is_outline);
77 ClassDB::bind_method(D_METHOD("set_outline", "outline"), &CharFXTransform::set_outline);
78
79 ClassDB::bind_method(D_METHOD("get_offset"), &CharFXTransform::get_offset);
80 ClassDB::bind_method(D_METHOD("set_offset", "offset"), &CharFXTransform::set_offset);
81
82 ClassDB::bind_method(D_METHOD("get_color"), &CharFXTransform::get_color);
83 ClassDB::bind_method(D_METHOD("set_color", "color"), &CharFXTransform::set_color);
84
85 ClassDB::bind_method(D_METHOD("get_environment"), &CharFXTransform::get_environment);
86 ClassDB::bind_method(D_METHOD("set_environment", "environment"), &CharFXTransform::set_environment);
87
88 ClassDB::bind_method(D_METHOD("get_glyph_index"), &CharFXTransform::get_glyph_index);
89 ClassDB::bind_method(D_METHOD("set_glyph_index", "glyph_index"), &CharFXTransform::set_glyph_index);
90
91 ClassDB::bind_method(D_METHOD("get_relative_index"), &CharFXTransform::get_relative_index);
92 ClassDB::bind_method(D_METHOD("set_relative_index", "relative_index"), &CharFXTransform::set_relative_index);
93
94 ClassDB::bind_method(D_METHOD("get_glyph_count"), &CharFXTransform::get_glyph_count);
95 ClassDB::bind_method(D_METHOD("set_glyph_count", "glyph_count"), &CharFXTransform::set_glyph_count);
96
97 ClassDB::bind_method(D_METHOD("get_glyph_flags"), &CharFXTransform::get_glyph_flags);
98 ClassDB::bind_method(D_METHOD("set_glyph_flags", "glyph_flags"), &CharFXTransform::set_glyph_flags);
99
100 ClassDB::bind_method(D_METHOD("get_font"), &CharFXTransform::get_font);
101 ClassDB::bind_method(D_METHOD("set_font", "font"), &CharFXTransform::set_font);
102
103 ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "range"), "set_range", "get_range");
104 ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "elapsed_time"), "set_elapsed_time", "get_elapsed_time");
105 ADD_PROPERTY(PropertyInfo(Variant::BOOL, "visible"), "set_visibility", "is_visible");
106 ADD_PROPERTY(PropertyInfo(Variant::BOOL, "outline"), "set_outline", "is_outline");
107 ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
108 ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
109 ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "env"), "set_environment", "get_environment");
110 ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_index"), "set_glyph_index", "get_glyph_index");
111 ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_count"), "set_glyph_count", "get_glyph_count");
112 ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_flags"), "set_glyph_flags", "get_glyph_flags");
113 ADD_PROPERTY(PropertyInfo(Variant::INT, "relative_index"), "set_relative_index", "get_relative_index");
114 ADD_PROPERTY(PropertyInfo(Variant::RID, "font"), "set_font", "get_font");
115}
116