diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 20:23:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 20:23:48 +0300 |
commit | 07904712e8943b5845df9559093018c8473f72f3 (patch) | |
tree | 03cdc6ea24ac87a2ee2a3c1a7299874040675489 /source/blender/makesrna/intern/rna_main_api.c | |
parent | ee74e720a82b7a1fb5f732cd8ceacbb26fa7e0d3 (diff) |
RNA:
* Property update functions no longer get context, instead they get only
Main and Scene. The RNA api was intended to be as context-less as
possible, since it doesn't really matter who is changing the property,
everything that uses the property should be updated.
* There's still one exception case that use it now, screen operations
still depend on context too much. It also revealed a few places using
context where they shouldn't.
* Ideally Scene shouldn't be passed, but much of Blender still depends on
it, should be dropped when we try to support multiple scene editing.
Change was planned for a while, but need this now to be able to call
update without a context pointer.
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 70dab957fb9..5069bbd6ae6 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -50,41 +50,41 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" -static Mesh *rna_Main_add_mesh(Main *main, char *name) +static Mesh *rna_Main_add_mesh(Main *bmain, char *name) { Mesh *me= add_mesh(name); me->id.us--; return me; } -static void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me) +static void rna_Main_remove_mesh(Main *bmain, ReportList *reports, Mesh *me) { if(me->id.us == 0) - free_libblock(&main->mesh, me); + free_libblock(&bmain->mesh, me); else BKE_report(reports, RPT_ERROR, "Mesh must have zero users to be removed."); /* XXX python now has invalid pointer? */ } -static void rna_Main_remove_armature(Main *main, ReportList *reports, bArmature *arm) +static void rna_Main_remove_armature(Main *bmain, ReportList *reports, bArmature *arm) { if(arm->id.us == 0) - free_libblock(&main->armature, arm); + free_libblock(&bmain->armature, arm); else BKE_report(reports, RPT_ERROR, "Armature must have zero users to be removed."); /* XXX python now has invalid pointer? */ } -static bArmature *rna_Main_add_armature(Main *main, char *name) +static bArmature *rna_Main_add_armature(Main *bmain, char *name) { bArmature *arm= add_armature(name); arm->id.us--; return arm; } -static Lamp *rna_Main_add_lamp(Main *main, char *name) +static Lamp *rna_Main_add_lamp(Main *bmain, char *name) { Lamp *la= add_lamp(name); la->id.us--; @@ -92,7 +92,7 @@ static Lamp *rna_Main_add_lamp(Main *main, char *name) } /* -static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la) +static void rna_Main_remove_lamp(Main *bmain, ReportList *reports, Lamp *la) { if(la->id.us == 0) free_libblock(&main->lamp, la); @@ -101,7 +101,7 @@ static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la) } */ -static Object* rna_Main_add_object(Main *main, int type, char *name) +static Object* rna_Main_add_object(Main *bmain, int type, char *name) { Object *ob= add_only_object(type, name); ob->id.us--; @@ -120,29 +120,29 @@ static Object* rna_Main_add_object(Main *main, int type, char *name) # don't do this since ob is already freed! bpy.data.remove_object(ob) */ -static void rna_Main_remove_object(Main *main, ReportList *reports, Object *ob) +static void rna_Main_remove_object(Main *bmain, ReportList *reports, Object *ob) { if(ob->id.us == 0) - free_libblock(&main->object, ob); + free_libblock(&bmain->object, ob); else BKE_report(reports, RPT_ERROR, "Object must have zero users to be removed."); } -static Material *rna_Main_add_material(Main *main, char *name) +static Material *rna_Main_add_material(Main *bmain, char *name) { return add_material(name); } /* TODO: remove material? */ -struct Tex *rna_Main_add_texture(Main *main, char *name) +struct Tex *rna_Main_add_texture(Main *bmain, char *name) { return add_texture(name); } /* TODO: remove texture? */ -struct Image *rna_Main_add_image(Main *main, char *filename) +struct Image *rna_Main_add_image(Main *bmain, char *filename) { return BKE_add_image_file(filename, 0); } |