~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/makesrna/intern/rna_main_api.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: rna_main_api.c 30277 2010-07-13 16:53:17Z campbellbarton $
3
 
 *
 
1
/*
4
2
 * ***** BEGIN GPL LICENSE BLOCK *****
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or
7
5
 * modify it under the terms of the GNU General Public License
8
6
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version. 
 
7
 * of the License, or (at your option) any later version.
10
8
 *
11
9
 * This program is distributed in the hope that it will be useful,
12
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
18
 * The Original Code is Copyright (C) 2009 Blender Foundation.
21
19
 * All rights reserved.
22
20
 *
23
 
 * 
 
21
 *
24
22
 * Contributor(s): Blender Foundation
25
23
 *
26
24
 * ***** END GPL LICENSE BLOCK *****
27
25
 */
28
26
 
 
27
/** \file blender/makesrna/intern/rna_main_api.c
 
28
 *  \ingroup RNA
 
29
 */
 
30
 
 
31
 
29
32
#include <stdlib.h>
30
33
#include <stdio.h>
31
34
#include <errno.h>
33
36
#include "RNA_define.h"
34
37
#include "RNA_access.h"
35
38
#include "RNA_enum_types.h"
 
39
#include "rna_internal.h"
36
40
 
37
41
#include "BKE_utildefines.h"
38
42
 
39
43
#ifdef RNA_RUNTIME
40
44
 
41
45
#include "BKE_main.h"
 
46
#include "BKE_camera.h"
42
47
#include "BKE_curve.h"
43
48
#include "BKE_mesh.h"
44
49
#include "BKE_armature.h"
 
50
#include "BKE_lamp.h"
45
51
#include "BKE_library.h"
46
52
#include "BKE_object.h"
47
53
#include "BKE_material.h"
58
64
#include "BKE_particle.h"
59
65
#include "BKE_font.h"
60
66
#include "BKE_node.h"
 
67
#include "BKE_depsgraph.h"
 
68
#include "BKE_speaker.h"
 
69
#include "BKE_movieclip.h"
61
70
 
62
71
#include "DNA_armature_types.h"
63
72
#include "DNA_camera_types.h"
66
75
#include "DNA_material_types.h"
67
76
#include "DNA_mesh_types.h"
68
77
#include "DNA_object_types.h"
 
78
#include "DNA_speaker_types.h"
69
79
#include "DNA_text_types.h"
70
80
#include "DNA_texture_types.h"
71
81
#include "DNA_group_types.h"
76
86
#include "DNA_particle_types.h"
77
87
#include "DNA_vfont_types.h"
78
88
#include "DNA_node_types.h"
 
89
#include "DNA_movieclip_types.h"
79
90
 
80
91
#include "ED_screen.h"
81
92
 
82
 
Tex *rna_Main_add_texture(Main *bmain, char *name)
83
 
{
84
 
        return add_texture(name);
85
 
}
86
 
 
87
 
Camera *rna_Main_cameras_new(Main *bmain, char* name)
88
 
{
89
 
        return add_camera(name);
 
93
Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
 
94
{
 
95
        ID *id = add_camera(name);
 
96
        id_us_min(id);
 
97
        return (Camera *)id;
90
98
}
91
99
void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
92
100
{
93
 
        if(ID_REAL_USERS(camera) <= 0)
 
101
        if (ID_REAL_USERS(camera) <= 0)
94
102
                free_libblock(&bmain->camera, camera);
95
103
        else
96
 
                BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d.", camera->id.name+2, ID_REAL_USERS(camera));
 
104
                BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d",
 
105
                            camera->id.name+2, ID_REAL_USERS(camera));
97
106
 
98
107
        /* XXX python now has invalid pointer? */
99
108
}
100
109
 
101
 
Scene *rna_Main_scenes_new(Main *bmain, char* name)
 
110
Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
102
111
{
103
112
        return add_scene(name);
104
113
}
105
114
void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
106
115
{
107
 
        /* dont call free_libblock(...) directly */
 
116
        /* don't call free_libblock(...) directly */
108
117
        Scene *newscene;
109
118
 
110
 
        if(scene->id.prev)
111
 
                newscene= scene->id.prev;
112
 
        else if(scene->id.next)
113
 
                newscene= scene->id.next;
 
119
        if (scene->id.prev)
 
120
                newscene = scene->id.prev;
 
121
        else if (scene->id.next)
 
122
                newscene = scene->id.next;
114
123
        else {
115
 
                BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed.", scene->id.name+2);
 
124
                BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed", scene->id.name+2);
116
125
                return;
117
126
        }
118
127
 
119
 
        ED_screen_set_scene(C, newscene);
 
128
        if (CTX_wm_screen(C)->scene == scene)
 
129
                ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
120
130
 
121
131
        unlink_scene(bmain, scene, newscene);
122
132
}
123
133
 
124
 
Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *data)
 
134
Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
125
135
{
126
136
        Object *ob;
127
 
        int type= OB_EMPTY;
128
 
        if(data) {
129
 
                switch(GS(data->name)) {
 
137
        int type = OB_EMPTY;
 
138
        if (data) {
 
139
                switch (GS(data->name)) {
130
140
                        case ID_ME:
131
 
                                type= OB_MESH;
 
141
                                type = OB_MESH;
132
142
                                break;
133
143
                        case ID_CU:
134
 
                                type= curve_type((struct Curve *)data);
 
144
                                type = curve_type((struct Curve *)data);
135
145
                                break;
136
146
                        case ID_MB:
137
 
                                type= OB_MBALL;
 
147
                                type = OB_MBALL;
138
148
                                break;
139
149
                        case ID_LA:
140
 
                                type= OB_LAMP;
 
150
                                type = OB_LAMP;
 
151
                                break;
 
152
                        case ID_SPK:
 
153
                                type = OB_SPEAKER;
141
154
                                break;
142
155
                        case ID_CA:
143
 
                                type= OB_CAMERA;
 
156
                                type = OB_CAMERA;
144
157
                                break;
145
158
                        case ID_LT:
146
 
                                type= OB_LATTICE;
 
159
                                type = OB_LATTICE;
147
160
                                break;
148
161
                        case ID_AR:
149
 
                                type= OB_ARMATURE;
 
162
                                type = OB_ARMATURE;
150
163
                                break;
151
164
                        default:
152
165
                        {
153
166
                                const char *idname;
154
 
                                if(RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
155
 
                                        idname= "UNKNOWN";
 
167
                                if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
 
168
                                        idname = "UNKNOWN";
156
169
 
157
 
                                BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object.", idname);
 
170
                                BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object", idname);
158
171
                                return NULL;
159
172
                        }
160
173
                }
161
174
 
162
 
                data->us++;
 
175
                id_us_plus(data);
163
176
        }
164
177
 
165
 
        ob= add_only_object(type, name);
166
 
        ob->id.us--;
 
178
        ob = add_only_object(type, name);
 
179
        id_us_min(&ob->id);
167
180
 
168
 
        ob->data= data;
 
181
        ob->data = data;
169
182
        test_object_materials(ob->data);
170
183
        
171
184
        return ob;
173
186
 
174
187
void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
175
188
{
176
 
        /*
177
 
          NOTE: the following example shows when this function should _not_ be called
178
 
 
179
 
          ob = bpy.data.add_object()
180
 
          scene.add_object(ob)
181
 
 
182
 
          # ob is freed here
183
 
          scene.remove_object(ob)
184
 
 
185
 
          # don't do this since ob is already freed!
186
 
          bpy.data.remove_object(ob)
187
 
        */
188
 
        if(ID_REAL_USERS(object) <= 0)
 
189
        if (ID_REAL_USERS(object) <= 0) {
 
190
                unlink_object(object); /* needed or ID pointers to this are not cleared */
189
191
                free_libblock(&bmain->object, object);
190
 
        else
191
 
                BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d.", object->id.name+2, ID_REAL_USERS(object));
 
192
        }
 
193
        else {
 
194
                BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d",
 
195
                            object->id.name+2, ID_REAL_USERS(object));
 
196
        }
192
197
}
193
198
 
194
 
struct Material *rna_Main_materials_new(Main *bmain, char* name)
 
199
struct Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
195
200
{
196
 
        return add_material(name);
 
201
        ID *id = (ID *)add_material(name);
 
202
        id_us_min(id);
 
203
        return (Material *)id;
197
204
}
198
205
void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
199
206
{
200
 
        if(ID_REAL_USERS(material) <= 0)
 
207
        if (ID_REAL_USERS(material) <= 0)
201
208
                free_libblock(&bmain->mat, material);
202
209
        else
203
 
                BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d.", material->id.name+2, ID_REAL_USERS(material));
 
210
                BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
 
211
                            material->id.name+2, ID_REAL_USERS(material));
204
212
 
205
213
        /* XXX python now has invalid pointer? */
206
214
}
207
215
 
208
 
// XXX, commended for now, need to see how this can be used with node groups.
209
 
struct bNodeTree *rna_Main_nodetree_new(Main *bmain, int type)
 
216
struct bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
210
217
{
211
 
        bNodeTree *tree = ntreeAddTree(type);
212
 
        tree->id.us--;
 
218
        bNodeTree *tree = ntreeAddTree(name, type, NODE_GROUP);
 
219
 
 
220
        id_us_min(&tree->id);
213
221
        return tree;
214
222
}
215
223
void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
216
224
{
217
 
        if(ID_REAL_USERS(tree) <= 0)
 
225
        if (ID_REAL_USERS(tree) <= 0)
218
226
                free_libblock(&bmain->nodetree, tree);
219
227
        else
220
 
                BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d.", tree->id.name+2, ID_REAL_USERS(tree));
 
228
                BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
 
229
                            tree->id.name+2, ID_REAL_USERS(tree));
221
230
 
222
231
        /* XXX python now has invalid pointer? */
223
232
}
224
233
 
225
 
Mesh *rna_Main_meshes_new(Main *bmain, char* name)
 
234
Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
226
235
{
227
 
        Mesh *me= add_mesh(name);
228
 
        me->id.us--;
 
236
        Mesh *me = add_mesh(name);
 
237
        id_us_min(&me->id);
229
238
        return me;
230
239
}
231
240
void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
232
241
{
233
 
        if(ID_REAL_USERS(mesh) <= 0)
 
242
        if (ID_REAL_USERS(mesh) <= 0)
234
243
                free_libblock(&bmain->mesh, mesh);
235
244
        else
236
 
                BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d.", mesh->id.name+2, ID_REAL_USERS(mesh));
 
245
                BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
 
246
                            mesh->id.name+2, ID_REAL_USERS(mesh));
237
247
 
238
248
        /* XXX python now has invalid pointer? */
239
249
}
240
250
 
