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-10-13 09:50:26 +0400
committerJoshua Leung <aligorith@gmail.com>2009-10-13 09:50:26 +0400
commitf8ab477f4569dec1853ec7c9114d21f9a84a062f (patch)
tree0cb46acfa690ab061e6dffcbc12d233807cfd31d /source/blender/editors
parent7171c5928e6bece26d3a3dde41c088e77dbba423 (diff)
2.5 Bugfixes:
* Reverting some changes I made to try and get Action Groups with no viewable F-Curves, but were collapsed to get hidden. These were causing buggy behaviour * Move bones to armature layers, and change armature layer operators now use the new automatic properties drawing invoke callback. This allows changing the buttons there immediately affect the bones in the viewport * #19581: Text Editor: "Jump To" (go to line) not working Made this use the automatic operator props invoke callback, and fixed an RNA properties bug for this (the default value and range values were swapped). * PoseLib rename pose operator now works again. Once again, this uses the auto-props popup. Also, improved the code here while I was at it. * Disabled non-functional/old entry in Select Linked operator ("IPO's")
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c25
-rw-r--r--source/blender/editors/armature/poselib.c102
-rw-r--r--source/blender/editors/armature/poseobject.c47
-rw-r--r--source/blender/editors/object/object_select.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c7
5 files changed, 86 insertions, 97 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 6b953d2460d..fef910a85a3 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -750,19 +750,14 @@ static int animdata_filter_action (ListBase *anim_data, bDopeSheet *ads, bAction
/* loop over groups */
// TODO: in future, should we expect to need nested groups?
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
- ListBase tmp_channels = {NULL, NULL};
- short grp_channel=0;
- int tmp_items = 0;
-
-
/* add this group as a channel first */
if ((filter_mode & ANIMFILTER_CHANNELS) || !(filter_mode & ANIMFILTER_CURVESONLY)) {
/* check if filtering by selection */
if ( ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
ale= make_new_animlistelem(agrp, ANIMTYPE_GROUP, NULL, ANIMTYPE_NONE, owner_id);
if (ale) {
- BLI_addtail(&tmp_channels, ale);
- grp_channel=1;
+ BLI_addtail(anim_data, ale);
+ items++;
}
}
}
@@ -792,25 +787,13 @@ static int animdata_filter_action (ListBase *anim_data, bDopeSheet *ads, bAction
if ( !(filter_mode & ANIMFILTER_CURVEVISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE) )
{
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
- // XXX the 'owner' info here needs review...
- tmp_items += animdata_filter_fcurves(&tmp_channels, ads, agrp->channels.first, agrp, owner, ownertype, filter_mode, owner_id);
+ items += animdata_filter_fcurves(anim_data, ads, agrp->channels.first, agrp, owner, ownertype, filter_mode, owner_id);
}
}
}
}
- /* check group had any F-Curves visible */
- // TODO: this needs more work to truly work so that closed group with no visible channels, and visible group with visible channels are differentiated between
- if (/*tmp_items*/1) {
- /* add the temp channels to the list of filtered channels */
- addlisttolist(anim_data, &tmp_channels);
-
- /* increase the counts as appropriate */
- items += tmp_items + grp_channel;
- }
- else {
- BLI_freelistN(&tmp_channels);
- }
+ // TODO: but we still need to deal with the case when the group may be closed, but it has no visible curves too
}
/* loop over un-grouped F-Curves (only if we're not only considering those channels in the animive group) */
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index d34da201ef5..b06c7286859 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -285,6 +285,9 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout,
bAction *act= ob->poselib;
TimeMarker *marker;
+ /* set the operator execution context correctly */
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
+
/* add each marker to this menu */
for (marker= act->markers.first; marker; marker= marker->next)
uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame);
@@ -398,7 +401,6 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-
void POSELIB_OT_pose_add (wmOperatorType *ot)
{
/* identifiers */
@@ -421,35 +423,35 @@ void POSELIB_OT_pose_add (wmOperatorType *ot)
/* ----- */
-static int poselib_stored_pose_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free)
{
Object *ob= CTX_data_active_object(C);
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
- uiPopupMenu *pup;
- uiLayout *layout;
- int i;
-
- /* sanity check */
- if (ELEM(NULL, ob, act))
- return OPERATOR_CANCELLED;
-
- /* start building */
- pup= uiPupMenuBegin(C, op->type->name, 0);
- layout= uiPupMenuLayout(pup);
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-
- /* add each marker to this menu */
- for (marker=act->markers.first, i=0; marker; marker= marker->next, i++)
- uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, op->idname, "index", i);
-
- uiPupMenuEnd(C, pup);
-
- /* this operator is only for a menu, not used further */
- return OPERATOR_CANCELLED;
-}
+ EnumPropertyItem *item= NULL, item_tmp;
+ int totitem= 0;
+ int i= 0;
+
+ if (C == NULL)
+ return NULL;
+
+ memset(&item_tmp, 0, sizeof(item_tmp));
+ /* add each marker to the list */
+ for (marker=act->markers.first, i=0; marker; marker= marker->next, i++) {
+ item_tmp.identifier= item_tmp.name= marker->name;
+ item_tmp.icon= ICON_ARMATURE_DATA;
+ item_tmp.value= i;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
+ if (i > 0) {
+ *free= 1;
+ return item;
+ }
+ else
+ return NULL;
+}
static int poselib_remove_exec (bContext *C, wmOperator *op)
{
@@ -465,7 +467,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
}
/* get index (and pointer) of pose to remove */
- marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "index"));
+ marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose"));
if (marker == NULL) {
BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
return OPERATOR_CANCELLED;
@@ -499,13 +501,18 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
void POSELIB_OT_pose_remove (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_poses_dummy_types[] = {
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* identifiers */
ot->name= "PoseLib Remove Pose";
ot->idname= "POSELIB_OT_pose_remove";
ot->description= "Remove nth pose from the active Pose Library";
/* api callbacks */
- ot->invoke= poselib_stored_pose_menu_invoke;
+ ot->invoke= WM_menu_invoke;
ot->exec= poselib_remove_exec;
ot->poll= ED_operator_posemode;
@@ -513,10 +520,37 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The index of the pose to remove", 0, INT_MAX);
+ prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to remove");
+ RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
}
-
+static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+{
+ Object *ob= CTX_data_active_object(C);
+ bAction *act= (ob) ? ob->poselib : NULL;
+ TimeMarker *marker;
+
+ /* check if valid poselib */
+ if (act == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
+ return OPERATOR_CANCELLED;
+ }
+
+ /* get index (and pointer) of pose to remove */
+ marker= BLI_findlink(&act->markers, act->active_marker-1);
+ if (marker == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ /* use the existing name of the marker as the name, and use the active marker as the one to rename */
+ RNA_enum_set(op->ptr, "pose", act->active_marker-1);
+ RNA_string_set(op->ptr, "name", marker->name);
+ }
+
+ /* part to sync with other similar operators... */
+ return WM_operator_props_popup(C, op, evt);
+}
static int poselib_rename_exec (bContext *C, wmOperator *op)
{
@@ -532,7 +566,7 @@ static int poselib_rename_exec (bContext *C, wmOperator *op)
}
/* get index (and pointer) of pose to remove */
- marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "index"));
+ marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose"));
if (marker == NULL) {
BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
return OPERATOR_CANCELLED;
@@ -551,13 +585,18 @@ static int poselib_rename_exec (bContext *C, wmOperator *op)
void POSELIB_OT_pose_rename (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_poses_dummy_types[] = {
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* identifiers */
ot->name= "PoseLib Rename Pose";
ot->idname= "POSELIB_OT_pose_rename";
ot->description= "Rename nth pose from the active Pose Library";
/* api callbacks */
- ot->invoke= poselib_stored_pose_menu_invoke;
+ ot->invoke= poselib_rename_invoke;
ot->exec= poselib_rename_exec;
ot->poll= ED_operator_posemode;
@@ -565,7 +604,8 @@ void POSELIB_OT_pose_rename (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The index of the pose to remove", 0, INT_MAX);
+ prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to rename");
+ RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 1531d922e04..57fe083b319 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1728,31 +1728,6 @@ void pose_activate_flipped_bone(Scene *scene)
/* ********************************************** */
/* Present a popup to get the layers that should be used */
-// TODO: move to wm?
-static uiBlock *wm_layers_select_create_menu(bContext *C, ARegion *ar, void *arg_op)
-{
- wmOperator *op= arg_op;
- uiBlock *block;
- uiLayout *layout;
- uiStyle *style= U.uistyles.first;
-
- block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
- uiBlockClearFlag(block, UI_BLOCK_LOOP);
- uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
-
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 150, 20, style);
- uiItemL(layout, op->type->name, 0);
- uiTemplateLayers(layout, op->ptr, "layers"); /* must have a property named layers setup */
-
- uiPopupBoundsBlock(block, 4.0f, 0, 0);
- uiEndBlock(C, block);
-
- return block;
-}
-
-/* ------------------- */
-
-/* Present a popup to get the layers that should be used */
static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
Object *ob= CTX_data_active_object(C);
@@ -1769,10 +1744,8 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
RNA_boolean_get_array(&ptr, "layer", layers);
RNA_boolean_set_array(op->ptr, "layers", layers);
- /* part to sync with other similar operators... */
- /* pass on operator, so return modal */
- uiPupBlockOperator(C, wm_layers_select_create_menu, op, WM_OP_EXEC_DEFAULT);
- return OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH;
+ /* part to sync with other similar operators... */
+ return WM_operator_props_popup(C, op, evt);
}
/* Set the visible layers for the active armature (edit and pose modes) */
@@ -1813,7 +1786,7 @@ void POSE_OT_armature_layers (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_boolean_array(ot->srna, "layers", 16, NULL, "Layers", "Armature layers to make visible.");
+ RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers to make visible");
}
void ARMATURE_OT_armature_layers (wmOperatorType *ot)
@@ -1832,7 +1805,7 @@ void ARMATURE_OT_armature_layers (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_boolean_array(ot->srna, "layers", 16, NULL, "Layers", "Armature layers to make visible.");
+ RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers to make visible");
}
/* ------------------- */
@@ -1861,9 +1834,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
RNA_boolean_set_array(op->ptr, "layers", layers);
/* part to sync with other similar operators... */
- /* pass on operator, so return modal */
- uiPupBlockOperator(C, wm_layers_select_create_menu, op, WM_OP_EXEC_DEFAULT);
- return OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH;
+ return WM_operator_props_popup(C, op, evt);
}
/* Set the visible layers for the active armature (edit and pose modes) */
@@ -1908,7 +1879,7 @@ void POSE_OT_bone_layers (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_boolean_array(ot->srna, "layers", 16, NULL, "Layers", "Armature layers that bone belongs to.");
+ RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers that bone belongs to");
}
/* ------------------- */
@@ -1937,9 +1908,7 @@ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
RNA_boolean_set_array(op->ptr, "layers", layers);
/* part to sync with other similar operators... */
- /* pass on operator, so return modal */
- uiPupBlockOperator(C, wm_layers_select_create_menu, op, WM_OP_EXEC_DEFAULT);
- return OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH;
+ return WM_operator_props_popup(C, op, evt);
}
/* Set the visible layers for the active armature (edit and pose modes) */
@@ -1984,7 +1953,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_boolean_array(ot->srna, "layers", 16, NULL, "Layers", "Armature layers that bone belongs to.");
+ RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers that bone belongs to");
}
/* ********************************************** */
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 4fa0e04728f..27713cc2fa9 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -171,7 +171,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
/*********************** Selection by Links *********************/
static EnumPropertyItem prop_select_linked_types[] = {
- {1, "IPO", 0, "Object IPO", ""}, // XXX depreceated animation system stuff...
+ //{1, "IPO", 0, "Object IPO", ""}, // XXX depreceated animation system stuff...
{2, "OBDATA", 0, "Ob Data", ""},
{3, "MATERIAL", 0, "Material", ""},
{4, "TEXTURE", 0, "Texture", ""},
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 44f7a097a18..a7b40deda22 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1628,10 +1628,6 @@ static int jump_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-// XXX invoke
-// short tmp= txt_get_span(text->lines.first, text->curl)+1;
-// button(&tmp, 1, nlines, "Jump to line:"))
-
void TEXT_OT_jump(wmOperatorType *ot)
{
/* identifiers */
@@ -1640,6 +1636,7 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->description= "Jump cursor to line.";
/* api callbacks */
+ ot->invoke= WM_operator_props_popup;
ot->exec= jump_exec;
ot->poll= text_edit_poll;
@@ -1647,7 +1644,7 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER;
/* properties */
- RNA_def_int(ot->srna, "line", 1, INT_MAX, 1, "Line", "Line number to jump to.", 1, 10000);
+ RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to.", 1, 10000);
}
/******************* delete operator **********************/