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) 2016 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup DNA
22  */
23 
24 #pragma once
25 
26 #include "DNA_ID.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct GSet;
33 
34 /* CacheFile::flag */
35 enum {
36   CACHEFILE_DS_EXPAND = (1 << 0),
37   CACHEFILE_UNUSED_0 = (1 << 1),
38 };
39 
40 #if 0 /* UNUSED */
41 /* CacheFile::draw_flag */
42 enum {
43   CACHEFILE_KEYFRAME_DRAWN = (1 << 0),
44 };
45 #endif
46 
47 /* Representation of an object's path inside the Alembic file.
48  * Note that this is not a file path. */
49 typedef struct AlembicObjectPath {
50   struct AlembicObjectPath *next, *prev;
51 
52   char path[4096];
53 } AlembicObjectPath;
54 
55 /* CacheFile::velocity_unit
56  * Determines what temporal unit is used to interpret velocity vectors for motion blur effects. */
57 enum {
58   CACHEFILE_VELOCITY_UNIT_FRAME,
59   CACHEFILE_VELOCITY_UNIT_SECOND,
60 };
61 
62 typedef struct CacheFile {
63   ID id;
64   struct AnimData *adt;
65 
66   /** Paths of the objects inside of the Alembic archive referenced by this CacheFile. */
67   ListBase object_paths;
68 
69   /** 1024 = FILE_MAX. */
70   char filepath[1024];
71 
72   char is_sequence;
73   char forward_axis;
74   char up_axis;
75   char override_frame;
76 
77   float scale;
78   /** The frame/time to lookup in the cache file. */
79   float frame;
80   /** The frame offset to subtract. */
81   float frame_offset;
82 
83   /** Animation flag. */
84   short flag;
85   short draw_flag; /* UNUSED */
86 
87   char _pad[3];
88 
89   char velocity_unit;
90   /* Name of the velocity property in the Alembic file. */
91   char velocity_name[64];
92 
93   /* Runtime */
94   struct AbcArchiveHandle *handle;
95   char handle_filepath[1024];
96   struct GSet *handle_readers;
97 } CacheFile;
98 
99 #ifdef __cplusplus
100 }
101 #endif
102