241
 
Lamp *rna_Main_lamps_new(Main *bmain, char* name)
 
251
Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
242
252
{
243
 
        Lamp *lamp= add_lamp(name);
244
 
        lamp->id.us--;
 
253
        Lamp *lamp = add_lamp(name);
 
254
        lamp->type = type;
 
255
        id_us_min(&lamp->id);
245
256
        return lamp;
246
257
}
247
258
void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
248
259
{
249
 
        if(ID_REAL_USERS(lamp) <= 0)
 
260
        if (ID_REAL_USERS(lamp) <= 0)
250
261
                free_libblock(&bmain->lamp, lamp);
251
262
        else
252
 
                BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d.", lamp->id.name+2, ID_REAL_USERS(lamp));
 
263
                BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
 
264
                            lamp->id.name+2, ID_REAL_USERS(lamp));
253
265
 
254
266
        /* XXX python now has invalid pointer? */
255
267
}
256
268
 
257
 
Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int alpha, int float_buffer)
 
269
Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
258
270
{
259
 
        float color[4]= {0.0, 0.0, 0.0, 1.0};
260
 
        Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
261
 
        image->id.us--;
 
271
        float color[4] = {0.0, 0.0, 0.0, 1.0};
 
272
        Image *image = BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
 
273
        id_us_min(&image->id);
262
274
        return image;
263
275
}
264
 
Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath)
 
276
Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
265
277
{
266
278
        Image *ima;
267
279
 
268
 
        errno= 0;
269
 
        ima= BKE_add_image_file(filepath, 0);
 
280
        errno = 0;
 
281
        ima = BKE_add_image_file(filepath);
270
282
 
271
 
        if(!ima)
272
 
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format");
 
283
        if (!ima)
 
284
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 
285
                            errno ? strerror(errno) : "Unsupported image format");
273
286
 
274
287
        return ima;
275
288
}
276
289
void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
277
290
{
278
 
        if(ID_REAL_USERS(image) <= 0)
 
291
        if (ID_REAL_USERS(image) <= 0)
279
292
                free_libblock(&bmain->image, image);
280
293
        else
281
 
                BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image));
 
294
                BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
 
295
                            image->id.name+2, ID_REAL_USERS(image));
282
296
 
283
297
        /* XXX python now has invalid pointer? */
284
298
}
285
299
 
286
 
Lattice *rna_Main_lattices_new(Main *bmain, char* name)
 
300
Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
287
301
{
288
 
        Lattice *lt= add_lattice(name);
289
 
        lt->id.us--;
 
302
        Lattice *lt = add_lattice(name);
 
303
        id_us_min(&lt->id);
290
304
        return lt;
291
305
}
292
306
void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
293
307
{
294
 
        if(ID_REAL_USERS(lt) <= 0)
 
308
        if (ID_REAL_USERS(lt) <= 0)
295
309
                free_libblock(&bmain->latt, lt);
296
310
        else
297
 
                BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d.", lt->id.name+2, ID_REAL_USERS(lt));
 
311
                BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
 
312
                            lt->id.name+2, ID_REAL_USERS(lt));
298
313
}
299
314
 
300
 
Curve *rna_Main_curves_new(Main *bmain, char* name, int type)
 
315
Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
301
316
{
302
 
        Curve *cu= add_curve(name, type);
303
 
        cu->id.us--;
 
317
        Curve *cu = add_curve(name, type);
 
318
        id_us_min(&cu->id);
304
319
        return cu;
305
320
}
306
321
void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
307
322
{
308
 
        if(ID_REAL_USERS(cu) <= 0)
 
323
        if (ID_REAL_USERS(cu) <= 0)
309
324
                free_libblock(&bmain->curve, cu);
310
325
        else
311
 
                BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d.", cu->id.name+2, ID_REAL_USERS(cu));
 
326
                BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
 
327
                            cu->id.name+2, ID_REAL_USERS(cu));
312
328
}
313
329
 
314
 
MetaBall *rna_Main_metaballs_new(Main *bmain, char* name)
 
330
MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
315
331
{
316
 
        MetaBall *mb= add_mball(name);
317
 
        mb->id.us--;
 
332
        MetaBall *mb = add_mball(name);
 
333
        id_us_min(&mb->id);
318
334
        return mb;
319
335
}
320
336
void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
321
337
{
322
 
        if(ID_REAL_USERS(mb) <= 0)
 
338
        if (ID_REAL_USERS(mb) <= 0)
323
339
                free_libblock(&bmain->mball, mb);
324
340
        else
325
 
                BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb));
 
341
                BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
 
342
                            mb->id.name+2, ID_REAL_USERS(mb));
326
343
}
327
344
 
328
 
VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, char *filepath)
 
345
VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
329
346
{
330
347
        VFont *font;
331
348
 
332
 
        errno= 0;
333
 
        font= load_vfont(filepath);
 
349
        errno = 0;
 
350
        font = load_vfont(bmain, filepath);
334
351
 
335
 
        if(!font)
336
 
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported font format");
 
352
        if (!font)
 
353
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 
354
                            errno ? strerror(errno) : "Unsupported font format");
337
355
 
338
356
        return font;
339
357
 
340
358
}
341
359
void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
342
360
{
343
 
        if(ID_REAL_USERS(vfont) <= 0)
 
361
        if (ID_REAL_USERS(vfont) <= 0)
344
362
                free_libblock(&bmain->vfont, vfont);
345
363
        else
346
 
                BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont));
 
364
                BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
 
365
                            vfont->id.name+2, ID_REAL_USERS(vfont));
347
366
 
348
367
        /* XXX python now has invalid pointer? */
349
368
}
350
369
 
351
 
Tex *rna_Main_textures_new(Main *bmain, char* name)
 
