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:
authorJoshua Leung <aligorith@gmail.com>2009-02-05 06:28:07 +0300
committerJoshua Leung <aligorith@gmail.com>2009-02-05 06:28:07 +0300
commitf89e3d251711f3617c982cae35f33d4c6115e72b (patch)
tree83b0399aba32a346ae448960f5153e26b2ebdabd /source/blender/editors/armature/armature_ops.c
parent61a6e1957a4a1555564f1eb8dbdb9707fb276826 (diff)
2.5 - Context API access for Bones (EditMode and PoseMode)
* Added selected, selected+editable, and active to access EditBones for Armature Operators to use. These take into account X-Axis Mirror too, so there is really no need to check that sort of thing anymore in tools. * Added a quick testing operator for verifying that these loops filter the data correctly. I've dumped this in armature_ops.c for now. It can be activated using the TKEY hotkey in Armature EditMode only. This should be removed once we have a few more functional tools. * Ported over cleaned up roll-calculation tools from AnimSys2 * Removed a few ugly stubs from posemode code
Diffstat (limited to 'source/blender/editors/armature/armature_ops.c')
-rw-r--r--source/blender/editors/armature/armature_ops.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index eaa8207bc11..e8f75bd4440 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -58,6 +58,49 @@
#include "armature_intern.h"
+/* ************************** quick tests **********************************/
+
+/* XXX This is a quick test operator to print names of all EditBones in context
+ * that should be removed once tool coding starts...
+ */
+
+static int armature_test_exec (bContext *C, wmOperator *op)
+{
+ printf("EditMode Armature Test: \n");
+
+ printf("\tSelected Bones \n");
+ CTX_DATA_BEGIN(C, EditBone*, ebone, selected_bones)
+ {
+ printf("\t\tEditBone '%s' \n", ebone->name);
+ }
+ CTX_DATA_END;
+
+ printf("\tEditable Bones \n");
+ CTX_DATA_BEGIN(C, EditBone*, ebone, selected_editable_bones)
+ {
+ printf("\t\tEditBone '%s' \n", ebone->name);
+ }
+ CTX_DATA_END;
+
+ printf("\tActive Bone \n");
+ {
+ EditBone *ebone= CTX_data_active_bone(C);
+ if (ebone) printf("\t\tEditBone '%s' \n");
+ else printf("\t\t<None> \n");
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_test(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Test Context";
+ ot->idname= "ARMATURE_OT_test";
+
+ /* api callbacks */
+ ot->exec= armature_test_exec;
+}
/* ************************** registration **********************************/
@@ -66,16 +109,23 @@ void ED_operatortypes_armature(void)
{
WM_operatortype_append(POSE_OT_hide);
WM_operatortype_append(POSE_OT_reveil);
+
+ WM_operatortype_append(ARMATURE_OT_test); // XXX temp test for context iterators... to be removed
}
void ED_keymap_armature(wmWindowManager *wm)
{
- ListBase *keymap= WM_keymap_listbase(wm, "Armature", 0, 0);
+ ListBase *keymap;
wmKeymapItem *kmi;
+ /* Armature ------------------------ */
+ keymap= WM_keymap_listbase(wm, "Armature", 0, 0);
+
/* only set in editmode armature, by space_view3d listener */
// WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
-
+ WM_keymap_add_item(keymap, "ARMATURE_OT_test", TKEY, KM_PRESS, 0, 0); // XXX temp test for context iterators... to be removed
+
+ /* Pose ------------------------ */
/* only set in posemode, by space_view3d listener */
keymap= WM_keymap_listbase(wm, "Pose", 0, 0);