diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-02 21:15:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-02 21:15:24 +0400 |
commit | 1e18da32fb3df5d491201770d10992f0b975650b (patch) | |
tree | 3c2efd537a5fcda4a5b9de57bc04c5905c984c02 /source/blender/editors/physics | |
parent | aa43cab8206a07a37dacb4e606ef6112c1054587 (diff) |
replace:
CTX_data_pointer_get_type(C, "object", &RNA_Object).data
with api call:
ED_object_context(C)
... since getting the context object is such a common operation.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/dynamicpaint_ops.c | 11 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 9 |
2 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 6e25307b786..cdcaae91070 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -42,6 +42,7 @@ #include "ED_mesh.h" #include "ED_screen.h" +#include "ED_object.h" #include "RNA_access.h" #include "RNA_define.h" @@ -58,7 +59,7 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { DynamicPaintModifierData *pmd = NULL; - Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *cObject = ED_object_context(C); DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; @@ -100,7 +101,7 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot) static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) { DynamicPaintModifierData *pmd = NULL; - Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *cObject = ED_object_context(C); DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; int id=0; @@ -148,7 +149,7 @@ void DPAINT_OT_surface_slot_remove(wmOperatorType *ot) static int type_toggle_exec(bContext *C, wmOperator *op) { - Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *cObject = ED_object_context(C); Scene *scene = CTX_data_scene(C); DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint); int type= RNA_enum_get(op->ptr, "type"); @@ -199,7 +200,7 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot) static int output_toggle_exec(bContext *C, wmOperator *op) { - Object *ob = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob = ED_object_context(C); Scene *scene = CTX_data_scene(C); DynamicPaintSurface *surface; DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint); @@ -344,7 +345,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op) { DynamicPaintModifierData *pmd = NULL; DynamicPaintCanvasSettings *canvas; - Object *ob = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob = ED_object_context(C); int status = 0; double timer = PIL_check_seconds_timer(); char result_str[80]; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index bbff2239a38..b26661da4a2 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -59,6 +59,7 @@ #include "ED_particle.h" #include "ED_screen.h" +#include "ED_object.h" #include "physics_intern.h" @@ -66,7 +67,7 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob= ED_object_context(C); Scene *scene = CTX_data_scene(C); if(!scene || !ob) @@ -97,7 +98,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob= ED_object_context(C); Scene *scene = CTX_data_scene(C); int mode_orig = ob->mode; if(!scene || !ob) @@ -581,7 +582,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys) static int disconnect_hair_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob= ED_object_context(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= NULL; int all = RNA_boolean_get(op->ptr, "all"); @@ -719,7 +720,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) static int connect_hair_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob= ED_object_context(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= NULL; int all = RNA_boolean_get(op->ptr, "all"); |