| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/scene/scene_tree_editor.h" |
| 34 |
#include "scene/gui/dialogs.h" |
| 35 |
#include "scene/gui/line_edit.h" |
| 36 |
|
| 37 |
class Button; |
| 38 |
class CheckBox; |
| 39 |
class CheckButton; |
| 40 |
class Label; |
| 41 |
class OptionButton; |
| 42 |
class SpinBox; |
| 43 |
class TabContainer; |
| 44 |
|
| 45 |
class RenameDialog : public ConfirmationDialog { |
| 46 |
GDCLASS(RenameDialog, ConfirmationDialog); |
| 47 |
|
| 48 |
virtual void ok_pressed() override { rename(); } |
| 49 |
void _cancel_pressed() {} |
| 50 |
void _features_toggled(bool pressed); |
| 51 |
void _insert_text(const String &text); |
| 52 |
void _update_substitute(); |
| 53 |
bool _is_main_field(LineEdit *line_edit); |
| 54 |
|
| 55 |
void _iterate_scene(const Node *node, const Array &selection, int *count); |
| 56 |
String _apply_rename(const Node *node, int count); |
| 57 |
String _substitute(const String &subject, const Node *node, int count); |
| 58 |
String _regex(const String &pattern, const String &subject, const String &replacement); |
| 59 |
String _postprocess(const String &subject); |
| 60 |
void _update_preview(const String &new_text = ""); |
| 61 |
void _update_preview_int(int new_value = 0); |
| 62 |
static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type); |
| 63 |
|
| 64 |
SceneTreeEditor *scene_tree_editor = nullptr; |
| 65 |
int global_count = 0; |
| 66 |
|
| 67 |
LineEdit *lne_search = nullptr; |
| 68 |
LineEdit *lne_replace = nullptr; |
| 69 |
LineEdit *lne_prefix = nullptr; |
| 70 |
LineEdit *lne_suffix = nullptr; |
| 71 |
|
| 72 |
TabContainer *tabc_features = nullptr; |
| 73 |
|
| 74 |
CheckBox *cbut_substitute = nullptr; |
| 75 |
CheckButton *cbut_regex = nullptr; |
| 76 |
CheckBox *cbut_process = nullptr; |
| 77 |
CheckBox *chk_per_level_counter = nullptr; |
| 78 |
|
| 79 |
Button *but_insert_name = nullptr; |
| 80 |
Button *but_insert_parent = nullptr; |
| 81 |
Button *but_insert_type = nullptr; |
| 82 |
Button *but_insert_scene = nullptr; |
| 83 |
Button *but_insert_root = nullptr; |
| 84 |
Button *but_insert_count = nullptr; |
| 85 |
|
| 86 |
SpinBox *spn_count_start = nullptr; |
| 87 |
SpinBox *spn_count_step = nullptr; |
| 88 |
SpinBox *spn_count_padding = nullptr; |
| 89 |
|
| 90 |
OptionButton *opt_style = nullptr; |
| 91 |
OptionButton *opt_case = nullptr; |
| 92 |
|
| 93 |
Label *lbl_preview_title = nullptr; |
| 94 |
Label *lbl_preview = nullptr; |
| 95 |
|
| 96 |
List<Pair<NodePath, String>> to_rename; |
| 97 |
Node *preview_node = nullptr; |
| 98 |
bool lock_preview_update = false; |
| 99 |
ErrorHandlerList eh; |
| 100 |
bool has_errors = false; |
| 101 |
|
| 102 |
protected: |
| 103 |
static void _bind_methods(); |
| 104 |
virtual void _post_popup() override; |
| 105 |
|
| 106 |
public: |
| 107 |
void reset(); |
| 108 |
void rename(); |
| 109 |
|
| 110 |
RenameDialog(SceneTreeEditor *p_scene_tree_editor); |
| 111 |
}; |