diff options
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 12 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 11 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 9 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 4 |
5 files changed, 20 insertions, 18 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index d0588806313..bb9d9d74bb4 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -150,7 +150,7 @@ bConstraint *get_active_constraint(Object *ob) /* ------------- PyConstraints ------------------ */ /* this callback sets the text-file to be used for selected menu item */ -static void validate_pyconstraint_cb(void *arg1, void *arg2) +static void validate_pyconstraint_cb(Main *bmain, void *arg1, void *arg2) { bPythonConstraint *data = arg1; Text *text = NULL; @@ -160,13 +160,13 @@ static void validate_pyconstraint_cb(void *arg1, void *arg2) /* exception for no script */ if (index) { /* innovative use of a for...loop to search */ - for (text = G.main->text.first, i = 1; text && index != i; i++, text = text->id.next) ; + for (text = bmain->text.first, i = 1; text && index != i; i++, text = text->id.next) ; } data->text = text; } /* this returns a string for the list of usable pyconstraint script names */ -static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex) +static char *buildmenu_pyconstraints(Main *bmain, Text *con_text, int *pyconindex) { DynStr *pupds = BLI_dynstr_new(); Text *text; @@ -183,7 +183,7 @@ static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex) *pyconindex = 0; /* loop through markers, adding them */ - for (text = G.main->text.first, i = 1; text; i++, text = text->id.next) { + for (text = bmain->text.first, i = 1; text; i++, text = text->id.next) { /* this is important to ensure that right script is shown as active */ if (text == con_text) *pyconindex = i; @@ -1792,14 +1792,14 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase char *menustr; int scriptint = 0; /* popup a list of usable scripts */ - menustr = buildmenu_pyconstraints(NULL, &scriptint); + menustr = buildmenu_pyconstraints(bmain, NULL, &scriptint); /* XXX scriptint = pupmenu(menustr); */ MEM_freeN(menustr); /* only add constraint if a script was chosen */ if (scriptint) { /* add constraint */ - validate_pyconstraint_cb(con->data, &scriptint); + validate_pyconstraint_cb(bmain, con->data, &scriptint); /* make sure target allowance is set correctly */ BPY_pyconstraint_update(ob, con); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 2737ae5d92d..2131c85ec82 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -383,7 +383,7 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f if (arm->edbo == NULL) { return false; } - ED_armature_from_edit(obedit->data); + ED_armature_from_edit(bmain, obedit->data); if (freedata) { ED_armature_edit_free(obedit->data); } @@ -398,7 +398,7 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f if (cu->editnurb == NULL) { return false; } - ED_curve_editnurb_load(obedit); + ED_curve_editnurb_load(bmain, obedit); if (freedata) { ED_curve_editnurb_free(obedit); } @@ -446,13 +446,13 @@ bool ED_object_editmode_load(Main *bmain, Object *obedit) * \param flag: * - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly. */ -bool ED_object_editmode_exit_ex(Scene *scene, Object *obedit, int flag) +bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag) { const bool freedata = (flag & EM_FREEDATA) != 0; if (flag & EM_WAITCURSOR) waitcursor(1); - if (ED_object_editmode_load_ex(G.main, obedit, freedata) == false) { + if (ED_object_editmode_load_ex(bmain, obedit, freedata) == false) { /* in rare cases (background mode) its possible active object * is flagged for editmode, without 'obedit' being set [#35489] */ if (UNLIKELY(scene->basact && (scene->basact->object->mode & OB_MODE_EDIT))) { @@ -495,9 +495,10 @@ bool ED_object_editmode_exit_ex(Scene *scene, Object *obedit, int flag) bool ED_object_editmode_exit(bContext *C, int flag) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - return ED_object_editmode_exit_ex(scene, obedit, flag); + return ED_object_editmode_exit_ex(bmain, scene, obedit, flag); } bool ED_object_editmode_enter(bContext *C, int flag) diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 5963e4b769b..b6dd3e2de66 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -301,7 +301,7 @@ static int return_editcurve_indexar( return totvert; } -static bool object_hook_index_array(Scene *scene, Object *obedit, +static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit, int *r_tot, int **r_indexar, char *r_name, float r_cent[3]) { *r_indexar = NULL; @@ -333,7 +333,7 @@ static bool object_hook_index_array(Scene *scene, Object *obedit, } case OB_CURVE: case OB_SURF: - ED_curve_editnurb_load(obedit); + ED_curve_editnurb_load(bmain, obedit); ED_curve_editnurb_make(obedit); return return_editcurve_indexar(obedit, r_tot, r_indexar, r_cent); case OB_LATTICE: @@ -473,7 +473,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob int tot, ok, *indexar; char name[MAX_NAME]; - ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent); + ok = object_hook_index_array(bmain, scene, obedit, &tot, &indexar, name, cent); if (!ok) { BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group"); @@ -809,6 +809,7 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot) static int object_hook_assign_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); int num = RNA_enum_get(op->ptr, "modifier"); @@ -826,7 +827,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op) /* assign functionality */ - if (!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) { + if (!object_hook_index_array(bmain, scene, ob, &tot, &indexar, name, cent)) { BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index b42732bd25d..368fd4fd98d 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1759,7 +1759,7 @@ static Object *modifier_skin_armature_create(Main *bmain, Scene *scene, Object * MEM_freeN(emap); MEM_freeN(emap_mem); - ED_armature_from_edit(arm); + ED_armature_from_edit(bmain, arm); ED_armature_edit_free(arm); return arm_ob; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 19dad374696..fab2396b05a 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -547,7 +547,7 @@ static int apply_objects_internal( BKE_mesh_calc_normals(me); } else if (ob->type == OB_ARMATURE) { - ED_armature_transform_apply(ob, mat, do_props); + ED_armature_transform_apply(bmain, ob, mat, do_props); } else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; @@ -994,7 +994,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) /* Function to recenter armatures in editarmature.c * Bone + object locations are handled there. */ - ED_armature_origin_set(scene, ob, cursor, centermode, around); + ED_armature_origin_set(bmain, scene, ob, cursor, centermode, around); tot_change++; arm->id.tag |= LIB_TAG_DOIT; |