mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Rearrange editor/naming/* project settings
				
					
				
			This commit is contained in:
		
							parent
							
								
									0e4e782ada
								
							
						
					
					
						commit
						8f706be6fa
					
				
					 7 changed files with 23 additions and 15 deletions
				
			
		|  | @ -1285,6 +1285,10 @@ ProjectSettings::ProjectSettings() { | ||||||
| 	GLOBAL_DEF("editor/script/templates_search_path", "res://script_templates"); | 	GLOBAL_DEF("editor/script/templates_search_path", "res://script_templates"); | ||||||
| 	custom_prop_info["editor/script/templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR); | 	custom_prop_info["editor/script/templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR); | ||||||
| 
 | 
 | ||||||
|  | 	// For correct doc generation.
 | ||||||
|  | 	GLOBAL_DEF("editor/naming/default_signal_callback_name", "_on_{node_name}_{signal_name}"); | ||||||
|  | 	GLOBAL_DEF("editor/naming/default_signal_callback_to_self_name", "_on_{signal_name}"); | ||||||
|  | 
 | ||||||
| 	_add_builtin_input_map(); | 	_add_builtin_input_map(); | ||||||
| 
 | 
 | ||||||
| 	// Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum.
 | 	// Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum.
 | ||||||
|  |  | ||||||
|  | @ -659,10 +659,16 @@ | ||||||
| 		<member name="editor/movie_writer/speaker_mode" type="int" setter="" getter="" default="0"> | 		<member name="editor/movie_writer/speaker_mode" type="int" setter="" getter="" default="0"> | ||||||
| 			The speaker mode to use in the recorded audio when writing a movie. See [enum AudioServer.SpeakerMode] for possible values. | 			The speaker mode to use in the recorded audio when writing a movie. See [enum AudioServer.SpeakerMode] for possible values. | ||||||
| 		</member> | 		</member> | ||||||
| 		<member name="editor/node_naming/name_casing" type="int" setter="" getter="" default="0"> | 		<member name="editor/naming/default_signal_callback_name" type="String" setter="" getter="" default=""_on_{node_name}_{signal_name}""> | ||||||
|  | 			The format of the default signal callback name (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code]. | ||||||
|  | 		</member> | ||||||
|  | 		<member name="editor/naming/default_signal_callback_to_self_name" type="String" setter="" getter="" default=""_on_{signal_name}""> | ||||||
|  | 			The format of the default signal callback name when a signal connects to the same node that emits it (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code]. | ||||||
|  | 		</member> | ||||||
|  | 		<member name="editor/naming/node_name_casing" type="int" setter="" getter="" default="0"> | ||||||
| 			When creating node names automatically, set the type of casing in this project. This is mostly an editor setting. | 			When creating node names automatically, set the type of casing in this project. This is mostly an editor setting. | ||||||
| 		</member> | 		</member> | ||||||
| 		<member name="editor/node_naming/name_num_separator" type="int" setter="" getter="" default="0"> | 		<member name="editor/naming/node_name_num_separator" type="int" setter="" getter="" default="0"> | ||||||
| 			What to use to separate node name from number. This is mostly an editor setting. | 			What to use to separate node name from number. This is mostly an editor setting. | ||||||
| 		</member> | 		</member> | ||||||
| 		<member name="editor/run/main_run_args" type="String" setter="" getter="" default=""""> | 		<member name="editor/run/main_run_args" type="String" setter="" getter="" default=""""> | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "connections_dialog.h" | #include "connections_dialog.h" | ||||||
| 
 | 
 | ||||||
|  | #include "core/config/project_settings.h" | ||||||
| #include "editor/doc_tools.h" | #include "editor/doc_tools.h" | ||||||
| #include "editor/editor_help.h" | #include "editor/editor_help.h" | ||||||
| #include "editor/editor_node.h" | #include "editor/editor_node.h" | ||||||
|  | @ -242,9 +243,9 @@ StringName ConnectDialog::generate_method_callback_name(Node *p_source, String p | ||||||
| 
 | 
 | ||||||
| 	String dst_method; | 	String dst_method; | ||||||
| 	if (p_source == p_target) { | 	if (p_source == p_target) { | ||||||
| 		dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_to_self_name")).format(subst); | 		dst_method = String(GLOBAL_GET("editor/naming/default_signal_callback_to_self_name")).format(subst); | ||||||
| 	} else { | 	} else { | ||||||
| 		dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_name")).format(subst); | 		dst_method = String(GLOBAL_GET("editor/naming/default_signal_callback_name")).format(subst); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return dst_method; | 	return dst_method; | ||||||
|  | @ -1237,9 +1238,6 @@ ConnectionsDock::ConnectionsDock() { | ||||||
| 	tree->connect("item_mouse_selected", callable_mp(this, &ConnectionsDock::_rmb_pressed)); | 	tree->connect("item_mouse_selected", callable_mp(this, &ConnectionsDock::_rmb_pressed)); | ||||||
| 
 | 
 | ||||||
| 	add_theme_constant_override("separation", 3 * EDSCALE); | 	add_theme_constant_override("separation", 3 * EDSCALE); | ||||||
| 
 |  | ||||||
| 	EDITOR_DEF("interface/editors/default_signal_callback_name", "_on_{node_name}_{signal_name}"); |  | ||||||
| 	EDITOR_DEF("interface/editors/default_signal_callback_to_self_name", "_on_{signal_name}"); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ConnectionsDock::~ConnectionsDock() { | ConnectionsDock::~ConnectionsDock() { | ||||||
|  |  | ||||||
|  | @ -3046,7 +3046,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| String EditorNode::adjust_scene_name_casing(const String &root_name) { | String EditorNode::adjust_scene_name_casing(const String &root_name) { | ||||||
| 	switch (GLOBAL_GET("editor/scene/scene_naming").operator int()) { | 	switch (GLOBAL_GET("editor/naming/scene_name_casing").operator int()) { | ||||||
| 		case SCENE_NAME_CASING_AUTO: | 		case SCENE_NAME_CASING_AUTO: | ||||||
| 			// Use casing of the root node.
 | 			// Use casing of the root node.
 | ||||||
| 			break; | 			break; | ||||||
|  | @ -5900,7 +5900,7 @@ void EditorNode::_feature_profile_changed() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void EditorNode::_bind_methods() { | void EditorNode::_bind_methods() { | ||||||
| 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/scene/scene_naming", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"), SCENE_NAME_CASING_SNAKE_CASE); | 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/scene_name_casing", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"), SCENE_NAME_CASING_SNAKE_CASE); | ||||||
| 	ClassDB::bind_method("edit_current", &EditorNode::edit_current); | 	ClassDB::bind_method("edit_current", &EditorNode::edit_current); | ||||||
| 	ClassDB::bind_method("edit_node", &EditorNode::edit_node); | 	ClassDB::bind_method("edit_node", &EditorNode::edit_node); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2188,7 +2188,7 @@ void SceneTreeDock::_do_create(Node *p_parent) { | ||||||
| 	ERR_FAIL_COND(!child); | 	ERR_FAIL_COND(!child); | ||||||
| 
 | 
 | ||||||
| 	String new_name = p_parent->validate_child_name(child); | 	String new_name = p_parent->validate_child_name(child); | ||||||
| 	if (GLOBAL_GET("editor/node_naming/name_casing").operator int() != NAME_CASING_PASCAL_CASE) { | 	if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) { | ||||||
| 		new_name = adjust_name_casing(new_name); | 		new_name = adjust_name_casing(new_name); | ||||||
| 	} | 	} | ||||||
| 	child->set_name(new_name); | 	child->set_name(new_name); | ||||||
|  |  | ||||||
|  | @ -971,7 +971,7 @@ void SceneTreeEditor::_renamed() { | ||||||
| 	String raw_new_name = which->get_text(0); | 	String raw_new_name = which->get_text(0); | ||||||
| 	if (raw_new_name.strip_edges().is_empty()) { | 	if (raw_new_name.strip_edges().is_empty()) { | ||||||
| 		// If name is empty, fallback to class name.
 | 		// If name is empty, fallback to class name.
 | ||||||
| 		if (GLOBAL_GET("editor/node_naming/name_casing").operator int() != NAME_CASING_PASCAL_CASE) { | 		if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) { | ||||||
| 			raw_new_name = Node::adjust_name_casing(n->get_class()); | 			raw_new_name = Node::adjust_name_casing(n->get_class()); | ||||||
| 		} else { | 		} else { | ||||||
| 			raw_new_name = n->get_class(); | 			raw_new_name = n->get_class(); | ||||||
|  |  | ||||||
|  | @ -944,7 +944,7 @@ String Node::validate_child_name(Node *p_child) { | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| String Node::adjust_name_casing(const String &p_name) { | String Node::adjust_name_casing(const String &p_name) { | ||||||
| 	switch (GLOBAL_GET("editor/node_naming/name_casing").operator int()) { | 	switch (GLOBAL_GET("editor/naming/node_name_casing").operator int()) { | ||||||
| 		case NAME_CASING_PASCAL_CASE: | 		case NAME_CASING_PASCAL_CASE: | ||||||
| 			return p_name.to_pascal_case(); | 			return p_name.to_pascal_case(); | ||||||
| 		case NAME_CASING_CAMEL_CASE: | 		case NAME_CASING_CAMEL_CASE: | ||||||
|  | @ -2795,8 +2795,8 @@ void Node::unhandled_key_input(const Ref<InputEvent> &p_key_event) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Node::_bind_methods() { | void Node::_bind_methods() { | ||||||
| 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/node_naming/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"), 0); | 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/node_name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"), 0); | ||||||
| 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/node_naming/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"), NAME_CASING_PASCAL_CASE); | 	GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/node_name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"), NAME_CASING_PASCAL_CASE); | ||||||
| 
 | 
 | ||||||
| 	ClassDB::bind_static_method("Node", D_METHOD("print_orphan_nodes"), &Node::print_orphan_nodes); | 	ClassDB::bind_static_method("Node", D_METHOD("print_orphan_nodes"), &Node::print_orphan_nodes); | ||||||
| 	ClassDB::bind_method(D_METHOD("add_sibling", "sibling", "force_readable_name"), &Node::add_sibling, DEFVAL(false)); | 	ClassDB::bind_method(D_METHOD("add_sibling", "sibling", "force_readable_name"), &Node::add_sibling, DEFVAL(false)); | ||||||
|  | @ -3017,7 +3017,7 @@ void Node::_bind_methods() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| String Node::_get_name_num_separator() { | String Node::_get_name_num_separator() { | ||||||
| 	switch (GLOBAL_GET("editor/node_naming/name_num_separator").operator int()) { | 	switch (GLOBAL_GET("editor/naming/node_name_num_separator").operator int()) { | ||||||
| 		case 0: | 		case 0: | ||||||
| 			return ""; | 			return ""; | ||||||
| 		case 1: | 		case 1: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Danil Alexeev
						Danil Alexeev