370
Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
352
371
{
353
 
        Tex *tex= add_texture(name);
354
 
        tex->id.us--;
 
372
        Tex *tex = add_texture(name);
 
373
        tex_set_type(tex, type);
 
374
        id_us_min(&tex->id);
355
375
        return tex;
356
376
}
357
377
void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
358
378
{
359
 
        if(ID_REAL_USERS(tex) <= 0)
 
379
        if (ID_REAL_USERS(tex) <= 0)
360
380
                free_libblock(&bmain->tex, tex);
361
381
        else
362
 
                BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex));
 
382
                BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
 
383
                            tex->id.name+2, ID_REAL_USERS(tex));
363
384
}
364
385
 
365
 
Brush *rna_Main_brushes_new(Main *bmain, char* name)
 
386
Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
366
387
{
367
388
        Brush *brush = add_brush(name);
368
 
        brush->id.us--;
 
389
        id_us_min(&brush->id);
369
390
        return brush;
370
391
}
371
392
void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
372
393
{
373
 
        if(ID_REAL_USERS(brush) <= 0)
 
394
        if (ID_REAL_USERS(brush) <= 0)
374
395
                free_libblock(&bmain->brush, brush);
375
396
        else
376
 
                BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush));
 
397
                BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
 
398
                            brush->id.name+2, ID_REAL_USERS(brush));
377
399
}
378
400
 
379
 
World *rna_Main_worlds_new(Main *bmain, char* name)
 
401
World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
380
402
{
381
403
        World *world = add_world(name);
382
 
        world->id.us--;
 
404
        id_us_min(&world->id);
383
405
        return world;
384
406
}
385
407
void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
386
408
{
387
 
        if(ID_REAL_USERS(world) <= 0)
 
409
        if (ID_REAL_USERS(world) <= 0)
388
410
                free_libblock(&bmain->world, world);
389
411
        else
390
 
                BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world));
 
412
                BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
 
413
                            world->id.name+2, ID_REAL_USERS(world));
391
414
}
392
415
 
393
 
Group *rna_Main_groups_new(Main *bmain, char* name)
 
416
Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
394
417
{
395
418
        return add_group(name);
396
419
}
397
 
void rna_Main_groups_remove(Main *bmain, ReportList *reports, Group *group)
 
420
void rna_Main_groups_remove(Main *bmain, Group *group)
398
421
{
399
422
        unlink_group(group);
400
423
        free_libblock(&bmain->group, group);
401
424
        /* XXX python now has invalid pointer? */
402
425
}
403
426
 
404
 
Text *rna_Main_texts_new(Main *bmain, char* name)
 
427
Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
 
428
{
 
429
        Speaker *speaker = add_speaker(name);
 
430
        id_us_min(&speaker->id);
 
431
        return speaker;
 
432
}
 
433
void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker)
 
434
{
 
435
        if (ID_REAL_USERS(speaker) <= 0)
 
436
                free_libblock(&bmain->speaker, speaker);
 
437
        else
 
438
                BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
 
439
                            speaker->id.name+2, ID_REAL_USERS(speaker));
 
440
 
 
441
        /* XXX python now has invalid pointer? */
 
442
}
 
443
 
 
444
Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
405
445
{
406
446
        return add_empty_text(name);
407
447
}
408
 
void rna_Main_texts_remove(Main *bmain, ReportList *reports, Text *text)
 
448
void rna_Main_texts_remove(Main *bmain, Text *text)
409
449
{
410
450
        unlink_text(bmain, text);
411
451
        free_libblock(&bmain->text, text);
412
452
        /* XXX python now has invalid pointer? */
413
453
}
414
454
 
415
 
Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* filepath)
 
455
Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath)
416
456
{
417
457
        Text *txt;
418
458
 
419
 
        errno= 0;
420
 
        txt= add_text(filepath, bmain->name);
 
459
        errno = 0;
 
460
        txt = add_text(filepath, bmain->name);
421
461
 
422
 
        if(!txt)
423
 
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load text");
 
462
        if (!txt)
 
463
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 
464
                            errno ? strerror(errno) : "Unable to load text");
424
465
 
425
466
        return txt;
426
467
}
427
468
 
428
 
bArmature *rna_Main_armatures_new(Main *bmain, char* name)
 
469
bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
429
470
{
430
 
        bArmature *arm= add_armature(name);
431
 
        arm->id.us--;
 
471
        bArmature *arm = add_armature(name);
 
472
        id_us_min(&arm->id);
432
473
        return arm;
433
474
}
434
475
void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
435
476
{
436
 
        if(ID_REAL_USERS(arm) <= 0)
 
477
        if (ID_REAL_USERS(arm) <= 0)
437
478
                free_libblock(&bmain->armature, arm);
438
479
        else
439
 
                BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d.", arm->id.name+2, ID_REAL_USERS(arm));
 
480
                BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
 
481
                            arm->id.name+2, ID_REAL_USERS(arm));
440
482
 
441
483
        /* XXX python now has invalid pointer? */
442
484
}
443
485
 
444
 
bAction *rna_Main_actions_new(Main *bmain, char* name)
 
486
bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
445
487
{
446
 
        bAction *act= add_empty_action(name);
447
 
        act->id.us--;
 
488
        bAction *act = add_empty_action(name);
 
489
        id_us_min(&act->id);
448
490
        act->id.flag &= ~LIB_FAKEUSER;
449
491
        return act;
450
492
}
451
493
void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
452
494
{
453
 
        if(ID_REAL_USERS(act) <= 0)
 
495
        if (ID_REAL_USERS(act) <= 0)
454
496
                free_libblock(&bmain->action, act);
455
497
        else
456
 
                BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d.", act->id.name+2, ID_REAL_USERS(act));
 
498
                BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
 
499
                            act->id.name+2, ID_REAL_USERS(act));
457
500
 
458
501
        /* XXX python now has invalid pointer? */
459
502
}
460
503
 
461
 
ParticleSettings *rna_Main_particles_new(Main *bmain, char* name)
 
504
ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
462
505
{
463
506
        ParticleSettings *part = psys_new_settings(name, bmain);
464
 
        part->id.us--;
 
507
        id_us_min(&part->id);
465
508
        return part;
466
509
}
467
510
void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
468
511
{
469
 
        if(ID_REAL_USERS(part) <= 0)
 
512
        if (ID_REAL_USERS(part) <= 0)
470
513
                free_libblock(&bmain->particle, part);
471
514
        else
472
 
                BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d.", part->id.name+2, ID_REAL_USERS(part));
473
 
 
474
 
        /* XXX python now has invalid pointer? */
475
 
}
 
515
                BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
 
516
                            part->id.name+2, ID_REAL_USERS(part));
 
517
 
 
518
        /* XXX python now has invalid pointer? */
 
519
}
 
520
 
 
521
MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
 
522
{
 
523
        MovieClip *clip;
 
524
 
 
525
        errno = 0;
 
526
        clip = BKE_add_movieclip_file(filepath);
 
527
 
 
528
        if (!clip)
 
529
                BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
 
530
                            errno ? strerror(errno) : "Unable to load movie clip");
 
531
 
 
532
        return clip;
 
533
}
 
534
 
 
535
void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
 
536
{
 
537
        unlink_movieclip(bmain, clip);
 
538
        free_libblock(&bmain->movieclip, clip);
 
539
        /* XXX python now has invalid pointer? */
 
540
}
 
541
 
 
542
/* tag functions, all the same */
 
543
void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
 
544
void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
 
545
void rna_Main_objects_tag(Main *bmain, int value) { tag_main_lb(&bmain->object, value); }
 
546
void rna_Main_materials_tag(Main *bmain, int value) { tag_main_lb(&bmain->mat, value); }
 
547
void rna_Main_node_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->nodetree, value); }
 
548
void rna_Main_meshes_tag(Main *bmain, int value) { tag_main_lb(&bmain->mesh, value); }
 
549
void rna_Main_lamps_tag(Main *bmain, int value) { tag_main_lb(&bmain->lamp, value); }
 
550
void rna_Main_libraries_tag(Main *bmain, int value) { tag_main_lb(&bmain->library, value); }
 
551
void rna_Main_screens_tag(Main *bmain, int value) { tag_main_lb(&bmain->screen, value); }
 
552
void rna_Main_window_managers_tag(Main *bmain, int value) { tag_main_lb(&bmain->wm, value); }
 
553
void rna_Main_images_tag(Main *bmain, int value) { tag_main_lb(&bmain->image, value); }
 
554
void rna_Main_lattices_tag(Main *bmain, int value) { tag_main_lb(&bmain->latt, value); }
 
