[Bf-blender-cvs] [4722fc5] master: Disable possibility to flip bone names of linked armatures

Sergey Sharybin noreply at git.blender.org
Wed Nov 16 10:42:15 CET 2016


Commit: 4722fc5dd0a335588a160e43cf77223c256ebd31
Author: Sergey Sharybin
Date:   Wed Nov 16 10:39:41 2016 +0100
Branches: master
https://developer.blender.org/rB4722fc5dd0a335588a160e43cf77223c256ebd31

Disable possibility to flip bone names of linked armatures

Linked data should not be modified in such a way.

Reported by Nathan here in the studio, reviewed by Bastien, thanks!

===================================================================

M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/screen/screen_ops.c

===================================================================

diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 5015829..322476d 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -626,7 +626,7 @@ void POSE_OT_flip_names(wmOperatorType *ot)
 	
 	/* api callbacks */
 	ot->exec = pose_flip_names_exec;
-	ot->poll = ED_operator_posemode;
+	ot->poll = ED_operator_posemode_local;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 6a558d1..ec09add 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -183,6 +183,7 @@ int     ED_operator_uvmap(struct bContext *C);
 int     ED_operator_posemode_exclusive(struct bContext *C);
 int     ED_operator_posemode_context(struct bContext *C);
 int     ED_operator_posemode(struct bContext *C);
+int     ED_operator_posemode_local(struct bContext *C);
 int     ED_operator_mask(struct bContext *C);
 
 
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 022b860..c69e014 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -442,6 +442,17 @@ int ED_operator_posemode(bContext *C)
 	return 0;
 }
 
+int ED_operator_posemode_local(bContext *C)
+{
+	if (ED_operator_posemode(C)) {
+		Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
+		bArmature *arm = ob->data;
+		return !(ID_IS_LINKED_DATABLOCK(&ob->id) ||
+		         ID_IS_LINKED_DATABLOCK(&arm->id));
+	}
+	return false;
+}
+
 /* wrapper for ED_space_image_show_uvedit */
 int ED_operator_uvedit(bContext *C)
 {




More information about the Bf-blender-cvs mailing list