MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _quote_drop_data

Function _quote_drop_data

editor/script/script_text_editor.cpp:2200–2212  ·  view source on GitHub ↗

This function prepares a string for being "dropped" into the script editor. The string can be a resource path, node path or property name.

Source from the content-addressed store, hash-verified

2198/// This function prepares a string for being "dropped" into the script editor.
2199/// The string can be a resource path, node path or property name.
2200static String _quote_drop_data(const String &str) {
2201 const bool using_single_quotes = EDITOR_GET("text_editor/completion/use_single_quotes");
2202
2203 String escaped = str.c_escape();
2204
2205 // If string is double quoted, there is no need to escape single quotes.
2206 // We can revert the extra escaping added in c_escape().
2207 if (!using_single_quotes) {
2208 escaped = escaped.replace("\\'", "\'");
2209 }
2210
2211 return escaped.quote(using_single_quotes ? "'" : "\"");
2212}
2213
2214static String _get_dropped_resource_line(const Ref<Resource> &p_resource, bool p_create_field, bool p_allow_uid) {
2215 String path = p_resource->get_path();

Callers 2

drop_data_fwMethod · 0.85

Calls 3

c_escapeMethod · 0.80
quoteMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected