1 /** 2 An editor feature profile which can be used to disable specific features. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.editorfeatureprofile; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.reference; 24 /** 25 An editor feature profile which can be used to disable specific features. 26 27 An editor feature profile can be used to disable specific features of the Godot editor. When disabled, the features won't appear in the editor, which makes the editor less cluttered. This is useful in education settings to reduce confusion or when working in a team. For example, artists and level designers could use a feature profile that disables the script editor to avoid accidentally making changes to files they aren't supposed to edit. 28 To manage editor feature profiles visually, use $(B Editor > Manage Feature Profiles...) at the top of the editor window. 29 */ 30 @GodotBaseClass struct EditorFeatureProfile 31 { 32 package(godot) enum string _GODOT_internal_name = "EditorFeatureProfile"; 33 public: 34 @nogc nothrow: 35 union { /** */ godot_object _godot_object; /** */ Reference _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct GDNativeClassBinding 40 { 41 __gshared: 42 @GodotName("get_feature_name") GodotMethod!(String, long) getFeatureName; 43 @GodotName("is_class_disabled") GodotMethod!(bool, String) isClassDisabled; 44 @GodotName("is_class_editor_disabled") GodotMethod!(bool, String) isClassEditorDisabled; 45 @GodotName("is_class_property_disabled") GodotMethod!(bool, String, String) isClassPropertyDisabled; 46 @GodotName("is_feature_disabled") GodotMethod!(bool, long) isFeatureDisabled; 47 @GodotName("load_from_file") GodotMethod!(GodotError, String) loadFromFile; 48 @GodotName("save_to_file") GodotMethod!(GodotError, String) saveToFile; 49 @GodotName("set_disable_class") GodotMethod!(void, String, bool) setDisableClass; 50 @GodotName("set_disable_class_editor") GodotMethod!(void, String, bool) setDisableClassEditor; 51 @GodotName("set_disable_class_property") GodotMethod!(void, String, String, bool) setDisableClassProperty; 52 @GodotName("set_disable_feature") GodotMethod!(void, long, bool) setDisableFeature; 53 } 54 /// 55 pragma(inline, true) bool opEquals(in EditorFeatureProfile other) const 56 { return _godot_object.ptr is other._godot_object.ptr; } 57 /// 58 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 59 { _godot_object.ptr = n; return null; } 60 /// 61 pragma(inline, true) bool opEquals(typeof(null) n) const 62 { return _godot_object.ptr is n; } 63 /// 64 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 65 mixin baseCasts; 66 /// Construct a new instance of EditorFeatureProfile. 67 /// Note: use `memnew!EditorFeatureProfile` instead. 68 static EditorFeatureProfile _new() 69 { 70 static godot_class_constructor constructor; 71 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorFeatureProfile"); 72 if(constructor is null) return typeof(this).init; 73 return cast(EditorFeatureProfile)(constructor()); 74 } 75 @disable new(size_t s); 76 /// 77 enum Feature : int 78 { 79 /** 80 The 3D editor. If this feature is disabled, the 3D editor won't display but 3D nodes will still display in the Create New Node dialog. 81 */ 82 feature3d = 0, 83 /** 84 The Script tab, which contains the script editor and class reference browser. If this feature is disabled, the Script tab won't display. 85 */ 86 featureScript = 1, 87 /** 88 The AssetLib tab. If this feature is disabled, the AssetLib tab won't display. 89 */ 90 featureAssetLib = 2, 91 /** 92 Scene tree editing. If this feature is disabled, the Scene tree dock will still be visible but will be read-only. 93 */ 94 featureSceneTree = 3, 95 /** 96 The Node dock. If this feature is disabled, signals and groups won't be visible and modifiable from the editor. 97 */ 98 featureNodeDock = 4, 99 /** 100 The FileSystem dock. If this feature is disabled, the FileSystem dock won't be visible. 101 */ 102 featureFilesystemDock = 5, 103 /** 104 The Import dock. If this feature is disabled, the Import dock won't be visible. 105 */ 106 featureImportDock = 6, 107 /** 108 Represents the size of the $(D feature) enum. 109 */ 110 featureMax = 7, 111 } 112 /// 113 enum Constants : int 114 { 115 feature3d = 0, 116 featureScript = 1, 117 featureAssetLib = 2, 118 featureSceneTree = 3, 119 featureNodeDock = 4, 120 featureFilesystemDock = 5, 121 featureImportDock = 6, 122 featureMax = 7, 123 } 124 /** 125 Returns the specified `feature`'s human-readable name. 126 */ 127 String getFeatureName(in long feature) 128 { 129 checkClassBinding!(typeof(this))(); 130 return ptrcall!(String)(GDNativeClassBinding.getFeatureName, _godot_object, feature); 131 } 132 /** 133 Returns `true` if the class specified by `class_name` is disabled. When disabled, the class won't appear in the Create New Node dialog. 134 */ 135 bool isClassDisabled(in String class_name) const 136 { 137 checkClassBinding!(typeof(this))(); 138 return ptrcall!(bool)(GDNativeClassBinding.isClassDisabled, _godot_object, class_name); 139 } 140 /** 141 Returns `true` if editing for the class specified by `class_name` is disabled. When disabled, the class will still appear in the Create New Node dialog but the inspector will be read-only when selecting a node that extends the class. 142 */ 143 bool isClassEditorDisabled(in String class_name) const 144 { 145 checkClassBinding!(typeof(this))(); 146 return ptrcall!(bool)(GDNativeClassBinding.isClassEditorDisabled, _godot_object, class_name); 147 } 148 /** 149 Returns `true` if `property` is disabled in the class specified by `class_name`. When a property is disabled, it won't appear in the inspector when selecting a node that extends the class specified by `class_name`. 150 */ 151 bool isClassPropertyDisabled(in String class_name, in String property) const 152 { 153 checkClassBinding!(typeof(this))(); 154 return ptrcall!(bool)(GDNativeClassBinding.isClassPropertyDisabled, _godot_object, class_name, property); 155 } 156 /** 157 Returns `true` if the `feature` is disabled. When a feature is disabled, it will disappear from the editor entirely. 158 */ 159 bool isFeatureDisabled(in long feature) const 160 { 161 checkClassBinding!(typeof(this))(); 162 return ptrcall!(bool)(GDNativeClassBinding.isFeatureDisabled, _godot_object, feature); 163 } 164 /** 165 Loads an editor feature profile from a file. The file must follow the JSON format obtained by using the feature profile manager's $(B Export) button or the $(D saveToFile) method. 166 */ 167 GodotError loadFromFile(in String path) 168 { 169 checkClassBinding!(typeof(this))(); 170 return ptrcall!(GodotError)(GDNativeClassBinding.loadFromFile, _godot_object, path); 171 } 172 /** 173 Saves the editor feature profile to a file in JSON format. It can then be imported using the feature profile manager's $(B Import) button or the $(D loadFromFile) button. 174 */ 175 GodotError saveToFile(in String path) 176 { 177 checkClassBinding!(typeof(this))(); 178 return ptrcall!(GodotError)(GDNativeClassBinding.saveToFile, _godot_object, path); 179 } 180 /** 181 If `disable` is `true`, disables the class specified by `class_name`. When disabled, the class won't appear in the Create New Node dialog. 182 */ 183 void setDisableClass(in String class_name, in bool disable) 184 { 185 checkClassBinding!(typeof(this))(); 186 ptrcall!(void)(GDNativeClassBinding.setDisableClass, _godot_object, class_name, disable); 187 } 188 /** 189 If `disable` is `true`, disables editing for the class specified by `class_name`. When disabled, the class will still appear in the Create New Node dialog but the inspector will be read-only when selecting a node that extends the class. 190 */ 191 void setDisableClassEditor(in String class_name, in bool disable) 192 { 193 checkClassBinding!(typeof(this))(); 194 ptrcall!(void)(GDNativeClassBinding.setDisableClassEditor, _godot_object, class_name, disable); 195 } 196 /** 197 If `disable` is `true`, disables editing for `property` in the class specified by `class_name`. When a property is disabled, it won't appear in the inspector when selecting a node that extends the class specified by `class_name`. 198 */ 199 void setDisableClassProperty(in String class_name, in String property, in bool disable) 200 { 201 checkClassBinding!(typeof(this))(); 202 ptrcall!(void)(GDNativeClassBinding.setDisableClassProperty, _godot_object, class_name, property, disable); 203 } 204 /** 205 If `disable` is `true`, disables the editor feature specified in `feature`. When a feature is disabled, it will disappear from the editor entirely. 206 */ 207 void setDisableFeature(in long feature, in bool disable) 208 { 209 checkClassBinding!(typeof(this))(); 210 ptrcall!(void)(GDNativeClassBinding.setDisableFeature, _godot_object, feature, disable); 211 } 212 }