555
void rna_Main_curves_tag(Main *bmain, int value) { tag_main_lb(&bmain->curve, value); }
 
556
void rna_Main_metaballs_tag(Main *bmain, int value) { tag_main_lb(&bmain->mball, value); }
 
557
void rna_Main_fonts_tag(Main *bmain, int value) { tag_main_lb(&bmain->vfont, value); }
 
558
void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain->tex, value); }
 
559
void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); }
 
560
void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); }
 
561
void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); }
 
562
void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); }
 
563
void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); }
 
564
void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); }
 
565
void rna_Main_speakers_tag(Main *bmain, int value) { tag_main_lb(&bmain->speaker, value); }
 
566
void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); }
 
567
void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armature, value); }
 
568
void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); }
 
569
void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
 
570
void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
 
571
void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->movieclip, value); }
 
572
 
 
573
static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); }
 
574
static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); }
 
575
static int rna_Main_objects_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); }
 
576
static int rna_Main_materials_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MA); }
 
577
static int rna_Main_node_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_NT); }
 
578
static int rna_Main_meshes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_ME); }
 
579
static int rna_Main_lamps_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LA); }
 
580
static int rna_Main_libraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LI); }
 
581
static int rna_Main_screens_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCR); }
 
582
static int rna_Main_window_managers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WM); }
 
583
static int rna_Main_images_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_IM); }
 
584
static int rna_Main_lattices_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LT); }
 
585
static int rna_Main_curves_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CU); }
 
586
static int rna_Main_metaballs_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MB); }
 
587
static int rna_Main_fonts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_VF); }
 
588
static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TE); }
 
589
static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR); }
 
590
static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO); }
 
591
static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR); }
 
592
static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT); }
 
593
static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK); }
 
594
static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO); }
 
595
static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR); }
 
596
static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC); }
 
597
static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA); }
 
598
static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD); }
476
599
 
477
600
#else
478
601
 
479
602
void RNA_api_main(StructRNA *srna)
480
603
{
481
 
        /*
 
604
#if 0
482
605
        FunctionRNA *func;
483
606
        PropertyRNA *parm;
484
 
        */
485
607
        /* maybe we want to add functions in 'bpy.data' still?
486
608
         * for now they are all in collections bpy.data.images.new(...) */
487
 
        /*
488
609
        func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
489
 
        RNA_def_function_ui_description(func, "Add a new image.");
490
 
        parm= RNA_def_string(func, "filepath", "", 0, "", "File path to load image from.");
 
610
        RNA_def_function_ui_description(func, "Add a new image");
 
611
        parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from");
491
612
        RNA_def_property_flag(parm, PROP_REQUIRED);
492
 
        parm= RNA_def_pointer(func, "image", "Image", "", "New image.");
 
613
        parm= RNA_def_pointer(func, "image", "Image", "", "New image");
493
614
        RNA_def_function_return(func, parm);
494
 
        */
495
 
 
 
615
#endif
496
616
}
497
617
 
498
618
void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
500
620
        StructRNA *srna;
501
621
        FunctionRNA *func;
502
622
        PropertyRNA *parm;
 
623
        PropertyRNA *prop;
503
624
 
504
 
        RNA_def_property_srna(cprop, "MainCameras");
505
 
        srna= RNA_def_struct(brna, "MainCameras", NULL);
 
625
        RNA_def_property_srna(cprop, "BlendDataCameras");
 
626
        srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
 
627
        RNA_def_struct_sdna(srna, "Main");
506
628
        RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
507
629
 
508
 
        func= RNA_def_function(srna, "new", "rna_Main_cameras_new");
 
630
        func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
509
631
        RNA_def_function_ui_description(func, "Add a new camera to the main database");
510
 
        parm= RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock.");
 
632
        parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
511
633
        RNA_def_property_flag(parm, PROP_REQUIRED);
512
634
        /* return type */
513
 
        parm= RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock.");
 
635
        parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
514
636
        RNA_def_function_return(func, parm);
515
637
 
516
 
        func= RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
 
638
        func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
517
639
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
518
 
        RNA_def_function_ui_description(func, "Remove a camera from the current blendfile.");
519
 
        parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove.");
 
640
        RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
 
641
        parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
 
642
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
643
 
 
644
        func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
 
645
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
520
646
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
647
 
 
648
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
649
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
650
        RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL);
521
651
}
522
652
 
523
653
void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
525
655
        StructRNA *srna;
526
656
        FunctionRNA *func;
527
657
        PropertyRNA *parm;
 
658
        PropertyRNA *prop;
528
659
 
529
 
        RNA_def_property_srna(cprop, "MainScenes");
530
 
        srna= RNA_def_struct(brna, "MainScenes", NULL);
 
660
        RNA_def_property_srna(cprop, "BlendDataScenes");
 
661
        srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
 
662
        RNA_def_struct_sdna(srna, "Main");
531
663
        RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
532
664
 
533
 
        func= RNA_def_function(srna, "new", "rna_Main_scenes_new");
 
665
        func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
534
666
        RNA_def_function_ui_description(func, "Add a new scene to the main database");
535
 
        parm= RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock.");
 
667
        parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
536
668
        RNA_def_property_flag(parm, PROP_REQUIRED);
537
669
        /* return type */
538
 
        parm= RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock.");
 
670
        parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
539
671
        RNA_def_function_return(func, parm);
540
672
 
541
 
        func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
 
673
        func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
542
674
        RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
543
 
        parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
544
 
        RNA_def_property_flag(parm, PROP_REQUIRED);
545
 
        RNA_def_function_ui_description(func, "Remove a scene from the current blendfile.");
546
 
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
675
        RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
 
676
        parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
 
677
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
678
 
 
679
        func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
 
680
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
681
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
682
 
 
683
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
684
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
685
        RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL);
547
686
}
548
687
 
549
688
void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
551
690
        StructRNA *srna;
552
691
        FunctionRNA *func;
553
692
        PropertyRNA *parm;
 
693
        PropertyRNA *prop;
554
694
 
555
 
        RNA_def_property_srna(cprop, "MainObjects");
556
 
        srna= RNA_def_struct(brna, "MainObjects", NULL);
 
695
        RNA_def_property_srna(cprop, "BlendDataObjects");
 
696
        srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
 
697
        RNA_def_struct_sdna(srna, "Main");
557
698
        RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
558
699
 
559
 
        func= RNA_def_function(srna, "new", "rna_Main_objects_new");
 
700
        func = RNA_def_function(srna, "new", "rna_Main_objects_new");
560
701
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
561
702
        RNA_def_function_ui_description(func, "Add a new object to the main database");
562
 
        parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock.");
 
703
        parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
563
704
        RNA_def_property_flag(parm, PROP_REQUIRED);
564
 
        parm= RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object.");
 
705
        parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
565
706
        RNA_def_property_flag(parm, PROP_REQUIRED);
566
707
 
567
708
        /* return type */
568
 
        parm= RNA_def_pointer(func, "object", "Object", "", "New object datablock.");
 
709
        parm = RNA_def_pointer(func, "object", "Object", "", "New object datablock");
569
710
        RNA_def_function_return(func, parm);
570
711
 
571
 
        func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
 
712
        func = RNA_def_function(srna, "remove", "rna_Main_objects_remove");
 
713
        RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
572
714
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
573
 
        parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove.");
 
715
        parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
 
716
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
717
 
 
718
        func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
 
719
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
574
720
        RNA_def_property_flag(parm, PROP_REQUIRED);
575
 
        RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
 
721
 
 
722
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
723
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
724
        RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL);
576
725
}
577
726
 
578
727
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
580
729
        StructRNA *srna;
581
730
        FunctionRNA *func;
582
731
        PropertyRNA *parm;
583
 
 
584
 
        RNA_def_property_srna(cprop, "MainMaterials");
585
 
        srna= RNA_def_struct(brna, "MainMaterials", NULL);
586
 
        RNA_def_struct_ui_text(srna, "Main Material", "Collection of materials");
587
 
 
588
 
        func= RNA_def_function(srna, "new", "rna_Main_materials_new");
 
732
        PropertyRNA *prop;
 
733
 
 
734
        RNA_def_property_srna(cprop, "BlendDataMaterials");
 
735
        srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
 
