You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Add Options, Functions and Settings to convert Node-Names and Strings to kebab-case
- refactored and renamed String::_camelcase_to_underscore to String:_separate_compound_words - refactored String::to_snake_case to work with the refactored String::_separate_compound_words - created char_utils::is_hyphen to catch all hyphen variants in kebab-case conversion - created String::to_kebab_case using the new String::_separate_compound_words - created corresponding Documentation in String and StringName - simplified both switch statements in EditorNode and ProjectDialog - added new kebab-casing Option for Node Names in ProjectSettings - added missing camelCase Options to Scene- and Node-Names in ProjectSettings - simplified Mono RuntimeInterop Functions - hooked up the ConnectionsDialog - created additional Unit Tests
This commit is contained in:
@@ -3374,11 +3374,13 @@ String EditorNode::adjust_scene_name_casing(const String &p_root_name) {
|
||||
// Use casing of the root node.
|
||||
break;
|
||||
case SCENE_NAME_CASING_PASCAL_CASE:
|
||||
return p_root_name.replace_char('-', '_').to_pascal_case();
|
||||
return p_root_name.to_pascal_case();
|
||||
case SCENE_NAME_CASING_SNAKE_CASE:
|
||||
return p_root_name.replace_char('-', '_').to_snake_case();
|
||||
return p_root_name.to_snake_case();
|
||||
case SCENE_NAME_CASING_KEBAB_CASE:
|
||||
return p_root_name.to_snake_case().replace_char('_', '-');
|
||||
return p_root_name.to_kebab_case();
|
||||
case SCENE_NAME_CASING_CAMEL_CASE:
|
||||
return p_root_name.to_camel_case();
|
||||
}
|
||||
return p_root_name;
|
||||
}
|
||||
@@ -3395,11 +3397,13 @@ String EditorNode::adjust_script_name_casing(const String &p_file_name, ScriptLa
|
||||
// Script language has no preference, so do not adjust.
|
||||
break;
|
||||
case ScriptLanguage::SCRIPT_NAME_CASING_PASCAL_CASE:
|
||||
return p_file_name.replace_char('-', '_').to_pascal_case();
|
||||
return p_file_name.to_pascal_case();
|
||||
case ScriptLanguage::SCRIPT_NAME_CASING_SNAKE_CASE:
|
||||
return p_file_name.replace_char('-', '_').to_snake_case();
|
||||
return p_file_name.to_snake_case();
|
||||
case ScriptLanguage::SCRIPT_NAME_CASING_KEBAB_CASE:
|
||||
return p_file_name.to_snake_case().replace_char('_', '-');
|
||||
return p_file_name.to_kebab_case();
|
||||
case ScriptLanguage::SCRIPT_NAME_CASING_CAMEL_CASE:
|
||||
return p_file_name.to_camel_case();
|
||||
}
|
||||
return p_file_name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user