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:
authorCampbell Barton <ideasman42@gmail.com>2011-03-22 11:30:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-22 11:30:07 +0300
commit91e4a1bdf8c1b7cee7ac5c508775bcd3180b94b6 (patch)
treee25430e277722c92852b4d99752f6326c2c3af3b /source/blender/editors/armature
parenta5867232b1e91db7f7d1d2071de341297e86cf22 (diff)
fix for crashes moving armature layers and applying loc/scale/rot in armature editmode.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/poseobject.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 6baf76192a6..23253c0b4cf 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1707,20 +1707,23 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
static int pose_armature_layers_exec (bContext *C, wmOperator *op)
{
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
- bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
+ if(ob==NULL || ob->data==NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
-
+
/* get pointer for armature, and write data there... */
- RNA_id_pointer_create((ID *)arm, &ptr);
+ RNA_id_pointer_create((ID *)ob->data, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -1794,25 +1797,28 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int pose_bone_layers_exec (bContext *C, wmOperator *op)
{
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
- bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
+ if(ob==NULL || ob->data==NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
-
+
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
{
/* get pointer for pchan, and write flags this way */
- RNA_pointer_create((ID *)arm, &RNA_Bone, pchan->bone, &ptr);
+ RNA_pointer_create((ID *)ob->data, &RNA_Bone, pchan->bone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
}
CTX_DATA_END;
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}