736
        RNA_def_struct_sdna(srna, "Main");
 
737
        RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
 
738
 
 
739
        func = RNA_def_function(srna, "new", "rna_Main_materials_new");
589
740
        RNA_def_function_ui_description(func, "Add a new material to the main database");
590
 
        parm= RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock.");
 
741
        parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
591
742
        RNA_def_property_flag(parm, PROP_REQUIRED);
592
743
        /* return type */
593
 
        parm= RNA_def_pointer(func, "material", "Material", "", "New material datablock.");
 
744
        parm = RNA_def_pointer(func, "material", "Material", "", "New material datablock");
594
745
        RNA_def_function_return(func, parm);
595
746
 
596
 
        func= RNA_def_function(srna, "remove", "rna_Main_materials_remove");
 
747
        func = RNA_def_function(srna, "remove", "rna_Main_materials_remove");
597
748
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
598
 
        RNA_def_function_ui_description(func, "Remove a material from the current blendfile.");
599
 
        parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
 
749
        RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
 
750
        parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
 
751
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
752
 
 
753
        func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
 
754
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
600
755
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
756
 
 
757
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
758
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
759
        RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL);
601
760
}
602
761
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
603
762
{
604
763
        StructRNA *srna;
605
 
//      FunctionRNA *func;
606
 
//      PropertyRNA *parm;
 
764
        FunctionRNA *func;
 
765
        PropertyRNA *parm;
 
766
        PropertyRNA *prop;
607
767
 
608
 
/*      static EnumPropertyItem node_nodetree_items[] = {
 
768
        static EnumPropertyItem node_nodetree_items[] = {
609
769
        {0, "SHADER",       0,    "Shader",       ""},
610
770
        {1, "COMPOSITE",    0,    "Composite",    ""},
611
771
        {2, "TEXTURE",      0,    "Texture",      ""},
612
 
        {0, NULL, 0, NULL, NULL}}; */
 
772
        {0, NULL, 0, NULL, NULL}};
613
773
 
614
 
        RNA_def_property_srna(cprop, "MainNodeTrees");
615
 
        srna= RNA_def_struct(brna, "MainNodeTrees", NULL);
 
774
        RNA_def_property_srna(cprop, "BlendDataNodeTrees");
 
775
        srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
 
776
        RNA_def_struct_sdna(srna, "Main");
616
777
        RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
617
778
 
618
 
#if 0 // need to see some examples of using these functions before enabling.
619
 
        func= RNA_def_function(srna, "new", "rna_Main_nodetree_new");
 
779
        func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
620
780
        RNA_def_function_ui_description(func, "Add a new node tree to the main database");
621
 
        parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of curve object to add");
 
781
        parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
 
782
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
783
        parm = RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add");
622
784
        RNA_def_property_flag(parm, PROP_REQUIRED);
623
785
        /* return type */
624
 
        parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock.");
 
786
        parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
625
787
        RNA_def_function_return(func, parm);
626
788
 
627
 
        func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
 
789
        func = RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
628
790
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
629
 
        RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile.");
630
 
        parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove.");
 
791
        RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
 
792
        parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
 
793
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
794
 
 
795
        func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
 
796
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
631
797
        RNA_def_property_flag(parm, PROP_REQUIRED);
632
 
#endif
 
798
 
 
799
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
800
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
801
        RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL);
633
802
}
634
803
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
635
804
{
636
805
        StructRNA *srna;
637
806
        FunctionRNA *func;
638
807
        PropertyRNA *parm;
 
808
        PropertyRNA *prop;
639
809
 
640
 
        RNA_def_property_srna(cprop, "MainMeshes");
641
 
        srna= RNA_def_struct(brna, "MainMeshes", NULL);
 
810
        RNA_def_property_srna(cprop, "BlendDataMeshes");
 
811
        srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
 
812
        RNA_def_struct_sdna(srna, "Main");
642
813
        RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
643
814
 
644
 
        func= RNA_def_function(srna, "new", "rna_Main_meshes_new");
 
815
        func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
645
816
        RNA_def_function_ui_description(func, "Add a new mesh to the main database");
646
 
        parm= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock.");
 
817
        parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
647
818
        RNA_def_property_flag(parm, PROP_REQUIRED);
648
819
        /* return type */
649
 
        parm= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock.");
 
820
        parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
650
821
        RNA_def_function_return(func, parm);
651
822
 
652
 
        func= RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
 
823
        func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
653
824
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
654
 
        RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile.");
655
 
        parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
 
825
        RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
 
826
        parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
 
827
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
828
 
 
829
        func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
 
830
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
656
831
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
832
 
 
833
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
834
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
835
        RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL);
657
836
}
658
837
void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
659
838
{
660
839
        StructRNA *srna;
661
840
        FunctionRNA *func;
662
841
        PropertyRNA *parm;
 
842
        PropertyRNA *prop;
663
843
 
664
 
        RNA_def_property_srna(cprop, "MainLamps");
665
 
        srna= RNA_def_struct(brna, "MainLamps", NULL);
 
844
        RNA_def_property_srna(cprop, "BlendDataLamps");
 
845
        srna = RNA_def_struct(brna, "BlendDataLamps", NULL);
 
846
        RNA_def_struct_sdna(srna, "Main");
666
847
        RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
667
848
 
668
 
        func= RNA_def_function(srna, "new", "rna_Main_lamps_new");
 
849
        func = RNA_def_function(srna, "new", "rna_Main_lamps_new");
669
850
        RNA_def_function_ui_description(func, "Add a new lamp to the main database");
670
 
        parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock.");
 
851
        parm = RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
 
852
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
853
        parm = RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
671
854
        RNA_def_property_flag(parm, PROP_REQUIRED);
672
855
        /* return type */
673
 
        parm= RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock.");
 
856
        parm = RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
674
857
        RNA_def_function_return(func, parm);
675
858
 
676
 
        func= RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
 
859
        func = RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
677
860
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
678
 
        RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile.");
679
 
        parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove.");
 
861
        RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile");
 
862
        parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
 
863
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
864
 
 
865
        func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
 
866
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
680
867
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
868
 
 
869
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
870
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
871
        RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL);
681
872
}
 
873
 
682
874
void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
683
875
{
684
 
 
 
876
        StructRNA *srna;
 
877
        FunctionRNA *func;
 
878
        PropertyRNA *parm;
 
879
        PropertyRNA *prop;
 
880
 
 
881
        RNA_def_property_srna(cprop, "BlendDataLibraries");
 
882
        srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
 
883
        RNA_def_struct_sdna(srna, "Main");
 
884
        RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
 
885
 
 
886
        func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
 
887
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
888
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
889
 
 
890
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
891
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
892
        RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL);
685
893
}
 
894
 
686
895
void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
687
896
{
688
 
 
 
897
        StructRNA *srna;
 
898
        FunctionRNA *func;
 
899
        PropertyRNA *parm;
 
900
        PropertyRNA *prop;
 
901
 
 
902
        RNA_def_property_srna(cprop, "BlendDataScreens");
 
903
        srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
 
904
        RNA_def_struct_sdna(srna, "Main");
 
905
        RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
 
906
 
 
907
        func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
 
908
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
909
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
910
 
 
911
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
912
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
913
        RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL);
689
914
}
 
915
 
690
916
void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
691
917
{
692
 
    
 
918
        StructRNA *srna;
 
919
        FunctionRNA *func;
 
920
        PropertyRNA *parm;
 
921
        PropertyRNA *prop;
 
922
 
 
923
        RNA_def_property_srna(cprop, "BlendDataWindowManagers");
 
924
        srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
 
925
        RNA_def_struct_sdna(srna, "Main");
 
926
        RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
 
927
 
 
928
        func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
 
929
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
930
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
931
 
 
932
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
933
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
934
        RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL);
693
935
}
694
936
void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
695
937
{
696
938
        StructRNA *srna;
697
939
        FunctionRNA *func;
698
940
        PropertyRNA *parm;
 
941
        PropertyRNA *prop;
699
942
 
700
 
        RNA_def_property_srna(cprop, "MainImages");
701
 
        srna= RNA_def_struct(brna, "MainImages", NULL);
 
943
        RNA_def_property_srna(cprop, "BlendDataImages");
 
944
        srna = RNA_def_struct(brna, "BlendDataImages", NULL);
 
945
        RNA_def_struct_sdna(srna, "Main");
702
946
        RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
703
947
 
704
 
        func= RNA_def_function(srna, "new", "rna_Main_images_new");
 
948
        func = RNA_def_function(srna, "new", "rna_Main_images_new");
705
949
        RNA_def_function_ui_description(func, "Add a new image to the main database");
706
 
        parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock.");
707
 
        RNA_def_property_flag(parm, PROP_REQUIRED);
708
 
        parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX);
