1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 /** \file
20  * \ingroup DNA
21  *
22  * Structs for each of space type in the user interface.
23  */
24 
25 #pragma once
26 
27 #include "DNA_color_types.h" /* for Histogram */
28 #include "DNA_defs.h"
29 #include "DNA_image_types.h" /* ImageUser */
30 #include "DNA_listBase.h"
31 #include "DNA_movieclip_types.h" /* MovieClipUser */
32 #include "DNA_node_types.h"      /* for bNodeInstanceKey */
33 #include "DNA_outliner_types.h"  /* for TreeStoreElem */
34 #include "DNA_sequence_types.h"  /* SequencerScopes */
35 #include "DNA_vec_types.h"
36 /* Hum ... Not really nice... but needed for spacebuts. */
37 #include "DNA_view2d_types.h"
38 
39 struct BLI_mempool;
40 struct FileLayout;
41 struct FileList;
42 struct FileSelectParams;
43 struct Histogram;
44 struct ID;
45 struct Image;
46 struct Mask;
47 struct MovieClip;
48 struct MovieClipScopes;
49 struct Scopes;
50 struct Script;
51 struct SpaceGraph;
52 struct Text;
53 struct bDopeSheet;
54 struct bGPdata;
55 struct bNodeTree;
56 struct wmOperator;
57 struct wmTimer;
58 
59 /* Defined in `buttons_intern.h`. */
60 typedef struct SpaceProperties_Runtime SpaceProperties_Runtime;
61 
62 /* TODO 2.8: We don't write the global areas to files currently. Uncomment
63  * define to enable writing (should become the default in a bit). */
64 //#define WITH_GLOBAL_AREA_WRITING
65 
66 /* -------------------------------------------------------------------- */
67 /** \name SpaceLink (Base)
68  * \{ */
69 
70 /**
71  * The base structure all the other spaces
72  * are derived (implicitly) from. Would be
73  * good to make this explicit.
74  */
75 typedef struct SpaceLink {
76   struct SpaceLink *next, *prev;
77   /** Storage of regions for inactive spaces. */
78   ListBase regionbase;
79   char spacetype;
80   char link_flag;
81   char _pad0[6];
82 } SpaceLink;
83 
84 /* SpaceLink.link_flag */
85 enum {
86   /**
87    * The space is not a regular one opened through the editor menu (for example) but spawned by an
88    * operator to fulfill some task and then disappear again.
89    * Can typically be cancelled using Escape, but that is handled on the editor level. */
90   SPACE_FLAG_TYPE_TEMPORARY = (1 << 0),
91   /**
92    * Used to mark a space as active but "overlapped" by temporary full-screen spaces. Without this
93    * we wouldn't be able to restore the correct active space after closing temp full-screens
94    * reliably if the same space type is opened twice in a full-screen stack (see T19296). We don't
95    * actually open the same space twice, we have to pretend it is by managing area order carefully.
96    */
97   SPACE_FLAG_TYPE_WAS_ACTIVE = (1 << 1),
98 };
99 
100 /** \} */
101 
102 /* -------------------------------------------------------------------- */
103 /** \name Space Info
104  * \{ */
105 
106 /* Info Header */
107 typedef struct SpaceInfo {
108   SpaceLink *next, *prev;
109   /** Storage of regions for inactive spaces. */
110   ListBase regionbase;
111   char spacetype;
112   char link_flag;
113   char _pad0[6];
114   /* End 'SpaceLink' header. */
115 
116   char rpt_mask;
117   char _pad[7];
118 } SpaceInfo;
119 
120 /* SpaceInfo.rpt_mask */
121 typedef enum eSpaceInfo_RptMask {
122   INFO_RPT_DEBUG = (1 << 0),
123   INFO_RPT_INFO = (1 << 1),
124   INFO_RPT_OP = (1 << 2),
125   INFO_RPT_WARN = (1 << 3),
126   INFO_RPT_ERR = (1 << 4),
127 } eSpaceInfo_RptMask;
128 
129 /** \} */
130 
131 /* -------------------------------------------------------------------- */
132 /** \name Properties Editor
133  * \{ */
134 
135 /* Properties Editor */
136 typedef struct SpaceProperties {
137   SpaceLink *next, *prev;
138   /** Storage of regions for inactive spaces. */
139   ListBase regionbase;
140   char spacetype;
141   char link_flag;
142   char _pad0[6];
143   /* End 'SpaceLink' header. */
144 
145   /** Deprecated, copied to region. */
146   View2D v2d DNA_DEPRECATED;
147 
148   /* For different kinds of property editors (exposed in the space type selector). */
149   short space_subtype;
150 
151   /** Context tabs. */
152   short mainb, mainbo, mainbuser;
153   /** Preview is signal to refresh. */
154   short preview;
155   char _pad[5];
156   char flag;
157 
158   /** Runtime. */
159   void *path;
160   /** Runtime. */
161   int pathflag, dataicon;
162   ID *pinid;
163 
164   void *texuser;
165 
166   /* Doesn't necessarily need to be a pointer, but runtime structs are still written to files. */
167   struct SpaceProperties_Runtime *runtime;
168 } SpaceProperties;
169 
170 /* button defines (deprecated) */
171 #ifdef DNA_DEPRECATED_ALLOW
172 /* warning: the values of these defines are used in SpaceProperties.tabs[8] */
173 /* SpaceProperties.mainb new */
174 #  define CONTEXT_SCENE 0
175 #  define CONTEXT_OBJECT 1
176 // #define CONTEXT_TYPES   2
177 #  define CONTEXT_SHADING 3
178 #  define CONTEXT_EDITING 4
179 // #define CONTEXT_SCRIPT  5
180 // #define CONTEXT_LOGIC   6
181 
182 /* SpaceProperties.mainb old (deprecated) */
183 // #define BUTS_VIEW           0
184 #  define BUTS_LAMP 1
185 #  define BUTS_MAT 2
186 #  define BUTS_TEX 3
187 #  define BUTS_ANIM 4
188 #  define BUTS_WORLD 5
189 #  define BUTS_RENDER 6
190 #  define BUTS_EDIT 7
191 // #define BUTS_GAME           8
192 #  define BUTS_FPAINT 9
193 #  define BUTS_RADIO 10
194 #  define BUTS_SCRIPT 11
195 // #define BUTS_SOUND          12
196 #  define BUTS_CONSTRAINT 13
197 // #define BUTS_EFFECTS        14
198 #endif /* DNA_DEPRECATED_ALLOW */
199 
200 /* SpaceProperties.mainb new */
201 typedef enum eSpaceButtons_Context {
202   BCONTEXT_RENDER = 0,
203   BCONTEXT_SCENE = 1,
204   BCONTEXT_WORLD = 2,
205   BCONTEXT_OBJECT = 3,
206   BCONTEXT_DATA = 4,
207   BCONTEXT_MATERIAL = 5,
208   BCONTEXT_TEXTURE = 6,
209   BCONTEXT_PARTICLE = 7,
210   BCONTEXT_PHYSICS = 8,
211   BCONTEXT_BONE = 9,
212   BCONTEXT_MODIFIER = 10,
213   BCONTEXT_CONSTRAINT = 11,
214   BCONTEXT_BONE_CONSTRAINT = 12,
215   BCONTEXT_VIEW_LAYER = 13,
216   BCONTEXT_TOOL = 14,
217   BCONTEXT_SHADERFX = 15,
218   BCONTEXT_OUTPUT = 16,
219 
220   /* Keep last. */
221   BCONTEXT_TOT,
222 } eSpaceButtons_Context;
223 
224 /* SpaceProperties.flag */
225 typedef enum eSpaceButtons_Flag {
226   /* SB_PRV_OSA = (1 << 0), */ /* UNUSED */
227   SB_PIN_CONTEXT = (1 << 1),
228   SB_FLAG_UNUSED_2 = (1 << 2),
229   SB_FLAG_UNUSED_3 = (1 << 3),
230   /** Do not add materials, particles, etc. in TemplateTextureUser list. */
231   SB_TEX_USER_LIMITED = (1 << 3),
232   SB_SHADING_CONTEXT = (1 << 4),
233 } eSpaceButtons_Flag;
234 
235 /** \} */
236 
237 /* -------------------------------------------------------------------- */
238 /** \name Outliner
239  * \{ */
240 
241 /* Outliner */
242 typedef struct SpaceOutliner {
243   SpaceLink *next, *prev;
244   /** Storage of regions for inactive spaces. */
245   ListBase regionbase;
246   char spacetype;
247   char link_flag;
248   char _pad0[6];
249   /* End 'SpaceLink' header. */
250 
251   /** Deprecated, copied to region. */
252   View2D v2d DNA_DEPRECATED;
253 
254   ListBase tree;
255 
256   /* treestore is an ordered list of TreeStoreElem's from outliner tree;
257    * Note that treestore may contain duplicate elements if element
258    * is used multiple times in outliner tree (e. g. linked objects)
259    * Also note that BLI_mempool can not be read/written in DNA directly,
260    * therefore readfile.c/writefile.c linearize treestore into TreeStore structure
261    */
262   struct BLI_mempool *treestore;
263 
264   /* search stuff */
265   char search_string[64];
266   struct TreeStoreElem search_tse;
267 
268   short flag, outlinevis, storeflag;
269   char search_flags;
270 
271   /** Selection syncing flag (#WM_OUTLINER_SYNC_SELECT_FROM_OBJECT and similar flags). */
272   char sync_select_dirty;
273 
274   int filter;
275   char filter_state;
276   char show_restrict_flags;
277   short filter_id_type;
278 
279   /**
280    * Pointers to treestore elements, grouped by (id, type, nr)
281    * in hashtable for faster searching */
282   void *treehash;
283 } SpaceOutliner;
284 
285 /* SpaceOutliner.flag */
286 typedef enum eSpaceOutliner_Flag {
287   /* SO_TESTBLOCKS = (1 << 0), */         /* UNUSED */
288   /* SO_NEWSELECTED = (1 << 1), */        /* UNUSED */
289   SO_FLAG_UNUSED_1 = (1 << 2),            /* cleared */
290   /* SO_HIDE_KEYINGSETINFO = (1 << 3), */ /* UNUSED */
291   SO_SKIP_SORT_ALPHA = (1 << 4),
292   SO_SYNC_SELECT = (1 << 5),
293   SO_MODE_COLUMN = (1 << 6),
294 } eSpaceOutliner_Flag;
295 
296 /* SpaceOutliner.filter */
297 typedef enum eSpaceOutliner_Filter {
298   SO_FILTER_SEARCH = (1 << 0),   /* Run-time flag. */
299   SO_FILTER_UNUSED_1 = (1 << 1), /* cleared */
300   SO_FILTER_NO_OBJECT = (1 << 2),
301   SO_FILTER_NO_OB_CONTENT = (1 << 3), /* Not only mesh, but modifiers, constraints, ... */
302   SO_FILTER_NO_CHILDREN = (1 << 4),
303 
304   SO_FILTER_UNUSED_5 = (1 << 5), /* cleared */
305   SO_FILTER_NO_OB_MESH = (1 << 6),
306   SO_FILTER_NO_OB_ARMATURE = (1 << 7),
307   SO_FILTER_NO_OB_EMPTY = (1 << 8),
308   SO_FILTER_NO_OB_LAMP = (1 << 9),
309   SO_FILTER_NO_OB_CAMERA = (1 << 10),
310   SO_FILTER_NO_OB_OTHERS = (1 << 11),
311 
312   SO_FILTER_UNUSED_12 = (1 << 12),         /* cleared */
313   SO_FILTER_OB_STATE_VISIBLE = (1 << 13),  /* Not set via DNA. */
314   SO_FILTER_OB_STATE_HIDDEN = (1 << 14),   /* Not set via DNA. */
315   SO_FILTER_OB_STATE_SELECTED = (1 << 15), /* Not set via DNA. */
316   SO_FILTER_OB_STATE_ACTIVE = (1 << 16),   /* Not set via DNA. */
317   SO_FILTER_NO_COLLECTION = (1 << 17),
318 
319   SO_FILTER_ID_TYPE = (1 << 18),
320 } eSpaceOutliner_Filter;
321 
322 #define SO_FILTER_OB_TYPE \
323   (SO_FILTER_NO_OB_MESH | SO_FILTER_NO_OB_ARMATURE | SO_FILTER_NO_OB_EMPTY | \
324    SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_OTHERS)
325 
326 #define SO_FILTER_OB_STATE \
327   (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_HIDDEN | SO_FILTER_OB_STATE_SELECTED | \
328    SO_FILTER_OB_STATE_ACTIVE)
329 
330 #define SO_FILTER_ANY \
331   (SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | SO_FILTER_OB_STATE | \
332    SO_FILTER_NO_COLLECTION)
333 
334 /* SpaceOutliner.filter_state */
335 typedef enum eSpaceOutliner_StateFilter {
336   SO_FILTER_OB_ALL = 0,
337   SO_FILTER_OB_VISIBLE = 1,
338   SO_FILTER_OB_HIDDEN = 2,
339   SO_FILTER_OB_SELECTED = 3,
340   SO_FILTER_OB_ACTIVE = 4,
341 } eSpaceOutliner_StateFilter;
342 
343 /* SpaceOutliner.show_restrict_flags */
344 typedef enum eSpaceOutliner_ShowRestrictFlag {
345   SO_RESTRICT_ENABLE = (1 << 0),
346   SO_RESTRICT_SELECT = (1 << 1),
347   SO_RESTRICT_HIDE = (1 << 2),
348   SO_RESTRICT_VIEWPORT = (1 << 3),
349   SO_RESTRICT_RENDER = (1 << 4),
350   SO_RESTRICT_HOLDOUT = (1 << 5),
351   SO_RESTRICT_INDIRECT_ONLY = (1 << 6),
352 } eSpaceOutliner_Restrict;
353 
354 /* SpaceOutliner.outlinevis */
355 typedef enum eSpaceOutliner_Mode {
356   SO_SCENES = 0,
357   /* SO_CUR_SCENE      = 1, */ /* deprecated! */
358   /* SO_VISIBLE        = 2, */ /* deprecated! */
359   /* SO_SELECTED       = 3, */ /* deprecated! */
360   /* SO_ACTIVE         = 4, */ /* deprecated! */
361   /* SO_SAME_TYPE      = 5, */ /* deprecated! */
362   /* SO_GROUPS         = 6, */ /* deprecated! */
363   SO_LIBRARIES = 7,
364   /* SO_VERSE_SESSION  = 8, */ /* deprecated! */
365   /* SO_VERSE_MS       = 9, */ /* deprecated! */
366   SO_SEQUENCE = 10,
367   SO_DATA_API = 11,
368   /* SO_USERDEF        = 12, */ /* deprecated! */
369   /* SO_KEYMAP         = 13, */ /* deprecated! */
370   SO_ID_ORPHANS = 14,
371   SO_VIEW_LAYER = 15,
372 } eSpaceOutliner_Mode;
373 
374 /* SpaceOutliner.storeflag */
375 typedef enum eSpaceOutliner_StoreFlag {
376   /* cleanup tree */
377   SO_TREESTORE_CLEANUP = (1 << 0),
378   SO_TREESTORE_UNUSED_1 = (1 << 1), /* cleared */
379   /* rebuild the tree, similar to cleanup,
380    * but defer a call to BKE_outliner_treehash_rebuild_from_treestore instead */
381   SO_TREESTORE_REBUILD = (1 << 2),
382 } eSpaceOutliner_StoreFlag;
383 
384 /* outliner search flags (SpaceOutliner.search_flags) */
385 typedef enum eSpaceOutliner_Search_Flags {
386   SO_FIND_CASE_SENSITIVE = (1 << 0),
387   SO_FIND_COMPLETE = (1 << 1),
388   SO_SEARCH_RECURSIVE = (1 << 2),
389 } eSpaceOutliner_Search_Flags;
390 
391 /** \} */
392 
393 /* -------------------------------------------------------------------- */
394 /** \name Graph Editor
395  * \{ */
396 
397 typedef struct SpaceGraph_Runtime {
398   /** #eGraphEdit_Runtime_Flag */
399   char flag;
400   char _pad[7];
401   /** Sampled snapshots of F-Curves used as in-session guides */
402   ListBase ghost_curves;
403 } SpaceGraph_Runtime;
404 
405 /* 'Graph' Editor (formerly known as the IPO Editor) */
406 typedef struct SpaceGraph {
407   SpaceLink *next, *prev;
408   /** Storage of regions for inactive spaces. */
409   ListBase regionbase;
410   char spacetype;
411   char link_flag;
412   char _pad0[6];
413   /* End 'SpaceLink' header. */
414 
415   /** Deprecated, copied to region. */
416   View2D v2d DNA_DEPRECATED;
417 
418   /** Settings for filtering animation data
419    * \note we use a pointer due to code-linking issues. */
420   struct bDopeSheet *ads;
421 
422   /** Mode for the Graph editor (eGraphEdit_Mode). */
423   short mode;
424   /**
425    * Time-transform autosnapping settings for Graph editor
426    * (eAnimEdit_AutoSnap in DNA_action_types.h).
427    */
428   short autosnap;
429   /** Settings for Graph editor (eGraphEdit_Flag). */
430   int flag;
431 
432   /** Time value for cursor (when in drivers mode; animation uses current frame). */
433   float cursorTime;
434   /** Cursor value (y-value, x-value is current frame). */
435   float cursorVal;
436   /** Pivot point for transforms. */
437   int around;
438   char _pad[4];
439 
440   SpaceGraph_Runtime runtime;
441 } SpaceGraph;
442 
443 /* SpaceGraph.flag (Graph Editor Settings) */
444 typedef enum eGraphEdit_Flag {
445   /* OLD DEPRECATED SETTING */
446   /* SIPO_LOCK_VIEW            = (1 << 0), */
447 
448   /* don't merge keyframes on the same frame after a transform */
449   SIPO_NOTRANSKEYCULL = (1 << 1),
450   /* don't show any keyframe handles at all */
451   SIPO_NOHANDLES = (1 << 2),
452   /* SIPO_NODRAWCFRANUM = (1 << 3), DEPRECATED */
453   /* show timing in seconds instead of frames */
454   SIPO_DRAWTIME = (1 << 4),
455   /* only show keyframes for selected F-Curves */
456   SIPO_SELCUVERTSONLY = (1 << 5),
457   /* draw names of F-Curves beside the respective curves */
458   /* NOTE: currently not used */
459   /* SIPO_DRAWNAMES = (1 << 6), */ /* UNUSED */
460   /* show sliders in channels list */
461   SIPO_SLIDERS = (1 << 7),
462   /* don't show the horizontal component of the cursor */
463   SIPO_NODRAWCURSOR = (1 << 8),
464   /* only show handles of selected keyframes */
465   SIPO_SELVHANDLESONLY = (1 << 9),
466   /* don't perform realtime updates */
467   SIPO_NOREALTIMEUPDATES = (1 << 11),
468   /* don't draw curves with AA ("beauty-draw") for performance */
469   SIPO_BEAUTYDRAW_OFF = (1 << 12),
470   /* draw grouped channels with colors set in group */
471   SIPO_NODRAWGCOLORS = (1 << 13),
472   /* normalize curves on display */
473   SIPO_NORMALIZE = (1 << 14),
474   SIPO_NORMALIZE_FREEZE = (1 << 15),
475   /* show markers region */
476   SIPO_SHOW_MARKERS = (1 << 16),
477 } eGraphEdit_Flag;
478 
479 /* SpaceGraph.mode (Graph Editor Mode) */
480 typedef enum eGraphEdit_Mode {
481   /* all animation curves (from all over Blender) */
482   SIPO_MODE_ANIMATION = 0,
483   /* drivers only */
484   SIPO_MODE_DRIVERS = 1,
485 } eGraphEdit_Mode;
486 
487 typedef enum eGraphEdit_Runtime_Flag {
488   /** Temporary flag to force channel selections to be synced with main. */
489   SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC = (1 << 0),
490   /** Temporary flag to force fcurves to recalculate colors. */
491   SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR = (1 << 1),
492 
493   /**
494    * These flags are for the mouse-select code to communicate with the transform code. Click
495    * dragging (tweaking) a handle sets the according left/right flag which transform code uses then
496    * to limit translation to this side. */
497   SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT = (1 << 2),
498   SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT = (1 << 3),
499 } eGraphEdit_Runtime_Flag;
500 
501 /** \} */
502 
503 /* -------------------------------------------------------------------- */
504 /** \name NLA Editor
505  * \{ */
506 
507 /* NLA Editor */
508 typedef struct SpaceNla {
509   struct SpaceLink *next, *prev;
510   /** Storage of regions for inactive spaces. */
511   ListBase regionbase;
512   char spacetype;
513   char link_flag;
514   char _pad0[6];
515   /* End 'SpaceLink' header. */
516 
517   /** This uses the same settings as autosnap for Action Editor. */
518   short autosnap;
519   short flag;
520   char _pad[4];
521 
522   struct bDopeSheet *ads;
523   /** Deprecated, copied to region. */
524   View2D v2d DNA_DEPRECATED;
525 } SpaceNla;
526 
527 /* SpaceNla.flag */
528 typedef enum eSpaceNla_Flag {
529   SNLA_FLAG_UNUSED_0 = (1 << 0),
530   SNLA_FLAG_UNUSED_1 = (1 << 1),
531   /* draw timing in seconds instead of frames */
532   SNLA_DRAWTIME = (1 << 2),
533   SNLA_FLAG_UNUSED_3 = (1 << 3),
534   /* SNLA_NODRAWCFRANUM = (1 << 4), DEPRECATED */
535   /* don't draw influence curves on strips */
536   SNLA_NOSTRIPCURVES = (1 << 5),
537   /* don't perform realtime updates */
538   SNLA_NOREALTIMEUPDATES = (1 << 6),
539   /* don't show local strip marker indications */
540   SNLA_NOLOCALMARKERS = (1 << 7),
541   /* show markers region */
542   SNLA_SHOW_MARKERS = (1 << 8),
543 } eSpaceNla_Flag;
544 
545 /** \} */
546 
547 /* -------------------------------------------------------------------- */
548 /** \name Sequence Editor
549  * \{ */
550 
551 /* Sequencer */
552 typedef struct SpaceSeq {
553   SpaceLink *next, *prev;
554   /** Storage of regions for inactive spaces. */
555   ListBase regionbase;
556   char spacetype;
557   char link_flag;
558   char _pad0[6];
559   /* End 'SpaceLink' header. */
560 
561   /** Deprecated, copied to region. */
562   View2D v2d DNA_DEPRECATED;
563 
564   /** Deprecated: offset for drawing the image preview. */
565   float xof DNA_DEPRECATED, yof DNA_DEPRECATED;
566   /** Weird name for the sequencer subtype (seq, image, luma... etc). */
567   short mainb;
568   /** ESpaceSeq_Proxy_RenderSize. */
569   short render_size;
570   short chanshown;
571   short zebra;
572   int flag;
573   /** Deprecated, handled by View2D now. */
574   float zoom DNA_DEPRECATED;
575   /** See SEQ_VIEW_* below. */
576   int view;
577   int overlay_type;
578   /** Overlay an image of the editing on below the strips. */
579   int draw_flag;
580   char _pad[4];
581 
582   /** Grease-pencil data. */
583   struct bGPdata *gpd;
584 
585   /** Different scoped displayed in space. */
586   struct SequencerScopes scopes;
587 
588   /** Multiview current eye - for internal use. */
589   char multiview_eye;
590   char _pad2[7];
591 } SpaceSeq;
592 
593 /* SpaceSeq.mainb */
594 typedef enum eSpaceSeq_RegionType {
595   SEQ_DRAW_SEQUENCE = 0,
596   SEQ_DRAW_IMG_IMBUF = 1,
597   SEQ_DRAW_IMG_WAVEFORM = 2,
598   SEQ_DRAW_IMG_VECTORSCOPE = 3,
599   SEQ_DRAW_IMG_HISTOGRAM = 4,
600 } eSpaceSeq_RegionType;
601 
602 /* SpaceSeq.draw_flag */
603 typedef enum eSpaceSeq_DrawFlag {
604   SEQ_DRAW_BACKDROP = (1 << 0),
605   SEQ_DRAW_OFFSET_EXT = (1 << 1),
606 } eSpaceSeq_DrawFlag;
607 
608 /* SpaceSeq.flag */
609 typedef enum eSpaceSeq_Flag {
610   SEQ_DRAWFRAMES = (1 << 0),
611   SEQ_MARKER_TRANS = (1 << 1),
612   SEQ_DRAW_COLOR_SEPARATED = (1 << 2),
613   SEQ_SHOW_SAFE_MARGINS = (1 << 3),
614   SEQ_SHOW_GPENCIL = (1 << 4),
615   SEQ_SHOW_FCURVES = (1 << 5),
616   SEQ_USE_ALPHA = (1 << 6),     /* use RGBA display mode for preview */
617   SEQ_ALL_WAVEFORMS = (1 << 7), /* draw all waveforms */
618   SEQ_NO_WAVEFORMS = (1 << 8),  /* draw no waveforms */
619   SEQ_SHOW_SAFE_CENTER = (1 << 9),
620   SEQ_SHOW_METADATA = (1 << 10),
621   SEQ_SHOW_MARKERS = (1 << 11), /* show markers region */
622   SEQ_ZOOM_TO_FIT = (1 << 12),
623 } eSpaceSeq_Flag;
624 
625 /* SpaceSeq.view */
626 typedef enum eSpaceSeq_Displays {
627   SEQ_VIEW_SEQUENCE = 1,
628   SEQ_VIEW_PREVIEW = 2,
629   SEQ_VIEW_SEQUENCE_PREVIEW = 3,
630 } eSpaceSeq_Dispays;
631 
632 /* SpaceSeq.render_size */
633 typedef enum eSpaceSeq_Proxy_RenderSize {
634   SEQ_RENDER_SIZE_NONE = -1,
635   SEQ_RENDER_SIZE_SCENE = 0,
636   SEQ_RENDER_SIZE_PROXY_25 = 25,
637   SEQ_RENDER_SIZE_PROXY_50 = 50,
638   SEQ_RENDER_SIZE_PROXY_75 = 75,
639   SEQ_RENDER_SIZE_PROXY_100 = 99,
640   SEQ_RENDER_SIZE_FULL = 100,
641 } eSpaceSeq_Proxy_RenderSize;
642 
643 typedef struct MaskSpaceInfo {
644   /* **** mask editing **** */
645   struct Mask *mask;
646   /* draw options */
647   char draw_flag;
648   char draw_type;
649   char overlay_mode;
650   char _pad3[5];
651 } MaskSpaceInfo;
652 
653 /* SpaceSeq.mainb */
654 typedef enum eSpaceSeq_OverlayType {
655   SEQ_DRAW_OVERLAY_RECT = 0,
656   SEQ_DRAW_OVERLAY_REFERENCE = 1,
657   SEQ_DRAW_OVERLAY_CURRENT = 2,
658 } eSpaceSeq_OverlayType;
659 
660 /** \} */
661 
662 /* -------------------------------------------------------------------- */
663 /** \name File Selector
664  * \{ */
665 
666 /* Config and Input for File Selector */
667 typedef struct FileSelectParams {
668   /** Title, also used for the text of the execute button. */
669   char title[96];
670   /**
671    * Directory, FILE_MAX_LIBEXTRA, 1024 + 66, this is for extreme case when 1023 length path
672    * needs to be linked in, where foo.blend/Armature need adding
673    */
674   char dir[1090];
675   char file[256];
676 
677   char renamefile[256];
678   short rename_flag;
679 
680   /** List of filetypes to filter (FILE_MAXFILE). */
681   char filter_glob[256];
682 
683   /** Text items name must match to be shown. */
684   char filter_search[64];
685   /** Same as filter, but for ID types (aka library groups). */
686   int _pad0;
687   uint64_t filter_id;
688 
689   /** Active file used for keyboard navigation. */
690   int active_file;
691   /** File under cursor. */
692   int highlight_file;
693   int sel_first;
694   int sel_last;
695   unsigned short thumbnail_size;
696   char _pad1[2];
697 
698   /* short */
699   /** XXXXX for now store type here, should be moved to the operator. */
700   short type;
701   /** Settings for filter, hiding dots files. */
702   short flag;
703   /** Sort order. */
704   short sort;
705   /** Display mode flag. */
706   short display;
707   /** Details toggles (file size, creation date, etc.) */
708   char details_flags;
709   char _pad2[3];
710   /** Filter when (flags & FILE_FILTER) is true. */
711   int filter;
712 
713   /** Max number of levels in dirtree to show at once, 0 to disable recursion. */
714   short recursion_level;
715 
716   /* XXX --- still unused -- */
717   /** Show font preview. */
718   short f_fp;
719   /** String to use for font preview. */
720   char fp_str[8];
721 
722   /* XXX --- end unused -- */
723 } FileSelectParams;
724 
725 /* File Browser */
726 typedef struct SpaceFile {
727   SpaceLink *next, *prev;
728   /** Storage of regions for inactive spaces. */
729   ListBase regionbase;
730   char spacetype;
731   char link_flag;
732   char _pad0[6];
733   /* End 'SpaceLink' header. */
734 
735   char _pad1[4];
736   int scroll_offset;
737 
738   /** Config and input for file select. */
739   struct FileSelectParams *params;
740 
741   /** Holds the list of files to show. */
742   struct FileList *files;
743 
744   /** Holds the list of previous directories to show. */
745   ListBase *folders_prev;
746   /** Holds the list of next directories (pushed from previous) to show. */
747   ListBase *folders_next;
748 
749   /* operator that is invoking fileselect
750    * op->exec() will be called on the 'Load' button.
751    * if operator provides op->cancel(), then this will be invoked
752    * on the cancel button.
753    */
754   struct wmOperator *op;
755 
756   struct wmTimer *smoothscroll_timer;
757   struct wmTimer *previews_timer;
758 
759   struct FileLayout *layout;
760 
761   short recentnr, bookmarknr;
762   short systemnr, system_bookmarknr;
763 } SpaceFile;
764 
765 /* FileSelectParams.display */
766 enum eFileDisplayType {
767   FILE_DEFAULTDISPLAY = 0,
768   FILE_VERTICALDISPLAY = 1,
769   FILE_HORIZONTALDISPLAY = 2,
770   FILE_IMGDISPLAY = 3,
771 };
772 
773 /* FileSelectParams.sort */
774 enum eFileSortType {
775   FILE_SORT_NONE = 0,
776   FILE_SORT_ALPHA = 1,
777   FILE_SORT_EXTENSION = 2,
778   FILE_SORT_TIME = 3,
779   FILE_SORT_SIZE = 4,
780 };
781 
782 /* FileSelectParams.details_flags */
783 enum eFileDetails {
784   FILE_DETAILS_SIZE = (1 << 0),
785   FILE_DETAILS_DATETIME = (1 << 1),
786 };
787 
788 /* these values need to be hardcoded in structs, dna does not recognize defines */
789 /* also defined in BKE */
790 #define FILE_MAXDIR 768
791 #define FILE_MAXFILE 256
792 #define FILE_MAX 1024
793 
794 #define FILE_MAX_LIBEXTRA (FILE_MAX + MAX_ID_NAME)
795 
796 /* filesel types */
797 #define FILE_UNIX 8
798 #define FILE_BLENDER 8 /* don't display relative paths */
799 #define FILE_SPECIAL 9
800 
801 #define FILE_LOADLIB 1
802 #define FILE_MAIN 2
803 
804 /* filesel op property -> action */
805 typedef enum eFileSel_Action {
806   FILE_OPENFILE = 0,
807   FILE_SAVE = 1,
808 } eFileSel_Action;
809 
810 /* sfile->params->flag */
811 /**
812  * \note short flag, also used as 16 lower bits of flags in link/append code
813  * (WM and BLO code area, see #eBLOLibLinkFlags in BLO_readfile.h).
814  */
815 typedef enum eFileSel_Params_Flag {
816   FILE_PARAMS_FLAG_UNUSED_1 = (1 << 0), /* cleared */
817   FILE_RELPATH = (1 << 1),
818   FILE_LINK = (1 << 2),
819   FILE_HIDE_DOT = (1 << 3),
820   FILE_AUTOSELECT = (1 << 4),
821   FILE_ACTIVE_COLLECTION = (1 << 5),
822   FILE_PARAMS_FLAG_UNUSED_6 = (1 << 6), /* cleared */
823   FILE_DIRSEL_ONLY = (1 << 7),
824   FILE_FILTER = (1 << 8),
825   FILE_OBDATA_INSTANCE = (1 << 9),
826   FILE_COLLECTION_INSTANCE = (1 << 10),
827   FILE_SORT_INVERT = (1 << 11),
828   FILE_HIDE_TOOL_PROPS = (1 << 12),
829   FILE_CHECK_EXISTING = (1 << 13),
830 } eFileSel_Params_Flag;
831 
832 /* sfile->params->rename_flag */
833 /* Note: short flag. Defined as bitflags, but currently only used as exclusive status markers... */
834 typedef enum eFileSel_Params_RenameFlag {
835   /** Used when we only have the name of the entry we want to rename,
836    * but not yet access to its matching file entry. */
837   FILE_PARAMS_RENAME_PENDING = 1 << 0,
838   /** We are actually renaming an entry. */
839   FILE_PARAMS_RENAME_ACTIVE = 1 << 1,
840   /** Used to scroll to newly renamed entry. */
841   FILE_PARAMS_RENAME_POSTSCROLL_PENDING = 1 << 2,
842   FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE = 1 << 3,
843 } eFileSel_Params_RenameFlag;
844 
845 /**
846  * Files in the file selector list: file types
847  * Note we could use mere values (instead of bit-flags) for file types themselves,
848  * but since we do not lack of bytes currently.
849  */
850 typedef enum eFileSel_File_Types {
851   FILE_TYPE_BLENDER = (1 << 2),
852   FILE_TYPE_BLENDER_BACKUP = (1 << 3),
853   FILE_TYPE_IMAGE = (1 << 4),
854   FILE_TYPE_MOVIE = (1 << 5),
855   FILE_TYPE_PYSCRIPT = (1 << 6),
856   FILE_TYPE_FTFONT = (1 << 7),
857   FILE_TYPE_SOUND = (1 << 8),
858   FILE_TYPE_TEXT = (1 << 9),
859   FILE_TYPE_ARCHIVE = (1 << 10),
860   /** represents folders for filtering */
861   FILE_TYPE_FOLDER = (1 << 11),
862   FILE_TYPE_BTX = (1 << 12),
863   FILE_TYPE_COLLADA = (1 << 13),
864   /** from filter_glob operator property */
865   FILE_TYPE_OPERATOR = (1 << 14),
866   FILE_TYPE_APPLICATIONBUNDLE = (1 << 15),
867   FILE_TYPE_ALEMBIC = (1 << 16),
868   /** For all kinds of recognized import/export formats. No need for specialized types. */
869   FILE_TYPE_OBJECT_IO = (1 << 17),
870   FILE_TYPE_USD = (1 << 18),
871   FILE_TYPE_VOLUME = (1 << 19),
872 
873   /** An FS directory (i.e. S_ISDIR on its path is true). */
874   FILE_TYPE_DIR = (1 << 30),
875   FILE_TYPE_BLENDERLIB = (1u << 31),
876 } eFileSel_File_Types;
877 
878 /* Selection Flags in filesel: struct direntry, unsigned char selflag */
879 typedef enum eDirEntry_SelectFlag {
880   /*  FILE_SEL_ACTIVE         = (1 << 1), */ /* UNUSED */
881   FILE_SEL_HIGHLIGHTED = (1 << 2),
882   FILE_SEL_SELECTED = (1 << 3),
883   FILE_SEL_EDITING = (1 << 4),
884 } eDirEntry_SelectFlag;
885 
886 /* ***** Related to file browser, but never saved in DNA, only here to help with RNA. ***** */
887 
888 /**
889  * About Unique identifier.
890  *
891  * Stored in a CustomProps once imported.
892  * Each engine is free to use it as it likes - it will be the only thing passed to it by blender to
893  * identify asset/variant/version (concatenating the three into a single 48 bytes one).
894  * Assumed to be 128bits, handled as four integers due to lack of real bytes proptype in RNA :|.
895  */
896 #define ASSET_UUID_LENGTH 16
897 
898 /* Used to communicate with asset engines outside of 'import' context. */
899 #
900 #
901 typedef struct AssetUUID {
902   int uuid_asset[4];
903   int uuid_variant[4];
904   int uuid_revision[4];
905 } AssetUUID;
906 
907 #
908 #
909 typedef struct AssetUUIDList {
910   AssetUUID *uuids;
911   int nbr_uuids;
912   char _pad[4];
913 } AssetUUIDList;
914 
915 /* Container for a revision, only relevant in asset context. */
916 #
917 #
918 typedef struct FileDirEntryRevision {
919   struct FileDirEntryRevision *next, *prev;
920 
921   char *comment;
922   void *_pad;
923 
924   int uuid[4];
925 
926   uint64_t size;
927   int64_t time;
928   /* Temp caching of UI-generated strings... */
929   char size_str[16];
930   char datetime_str[16 + 8];
931 } FileDirEntryRevision;
932 
933 /* Container for a variant, only relevant in asset context.
934  * In case there are no variants, a single one shall exist, with NULL name/description. */
935 #
936 #
937 typedef struct FileDirEntryVariant {
938   struct FileDirEntryVariant *next, *prev;
939 
940   int uuid[4];
941   char *name;
942   char *description;
943 
944   ListBase revisions;
945   int nbr_revisions;
946   int act_revision;
947 } FileDirEntryVariant;
948 
949 /* Container for mere direntry, with additional asset-related data. */
950 #
951 #
952 typedef struct FileDirEntry {
953   struct FileDirEntry *next, *prev;
954 
955   int uuid[4];
956   char *name;
957   char *description;
958 
959   /* Either point to active variant/revision if available, or own entry
960    * (in mere filebrowser case). */
961   FileDirEntryRevision *entry;
962 
963   /** #eFileSel_File_Types. */
964   int typeflag;
965   /** ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
966   int blentype;
967 
968   /* Path to item that is relative to current folder root. */
969   char *relpath;
970   /** Optional argument for shortcuts, aliases etc. */
971   char *redirection_path;
972 
973   /** TODO: make this a real ID pointer? */
974   void *poin;
975   struct ImBuf *image;
976 
977   /* Tags are for info only, most of filtering is done in asset engine. */
978   char **tags;
979   int nbr_tags;
980 
981   short status;
982   short flags;
983   /* eFileAttributes defined in BLI_fileops.h */
984   int attributes;
985 
986   ListBase variants;
987   int nbr_variants;
988   int act_variant;
989 } FileDirEntry;
990 
991 /**
992  * Array of direntries.
993  *
994  * This struct is used in various, different contexts.
995  *
996  * In Filebrowser UI, it stores the total number of available entries, the number of visible
997  * (filtered) entries, and a subset of those in 'entries' ListBase, from idx_start (included)
998  * to idx_end (excluded).
999  *
1000  * In AssetEngine context (i.e. outside of 'browsing' context), entries contain all needed data,
1001  * there is no filtering, so nbr_entries_filtered, entry_idx_start and entry_idx_end
1002  * should all be set to -1.
1003  */
1004 #
1005 #
1006 typedef struct FileDirEntryArr {
1007   ListBase entries;
1008   int nbr_entries;
1009   int nbr_entries_filtered;
1010   int entry_idx_start, entry_idx_end;
1011 
1012   /** FILE_MAX. */
1013   char root[1024];
1014 } FileDirEntryArr;
1015 
1016 #if 0 /* UNUSED */
1017 /* FileDirEntry.status */
1018 enum {
1019   ASSET_STATUS_LOCAL = 1 << 0,  /* If active uuid is available locally/immediately. */
1020   ASSET_STATUS_LATEST = 1 << 1, /* If active uuid is latest available version. */
1021 };
1022 #endif
1023 
1024 /* FileDirEntry.flags */
1025 enum {
1026   FILE_ENTRY_INVALID_PREVIEW = 1 << 0, /* The preview for this entry could not be generated. */
1027 };
1028 
1029 /** \} */
1030 
1031 /* -------------------------------------------------------------------- */
1032 /** \name Image/UV Editor
1033  * \{ */
1034 
1035 /* Image/UV Editor */
1036 
1037 typedef struct SpaceImageOverlay {
1038   int flag;
1039   char _pad[4];
1040 } SpaceImageOverlay;
1041 
1042 typedef struct SpaceImage {
1043   SpaceLink *next, *prev;
1044   /** Storage of regions for inactive spaces. */
1045   ListBase regionbase;
1046   char spacetype;
1047   char link_flag;
1048   char _pad0[6];
1049   /* End 'SpaceLink' header. */
1050 
1051   struct Image *image;
1052   struct ImageUser iuser;
1053 
1054   /** Histogram waveform and vectorscope. */
1055   struct Scopes scopes;
1056   /** Sample line histogram. */
1057   struct Histogram sample_line_hist;
1058 
1059   /** Grease pencil data. */
1060   struct bGPdata *gpd;
1061 
1062   /** UV editor 2d cursor. */
1063   float cursor[2];
1064   /** User defined offset, image is centered. */
1065   float xof, yof;
1066   /** User defined zoom level. */
1067   float zoom;
1068   /** Storage for offset while render drawing. */
1069   float centx, centy;
1070 
1071   /** View/paint/mask. */
1072   char mode;
1073   /* Storage for sub-space types. */
1074   char mode_prev;
1075 
1076   char pin;
1077   char _pad1;
1078   /**
1079    * The currently active tile of the image when tile is enabled,
1080    * is kept in sync with the active faces tile.
1081    */
1082   short curtile;
1083   short lock;
1084   /** UV draw type. */
1085   char dt_uv;
1086   /** Sticky selection type. */
1087   char sticky;
1088   char dt_uvstretch;
1089   char around;
1090 
1091   int flag;
1092 
1093   char pixel_snap_mode;
1094   char _pad2[7];
1095 
1096   float uv_opacity;
1097 
1098   int tile_grid_shape[2];
1099 
1100   MaskSpaceInfo mask_info;
1101   SpaceImageOverlay overlay;
1102 } SpaceImage;
1103 
1104 /* SpaceImage.dt_uv */
1105 typedef enum eSpaceImage_UVDT {
1106   SI_UVDT_OUTLINE = 0,
1107   SI_UVDT_DASH = 1,
1108   SI_UVDT_BLACK = 2,
1109   SI_UVDT_WHITE = 3,
1110 } eSpaceImage_UVDT;
1111 
1112 /* SpaceImage.dt_uvstretch */
1113 typedef enum eSpaceImage_UVDT_Stretch {
1114   SI_UVDT_STRETCH_ANGLE = 0,
1115   SI_UVDT_STRETCH_AREA = 1,
1116 } eSpaceImage_UVDT_Stretch;
1117 
1118 /* SpaceImage.pixel_snap_mode */
1119 typedef enum eSpaceImage_PixelSnapMode {
1120   SI_PIXEL_SNAP_DISABLED = 0,
1121   SI_PIXEL_SNAP_CENTER = 1,
1122   SI_PIXEL_SNAP_CORNER = 2,
1123 } eSpaceImage_Snap_Mode;
1124 
1125 /* SpaceImage.mode */
1126 typedef enum eSpaceImage_Mode {
1127   SI_MODE_VIEW = 0,
1128   SI_MODE_PAINT = 1,
1129   SI_MODE_MASK = 2,
1130   SI_MODE_UV = 3,
1131 } eSpaceImage_Mode;
1132 
1133 /* SpaceImage.sticky
1134  * Note DISABLE should be 0, however would also need to re-arrange icon order,
1135  * also, sticky loc is the default mode so this means we don't need to 'do_versions' */
1136 typedef enum eSpaceImage_Sticky {
1137   SI_STICKY_LOC = 0,
1138   SI_STICKY_DISABLE = 1,
1139   SI_STICKY_VERTEX = 2,
1140 } eSpaceImage_Sticky;
1141 
1142 /* SpaceImage.flag */
1143 typedef enum eSpaceImage_Flag {
1144   SI_FLAG_UNUSED_0 = (1 << 0), /* cleared */
1145   SI_FLAG_UNUSED_1 = (1 << 1), /* cleared */
1146   SI_CLIP_UV = (1 << 2),
1147   SI_FLAG_UNUSED_3 = (1 << 3), /* cleared */
1148   SI_NO_DRAWFACES = (1 << 4),
1149   SI_DRAWSHADOW = (1 << 5),
1150   SI_FLAG_UNUSED_6 = (1 << 6), /* cleared */
1151   SI_FLAG_UNUSED_7 = (1 << 7), /* cleared */
1152   SI_FLAG_UNUSED_8 = (1 << 8), /* cleared */
1153   SI_COORDFLOATS = (1 << 9),
1154   SI_FLAG_UNUSED_10 = (1 << 10),
1155   SI_LIVE_UNWRAP = (1 << 11),
1156   SI_USE_ALPHA = (1 << 12),
1157   SI_SHOW_ALPHA = (1 << 13),
1158   SI_SHOW_ZBUF = (1 << 14),
1159 
1160   /* next two for render window display */
1161   SI_PREVSPACE = (1 << 15),
1162   SI_FULLWINDOW = (1 << 16),
1163 
1164   SI_FLAG_UNUSED_17 = (1 << 17),
1165   SI_FLAG_UNUSED_18 = (1 << 18), /* cleared */
1166 
1167   /**
1168    * This means that the image is drawn until it reaches the view edge,
1169    * in the image view, it's unrelated to UDIM tiles.
1170    */
1171   SI_DRAW_TILE = (1 << 19),
1172   SI_FLAG_UNUSED_20 = (1 << 20), /* cleared */
1173   SI_DRAW_STRETCH = (1 << 21),
1174   SI_SHOW_GPENCIL = (1 << 22),
1175   SI_FLAG_UNUSED_23 = (1 << 23), /* cleared */
1176 
1177   SI_FLAG_UNUSED_24 = (1 << 24),
1178 
1179   SI_NO_DRAW_TEXPAINT = (1 << 25),
1180   SI_DRAW_METADATA = (1 << 26),
1181 
1182   SI_SHOW_R = (1 << 27),
1183   SI_SHOW_G = (1 << 28),
1184   SI_SHOW_B = (1 << 29),
1185 } eSpaceImage_Flag;
1186 
1187 typedef enum eSpaceImageOverlay_Flag {
1188   SI_OVERLAY_SHOW_OVERLAYS = (1 << 0),
1189 } eSpaceImageOverlay_Flag;
1190 
1191 /** \} */
1192 
1193 /* -------------------------------------------------------------------- */
1194 /** \name Text Editor
1195  * \{ */
1196 
1197 typedef struct SpaceText_Runtime {
1198 
1199   /** Actual line height, scaled by dpi. */
1200   int lheight_px;
1201 
1202   /** Runtime computed, character width. */
1203   int cwidth_px;
1204 
1205   /** The handle of the scroll-bar which can be clicked and dragged. */
1206   struct rcti scroll_region_handle;
1207   /** The region for selected text to show in the scrolling area. */
1208   struct rcti scroll_region_select;
1209 
1210   /** Number of digits to show in the line numbers column (when enabled). */
1211   int line_number_display_digits;
1212 
1213   /** Number of lines this window can display (even when they aren't used). */
1214   int viewlines;
1215 
1216   /** Use for drawing scroll-bar & calculating scroll operator motion scaling. */
1217   float scroll_px_per_line;
1218 
1219   /**
1220    * Run-time for scroll increments smaller than a line (smooth scroll).
1221    * Values must be between zero and the line, column width: (cwidth, TXT_LINE_HEIGHT(st)).
1222    */
1223   int scroll_ofs_px[2];
1224 
1225   char _pad1[4];
1226 
1227   /** Cache for faster drawing. */
1228   void *drawcache;
1229 
1230 } SpaceText_Runtime;
1231 
1232 /* Text Editor */
1233 typedef struct SpaceText {
1234   SpaceLink *next, *prev;
1235   /** Storage of regions for inactive spaces. */
1236   ListBase regionbase;
1237   char spacetype;
1238   char link_flag;
1239   char _pad0[6];
1240   /* End 'SpaceLink' header. */
1241 
1242   struct Text *text;
1243 
1244   /** Determines at what line the top of the text is displayed. */
1245   int top;
1246 
1247   /** Determines the horizontal scroll (in columns). */
1248   int left;
1249   char _pad1[4];
1250 
1251   short flags;
1252 
1253   /** User preference, is font_size! */
1254   short lheight;
1255 
1256   int tabnumber;
1257 
1258   /* Booleans */
1259   char wordwrap;
1260   char doplugins;
1261   char showlinenrs;
1262   char showsyntax;
1263   char line_hlight;
1264   char overwrite;
1265   /** Run python while editing, evil. */
1266   char live_edit;
1267   char _pad2[1];
1268 
1269   /** ST_MAX_FIND_STR. */
1270   char findstr[256];
1271   /** ST_MAX_FIND_STR. */
1272   char replacestr[256];
1273 
1274   /** Column number to show right margin at. */
1275   short margin_column;
1276   char _pad3[2];
1277 
1278   /** Keep last. */
1279   SpaceText_Runtime runtime;
1280 } SpaceText;
1281 
1282 /* SpaceText flags (moved from DNA_text_types.h) */
1283 typedef enum eSpaceText_Flags {
1284   /* scrollable */
1285   ST_SCROLL_SELECT = (1 << 0),
1286 
1287   ST_FLAG_UNUSED_4 = (1 << 4), /* dirty */
1288 
1289   ST_FIND_WRAP = (1 << 5),
1290   ST_FIND_ALL = (1 << 6),
1291   ST_SHOW_MARGIN = (1 << 7),
1292   ST_MATCH_CASE = (1 << 8),
1293 
1294   ST_FIND_ACTIVATE = (1 << 9),
1295 } eSpaceText_Flags;
1296 
1297 /* SpaceText.findstr/replacestr */
1298 #define ST_MAX_FIND_STR 256
1299 
1300 /** \} */
1301 
1302 /* -------------------------------------------------------------------- */
1303 /** \name Script View (Obsolete)
1304  * \{ */
1305 
1306 /* Script Runtime Data - Obsolete (pre 2.5) */
1307 typedef struct Script {
1308   ID id;
1309 
1310   void *py_draw;
1311   void *py_event;
1312   void *py_button;
1313   void *py_browsercallback;
1314   void *py_globaldict;
1315 
1316   int flags, lastspace;
1317   /**
1318    * Store the script file here so we can re-run it on loading blender,
1319    * if "Enable Scripts" is on
1320    */
1321   /** 1024 = FILE_MAX. */
1322   char scriptname[1024];
1323   /** 1024 = FILE_MAX. */
1324   char scriptarg[256];
1325 } Script;
1326 #define SCRIPT_SET_NULL(_script) \
1327   _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = \
1328       _script->py_globaldict = NULL; \
1329   _script->flags = 0
1330 
1331 /* Script View - Obsolete (pre 2.5) */
1332 typedef struct SpaceScript {
1333   SpaceLink *next, *prev;
1334   /** Storage of regions for inactive spaces. */
1335   ListBase regionbase;
1336   char spacetype;
1337   char link_flag;
1338   char _pad0[6];
1339   /* End 'SpaceLink' header. */
1340 
1341   struct Script *script;
1342 
1343   short flags, menunr;
1344   char _pad1[4];
1345 
1346   void *but_refs;
1347 } SpaceScript;
1348 
1349 /** \} */
1350 
1351 /* -------------------------------------------------------------------- */
1352 /** \name Nodes Editor
1353  * \{ */
1354 
1355 typedef struct bNodeTreePath {
1356   struct bNodeTreePath *next, *prev;
1357 
1358   struct bNodeTree *nodetree;
1359   /** Base key for nodes in this tree instance. */
1360   bNodeInstanceKey parent_key;
1361   char _pad[4];
1362   /** V2d center point, so node trees can have different offsets in editors. */
1363   float view_center[2];
1364 
1365   /** MAX_NAME. */
1366   char node_name[64];
1367 } bNodeTreePath;
1368 
1369 typedef struct SpaceNode {
1370   SpaceLink *next, *prev;
1371   /** Storage of regions for inactive spaces. */
1372   ListBase regionbase;
1373   char spacetype;
1374   char link_flag;
1375   char _pad0[6];
1376   /* End 'SpaceLink' header. */
1377 
1378   /** Deprecated, copied to region. */
1379   View2D v2d DNA_DEPRECATED;
1380 
1381   /** Context, no need to save in file? well... pinning... */
1382   struct ID *id, *from;
1383   /** Menunr: browse id block in header. */
1384   short flag;
1385   char _pad1[2];
1386   /** Internal state variables. */
1387   float aspect;
1388   char _pad2[4];
1389 
1390   /** Offset for drawing the backdrop. */
1391   float xof, yof;
1392   /** Zoom for backdrop. */
1393   float zoom;
1394   /** Mouse pos for drawing socketless link and adding nodes. */
1395   float cursor[2];
1396 
1397   /**
1398    * XXX nodetree pointer info is all in the path stack now,
1399    * remove later on and use bNodeTreePath instead.
1400    * For now these variables are set when pushing/popping
1401    * from path stack, to avoid having to update all the functions and operators.
1402    * Can be done when design is accepted and everything is properly tested.
1403    */
1404   ListBase treepath;
1405 
1406   struct bNodeTree *nodetree, *edittree;
1407 
1408   /* tree type for the current node tree */
1409   char tree_idname[64];
1410   /** Treetype: as same nodetree->type. */
1411   int treetype DNA_DEPRECATED;
1412   char _pad3[4];
1413 
1414   /** Texfrom object, world or brush. */
1415   short texfrom;
1416   /** Shader from object or world. */
1417   short shaderfrom;
1418   /** Currently on 0/1, for auto compo. */
1419   short recalc;
1420 
1421   /** Direction for offsetting nodes on insertion. */
1422   char insert_ofs_dir;
1423   char _pad4;
1424 
1425   /** Temporary data for modal linking operator. */
1426   ListBase linkdrag;
1427   /* XXX hack for translate_attach op-macros to pass data from transform op to insert_offset op */
1428   /** Temporary data for node insert offset (in UI called Auto-offset). */
1429   struct NodeInsertOfsData *iofsd;
1430 
1431   /** Grease-pencil data. */
1432   struct bGPdata *gpd;
1433 } SpaceNode;
1434 
1435 /* SpaceNode.flag */
1436 typedef enum eSpaceNode_Flag {
1437   SNODE_BACKDRAW = (1 << 1),
1438   SNODE_SHOW_GPENCIL = (1 << 2),
1439   SNODE_USE_ALPHA = (1 << 3),
1440   SNODE_SHOW_ALPHA = (1 << 4),
1441   SNODE_SHOW_R = (1 << 7),
1442   SNODE_SHOW_G = (1 << 8),
1443   SNODE_SHOW_B = (1 << 9),
1444   SNODE_AUTO_RENDER = (1 << 5),
1445   SNODE_FLAG_UNUSED_6 = (1 << 6),   /* cleared */
1446   SNODE_FLAG_UNUSED_10 = (1 << 10), /* cleared */
1447   SNODE_FLAG_UNUSED_11 = (1 << 11), /* cleared */
1448   SNODE_PIN = (1 << 12),
1449   /** automatically offset following nodes in a chain on insertion */
1450   SNODE_SKIP_INSOFFSET = (1 << 13),
1451 } eSpaceNode_Flag;
1452 
1453 /* SpaceNode.texfrom */
1454 typedef enum eSpaceNode_TexFrom {
1455   /* SNODE_TEX_OBJECT   = 0, */
1456   SNODE_TEX_WORLD = 1,
1457   SNODE_TEX_BRUSH = 2,
1458   SNODE_TEX_LINESTYLE = 3,
1459 } eSpaceNode_TexFrom;
1460 
1461 /* SpaceNode.shaderfrom */
1462 typedef enum eSpaceNode_ShaderFrom {
1463   SNODE_SHADER_OBJECT = 0,
1464   SNODE_SHADER_WORLD = 1,
1465   SNODE_SHADER_LINESTYLE = 2,
1466 } eSpaceNode_ShaderFrom;
1467 
1468 /* SpaceNode.insert_ofs_dir */
1469 enum {
1470   SNODE_INSERTOFS_DIR_RIGHT = 0,
1471   SNODE_INSERTOFS_DIR_LEFT = 1,
1472 };
1473 
1474 /** \} */
1475 
1476 /* -------------------------------------------------------------------- */
1477 /** \name Console
1478  * \{ */
1479 
1480 /* Console content */
1481 typedef struct ConsoleLine {
1482   struct ConsoleLine *next, *prev;
1483 
1484   /* keep these 3 vars so as to share free, realloc funcs */
1485   /** Allocated length. */
1486   int len_alloc;
1487   /** Real len - strlen(). */
1488   int len;
1489   char *line;
1490 
1491   int cursor;
1492   /** Only for use when in the 'scrollback' listbase. */
1493   int type;
1494 } ConsoleLine;
1495 
1496 /* ConsoleLine.type */
1497 typedef enum eConsoleLine_Type {
1498   CONSOLE_LINE_OUTPUT = 0,
1499   CONSOLE_LINE_INPUT = 1,
1500   CONSOLE_LINE_INFO = 2, /* autocomp feedback */
1501   CONSOLE_LINE_ERROR = 3,
1502 } eConsoleLine_Type;
1503 
1504 /* Console View */
1505 typedef struct SpaceConsole {
1506   SpaceLink *next, *prev;
1507   /** Storage of regions for inactive spaces. */
1508   ListBase regionbase;
1509   char spacetype;
1510   char link_flag;
1511   char _pad0[6];
1512   /* End 'SpaceLink' header. */
1513 
1514   /* space vars */
1515   int lheight;
1516   char _pad[4];
1517 
1518   /** ConsoleLine; output. */
1519   ListBase scrollback;
1520   /** ConsoleLine; command history, current edited line is the first. */
1521   ListBase history;
1522   char prompt[256];
1523   /** Multiple consoles are possible, not just python. */
1524   char language[32];
1525 
1526   /** Selection offset in bytes. */
1527   int sel_start;
1528   int sel_end;
1529 } SpaceConsole;
1530 
1531 /** \} */
1532 
1533 /* -------------------------------------------------------------------- */
1534 /** \name User Preferences
1535  * \{ */
1536 
1537 typedef struct SpaceUserPref {
1538   SpaceLink *next, *prev;
1539   /** Storage of regions for inactive spaces. */
1540   ListBase regionbase;
1541   char spacetype;
1542   char link_flag;
1543   char _pad0[6];
1544   /* End 'SpaceLink' header. */
1545 
1546   char _pad1[7];
1547   char filter_type;
1548   /** Search term for filtering in the UI. */
1549   char filter[64];
1550 } SpaceUserPref;
1551 
1552 /** \} */
1553 
1554 /* -------------------------------------------------------------------- */
1555 /** \name Motion Tracking
1556  * \{ */
1557 
1558 /* Clip Editor */
1559 typedef struct SpaceClip {
1560   SpaceLink *next, *prev;
1561   /** Storage of regions for inactive spaces. */
1562   ListBase regionbase;
1563   char spacetype;
1564   char link_flag;
1565   char _pad0[6];
1566   /* End 'SpaceLink' header. */
1567 
1568   char _pad1[4];
1569 
1570   /** User defined offset, image is centered. */
1571   float xof, yof;
1572   /** User defined offset from locked position. */
1573   float xlockof, ylockof;
1574   /** User defined zoom level. */
1575   float zoom;
1576 
1577   /** User of clip. */
1578   struct MovieClipUser user;
1579   /** Clip data. */
1580   struct MovieClip *clip;
1581   /** Different scoped displayed in space panels. */
1582   struct MovieClipScopes scopes;
1583 
1584   /** Flags. */
1585   int flag;
1586   /** Editor mode (editing context being displayed). */
1587   short mode;
1588   /** Type of the clip editor view. */
1589   short view;
1590 
1591   /** Length of displaying path, in frames. */
1592   int path_length;
1593 
1594   /* current stabilization data */
1595   /** Pre-composed stabilization data. */
1596   float loc[2], scale, angle;
1597   char _pad[4];
1598   /**
1599    * Current stabilization matrix and the same matrix in unified space,
1600    * defined when drawing and used for mouse position calculation.
1601    */
1602   float stabmat[4][4], unistabmat[4][4];
1603 
1604   /* movie postprocessing */
1605   int postproc_flag;
1606 
1607   /* grease pencil */
1608   short gpencil_src;
1609   char _pad2[2];
1610 
1611   /** Pivot point for transforms. */
1612   int around;
1613   char _pad4[4];
1614 
1615   /** Mask editor 2d cursor. */
1616   float cursor[2];
1617 
1618   MaskSpaceInfo mask_info;
1619 } SpaceClip;
1620 
1621 /* SpaceClip.flag */
1622 typedef enum eSpaceClip_Flag {
1623   SC_SHOW_MARKER_PATTERN = (1 << 0),
1624   SC_SHOW_MARKER_SEARCH = (1 << 1),
1625   SC_LOCK_SELECTION = (1 << 2),
1626   SC_SHOW_TINY_MARKER = (1 << 3),
1627   SC_SHOW_TRACK_PATH = (1 << 4),
1628   SC_SHOW_BUNDLES = (1 << 5),
1629   SC_MUTE_FOOTAGE = (1 << 6),
1630   SC_HIDE_DISABLED = (1 << 7),
1631   SC_SHOW_NAMES = (1 << 8),
1632   SC_SHOW_GRID = (1 << 9),
1633   SC_SHOW_STABLE = (1 << 10),
1634   SC_MANUAL_CALIBRATION = (1 << 11),
1635   SC_SHOW_ANNOTATION = (1 << 12),
1636   SC_SHOW_FILTERS = (1 << 13),
1637   SC_SHOW_GRAPH_FRAMES = (1 << 14),
1638   SC_SHOW_GRAPH_TRACKS_MOTION = (1 << 15),
1639   /*  SC_SHOW_PYRAMID_LEVELS      = (1 << 16), */ /* UNUSED */
1640   SC_LOCK_TIMECURSOR = (1 << 17),
1641   SC_SHOW_SECONDS = (1 << 18),
1642   SC_SHOW_GRAPH_SEL_ONLY = (1 << 19),
1643   SC_SHOW_GRAPH_HIDDEN = (1 << 20),
1644   SC_SHOW_GRAPH_TRACKS_ERROR = (1 << 21),
1645   SC_SHOW_METADATA = (1 << 22),
1646 } eSpaceClip_Flag;
1647 
1648 /* SpaceClip.mode */
1649 typedef enum eSpaceClip_Mode {
1650   SC_MODE_TRACKING = 0,
1651   /*SC_MODE_RECONSTRUCTION = 1,*/ /* DEPRECATED */
1652   /*SC_MODE_DISTORTION = 2,*/     /* DEPRECATED */
1653   SC_MODE_MASKEDIT = 3,
1654 } eSpaceClip_Mode;
1655 
1656 /* SpaceClip.view */
1657 typedef enum eSpaceClip_View {
1658   SC_VIEW_CLIP = 0,
1659   SC_VIEW_GRAPH = 1,
1660   SC_VIEW_DOPESHEET = 2,
1661 } eSpaceClip_View;
1662 
1663 /* SpaceClip.gpencil_src */
1664 typedef enum eSpaceClip_GPencil_Source {
1665   SC_GPENCIL_SRC_CLIP = 0,
1666   SC_GPENCIL_SRC_TRACK = 1,
1667 } eSpaceClip_GPencil_Source;
1668 
1669 /** \} */
1670 
1671 /* -------------------------------------------------------------------- */
1672 /** \name Top Bar
1673  * \{ */
1674 
1675 /* These two lines with # tell makesdna this struct can be excluded.
1676  * Should be: #ifndef WITH_GLOBAL_AREA_WRITING */
1677 #
1678 #
1679 typedef struct SpaceTopBar {
1680   SpaceLink *next, *prev;
1681   /** Storage of regions for inactive spaces. */
1682   ListBase regionbase;
1683   char spacetype;
1684   char link_flag;
1685   char _pad0[6];
1686   /* End 'SpaceLink' header. */
1687 } SpaceTopBar;
1688 
1689 /** \} */
1690 
1691 /* -------------------------------------------------------------------- */
1692 /** \name Status Bar
1693  * \{ */
1694 
1695 /* These two lines with # tell makesdna this struct can be excluded.
1696  * Should be: #ifndef WITH_GLOBAL_AREA_WRITING */
1697 #
1698 #
1699 typedef struct SpaceStatusBar {
1700   SpaceLink *next, *prev;
1701   /** Storage of regions for inactive spaces. */
1702   ListBase regionbase;
1703   char spacetype;
1704   char link_flag;
1705   char _pad0[6];
1706   /* End 'SpaceLink' header. */
1707 } SpaceStatusBar;
1708 
1709 /** \} */
1710 
1711 /* -------------------------------------------------------------------- */
1712 /** \name Space Defines (eSpace_Type)
1713  * \{ */
1714 
1715 /* space types, moved from DNA_screen_types.h */
1716 /* Do NOT change order, append on end. types are hardcoded needed */
1717 typedef enum eSpace_Type {
1718   SPACE_EMPTY = 0,
1719   SPACE_VIEW3D = 1,
1720   SPACE_GRAPH = 2,
1721   SPACE_OUTLINER = 3,
1722   SPACE_PROPERTIES = 4,
1723   SPACE_FILE = 5,
1724   SPACE_IMAGE = 6,
1725   SPACE_INFO = 7,
1726   SPACE_SEQ = 8,
1727   SPACE_TEXT = 9,
1728 #ifdef DNA_DEPRECATED_ALLOW
1729   SPACE_IMASEL = 10, /* Deprecated */
1730   SPACE_SOUND = 11,  /* Deprecated */
1731 #endif
1732   SPACE_ACTION = 12,
1733   SPACE_NLA = 13,
1734   /* TODO: fully deprecate */
1735   SPACE_SCRIPT = 14, /* Deprecated */
1736 #ifdef DNA_DEPRECATED_ALLOW
1737   SPACE_TIME = 15, /* Deprecated */
1738 #endif
1739   SPACE_NODE = 16,
1740 #ifdef DNA_DEPRECATED_ALLOW
1741   SPACE_LOGIC = 17, /* Deprecated */
1742 #endif
1743   SPACE_CONSOLE = 18,
1744   SPACE_USERPREF = 19,
1745   SPACE_CLIP = 20,
1746   SPACE_TOPBAR = 21,
1747   SPACE_STATUSBAR = 22,
1748 
1749 #define SPACE_TYPE_LAST SPACE_STATUSBAR
1750 } eSpace_Type;
1751 
1752 /* use for function args */
1753 #define SPACE_TYPE_ANY -1
1754 
1755 #define IMG_SIZE_FALLBACK 256
1756 
1757 /** \} */
1758