diff options
Diffstat (limited to 'scene/main/node.cpp')
| -rw-r--r-- | scene/main/node.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 32cefa6085..86b78f60f6 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1384,6 +1384,17 @@ String Node::_generate_serial_child_name(Node *p_child) { if (name=="") { name = p_child->get_class(); + // Adjust casing according to project setting. The current type name is expected to be in PascalCase. + switch (GlobalConfig::get_singleton()->get("editor/node_name_casing").operator int()) { + case NAME_CASING_PASCAL_CASE: + break; + case NAME_CASING_CAMEL_CASE: + name[0] = name.to_lower()[0]; + break; + case NAME_CASING_SNAKE_CASE: + name = name.camelcase_to_underscore(true); + break; + } } // Extract trailing number @@ -2723,7 +2734,7 @@ void Node::_set_tree(SceneTree *p_tree) { SceneTree *tree_changed_a=NULL; SceneTree *tree_changed_b=NULL; -// ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null + //ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null if (data.tree) { _propagate_exit_tree(); @@ -2888,9 +2899,10 @@ void Node::request_ready() { void Node::_bind_methods() { - _GLOBAL_DEF("editor/node_name_num_separator",0); + GLOBAL_DEF("editor/node_name_num_separator",0); GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_num_separator",PropertyInfo(Variant::INT,"editor/node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash")); - + GLOBAL_DEF("editor/node_name_casing",NAME_CASING_PASCAL_CASE); + GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_casing",PropertyInfo(Variant::INT,"editor/node_name_casing",PROPERTY_HINT_ENUM,"PascalCase,camelCase,snake_case")); ClassDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false)); @@ -3050,8 +3062,8 @@ void Node::_bind_methods() { ADD_SIGNAL( MethodInfo("tree_entered") ); ADD_SIGNAL( MethodInfo("tree_exited") ); -// ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); -// ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); + //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); + //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), _SCS("set_process_input"),_SCS("is_processing_input" ) ); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), _SCS("set_process_unhandled_input"),_SCS("is_processing_unhandled_input" ) ); ADD_GROUP("Pause","pause_"); |