709
 
        parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX);
710
 
        parm= RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
711
 
        parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
 
950
        parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock");
 
951
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
952
        parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 0, INT_MAX);
 
953
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
954
        parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 0, INT_MAX);
 
955
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
956
        RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
 
957
        RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
712
958
        /* return type */
713
 
        parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
 
959
        parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
714
960
        RNA_def_function_return(func, parm);
715
961
 
716
 
        func= RNA_def_function(srna, "load", "rna_Main_images_load");
 
962
        func = RNA_def_function(srna, "load", "rna_Main_images_load");
717
963
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
718
964
        RNA_def_function_ui_description(func, "Load a new image into the main database");
719
 
        parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the file to load.");
 
965
        parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
720
966
        RNA_def_property_flag(parm, PROP_REQUIRED);
721
967
        /* return type */
722
 
        parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
 
968
        parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
723
969
        RNA_def_function_return(func, parm);
724
970
 
725
 
        func= RNA_def_function(srna, "remove", "rna_Main_images_remove");
 
971
        func = RNA_def_function(srna, "remove", "rna_Main_images_remove");
726
972
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
727
 
        RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
728
 
        parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
 
973
        RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
 
974
        parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
 
975
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
976
 
 
977
        func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
 
978
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
729
979
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
980
 
 
981
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
982
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
983
        RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL);
730
984
}
731
985
 
732
986
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
734
988
        StructRNA *srna;
735
989
        FunctionRNA *func;
736
990
        PropertyRNA *parm;
 
991
        PropertyRNA *prop;
737
992
 
738
 
        RNA_def_property_srna(cprop, "MainLattices");
739
 
        srna= RNA_def_struct(brna, "MainLattices", NULL);
 
993
        RNA_def_property_srna(cprop, "BlendDataLattices");
 
994
        srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
 
995
        RNA_def_struct_sdna(srna, "Main");
740
996
        RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
741
997
 
742
 
        func= RNA_def_function(srna, "new", "rna_Main_lattices_new");
 
998
        func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
743
999
        RNA_def_function_ui_description(func, "Add a new lattice to the main database");
744
 
        parm= RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock.");
 
1000
        parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
745
1001
        RNA_def_property_flag(parm, PROP_REQUIRED);
746
1002
        /* return type */
747
 
        parm= RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock.");
 
1003
        parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
748
1004
        RNA_def_function_return(func, parm);
749
1005
 
750
 
        func= RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
 
1006
        func = RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
751
1007
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
752
 
        RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile.");
753
 
        parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove.");
 
1008
        RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
 
1009
        parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
 
1010
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1011
 
 
1012
        func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
 
1013
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
754
1014
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1015
 
 
1016
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1017
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1018
        RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL);
755
1019
}
756
1020
void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
757
1021
{
758
1022
        StructRNA *srna;
759
1023
        FunctionRNA *func;
760
1024
        PropertyRNA *parm;
 
1025
        PropertyRNA *prop;
761
1026
 
762
 
        RNA_def_property_srna(cprop, "MainCurves");
763
 
        srna= RNA_def_struct(brna, "MainCurves", NULL);
 
1027
        RNA_def_property_srna(cprop, "BlendDataCurves");
 
1028
        srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
 
1029
        RNA_def_struct_sdna(srna, "Main");
764
1030
        RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
765
1031
 
766
 
        func= RNA_def_function(srna, "new", "rna_Main_curves_new");
 
1032
        func = RNA_def_function(srna, "new", "rna_Main_curves_new");
767
1033
        RNA_def_function_ui_description(func, "Add a new curve to the main database");
768
 
        parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
 
1034
        parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
769
1035
        RNA_def_property_flag(parm, PROP_REQUIRED);
770
 
        parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve object to add");
 
1036
        parm = RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
771
1037
        RNA_def_property_flag(parm, PROP_REQUIRED);
772
1038
        /* return type */
773
 
        parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
 
1039
        parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
774
1040
        RNA_def_function_return(func, parm);
775
1041
 
776
 
        func= RNA_def_function(srna, "remove", "rna_Main_curves_remove");
 
1042
        func = RNA_def_function(srna, "remove", "rna_Main_curves_remove");
777
1043
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
778
 
        RNA_def_function_ui_description(func, "Remove a curve from the current blendfile.");
779
 
        parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove.");
 
1044
        RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
 
1045
        parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
 
1046
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1047
 
 
1048
        func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
 
1049
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
780
1050
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1051
 
 
1052
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1053
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1054
        RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL);
781
1055
}
782
1056
void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
783
1057
{
784
1058
        StructRNA *srna;
785
1059
        FunctionRNA *func;
786
1060
        PropertyRNA *parm;
787
 
 
788
 
        RNA_def_property_srna(cprop, "MainMetaBalls");
789
 
        srna= RNA_def_struct(brna, "MainMetaBalls", NULL);
790
 
        RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs");
791
 
 
792
 
        func= RNA_def_function(srna, "new", "rna_Main_metaballs_new");
 
1061
        PropertyRNA *prop;
 
1062
 
 
1063
        RNA_def_property_srna(cprop, "BlendDataMetaBalls");
 
1064
        srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
 
1065
        RNA_def_struct_sdna(srna, "Main");
 
1066
        RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
 
1067
 
 
1068
        func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
793
1069
        RNA_def_function_ui_description(func, "Add a new metaball to the main database");
794
 
        parm= RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock.");
 
1070
        parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
795
1071
        RNA_def_property_flag(parm, PROP_REQUIRED);
796
1072
        /* return type */
797
 
        parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock.");
 
1073
        parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
798
1074
        RNA_def_function_return(func, parm);
799
1075
 
800
 
        func= RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
 
1076
        func = RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
801
1077
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
802
 
        RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile.");
803
 
        parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove.");
 
1078
        RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
 
1079
        parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
 
1080
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1081
 
 
1082
        func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
 
1083
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
804
1084
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1085
 
 
1086
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1087
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1088
        RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL);
805
1089
}
806
1090
void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
807
1091
{
808
1092
        StructRNA *srna;
809
1093
        FunctionRNA *func;
810
1094
        PropertyRNA *parm;
 
1095
        PropertyRNA *prop;
811
1096
 
812
 
        RNA_def_property_srna(cprop, "MainFonts");
813
 
        srna= RNA_def_struct(brna, "MainFonts", NULL);
 
1097
        RNA_def_property_srna(cprop, "BlendDataFonts");
 
1098
        srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
 
1099
        RNA_def_struct_sdna(srna, "Main");
814
1100
        RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
815
1101
 
816
 
        func= RNA_def_function(srna, "load", "rna_Main_fonts_load");
 
1102
        func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
817
1103
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
818
1104
        RNA_def_function_ui_description(func, "Load a new font into the main database");
819
 
        parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the font to load.");
 
1105
        parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
820
1106
        RNA_def_property_flag(parm, PROP_REQUIRED);
821
1107
        /* return type */
822
 
        parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock.");
 
1108
        parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
823
1109
        RNA_def_function_return(func, parm);
824
1110
 
825
 
        func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
 
1111
        func = RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
826
1112
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
827
 
        RNA_def_function_ui_description(func, "Remove a font from the current blendfile.");
828
 
        parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove.");
 
1113
        RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
 
1114
        parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
 
1115
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1116
 
 
1117
        func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
 
1118
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
829
1119
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1120
 
 
1121
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1122
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1123
        RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL);
