mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	Merge pull request #68342 from KoBeWi/Godot_museum't
Allow to disable History Dock via feature profile
This commit is contained in:
		
						commit
						518b4bcc0d
					
				
					 5 changed files with 18 additions and 4 deletions
				
			
		| 
						 | 
					@ -116,7 +116,10 @@
 | 
				
			||||||
		<constant name="FEATURE_IMPORT_DOCK" value="6" enum="Feature">
 | 
							<constant name="FEATURE_IMPORT_DOCK" value="6" enum="Feature">
 | 
				
			||||||
			The Import dock. If this feature is disabled, the Import dock won't be visible.
 | 
								The Import dock. If this feature is disabled, the Import dock won't be visible.
 | 
				
			||||||
		</constant>
 | 
							</constant>
 | 
				
			||||||
		<constant name="FEATURE_MAX" value="7" enum="Feature">
 | 
							<constant name="FEATURE_HISTORY_DOCK" value="7" enum="Feature">
 | 
				
			||||||
 | 
								The History dock. If this feature is disabled, the History dock won't be visible.
 | 
				
			||||||
 | 
							</constant>
 | 
				
			||||||
 | 
							<constant name="FEATURE_MAX" value="8" enum="Feature">
 | 
				
			||||||
			Represents the size of the [enum Feature] enum.
 | 
								Represents the size of the [enum Feature] enum.
 | 
				
			||||||
		</constant>
 | 
							</constant>
 | 
				
			||||||
	</constants>
 | 
						</constants>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
 | 
				
			||||||
	TTRC("Node Dock"),
 | 
						TTRC("Node Dock"),
 | 
				
			||||||
	TTRC("FileSystem Dock"),
 | 
						TTRC("FileSystem Dock"),
 | 
				
			||||||
	TTRC("Import Dock"),
 | 
						TTRC("Import Dock"),
 | 
				
			||||||
 | 
						TTRC("History Dock"),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
 | 
					const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
 | 
				
			||||||
| 
						 | 
					@ -57,6 +58,7 @@ const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
 | 
				
			||||||
	TTRC("Allows to work with signals and groups of the node selected in the Scene dock."),
 | 
						TTRC("Allows to work with signals and groups of the node selected in the Scene dock."),
 | 
				
			||||||
	TTRC("Allows to browse the local file system via a dedicated dock."),
 | 
						TTRC("Allows to browse the local file system via a dedicated dock."),
 | 
				
			||||||
	TTRC("Allows to configure import settings for individual assets. Requires the FileSystem dock to function."),
 | 
						TTRC("Allows to configure import settings for individual assets. Requires the FileSystem dock to function."),
 | 
				
			||||||
 | 
						TTRC("Provides an overview of the editor's and each scene's undo history."),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
 | 
					const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
 | 
				
			||||||
| 
						 | 
					@ -67,6 +69,7 @@ const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
 | 
				
			||||||
	"node_dock",
 | 
						"node_dock",
 | 
				
			||||||
	"filesystem_dock",
 | 
						"filesystem_dock",
 | 
				
			||||||
	"import_dock",
 | 
						"import_dock",
 | 
				
			||||||
 | 
						"history_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) {
 | 
				
			||||||
| 
						 | 
					@ -302,6 +305,7 @@ void EditorFeatureProfile::_bind_methods() {
 | 
				
			||||||
	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_IMPORT_DOCK);
 | 
				
			||||||
 | 
						BIND_ENUM_CONSTANT(FEATURE_HISTORY_DOCK);
 | 
				
			||||||
	BIND_ENUM_CONSTANT(FEATURE_MAX);
 | 
						BIND_ENUM_CONSTANT(FEATURE_MAX);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,6 +52,7 @@ public:
 | 
				
			||||||
		FEATURE_NODE_DOCK,
 | 
							FEATURE_NODE_DOCK,
 | 
				
			||||||
		FEATURE_FILESYSTEM_DOCK,
 | 
							FEATURE_FILESYSTEM_DOCK,
 | 
				
			||||||
		FEATURE_IMPORT_DOCK,
 | 
							FEATURE_IMPORT_DOCK,
 | 
				
			||||||
 | 
							FEATURE_HISTORY_DOCK,
 | 
				
			||||||
		FEATURE_MAX
 | 
							FEATURE_MAX
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5968,12 +5968,14 @@ void EditorNode::_feature_profile_changed() {
 | 
				
			||||||
	TabContainer *import_tabs = cast_to<TabContainer>(ImportDock::get_singleton()->get_parent());
 | 
						TabContainer *import_tabs = cast_to<TabContainer>(ImportDock::get_singleton()->get_parent());
 | 
				
			||||||
	TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
 | 
						TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
 | 
				
			||||||
	TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
 | 
						TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
 | 
				
			||||||
 | 
						TabContainer *history_tabs = cast_to<TabContainer>(history_dock->get_parent());
 | 
				
			||||||
	if (profile.is_valid()) {
 | 
						if (profile.is_valid()) {
 | 
				
			||||||
		node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
 | 
							node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
 | 
				
			||||||
		// The Import dock is useless without the FileSystem dock. Ensure the configuration is valid.
 | 
							// 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);
 | 
							bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK);
 | 
				
			||||||
		fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
 | 
							fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
 | 
				
			||||||
		import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
 | 
							import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
 | 
				
			||||||
 | 
							history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_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));
 | 
				
			||||||
