diff options
Diffstat (limited to 'source/blender/editors')
18 files changed, 47 insertions, 26 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 64832a1311f..c99f939300e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -143,7 +143,7 @@ bAction *verify_adt_action(ID *id, short add) if ((adt->action == NULL) && (add)) { char actname[sizeof(id->name) - 2]; BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2); - adt->action = add_empty_action(actname); + adt->action = add_empty_action(G.main, actname); } /* return the action */ diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 04815b9c33c..b2c1b7fdcd0 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -54,6 +54,7 @@ #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_object.h" @@ -196,7 +197,7 @@ static bAction *poselib_init_new(Object *ob) /* init object's poselib action (unlink old one if there) */ if (ob->poselib) id_us_min(&ob->poselib->id); - ob->poselib = add_empty_action("PoseLib"); + ob->poselib = add_empty_action(G.main, "PoseLib"); return ob->poselib; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index e57e52d74b6..e03a171da18 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -661,11 +661,12 @@ static int reports_to_text_poll(bContext *C) static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) { ReportList *reports = CTX_wm_reports(C); + Main *bmain = CTX_data_main(C); Text *txt; char *str; /* create new text-block to write to */ - txt = BKE_text_add("Recent Reports"); + txt = BKE_text_add(bmain, "Recent Reports"); /* convert entire list to a display string, and add this to the text-block * - if commandline debug option enabled, show debug reports too @@ -803,7 +804,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, } if (text == NULL) { - text = BKE_text_load(filepath, bmain->name); + text = BKE_text_load(bmain, filepath, bmain->name); } if (text == NULL) { diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 35f85f3faee..0a996c11f14 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -36,6 +36,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_main.h" #include "BKE_mask.h" #include "DNA_scene_types.h" @@ -261,9 +262,10 @@ int ED_mask_feather_find_nearest(const bContext *C, Mask *mask, float normal_co[ Mask *ED_mask_new(bContext *C, const char *name) { ScrArea *sa = CTX_wm_area(C); + Main *bmain = CTX_data_main(C); Mask *mask; - mask = BKE_mask_new(name); + mask = BKE_mask_new(bmain, name); if (sa && sa->spacedata.first) { switch (sa->spacetype) { diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 8457b278c6c..3b2ddfe15ee 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1558,7 +1558,7 @@ static int convert_exec(bContext *C, wmOperator *op) mb = newob->data; mb->id.us--; - newob->data = BKE_mesh_add("Mesh"); + newob->data = BKE_mesh_add(bmain, "Mesh"); newob->type = OB_MESH; me = newob->data; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 7bf1a5db3b1..9b683a1ba98 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -311,7 +311,7 @@ static int group_create_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); - group = add_group(name); + group = add_group(bmain, name); CTX_DATA_BEGIN (C, Base *, base, selected_bases) { @@ -348,12 +348,13 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *ob = ED_object_context(C); + Main *bmain = CTX_data_main(C); Group *group; if (ob == NULL) return OPERATOR_CANCELLED; - group = add_group("Group"); + group = add_group(bmain, "Group"); add_to_group(group, ob, scene, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c index fac835a414a..b2f53379090 100644 --- a/source/blender/editors/physics/rigidbody_constraint.c +++ b/source/blender/editors/physics/rigidbody_constraint.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" #include "BKE_group.h" #include "BKE_object.h" #include "BKE_report.h" @@ -87,7 +88,7 @@ void ED_rigidbody_con_add(wmOperator *op, Scene *scene, Object *ob, int type) } /* create constraint group if it doesn't already exits */ if (rbw->constraints == NULL) { - rbw->constraints = add_group("RigidBodyConstraints"); + rbw->constraints = add_group(G.main, "RigidBodyConstraints"); } /* make rigidbody constraint settings */ ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, type); diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index 38ed903a161..fa258c98567 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -46,6 +46,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" #include "BKE_group.h" #include "BKE_object.h" #include "BKE_report.h" @@ -113,7 +114,7 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type) scene->rigidbody_world = rbw; } if (rbw->group == NULL) { - rbw->group = add_group("RigidBodyWorld"); + rbw->group = add_group(G.main, "RigidBodyWorld"); } /* make rigidbody object settings */ diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 53e1f49d544..e00db9b5850 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -367,6 +367,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data; + Main *bmain = CTX_data_main(C); PointerRNA ptr, idptr; PropertyRNA *prop; @@ -375,7 +376,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) ma = BKE_material_copy(ma); } else { - ma = BKE_material_add("Material"); + ma = BKE_material_add(bmain, "Material"); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(scene, &ma->id); @@ -420,6 +421,7 @@ void MATERIAL_OT_new(wmOperatorType *ot) static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; + Main *bmain = CTX_data_main(C); PointerRNA ptr, idptr; PropertyRNA *prop; @@ -427,7 +429,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) if (tex) tex = BKE_texture_copy(tex); else - tex = add_texture("Texture"); + tex = add_texture(bmain, "Texture"); /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -467,6 +469,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data; + Main *bmain = CTX_data_main(C); PointerRNA ptr, idptr; PropertyRNA *prop; @@ -475,7 +478,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) wo = BKE_world_copy(wo); } else { - wo = add_world("World"); + wo = add_world(bmain, "World"); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(scene, &wo->id); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 618d545b084..408572c7979 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -62,11 +62,12 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) /*int type = RNA_enum_get(op->ptr, "type");*/ Paint *paint = paint_get_active_from_context(C); struct Brush *br = paint_brush(paint); + Main *bmain = CTX_data_main(C); if (br) br = BKE_brush_copy(br); else - br = BKE_brush_add("Brush"); + br = BKE_brush_add(bmain, "Brush"); paint_brush_set(paint, br); @@ -272,7 +273,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode); if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) { - brush = BKE_brush_add(tool_name); + brush = BKE_brush_add(bmain, tool_name); brush_tool_set(brush, tool_offset, tool); brush->ob_mode = ob_mode; brush->toggle_brush = brush_orig; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a80d425b90a..7e99e6c065d 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -53,6 +53,7 @@ #include "BKE_action.h" #include "BKE_fcurve.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_nla.h" #include "BKE_context.h" #include "BKE_report.h" @@ -104,8 +105,10 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) action = BKE_action_copy(oldact); } else { + Main *bmain = CTX_data_main(C); + /* just make a new (empty) action */ - action = add_empty_action("Action"); + action = add_empty_action(bmain, "Action"); } /* when creating new ID blocks, use is already 1 (fake user), diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index cf4e76a8427..dfb69be6f18 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -160,6 +160,7 @@ static int open_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); bScreen *screen = CTX_wm_screen(C); + Main *bmain = CTX_data_main(C); PropertyPointerRNA *pprop; PointerRNA idptr; MovieClip *clip = NULL; @@ -191,7 +192,7 @@ static int open_exec(bContext *C, wmOperator *op) errno = 0; - clip = BKE_movieclip_file_add(str); + clip = BKE_movieclip_file_add(bmain, str); if (!clip) { if (op->customdata) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8bb51edde02..2d2d29d9eaa 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1716,6 +1716,7 @@ static int image_new_exec(bContext *C, wmOperator *op) Scene *scene; Object *obedit; Image *ima; + Main *bmain; PointerRNA ptr, idptr; PropertyRNA *prop; char name[MAX_ID_NAME - 2]; @@ -1726,6 +1727,7 @@ static int image_new_exec(bContext *C, wmOperator *op) sima = CTX_wm_space_image(C); scene = CTX_data_scene(C); obedit = CTX_data_edit_object(C); + bmain = CTX_data_main(C); RNA_string_get(op->ptr, "name", name); width = RNA_int_get(op->ptr, "width"); @@ -1738,7 +1740,7 @@ static int image_new_exec(bContext *C, wmOperator *op) if (!alpha) color[3] = 1.0f; - ima = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color); + ima = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color); if (!ima) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index b47be150417..22631568d03 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -441,6 +441,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) { SpaceNode *snode; bNodeTree *ntree; + Main *bmain; PointerRNA ptr, idptr; PropertyRNA *prop; int treetype; @@ -448,6 +449,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) /* retrieve state */ snode = CTX_wm_space_node(C); + bmain = CTX_data_main(C); if (RNA_struct_property_is_set(op->ptr, "type")) treetype = RNA_enum_get(op->ptr, "type"); @@ -457,7 +459,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) if (RNA_struct_property_is_set(op->ptr, "name")) RNA_string_get(op->ptr, "name", treename); - ntree = ntreeAddTree(treename, treetype, 0); + ntree = ntreeAddTree(bmain, treename, treetype, 0); if (!ntree) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 321eaa32e80..fb4e4f62e52 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -328,7 +328,7 @@ void ED_node_shader_default(Scene *scene, ID *id) int output_type, shader_type; float color[3], strength = 1.0f; - ntree = ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0); + ntree = ntreeAddTree(G.main, "Shader Nodetree", NTREE_SHADER, 0); switch (GS(id->name)) { case ID_MA: @@ -424,7 +424,7 @@ void ED_node_composit_default(Scene *sce) return; } - sce->nodetree = ntreeAddTree("Compositing Nodetree", NTREE_COMPOSIT, 0); + sce->nodetree = ntreeAddTree(G.main, "Compositing Nodetree", NTREE_COMPOSIT, 0); sce->nodetree->chunksize = 256; sce->nodetree->edit_quality = NTREE_QUALITY_HIGH; @@ -468,7 +468,7 @@ void ED_node_texture_default(Tex *tx) return; } - tx->nodetree = ntreeAddTree("Texture Nodetree", NTREE_TEXTURE, 0); + tx->nodetree = ntreeAddTree(G.main, "Texture Nodetree", NTREE_TEXTURE, 0); ntemp.type = TEX_NODE_OUTPUT; out = nodeAddNode(tx->nodetree, &ntemp); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 4dd9c89375d..7572ca04a33 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -1039,7 +1039,7 @@ static bNode *node_group_make_from_selected(bNodeTree *ntree) node_get_selected_minmax(ntree, NULL, min, max); /* new nodetree */ - ngroup = ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP); + ngroup = ntreeAddTree(G.main, "NodeGroup", ntree->type, NODE_GROUP); /* make group node */ ntemp.type = NODE_GROUP; diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index e82917feb21..e92d93485a1 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -136,7 +136,7 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event) ntemp.type = -event; switch (ntemp.type) { case NODE_GROUP: - ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type); + ntemp.ngroup = ntreeAddTree(bmain, "Group", snode->treetype, ntemp.type); break; default: ntemp.ngroup = NULL; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 21966ef614c..1f209f90007 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -161,11 +161,12 @@ void text_update_edited(Text *text) static int text_new_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st = CTX_wm_space_text(C); + Main *bmain = CTX_data_main(C); Text *text; PointerRNA ptr, idptr; PropertyRNA *prop; - text = BKE_text_add("Text"); + text = BKE_text_add(bmain, "Text"); /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -226,6 +227,7 @@ static int text_open_cancel(bContext *UNUSED(C), wmOperator *op) static int text_open_exec(bContext *C, wmOperator *op) { SpaceText *st = CTX_wm_space_text(C); + Main *bmain = CTX_data_main(C); Text *text; PropertyPointerRNA *pprop; PointerRNA idptr; @@ -234,7 +236,7 @@ static int text_open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - text = BKE_text_load(str, G.main->name); + text = BKE_text_load(bmain, str, G.main->name); if (!text) { if (op->customdata) MEM_freeN(op->customdata); |