830
1124
}
831
1125
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
832
1126
{
833
1127
        StructRNA *srna;
834
1128
        FunctionRNA *func;
835
1129
        PropertyRNA *parm;
 
1130
        PropertyRNA *prop;
836
1131
 
837
 
        RNA_def_property_srna(cprop, "MainTextures");
838
 
        srna= RNA_def_struct(brna, "MainTextures", NULL);
 
1132
        RNA_def_property_srna(cprop, "BlendDataTextures");
 
1133
        srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
 
1134
        RNA_def_struct_sdna(srna, "Main");
839
1135
        RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
840
1136
 
841
 
        func= RNA_def_function(srna, "new", "rna_Main_textures_new");
 
1137
        func = RNA_def_function(srna, "new", "rna_Main_textures_new");
842
1138
        RNA_def_function_ui_description(func, "Add a new texture to the main database");
843
 
        parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
 
1139
        parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
 
1140
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1141
        parm = RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
844
1142
        RNA_def_property_flag(parm, PROP_REQUIRED);
845
1143
        /* return type */
846
 
        parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
 
1144
        parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
847
1145
        RNA_def_function_return(func, parm);
848
1146
 
849
 
        func= RNA_def_function(srna, "remove", "rna_Main_textures_remove");
 
1147
        func = RNA_def_function(srna, "remove", "rna_Main_textures_remove");
850
1148
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
851
 
        RNA_def_function_ui_description(func, "Remove a texture from the current blendfile.");
852
 
        parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove.");
 
1149
        RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
 
1150
        parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
 
1151
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1152
 
 
1153
        func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
 
1154
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
853
1155
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1156
 
 
1157
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1158
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1159
        RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL);
854
1160
}
855
1161
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
856
1162
{
857
1163
        StructRNA *srna;
858
1164
        FunctionRNA *func;
859
1165
        PropertyRNA *parm;
 
1166
        PropertyRNA *prop;
860
1167
 
861
 
        RNA_def_property_srna(cprop, "MainBrushes");
862
 
        srna= RNA_def_struct(brna, "MainBrushes", NULL);
 
1168
        RNA_def_property_srna(cprop, "BlendDataBrushes");
 
1169
        srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
 
1170
        RNA_def_struct_sdna(srna, "Main");
863
1171
        RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
864
1172
 
865
 
        func= RNA_def_function(srna, "new", "rna_Main_brushes_new");
 
1173
        func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
866
1174
        RNA_def_function_ui_description(func, "Add a new brush to the main database");
867
 
        parm= RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock.");
 
1175
        parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
868
1176
        RNA_def_property_flag(parm, PROP_REQUIRED);
869
1177
        /* return type */
870
 
        parm= RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock.");
 
1178
        parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
871
1179
        RNA_def_function_return(func, parm);
872
1180
 
873
 
        func= RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
 
1181
        func = RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
874
1182
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
875
 
        RNA_def_function_ui_description(func, "Remove a brush from the current blendfile.");
876
 
        parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove.");
 
1183
        RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
 
1184
        parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
 
1185
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1186
 
 
1187
        func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
 
1188
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
877
1189
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1190
 
 
1191
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1192
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1193
        RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL);
878
1194
}
879
1195
 
880
1196
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
882
1198
        StructRNA *srna;
883
1199
        FunctionRNA *func;
884
1200
        PropertyRNA *parm;
 
1201
        PropertyRNA *prop;
885
1202
 
886
 
        RNA_def_property_srna(cprop, "MainWorlds");
887
 
        srna= RNA_def_struct(brna, "MainWorlds", NULL);
 
1203
        RNA_def_property_srna(cprop, "BlendDataWorlds");
 
1204
        srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
 
1205
        RNA_def_struct_sdna(srna, "Main");
888
1206
        RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
889
1207
 
890
 
        func= RNA_def_function(srna, "new", "rna_Main_worlds_new");
 
1208
        func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
891
1209
        RNA_def_function_ui_description(func, "Add a new world to the main database");
892
 
        parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock.");
 
1210
        parm = RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
893
1211
        RNA_def_property_flag(parm, PROP_REQUIRED);
894
1212
        /* return type */
895
 
        parm= RNA_def_pointer(func, "world", "World", "", "New world datablock.");
 
1213
        parm = RNA_def_pointer(func, "world", "World", "", "New world datablock");
896
1214
        RNA_def_function_return(func, parm);
897
1215
 
898
 
        func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
 
1216
        func = RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
899
1217
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
900
 
        RNA_def_function_ui_description(func, "Remove a world from the current blendfile.");
901
 
        parm= RNA_def_pointer(func, "world", "World", "", "World to remove.");
 
1218
        RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
 
1219
        parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
 
1220
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1221
 
 
1222
        func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
 
1223
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
902
1224
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1225
 
 
1226
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1227
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1228
        RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
903
1229
}
904
1230
 
905
1231
void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
907
1233
        StructRNA *srna;
908
1234
        FunctionRNA *func;
909
1235
        PropertyRNA *parm;
 
1236
        PropertyRNA *prop;
910
1237
 
911
 
        RNA_def_property_srna(cprop, "MainGroups");
912
 
        srna= RNA_def_struct(brna, "MainGroups", NULL);
 
1238
        RNA_def_property_srna(cprop, "BlendDataGroups");
 
1239
        srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
 
1240
        RNA_def_struct_sdna(srna, "Main");
913
1241
        RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
914
1242
 
915
 
        func= RNA_def_function(srna, "new", "rna_Main_groups_new");
 
1243
        func = RNA_def_function(srna, "new", "rna_Main_groups_new");
916
1244
        RNA_def_function_ui_description(func, "Add a new group to the main database");
917
 
        parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock.");
918
 
        RNA_def_property_flag(parm, PROP_REQUIRED);
919
 
        /* return type */
920
 
        parm= RNA_def_pointer(func, "group", "Group", "", "New group datablock.");
921
 
        RNA_def_function_return(func, parm);
922
 
 
923
 
        func= RNA_def_function(srna, "remove", "rna_Main_groups_remove");
 
1245
        parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
 
1246
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1247
        /* return type */
 
1248
        parm = RNA_def_pointer(func, "group", "Group", "", "New group datablock");
 
1249
        RNA_def_function_return(func, parm);
 
1250
 
 
1251
        func = RNA_def_function(srna, "remove", "rna_Main_groups_remove");
 
1252
        RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
 
1253
        parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
 
1254
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1255
 
 
1256
        func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
 
1257
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
1258
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1259
 
 
1260
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1261
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1262
        RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
 
1263
}
 
1264
 
 
1265
void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
 
1266
{
 
1267
        StructRNA *srna;
 
1268
        FunctionRNA *func;
 
1269
        PropertyRNA *parm;
 
1270
        PropertyRNA *prop;
 
1271
 
 
1272
        RNA_def_property_srna(cprop, "BlendDataSpeakers");
 
1273
        srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
 
1274
        RNA_def_struct_sdna(srna, "Main");
 
1275
        RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
 
1276
 
 
1277
        func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
 
1278
        RNA_def_function_ui_description(func, "Add a new speaker to the main database");
 
1279
        parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
 
1280
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1281
        /* return type */
 
1282
        parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
 
1283
        RNA_def_function_return(func, parm);
 
1284
 
 
1285
        func = RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
924
1286
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
925
 
        RNA_def_function_ui_description(func, "Remove a group from the current blendfile.");
926
 
        parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove.");
 
1287
        RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
 
1288
        parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
 
1289
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1290
 
 
1291
        func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
 
1292
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
927
1293
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1294
 
 
1295
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1296
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1297
        RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL);
928
1298
}
 
1299
 
