Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-31 13:27:47 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-31 13:27:47 +0300
commit28369f725c10f167e504f0acd695a0f9d3c2a709 (patch)
tree8f8cb7289a660b84ec4be31ab018965d4082b11c /source/blender/makesrna
parent24d1829243c6e41c639c1d0722a13599a7c1927c (diff)
Cleanup: remove G.main from BKE object
Had to add some G.main to modifiers, but in 2.8 we do not need that anymore, so it's not that bad! ;)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_object.c16
-rw-r--r--source/blender/makesrna/intern/rna_pose.c9
3 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index b602c90c82c..55153c294b5 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -278,9 +278,9 @@ static char *rna_Constraint_path(PointerRNA *ptr)
}
}
-static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Constraint_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ED_object_constraint_tag_update(ptr->id.data, ptr->data);
+ ED_object_constraint_tag_update(bmain, ptr->id.data, ptr->data);
}
static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index b1fcfcb9aa6..f3ff88c3200 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1323,17 +1323,17 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
}
-static bConstraint *rna_Object_constraints_new(Object *object, int type)
+static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int type)
{
bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
- ED_object_constraint_tag_update(object, new_con);
+ ED_object_constraint_tag_update(bmain, object, new_con);
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
return new_con;
}
-static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
+static void rna_Object_constraints_remove(Object *object, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
{
bConstraint *con = con_ptr->data;
if (BLI_findindex(&object->constraints, con) == -1) {
@@ -1344,16 +1344,16 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P
BKE_constraint_remove(&object->constraints, con);
RNA_POINTER_INVALIDATE(con_ptr);
- ED_object_constraint_update(object);
+ ED_object_constraint_update(bmain, object);
ED_object_constraint_set_active(object, NULL);
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
}
-static void rna_Object_constraints_clear(Object *object)
+static void rna_Object_constraints_clear(Object *object, Main *bmain)
{
BKE_constraints_free(&object->constraints);
- ED_object_constraint_update(object);
+ ED_object_constraint_update(bmain, object);
ED_object_constraint_set_active(object, NULL);
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
@@ -1962,6 +1962,7 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
/* Constraint collection */
func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
RNA_def_function_ui_description(func, "Add a new constraint to this object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
/* object to add */
parm = RNA_def_enum(func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
@@ -1971,13 +1972,14 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
RNA_def_function_ui_description(func, "Remove a constraint from this object");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
/* constraint to remove */
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Remove all constraint from this object");
}
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index ac27a6c21a5..d8911705daa 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -237,7 +237,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), Pointer
BKE_pose_update_constraint_flags(pose);
- object_test_constraints(ob);
+ object_test_constraints(bmain, ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
}
@@ -535,7 +535,8 @@ static bConstraint *rna_PoseChannel_constraints_new(ID *id, bPoseChannel *pchan,
return new_con;
}
-static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr)
+static void rna_PoseChannel_constraints_remove(
+ ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
{
bConstraint *con = con_ptr->data;
const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
@@ -549,7 +550,7 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo
BKE_constraint_remove(&pchan->constraints, con);
RNA_POINTER_INVALIDATE(con_ptr);
- ED_object_constraint_update(ob);
+ ED_object_constraint_update(bmain, ob);
BKE_constraints_active_set(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */
@@ -777,7 +778,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
RNA_def_function_ui_description(func, "Remove a constraint from this object");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); /* ID needed for refresh */
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS ); /* ID needed for refresh */
/* constraint to remove */
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);