Browse Source

Make the Import dock depend on the FileSystem dock

(cherry picked from commit de6f8f9d21850b03f7563058d429f97833494275)
Aaron Franke 5 years ago
parent
commit
76a8458753

+ 5 - 5
doc/classes/EditorFeatureProfile.xml

@@ -135,15 +135,15 @@
 		<constant name="FEATURE_SCENE_TREE" value="3" enum="Feature">
 		<constant name="FEATURE_SCENE_TREE" value="3" enum="Feature">
 			Scene tree editing. If this feature is disabled, the Scene tree dock will still be visible but will be read-only.
 			Scene tree editing. If this feature is disabled, the Scene tree dock will still be visible but will be read-only.
 		</constant>
 		</constant>
-		<constant name="FEATURE_IMPORT_DOCK" value="4" enum="Feature">
-			The Import dock. If this feature is disabled, the Import dock won't be visible.
-		</constant>
-		<constant name="FEATURE_NODE_DOCK" value="5" enum="Feature">
+		<constant name="FEATURE_NODE_DOCK" value="4" enum="Feature">
 			The Node dock. If this feature is disabled, signals and groups won't be visible and modifiable from the editor.
 			The Node dock. If this feature is disabled, signals and groups won't be visible and modifiable from the editor.
 		</constant>
 		</constant>
-		<constant name="FEATURE_FILESYSTEM_DOCK" value="6" enum="Feature">
+		<constant name="FEATURE_FILESYSTEM_DOCK" value="5" enum="Feature">
 			The FileSystem dock. If this feature is disabled, the FileSystem dock won't be visible.
 			The FileSystem dock. If this feature is disabled, the FileSystem dock won't be visible.
 		</constant>
 		</constant>
+		<constant name="FEATURE_IMPORT_DOCK" value="6" enum="Feature">
+			The Import dock. If this feature is disabled, the Import dock won't be visible.
+		</constant>
 		<constant name="FEATURE_MAX" value="7" enum="Feature">
 		<constant name="FEATURE_MAX" value="7" enum="Feature">
 			Represents the size of the [enum Feature] enum.
 			Represents the size of the [enum Feature] enum.
 		</constant>
 		</constant>

+ 13 - 7
editor/editor_feature_profile.cpp

@@ -40,9 +40,9 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
 	TTRC("Script Editor"),
 	TTRC("Script Editor"),
 	TTRC("Asset Library"),
 	TTRC("Asset Library"),
 	TTRC("Scene Tree Editing"),
 	TTRC("Scene Tree Editing"),
-	TTRC("Import Dock"),
 	TTRC("Node Dock"),
 	TTRC("Node Dock"),
-	TTRC("FileSystem and Import Docks")
+	TTRC("FileSystem Dock"),
+	TTRC("Import Dock"),
 };
 };
 
 
 const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
 const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
@@ -50,9 +50,9 @@ const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
 	"script",
 	"script",
 	"asset_lib",
 	"asset_lib",
 	"scene_tree",
 	"scene_tree",
-	"import_dock",
 	"node_dock",
 	"node_dock",
-	"filesystem_dock"
+	"filesystem_dock",
+	"import_dock",
 };
 };
 
 
 void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) {
 void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) {
@@ -275,9 +275,9 @@ void EditorFeatureProfile::_bind_methods() {
 	BIND_ENUM_CONSTANT(FEATURE_SCRIPT);
 	BIND_ENUM_CONSTANT(FEATURE_SCRIPT);
 	BIND_ENUM_CONSTANT(FEATURE_ASSET_LIB);
 	BIND_ENUM_CONSTANT(FEATURE_ASSET_LIB);
 	BIND_ENUM_CONSTANT(FEATURE_SCENE_TREE);
 	BIND_ENUM_CONSTANT(FEATURE_SCENE_TREE);
-	BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK);
 	BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK);
 	BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK);
 	BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK);
 	BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK);
+	BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK);
 	BIND_ENUM_CONSTANT(FEATURE_MAX);
 	BIND_ENUM_CONSTANT(FEATURE_MAX);
 }
 }
 
 
@@ -688,10 +688,16 @@ void EditorFeatureProfileManager::_update_selected_profile() {
 	TreeItem *root = class_list->create_item();
 	TreeItem *root = class_list->create_item();
 
 
 	TreeItem *features = class_list->create_item(root);
 	TreeItem *features = class_list->create_item(root);
+	TreeItem *last_feature;
 	features->set_text(0, TTR("Enabled Features:"));
 	features->set_text(0, TTR("Enabled Features:"));
 	for (int i = 0; i < EditorFeatureProfile::FEATURE_MAX; i++) {
 	for (int i = 0; i < EditorFeatureProfile::FEATURE_MAX; i++) {
-
-		TreeItem *feature = class_list->create_item(features);
+		TreeItem *feature;
+		if (i == EditorFeatureProfile::FEATURE_IMPORT_DOCK) {
+			feature = class_list->create_item(last_feature);
+		} else {
+			feature = class_list->create_item(features);
+			last_feature = feature;
+		}
 		feature->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
 		feature->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
 		feature->set_text(0, TTRGET(EditorFeatureProfile::get_feature_name(EditorFeatureProfile::Feature(i))));
 		feature->set_text(0, TTRGET(EditorFeatureProfile::get_feature_name(EditorFeatureProfile::Feature(i))));
 		feature->set_selectable(0, true);
 		feature->set_selectable(0, true);

+ 1 - 1
editor/editor_feature_profile.h

@@ -49,9 +49,9 @@ public:
 		FEATURE_SCRIPT,
 		FEATURE_SCRIPT,
 		FEATURE_ASSET_LIB,
 		FEATURE_ASSET_LIB,
 		FEATURE_SCENE_TREE,
 		FEATURE_SCENE_TREE,
-		FEATURE_IMPORT_DOCK,
 		FEATURE_NODE_DOCK,
 		FEATURE_NODE_DOCK,
 		FEATURE_FILESYSTEM_DOCK,
 		FEATURE_FILESYSTEM_DOCK,
+		FEATURE_IMPORT_DOCK,
 		FEATURE_MAX
 		FEATURE_MAX
 	};
 	};
 
 

+ 4 - 3
editor/editor_node.cpp

@@ -5515,10 +5515,11 @@ void EditorNode::_feature_profile_changed() {
 	TabContainer *node_tabs = cast_to<TabContainer>(node_dock->get_parent());
 	TabContainer *node_tabs = cast_to<TabContainer>(node_dock->get_parent());
 	TabContainer *fs_tabs = cast_to<TabContainer>(filesystem_dock->get_parent());
 	TabContainer *fs_tabs = cast_to<TabContainer>(filesystem_dock->get_parent());
 	if (profile.is_valid()) {
 	if (profile.is_valid()) {
-
-		import_tabs->set_tab_hidden(import_dock->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
 		node_tabs->set_tab_hidden(node_dock->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
 		node_tabs->set_tab_hidden(node_dock->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
-		fs_tabs->set_tab_hidden(filesystem_dock->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK));
+		// The Import dock is useless without the FileSystem dock. Ensure the configuration is valid.
+		bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK);
+		fs_tabs->set_tab_hidden(filesystem_dock->get_index(), fs_dock_disabled);
+		import_tabs->set_tab_hidden(import_dock->get_index(), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
 
 
 		main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
 		main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
 		main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
 		main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));