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:
authorTon Roosendaal <ton@blender.org>2009-02-01 22:53:24 +0300
committerTon Roosendaal <ton@blender.org>2009-02-01 22:53:24 +0300
commit9c2e4571ccffcaf1c1e1db94a79636a933e89086 (patch)
tree9ae23f6111e8361267ba2505f59eb717c6b57447 /source/blender/editors/armature
parenta00aa16d7ec0f07f43d4c969f3ea58a518b7853f (diff)
2.5
Committed two posemode operators. Hide/Unhide. For people who want to check on adding operators, only check the changes in armature directory, rest is to get things to work, and a small bugfix :)
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_intern.h4
-rw-r--r--source/blender/editors/armature/armature_ops.c11
-rw-r--r--source/blender/editors/armature/editarmature.c90
-rw-r--r--source/blender/editors/armature/poseobject.c17
4 files changed, 88 insertions, 34 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index ec2ce1a4ac6..7673acabe3a 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -29,10 +29,14 @@
#define ED_ARMATURE_INTERN_H
/* internal exports only */
+struct wmOperatorType;
+/* editarmature.c */
void armature_bone_rename(Object *ob, char *oldnamep, char *newnamep);
EditBone *armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo);
+void POSE_OT_hide(struct wmOperatorType *ot);
+void POSE_OT_reveil(struct wmOperatorType *ot);
#endif /* ED_ARMATURE_INTERN_H */
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 0c591c6d576..eaa8207bc11 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -64,20 +64,25 @@
/* Both operators ARMATURE_OT_xxx and POSE_OT_xxx here */
void ED_operatortypes_armature(void)
{
-// WM_operatortype_append(POSE_OT_pose_hide);
+ WM_operatortype_append(POSE_OT_hide);
+ WM_operatortype_append(POSE_OT_reveil);
}
void ED_keymap_armature(wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "Armature", 0, 0);
+ wmKeymapItem *kmi;
/* 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_hide", HKEY, KM_PRESS, 0, 0);
/* only set in posemode, by space_view3d listener */
keymap= WM_keymap_listbase(wm, "Pose", 0, 0);
- WM_keymap_add_item(keymap, "POSE_OT_pose_hide", HKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, 0, 0);
+ kmi= WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "invert", 1);
+ WM_keymap_add_item(keymap, "POSE_OT_reveil", HKEY, KM_PRESS, KM_ALT, 0);
}
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index c776f7959da..631f6ce39df 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -74,12 +74,16 @@
#include "BIF_gl.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "WM_api.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_object.h"
+#include "ED_screen.h"
#include "ED_util.h"
#include "ED_view3d.h"
@@ -4055,6 +4059,8 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par)
}
}
+/* ************* hide/unhide pose bones ******************* */
+
static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr)
{
bArmature *arm= ob->data;
@@ -4068,20 +4074,6 @@ static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr)
return 0;
}
-/* active object is armature */
-void hide_selected_pose_bones(Object *ob)
-{
- bArmature *arm= ob->data;
-
- if (!arm)
- return;
-
- bone_looper(ob, arm->bonebase.first, NULL,
- hide_selected_pose_bone);
-
- BIF_undo_push("Hide Bones");
-}
-
static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr)
{
bArmature *arm= ob->data;
@@ -4096,15 +4088,40 @@ static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr)
return 0;
}
-/* active object is armature */
-void hide_unselected_pose_bones(Object *ob)
+/* active object is armature in posemode, poll checked */
+static int pose_hide_exec(bContext *C, wmOperator *op)
{
- bArmature *arm= ob->data;
+ Object *ob= CTX_data_active_object(C);
+ bArmature *arm= ob->data;
- bone_looper(ob, arm->bonebase.first, NULL,
+ if(RNA_boolean_get(op->ptr, "invert"))
+ bone_looper(ob, arm->bonebase.first, NULL,
hide_unselected_pose_bone);
+ else
+ bone_looper(ob, arm->bonebase.first, NULL,
+ hide_selected_pose_bone);
+
+ /* note, notifier might evolve */
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
+
+ return OPERATOR_FINISHED;
+}
- BIF_undo_push("Hide Unselected Bone");
+void POSE_OT_hide(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Hide Selection";
+ ot->idname= "POSE_OT_hide";
+
+ /* api callbacks */
+ ot->exec= pose_hide_exec;
+ ot->poll= ED_operator_posemode;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
@@ -4117,21 +4134,40 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
bone->flag |= BONE_SELECTED;
}
}
-
+
return 0;
}
-/* active object is armature in posemode */
-void show_all_pose_bones(Object *ob)
+/* active object is armature in posemode, poll checked */
+static int pose_reveil_exec(bContext *C, wmOperator *op)
{
- bArmature *arm= ob->data;
-
- bone_looper(ob, arm->bonebase.first, NULL,
- show_pose_bone);
+ Object *ob= CTX_data_active_object(C);
+ bArmature *arm= ob->data;
+
+ bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone);
+
+ /* note, notifier might evolve */
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
- BIF_undo_push("Reveal Bones");
+ return OPERATOR_FINISHED;
}
+void POSE_OT_reveil(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Reveil Selection";
+ ot->idname= "POSE_OT_reveil";
+
+ /* api callbacks */
+ ot->exec= pose_reveil_exec;
+ ot->poll= ED_operator_posemode;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+}
/* ************* RENAMING DISASTERS ************ */
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index da79c8b1bad..bb883c5a98d 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -67,6 +67,12 @@
#include "BIF_transform.h" /* for autokey TFM_TRANSLATION, etc */
#include "BIF_gl.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
#include "ED_armature.h"
#include "ED_anim_api.h"
#include "ED_keyframing.h"
@@ -108,7 +114,7 @@ void set_pose_keys (Object *ob)
}
}
-void ED_armature_enter_posemode(Base *base)
+void ED_armature_enter_posemode(bContext *C, Base *base)
{
Object *ob= base->object;
@@ -123,21 +129,24 @@ void ED_armature_enter_posemode(Base *base)
ob->flag |= OB_POSEMODE;
base->flag= ob->flag;
+ WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_POSEMODE, NULL);
+
break;
default:
return;
}
- // XXX
- G.f &= ~(G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT | G_SCULPTMODE);
+ ED_view3d_exit_paint_modes(C);
}
-void ED_armature_exit_posemode(Base *base)
+void ED_armature_exit_posemode(bContext *C, Base *base)
{
if(base) {
Object *ob= base->object;
ob->flag &= ~OB_POSEMODE;
base->flag= ob->flag;
+
+ WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
}
}