| 
						 | 
					@ -5989,6 +5991,8 @@ void EditorNode::_feature_profile_changed() {
 | 
				
			||||||
		import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
 | 
							import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
 | 
				
			||||||
		node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
 | 
							node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
 | 
				
			||||||
		fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
 | 
							fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
 | 
				
			||||||
 | 
							history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), false);
 | 
				
			||||||
 | 
							history_dock->set_visible(true);
 | 
				
			||||||
		ImportDock::get_singleton()->set_visible(true);
 | 
							ImportDock::get_singleton()->set_visible(true);
 | 
				
			||||||
		NodeDock::get_singleton()->set_visible(true);
 | 
							NodeDock::get_singleton()->set_visible(true);
 | 
				
			||||||
		FileSystemDock::get_singleton()->set_visible(true);
 | 
							FileSystemDock::get_singleton()->set_visible(true);
 | 
				
			||||||
| 
						 | 
					@ -7100,7 +7104,7 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
 | 
						filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
 | 
				
			||||||
	get_project_settings()->connect_filesystem_dock_signals(filesystem_dock);
 | 
						get_project_settings()->connect_filesystem_dock_signals(filesystem_dock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HistoryDock *hd = memnew(HistoryDock);
 | 
						history_dock = memnew(HistoryDock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Scene: Top left.
 | 
						// Scene: Top left.
 | 
				
			||||||
	dock_slot[DOCK_SLOT_LEFT_UR]->add_child(SceneTreeDock::get_singleton());
 | 
						dock_slot[DOCK_SLOT_LEFT_UR]->add_child(SceneTreeDock::get_singleton());
 | 
				
			||||||
| 
						 | 
					@ -7123,8 +7127,8 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(NodeDock::get_singleton()), TTR("Node"));
 | 
						dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(NodeDock::get_singleton()), TTR("Node"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// History: Full height right, behind Node.
 | 
						// History: Full height right, behind Node.
 | 
				
			||||||
	dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(hd);
 | 
						dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(history_dock);
 | 
				
			||||||
	dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(hd), TTR("History"));
 | 
						dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(history_dock), TTR("History"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Hide unused dock slots and vsplits.
 | 
						// Hide unused dock slots and vsplits.
 | 
				
			||||||
	dock_slot[DOCK_SLOT_LEFT_UL]->hide();
 | 
						dock_slot[DOCK_SLOT_LEFT_UL]->hide();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,6 +77,7 @@ class EditorUndoRedoManager;
 | 
				
			||||||
class ExportTemplateManager;
 | 
					class ExportTemplateManager;
 | 
				
			||||||
class FileDialog;
 | 
					class FileDialog;
 | 
				
			||||||
class FileSystemDock;
 | 
					class FileSystemDock;
 | 
				
			||||||
 | 
					class HistoryDock;
 | 
				
			||||||
class HSplitContainer;
 | 
					class HSplitContainer;
 | 
				
			||||||
class ImportDock;
 | 
					class ImportDock;
 | 
				
			||||||
class LinkButton;
 | 
					class LinkButton;
 | 
				
			||||||
| 
						 | 
					@ -274,6 +275,7 @@ private:
 | 
				
			||||||
	EditorRunNative *run_native = nullptr;
 | 
						EditorRunNative *run_native = nullptr;
 | 
				
			||||||
	EditorSelection *editor_selection = nullptr;
 | 
						EditorSelection *editor_selection = nullptr;
 | 
				
			||||||
	EditorSettingsDialog *editor_settings_dialog = nullptr;
 | 
						EditorSettingsDialog *editor_settings_dialog = nullptr;
 | 
				
			||||||
 | 
						HistoryDock *history_dock = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ProjectExportDialog *project_export = nullptr;
 | 
						ProjectExportDialog *project_export = nullptr;
 | 
				
			||||||
	ProjectSettingsEditor *project_settings_editor = nullptr;
 | 
						ProjectSettingsEditor *project_settings_editor = nullptr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue