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 :)
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
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);
|
||||
|
||||
bone_looper(ob, arm->bonebase.first, NULL,
|
||||
show_pose_bone);
|
||||
|
||||
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 ************ */
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ void unique_editbone_name (ListBase *edbo, char *name);
|
||||
void undo_push_armature(struct bContext *C, char *name);
|
||||
|
||||
/* poseobject.c */
|
||||
void ED_armature_exit_posemode(struct Base *base);
|
||||
void ED_armature_enter_posemode(struct Base *base);
|
||||
void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
|
||||
void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
|
||||
int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
|
||||
void ED_pose_deselectall(struct Object *ob, int test, int doundo);
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
|
||||
/* hide */
|
||||
WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "swap", 1);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "invert", 1);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
/* tools */
|
||||
|
||||
@@ -180,6 +180,10 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
keymap= WM_keymap_listbase(wm, "Object Non-modal", 0, 0);
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
|
||||
/* pose is not modal, operator poll checks for this */
|
||||
keymap= WM_keymap_listbase(wm, "Pose", 0, 0);
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
|
||||
/* object modal ops default */
|
||||
keymap= WM_keymap_listbase(wm, "Object Mode", 0, 0);
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
@@ -256,6 +260,12 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype)
|
||||
else
|
||||
WM_event_remove_keymap_handler(&ar->handlers, keymap);
|
||||
|
||||
keymap= WM_keymap_listbase(wm, "Armature", 0, 0);
|
||||
if(stype==NS_EDITMODE_ARMATURE)
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
else
|
||||
WM_event_remove_keymap_handler(&ar->handlers, keymap);
|
||||
|
||||
/* editfont keymap swallows all... */
|
||||
keymap= WM_keymap_listbase(wm, "Font", 0, 0);
|
||||
if(stype==NS_EDITMODE_TEXT)
|
||||
|
||||
@@ -5338,7 +5338,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
|
||||
|
||||
v3d->flag &= ~V3D_MODE;
|
||||
ED_view3d_exit_paint_modes(C);
|
||||
ED_armature_exit_posemode(basact);
|
||||
ED_armature_exit_posemode(C, basact);
|
||||
if(obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
|
||||
}
|
||||
@@ -5394,7 +5394,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
|
||||
if(obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
|
||||
|
||||
ED_armature_enter_posemode(basact);
|
||||
ED_armature_enter_posemode(C, basact);
|
||||
}
|
||||
}
|
||||
else if(v3d->modeselect == V3D_PARTICLEEDITMODE_SEL){
|
||||
|
||||
@@ -1098,7 +1098,6 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter)
|
||||
else if (BASE_SELECTABLE(v3d, basact)) {
|
||||
|
||||
oldbasact= BASACT;
|
||||
BASACT= basact;
|
||||
|
||||
if(!extend) {
|
||||
deselectall_except(scene, basact);
|
||||
@@ -1120,10 +1119,8 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter)
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ******************** border and circle ************************************** */
|
||||
|
||||
@@ -202,6 +202,7 @@ typedef struct wmNotifier {
|
||||
#define NS_EDITMODE_MBALL (6<<8)
|
||||
#define NS_EDITMODE_LATTICE (7<<8)
|
||||
#define NS_EDITMODE_ARMATURE (8<<8)
|
||||
#define NS_POSEMODE (9<<8)
|
||||
|
||||
|
||||
/* action classification */
|
||||
|
||||
Reference in New Issue
Block a user