Blender  V3.3
rna_cachefile.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. All rights reserved. */
3 
8 #include "DNA_cachefile_types.h"
9 #include "DNA_scene_types.h"
10 
11 #include "RNA_access.h"
12 #include "RNA_define.h"
13 #include "RNA_enum_types.h"
14 
15 #include "rna_internal.h"
16 
18  {CACHEFILE_VELOCITY_UNIT_SECOND, "SECOND", 0, "Second", ""},
19  {CACHEFILE_VELOCITY_UNIT_FRAME, "FRAME", 0, "Frame", ""},
20  {0, NULL, 0, NULL, NULL},
21 };
22 
23 #ifdef RNA_RUNTIME
24 
25 # include "BLI_math.h"
26 # include "BLI_string.h"
27 
28 # include "BKE_cachefile.h"
29 
30 # include "DEG_depsgraph.h"
31 # include "DEG_depsgraph_build.h"
32 
33 # include "WM_api.h"
34 # include "WM_types.h"
35 
36 # ifdef WITH_ALEMBIC
37 # include "ABC_alembic.h"
38 # endif
39 
40 static void rna_CacheFile_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
41 {
42  CacheFile *cache_file = (CacheFile *)ptr->data;
43 
46 }
47 
48 static void rna_CacheFileLayer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
49 {
50  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
51 
54 }
55 
56 static void rna_CacheFile_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
57 {
58  rna_CacheFile_update(bmain, scene, ptr);
60 }
61 
62 static void rna_CacheFile_object_paths_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
63 {
64  CacheFile *cache_file = (CacheFile *)ptr->data;
65  rna_iterator_listbase_begin(iter, &cache_file->object_paths, NULL);
66 }
67 
68 static PointerRNA rna_CacheFile_active_layer_get(PointerRNA *ptr)
69 {
70  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
72  ptr, &RNA_CacheFileLayer, BKE_cachefile_get_active_layer(cache_file));
73 }
74 
75 static void rna_CacheFile_active_layer_set(PointerRNA *ptr,
76  PointerRNA value,
77  struct ReportList *reports)
78 {
79  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
80  int index = BLI_findindex(&cache_file->layers, value.data);
81  if (index == -1) {
82  BKE_reportf(reports,
83  RPT_ERROR,
84  "Layer '%s' not found in object '%s'",
85  ((CacheFileLayer *)value.data)->filepath,
86  cache_file->id.name + 2);
87  return;
88  }
89 
90  cache_file->active_layer = index + 1;
91 }
92 
93 static int rna_CacheFile_active_layer_index_get(PointerRNA *ptr)
94 {
95  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
96  return cache_file->active_layer - 1;
97 }
98 
99 static void rna_CacheFile_active_layer_index_set(PointerRNA *ptr, int value)
100 {
101  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
102  cache_file->active_layer = value + 1;
103 }
104 
105 static void rna_CacheFile_active_layer_index_range(
106  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
107 {
108  CacheFile *cache_file = (CacheFile *)ptr->owner_id;
109 
110  *min = 0;
111  *max = max_ii(0, BLI_listbase_count(&cache_file->layers) - 1);
112 }
113 
114 static void rna_CacheFileLayer_hidden_flag_set(PointerRNA *ptr, const bool value)
115 {
116  CacheFileLayer *layer = (CacheFileLayer *)ptr->data;
117 
118  if (value) {
119  layer->flag |= CACHEFILE_LAYER_HIDDEN;
120  }
121  else {
122  layer->flag &= ~CACHEFILE_LAYER_HIDDEN;
123  }
124 }
125 
126 static CacheFileLayer *rna_CacheFile_layer_new(CacheFile *cache_file,
127  bContext *C,
128  ReportList *reports,
129  const char *filepath)
130 {
131  CacheFileLayer *layer = BKE_cachefile_add_layer(cache_file, filepath);
132  if (layer == NULL) {
133  BKE_reportf(
134  reports, RPT_ERROR, "Cannot add a layer to CacheFile '%s'", cache_file->id.name + 2);
135  return NULL;
136  }
137 
139  BKE_cachefile_reload(depsgraph, cache_file);
141  return layer;
142 }
143 
144 static void rna_CacheFile_layer_remove(CacheFile *cache_file, bContext *C, PointerRNA *layer_ptr)
145 {
146  CacheFileLayer *layer = layer_ptr->data;
147  BKE_cachefile_remove_layer(cache_file, layer);
149  BKE_cachefile_reload(depsgraph, cache_file);
151 }
152 
153 #else
154 
155 /* cachefile.object_paths */
157 {
158  StructRNA *srna = RNA_def_struct(brna, "CacheObjectPath", NULL);
159  RNA_def_struct_sdna(srna, "CacheObjectPath");
160  RNA_def_struct_ui_text(srna, "Object Path", "Path of an object inside of an Alembic archive");
161  RNA_def_struct_ui_icon(srna, ICON_NONE);
162 
164 
165  PropertyRNA *prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
166  RNA_def_property_ui_text(prop, "Path", "Object path");
167  RNA_def_struct_name_property(srna, prop);
168 
170 }
171 
172 /* cachefile.object_paths */
174 {
175  RNA_def_property_srna(cprop, "CacheObjectPaths");
176  StructRNA *srna = RNA_def_struct(brna, "CacheObjectPaths", NULL);
177  RNA_def_struct_sdna(srna, "CacheFile");
178  RNA_def_struct_ui_text(srna, "Object Paths", "Collection of object paths");
179 }
180 
182 {
183  StructRNA *srna = RNA_def_struct(brna, "CacheFileLayer", NULL);
184  RNA_def_struct_sdna(srna, "CacheFileLayer");
186  srna,
187  "Cache Layer",
188  "Layer of the cache, used to load or override data from the first the first layer");
189 
190  PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
191  RNA_def_property_ui_text(prop, "File Path", "Path to the archive");
192  RNA_def_property_update(prop, 0, "rna_CacheFileLayer_update");
193 
194  prop = RNA_def_property(srna, "hide_layer", PROP_BOOLEAN, PROP_NONE);
196  RNA_def_property_boolean_funcs(prop, NULL, "rna_CacheFileLayer_hidden_flag_set");
197  RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
198  RNA_def_property_ui_text(prop, "Hide Layer", "Do not load data from this layer");
199  RNA_def_property_update(prop, 0, "rna_CacheFileLayer_update");
200 }
201 
203 {
204  RNA_def_property_srna(cprop, "CacheFileLayers");
205  StructRNA *srna = RNA_def_struct(brna, "CacheFileLayers", NULL);
206  RNA_def_struct_sdna(srna, "CacheFile");
207  RNA_def_struct_ui_text(srna, "Cache Layers", "Collection of cache layers");
208 
209  PropertyRNA *prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
210  RNA_def_property_struct_type(prop, "CacheFileLayer");
212  prop, "rna_CacheFile_active_layer_get", "rna_CacheFile_active_layer_set", NULL, NULL);
214  RNA_def_property_ui_text(prop, "Active Layer", "Active layer of the CacheFile");
215 
216  /* Add a layer. */
217  FunctionRNA *func = RNA_def_function(srna, "new", "rna_CacheFile_layer_new");
219  RNA_def_function_ui_description(func, "Add a new layer");
220  PropertyRNA *parm = RNA_def_string(
221  func, "filepath", "File Path", 0, "", "File path to the archive used as a layer");
223  /* Return type. */
224  parm = RNA_def_pointer(func, "layer", "CacheFileLayer", "", "Newly created layer");
225  RNA_def_function_return(func, parm);
226 
227  /* Remove a layer. */
228  func = RNA_def_function(srna, "remove", "rna_CacheFile_layer_remove");
230  RNA_def_function_ui_description(func, "Remove an existing layer from the cache file");
231  parm = RNA_def_pointer(func, "layer", "CacheFileLayer", "", "Layer to remove");
234 }
235 
236 static void rna_def_cachefile(BlenderRNA *brna)
237 {
238  StructRNA *srna = RNA_def_struct(brna, "CacheFile", "ID");
239  RNA_def_struct_sdna(srna, "CacheFile");
240  RNA_def_struct_ui_text(srna, "CacheFile", "");
241  RNA_def_struct_ui_icon(srna, ICON_FILE);
242 
244 
245  PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
246  RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
247  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
248 
249  prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE);
251  prop, "Sequence", "Whether the cache is separated in a series of files");
252  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
253 
254  prop = RNA_def_property(srna, "use_render_procedural", PROP_BOOLEAN, PROP_NONE);
256  prop,
257  "Use Render Engine Procedural",
258  "Display boxes in the viewport as placeholders for the objects, Cycles will use a "
259  "procedural to load the objects during viewport rendering in experimental mode, "
260  "other render engines will also receive a placeholder and should take care of loading the "
261  "Alembic data themselves if possible");
262  RNA_def_property_update(prop, 0, "rna_CacheFile_dependency_update");
263 
264  /* ----------------- For Scene time ------------------- */
265 
266  prop = RNA_def_property(srna, "override_frame", PROP_BOOLEAN, PROP_NONE);
268  "Override Frame",
269  "Whether to use a custom frame for looking up data in the cache file,"
270  " instead of using the current scene frame");
271  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
272 
273  prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_NONE);
274  RNA_def_property_float_sdna(prop, NULL, "frame");
277  "Frame",
278  "The time to use for looking up the data in the cache file,"
279  " or to determine which file to use in a file sequence");
280  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
281 
282  prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
283  RNA_def_property_float_sdna(prop, NULL, "frame_offset");
286  "Frame Offset",
287  "Subtracted from the current frame to use for "
288  "looking up the data in the cache file, or to "
289  "determine which file to use in a file sequence");
290  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
291 
292  /* ----------------- Cache controls ----------------- */
293 
294  prop = RNA_def_property(srna, "use_prefetch", PROP_BOOLEAN, PROP_NONE);
296  prop,
297  "Use Prefetch",
298  "When enabled, the Cycles Procedural will preload animation data for faster updates");
299  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
300 
301  prop = RNA_def_property(srna, "prefetch_cache_size", PROP_INT, PROP_UNSIGNED);
303  prop,
304  "Prefetch Cache Size",
305  "Memory usage limit in megabytes for the Cycles Procedural cache, if the data does not "
306  "fit within the limit, rendering is aborted");
307  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
308 
309  /* ----------------- Axis Conversion ----------------- */
310 
311  prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
312  RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
314  RNA_def_property_ui_text(prop, "Forward", "");
315  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
316 
317  prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
318  RNA_def_property_enum_sdna(prop, NULL, "up_axis");
320  RNA_def_property_ui_text(prop, "Up", "");
321  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
322 
323  prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
324  RNA_def_property_float_sdna(prop, NULL, "scale");
325  RNA_def_property_range(prop, 0.0001f, 1000.0f);
327  prop,
328  "Scale",
329  "Value by which to enlarge or shrink the object with respect to the world's origin"
330  " (only applicable through a Transform Cache constraint)");
331  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
332 
333  /* object paths */
334  prop = RNA_def_property(srna, "object_paths", PROP_COLLECTION, PROP_NONE);
335  RNA_def_property_collection_sdna(prop, NULL, "object_paths", NULL);
337  "rna_CacheFile_object_paths_begin",
338  "rna_iterator_listbase_next",
339  "rna_iterator_listbase_end",
340  "rna_iterator_listbase_get",
341  NULL,
342  NULL,
343  NULL,
344  NULL);
345  RNA_def_property_struct_type(prop, "CacheObjectPath");
346  RNA_def_property_srna(prop, "CacheObjectPaths");
348  prop, "Object Paths", "Paths of the objects inside the Alembic archive");
349 
350  /* ----------------- Alembic Velocity Attribute ----------------- */
351 
352  prop = RNA_def_property(srna, "velocity_name", PROP_STRING, PROP_NONE);
354  "Velocity Attribute",
355  "Name of the Alembic attribute used for generating motion blur data");
356  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
358 
359  prop = RNA_def_property(srna, "velocity_unit", PROP_ENUM, PROP_NONE);
360  RNA_def_property_enum_sdna(prop, NULL, "velocity_unit");
363  prop,
364  "Velocity Unit",
365  "Define how the velocity vectors are interpreted with regard to time, 'frame' means "
366  "the delta time is 1 frame, 'second' means the delta time is 1 / FPS");
367  RNA_def_property_update(prop, 0, "rna_CacheFile_update");
369 
370  /* ----------------- Alembic Layers ----------------- */
371 
372  prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
373  RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
374  RNA_def_property_struct_type(prop, "CacheFileLayer");
376  RNA_def_property_ui_text(prop, "Cache Layers", "Layers of the cache");
377  rna_def_cachefile_layers(brna, prop);
378 
379  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
381  RNA_def_property_int_sdna(prop, NULL, "active_layer");
383  "rna_CacheFile_active_layer_index_get",
384  "rna_CacheFile_active_layer_index_set",
385  "rna_CacheFile_active_layer_index_range");
386 
388 
389  rna_def_cachefile_object_paths(brna, prop);
390 
392 }
393 
395 {
396  rna_def_cachefile(brna);
399 }
400 
401 #endif
struct CacheFileLayer * BKE_cachefile_add_layer(struct CacheFile *cache_file, const char filename[1024])
Definition: cachefile.c:432
void BKE_cachefile_remove_layer(struct CacheFile *cache_file, struct CacheFileLayer *layer)
Definition: cachefile.c:457
struct CacheFileLayer * BKE_cachefile_get_active_layer(struct CacheFile *cache_file)
Definition: cachefile.c:452
void BKE_cachefile_reload(struct Depsgraph *depsgraph, struct CacheFile *cache_file)
Definition: cachefile.c:331
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
#define UNUSED(x)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ CACHEFILE_LAYER_HIDDEN
@ CACHEFILE_VELOCITY_UNIT_SECOND
@ CACHEFILE_VELOCITY_UNIT_FRAME
#define MAXFRAME
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:662
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_FILEPATH
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:25
#define ND_DRAW
Definition: WM_types.h:410
#define NC_OBJECT
Definition: WM_types.h:329
Scene scene
const Depsgraph * depsgraph
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
Definition: rna_access.c:4729
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void rna_def_animdata_common(StructRNA *srna)
const EnumPropertyItem rna_enum_velocity_unit_items[]
Definition: rna_cachefile.c:17
void RNA_def_cachefile(BlenderRNA *brna)
static void rna_def_cachefile_layer(BlenderRNA *brna)
static void rna_def_cachefile(BlenderRNA *brna)
static void rna_def_alembic_object_path(BlenderRNA *brna)
static void rna_def_cachefile_layers(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_cachefile_object_paths(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_define_lib_overridable(const bool make_overridable)
Definition: rna_define.c:742
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1508
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
const EnumPropertyItem rna_enum_object_axis_items[]
Definition: rna_object.c:297
#define min(a, b)
Definition: sort.c:35
ListBase object_paths
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480