929
1300
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
930
1301
{
931
1302
        StructRNA *srna;
932
1303
        FunctionRNA *func;
933
1304
        PropertyRNA *parm;
 
1305
        PropertyRNA *prop;
934
1306
 
935
 
        RNA_def_property_srna(cprop, "MainTexts");
936
 
        srna= RNA_def_struct(brna, "MainTexts", NULL);
 
1307
        RNA_def_property_srna(cprop, "BlendDataTexts");
 
1308
        srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
 
1309
        RNA_def_struct_sdna(srna, "Main");
937
1310
        RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
938
1311
 
939
 
        func= RNA_def_function(srna, "new", "rna_Main_texts_new");
 
1312
        func = RNA_def_function(srna, "new", "rna_Main_texts_new");
940
1313
        RNA_def_function_ui_description(func, "Add a new text to the main database");
941
 
        parm= RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock.");
 
1314
        parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
942
1315
        RNA_def_property_flag(parm, PROP_REQUIRED);
943
1316
        /* return type */
944
 
        parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock.");
 
1317
        parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
945
1318
        RNA_def_function_return(func, parm);
946
1319
 
947
 
        func= RNA_def_function(srna, "remove", "rna_Main_texts_remove");
948
 
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
949
 
        RNA_def_function_ui_description(func, "Remove a text from the current blendfile.");
950
 
        parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove.");
951
 
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1320
        func = RNA_def_function(srna, "remove", "rna_Main_texts_remove");
 
1321
        RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
 
1322
        parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
 
1323
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
952
1324
 
953
1325
        /* load func */
954
 
        func= RNA_def_function(srna, "load", "rna_Main_texts_load");
 
1326
        func = RNA_def_function(srna, "load", "rna_Main_texts_load");
955
1327
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
956
1328
        RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
957
 
        parm= RNA_def_string(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock.");
 
1329
        parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
958
1330
        RNA_def_property_flag(parm, PROP_REQUIRED);
959
1331
        /* return type */
960
 
        parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock.");
 
1332
        parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
961
1333
        RNA_def_function_return(func, parm);
 
1334
 
 
1335
        func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
 
1336
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
1337
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1338
 
 
1339
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1340
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1341
        RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL);
962
1342
}
 
1343
 
963
1344
void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
964
1345
{
965
 
 
 
1346
        StructRNA *srna;
 
1347
        FunctionRNA *func;
 
1348
        PropertyRNA *parm;
 
1349
        PropertyRNA *prop;
 
1350
 
 
1351
        RNA_def_property_srna(cprop, "BlendDataSounds");
 
1352
        srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
 
1353
        RNA_def_struct_sdna(srna, "Main");
 
1354
        RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
 
1355
 
 
1356
        /* TODO, 'load' */
 
1357
 
 
1358
        func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
 
1359
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
1360
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1361
 
 
1362
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1363
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1364
        RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL);
966
1365
}
 
1366
 
967
1367
void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
968
1368
{
969
1369
        StructRNA *srna;
970
1370
        FunctionRNA *func;
971
1371
        PropertyRNA *parm;
 
1372
        PropertyRNA *prop;
972
1373
 
973
 
        RNA_def_property_srna(cprop, "MainArmatures");
974
 
        srna= RNA_def_struct(brna, "MainArmatures", NULL);
 
1374
        RNA_def_property_srna(cprop, "BlendDataArmatures");
 
1375
        srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
 
1376
        RNA_def_struct_sdna(srna, "Main");
975
1377
        RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
976
1378
 
977
 
        func= RNA_def_function(srna, "new", "rna_Main_armatures_new");
 
1379
        func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
978
1380
        RNA_def_function_ui_description(func, "Add a new armature to the main database");
979
 
        parm= RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock.");
 
1381
        parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
980
1382
        RNA_def_property_flag(parm, PROP_REQUIRED);
981
1383
        /* return type */
982
 
        parm= RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock.");
 
1384
        parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
983
1385
        RNA_def_function_return(func, parm);
984
1386
 
985
 
        func= RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
 
1387
        func = RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
986
1388
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
987
 
        RNA_def_function_ui_description(func, "Remove a armature from the current blendfile.");
988
 
        parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove.");
 
1389
        RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
 
1390
        parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
 
1391
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1392
 
 
1393
        func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
 
1394
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
989
1395
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1396
 
 
1397
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1398
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1399
        RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL);
990
1400
}
991
1401
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
992
1402
{
993
1403
        StructRNA *srna;
994
1404
        FunctionRNA *func;
995
1405
        PropertyRNA *parm;
 
1406
        PropertyRNA *prop;
996
1407
 
997
 
        RNA_def_property_srna(cprop, "MainActions");
998
 
        srna= RNA_def_struct(brna, "MainActions", NULL);
 
1408
        RNA_def_property_srna(cprop, "BlendDataActions");
 
1409
        srna = RNA_def_struct(brna, "BlendDataActions", NULL);
 
1410
        RNA_def_struct_sdna(srna, "Main");
999
1411
        RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
1000
1412
 
1001
 
        func= RNA_def_function(srna, "new", "rna_Main_actions_new");
 
1413
        func = RNA_def_function(srna, "new", "rna_Main_actions_new");
1002
1414
        RNA_def_function_ui_description(func, "Add a new action to the main database");
1003
 
        parm= RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock.");
 
1415
        parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
1004
1416
        RNA_def_property_flag(parm, PROP_REQUIRED);
1005
1417
        /* return type */
1006
 
        parm= RNA_def_pointer(func, "action", "Action", "", "New action datablock.");
 
1418
        parm = RNA_def_pointer(func, "action", "Action", "", "New action datablock");
1007
1419
        RNA_def_function_return(func, parm);
1008
1420
 
1009
 
        func= RNA_def_function(srna, "remove", "rna_Main_actions_remove");
 
1421
        func = RNA_def_function(srna, "remove", "rna_Main_actions_remove");
1010
1422
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
1011
 
        RNA_def_function_ui_description(func, "Remove a action from the current blendfile.");
1012
 
        parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove.");
 
1423
        RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
 
1424
        parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
 
1425
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1426
 
 
1427
        func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
 
1428
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
1013
1429
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1430
 
 
1431
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1432
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1433
        RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
1014
1434
}
1015
1435
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1016
1436
{
1017
1437
        StructRNA *srna;
1018
1438
        FunctionRNA *func;
1019
1439
        PropertyRNA *parm;
 
1440
        PropertyRNA *prop;
1020
1441
 
1021
 
        RNA_def_property_srna(cprop, "MainParticles");
1022
 
        srna= RNA_def_struct(brna, "MainParticles", NULL);
 
1442
        RNA_def_property_srna(cprop, "BlendDataParticles");
 
1443
        srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
 
1444
        RNA_def_struct_sdna(srna, "Main");
1023
1445
        RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1024
1446
 
1025
 
        func= RNA_def_function(srna, "new", "rna_Main_particles_new");
 
1447
        func = RNA_def_function(srna, "new", "rna_Main_particles_new");
1026
1448
        RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
1027
 
        parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock.");
 
1449
        parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
1028
1450
        RNA_def_property_flag(parm, PROP_REQUIRED);
1029
1451
        /* return type */
1030
 
        parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock.");
 
1452
        parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
1031
1453
        RNA_def_function_return(func, parm);
1032
1454
 
1033
 
        func= RNA_def_function(srna, "remove", "rna_Main_particles_remove");
 
1455
        func = RNA_def_function(srna, "remove", "rna_Main_particles_remove");
1034
1456
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
1035
 
        RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile.");
1036
 
        parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove.");
 
1457
        RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
 
1458
        parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
 
1459
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1460
 
 
1461
        func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
 
1462
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
1037
1463
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1464
 
 
1465
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1466
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1467
        RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
1038
1468
}
 
1469
 
1039
1470
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
1040
1471
{
1041
 
 
 
1472
        StructRNA *srna;
 
1473
        FunctionRNA *func;
 
1474
        PropertyRNA *parm;
 
1475
        PropertyRNA *prop;
 
1476
 
 
1477
        RNA_def_property_srna(cprop, "BlendDataGreasePencils");
 
1478
        srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
 
1479
        RNA_def_struct_sdna(srna, "Main");
 
1480
        RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
 
1481
 
 
1482
        func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
 
1483
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
1484
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1485
 
 
1486
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 
1487
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
1488
        RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
 
1489
}
 
1490
 
 
1491
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
 
1492
{
 
1493
        StructRNA *srna;
 
1494
        FunctionRNA *func;
 
1495
        PropertyRNA *parm;
 
1496
 
 
1497
        RNA_def_property_srna(cprop, "BlendDataMovieClips");
 
1498
        srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
 
1499
        RNA_def_struct_sdna(srna, "Main");
 
1500
        RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
 
1501
 
 
1502
        func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
 
1503
        parm = RNA_def_boolean(func, "value", 0, "Value", "");
 
1504
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1505
 
 
1506
        func = RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
 
1507
        RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
 
1508
        parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
 
1509
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
1510
 
 
1511
        /* load func */
 
1512
        func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
 
1513
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
1514
        RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
 
1515
        parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
 
1516
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
1517
        /* return type */
 
1518
        parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
 
1519
        RNA_def_function_return(func, parm);
1042
1520
}
1043
1521
 
1044
1522
#endif
1045