-
Notifications
You must be signed in to change notification settings - Fork 446
Expand file tree
/
Copy pathEditorPreferences.cs
More file actions
397 lines (353 loc) · 11.2 KB
/
EditorPreferences.cs
File metadata and controls
397 lines (353 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
using System;
namespace Editor;
public static class EditorPreferences
{
public static bool NotificationPopups
{
get => EditorCookie.Get<bool>( "NotificationPopups", true );
set => EditorCookie.Set( "NotificationPopups", value );
}
public static bool NotificationSounds
{
get => EditorCookie.Get<bool>( "NotificationSounds", true );
set => EditorCookie.Set( "NotificationSounds", value );
}
public static bool ClearConsoleOnPlay
{
get => EditorCookie.Get<bool>( "ClearConsoleOnPlay", false );
set => EditorCookie.Set( "ClearConsoleOnPlay", value );
}
public static bool FullScreenOnPlay
{
get => EditorCookie.Get<bool>( "FullScreenOnPlay", false );
set => EditorCookie.Set( "FullScreenOnPlay", value );
}
[Description( "Use a much faster way of loading code changes if you only change method bodies. Will currently break stack traces of hotloaded methods." )]
public static bool FastHotload
{
get => bool.TryParse( ConsoleSystem.GetValue( "hotload_fast" ), out var val ) ? val : true;
set => ConVarSystem.SetValue( "hotload_fast", value.ToString(), true );
}
public enum NotificationLevel
{
ShowAlways,
ShowOnError,
NeverShow
}
public static NotificationLevel CompileNotifications
{
get => EditorCookie.Get( "CompileNotifications", NotificationLevel.ShowAlways );
set => EditorCookie.Set( "CompileNotifications", value );
}
/// <summary>
/// The amount of seconds to keep a notification open if it's an error
/// </summary>
[Title( "Error Timeout" )]
public static float ErrorNotificationTimeout
{
get => EditorCookie.Get( "ErrorNotificationTimeout", 30.0f );
set => EditorCookie.Set( "ErrorNotificationTimeout", value );
}
/// <summary>
/// Camera field of view
/// </summary>
[Title( "Field Of View" )]
[Range( 1.0f, 180.0f )]
public static float CameraFieldOfView
{
get => EditorCookie.Get( "SceneView.CameraFOV", 80.0f );
set => EditorCookie.Set( "SceneView.CameraFOV", value );
}
/// <summary>
/// The closest thing to render
/// </summary>
[Title( "ZNear" )]
[Range( 1.0f, 10000.0f )]
public static float CameraZNear
{
get => EditorCookie.Get( "SceneView.CameraZNear", 1.0f );
set => EditorCookie.Set( "SceneView.CameraZNear", value );
}
/// <summary>
/// The furthest thing to render
/// </summary>
[Title( "ZFar" )]
[Range( 1.0f, 100000.0f )]
public static float CameraZFar
{
get => EditorCookie.Get( "SceneView.CameraZFar", 100000.0f );
set => EditorCookie.Set( "SceneView.CameraZFar", value );
}
/// <summary>
/// Should we smooth the movement of the camera. This is the smooth time, in seconds. No smoothing
/// feels pretty jarring, but a bit feels nice. Once you get over half a second it makes everything feel
/// slow and horrible.
/// </summary>
[Title( "Movement Smoothing" )]
[Range( 0.0f, 1.0f )]
public static float CameraMovementSmoothing
{
get => EditorCookie.Get( "SceneView.CameraMovementSmoothing", 0.5f );
set => EditorCookie.Set( "SceneView.CameraMovementSmoothing", value );
}
/// <summary>
/// How fast should the camera move
/// </summary>
[Title( "Movement Speed" )]
[Range( 0.0f, 100.0f )]
public static float CameraSpeed
{
get => EditorCookie.Get( "SceneView.CameraSpeed", 1.0f );
set => EditorCookie.Set( "SceneView.CameraSpeed", value );
}
[Title( "Sensitivity" )]
[Range( 0.01f, 5.0f )]
public static float CameraSensitivity
{
get => EditorCookie.Get( "SceneView.CameraSensitivity", 1.0f );
set => EditorCookie.Set( "SceneView.CameraSensitivity", value );
}
[Title( "Create Objects at Origin" )]
public static bool CreateObjectsAtOrigin
{
get => EditorCookie.Get( "SceneView.CreateObjectsAtOrigin", false );
set => EditorCookie.Set( "SceneView.CreateObjectsAtOrigin", value );
}
/// <summary>
/// Should the orbit camera zoom be inverted?
/// <list type="bullet">
/// <item>Inverted: mouse up/left zooms in, mouse down/right zooms out</item>
/// <item>Standard: mouse down/right zooms in, mouse up/left zooms out</item>
/// </list>
/// </summary>
[Title( "Invert Orbit Zoom" )]
public static bool InvertOrbitZoom
{
get => EditorCookie.Get( "SceneView.InvertOrbitZoom", false );
set => EditorCookie.Set( "SceneView.InvertOrbitZoom", value );
}
/// <summary>
/// How fast should the orbit camera zoom?
/// </summary>
[Title( "Zoom Speed" )]
[Description( "Scroll Wheel Zoom" )]
[Range( 0.1f, 2.0f )]
public static float ScrollZoomSpeed
{
get => EditorCookie.Get( "SceneView.ScrollZoomSpeed", 1.0f );
set => EditorCookie.Set( "SceneView.ScrollZoomSpeed", value );
}
/// <summary>
/// Should the camera panning be inverted?
/// </summary>
[Title( "Invert Pan" )]
public static bool CameraInvertPan
{
get => EditorCookie.Get( "SceneView.CameraInvertPan", false );
set => EditorCookie.Set( "SceneView.CameraInvertPan", value );
}
/// <summary>
/// Should we hide the eye cursor when rotating the scene camera?
/// </summary>
[Title( "Hide Cursor on Rotate" )]
public static bool HideRotateCursor
{
get => EditorCookie.Get( "SceneView.HideRotateCursor", false );
set => EditorCookie.Set( "SceneView.HideRotateCursor", value );
}
/// <summary>
/// Should we hide the eye cursor when panning scene camera?
/// </summary>
[Title( "Hide Cursor on Pan" )]
public static bool HidePanCursor
{
get => EditorCookie.Get( "SceneView.HidePanCursor", false );
set => EditorCookie.Set( "SceneView.HidePanCursor", value );
}
/// <summary>
/// Should we hide the eye cursor when orbiting scene camera?
/// </summary>
[Title( "Hide Cursor on Orbit" )]
public static bool HideOrbitCursor
{
get => EditorCookie.Get( "SceneView.HideOrbitCursor", false );
set => EditorCookie.Set( "SceneView.HideOrbitCursor", value );
}
/// <summary>
/// Should we hit the back faces when tracing meshes
/// </summary>
[Title( "Backface Selection" )]
public static bool BackfaceSelection
{
get => EditorCookie.Get( "SceneView.BackfaceSelection", true );
set => EditorCookie.Set( "SceneView.BackfaceSelection", value );
}
/// <summary>
/// Use bounds when dragging in objects
/// </summary>
[Title( "Place Using Bounds" )]
public static bool BoundsPlacement
{
get => EditorCookie.Get( "SceneView.BoundsPlacement", true );
set => EditorCookie.Set( "SceneView.BoundsPlacement", value );
}
/// <summary>
/// When enabled, pasted or duplicated objects are placed under the cursor and aligned to the hit surface.
/// </summary>
[Title( "Paste At Cursor" )]
public static bool PasteAtCursor
{
get => EditorCookie.Get( "SceneView.PasteAtCursor", true );
set => EditorCookie.Set( "SceneView.PasteAtCursor", value );
}
/// <summary>
/// Controls whether a sound is played for any undo/redo operation (success or failure)
/// </summary>
[Title( "Undo/Redo Sounds" )]
public static bool UndoSounds
{
get => EditorCookie.Get( "UndoSounds", true );
set => EditorCookie.Set( "UndoSounds", value );
}
//GENERAL -----------------
public enum NavigationStyleList
{
[Description( "Orbit: Middle Click\nPan: Shift + Middle Click\nZoom: Cntrl + Middle Click" )]
Blender,
[Description( "Orbit: Alt + Left Click\nPan: Alt + Middle Click\nZoom: Alt + Right Click" )]
Maya,
[Description( "Orbit: Alt + Left Click\nPan: Alt + Middle Click\nZoom: Alt + Right Click" )]
Cinema4D
}
public static NavigationStyleList NavigationStyle
{
get => EditorCookie.Get( "NavigationStyle", NavigationStyleList.Blender );
set => EditorCookie.Set( "NavigationStyle", value );
}
[Title( "Hide Cursor" )]
public static bool CameraCursor
{
get => EditorCookie.Get( "CameraCursor", false );
set => EditorCookie.Set( "CameraCursor", value );
}
//ORBIT -------------------
//Invert
[Title( "Invert Orbit X" )]
public static bool OrbitInvertHorizontal
{
get => EditorCookie.Get( "OrbitInvertHorizontal", true );
set => EditorCookie.Set( "OrbitInvertHorizontal", value );
}
[Title( "Invert Orbit Y" )]
public static bool OrbitInvertVertical
{
get => EditorCookie.Get( "OrbitInvertVertical", true );
set => EditorCookie.Set( "OrbitInvertVertical", value );
}
//Sensitivity
[Title( "Orbit sensitivity" )]
[Range( 0.1f, 2.0f )]
public static float OrbitSensitivity
{
get => EditorCookie.Get( "OrbitSensitivity", 1.0f );
set => EditorCookie.Set( "OrbitSensitivity", value );
}
//PAN ---------------------
[Title( "Invert Pan X" )]
public static bool PanInvertHorizontal
{
get => EditorCookie.Get( "PanInvertHorizontal", false );
set => EditorCookie.Set( "PanInvertHorizontal", value );
}
[Title( "Invert Pan Y" )]
public static bool PanInvertVertical
{
get => EditorCookie.Get( "PanInvertVertical", false );
set => EditorCookie.Set( "PanInvertVertical", value );
}
//Sensitivity
[Title( "Pan sensitivity" )]
[Range( 0.1f, 2.0f )]
public static float PanSensitivity
{
get => EditorCookie.Get( "PanSensitivity", 1f );
set => EditorCookie.Set( "PanSensitivity", value );
}
//ZOOM --------------------
[Title( "Invert Zoom" )]
public static bool ZoomInvert
{
get => EditorCookie.Get( "ZoomInvert", false );
set => EditorCookie.Set( "ZoomInvert", value );
}
//Sensitivity
[Title( "Zoom sensitivity" )]
[Range( 0.1f, 2.0f )]
public static float ZoomSensitivity
{
get => EditorCookie.Get( "ZoomSensitivity", 1.0f );
set => EditorCookie.Set( "ZoomSensitivity", value );
}
/// <summary>
/// Overrides for any Editor shortcuts.
/// </summary>
public static Dictionary<string, string> ShortcutOverrides
{
get
{
if ( _shortcutOverrides is null )
{
var json = EditorCookie.GetString( "KeybindOverrides", null );
if ( string.IsNullOrEmpty( json ) )
{
_shortcutOverrides = new Dictionary<string, string>();
}
else
{
_shortcutOverrides = Json.Deserialize<Dictionary<string, string>>( json );
if ( _shortcutOverrides is null )
{
_shortcutOverrides = new Dictionary<string, string>();
}
}
}
return _shortcutOverrides;
}
set
{
_shortcutOverrides = value;
EditorCookie.SetString( "KeybindOverrides", Json.Serialize( value ) );
}
}
private static Dictionary<string, string> _shortcutOverrides;
/// <summary>
/// Whether new game instances spawned by the editor are in windowed mode.
/// </summary>
[Title( "Windowed Local Instances" )]
[Description( "Whether new game instances spawned by the editor are in windowed mode." )]
public static bool WindowedLocalInstances
{
get => ProjectCookie.Get( "NewInstance.Windowed", true );
set => ProjectCookie.Set( "NewInstance.Windowed", value );
}
/// <summary>
/// Command-line arguments for new game instances spawned by the editor.
/// </summary>
[Title( "Command Line Args" )]
[Description( "Command-line arguments for new game instances spawned by the editor." )]
public static string NewInstanceCommandLineArgs
{
get => ProjectCookie.GetString( "NewInstance.Args" );
set => ProjectCookie.SetString( "NewInstance.Args", value );
}
/// <summary>
/// Command-line arguments for new game instances spawned by the editor.
/// </summary>
[Title( "Server Command Line Args" )]
[Description( "Command-line arguments for the dedicated server spawned by the editor." )]
public static string DedicatedServerCommandLineArgs
{
get => ProjectCookie.GetString( "DedicatedServerInstance.Args" );
set => ProjectCookie.SetString( "DedicatedServerInstance.Args", value );
}
}