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:
authorCampbell Barton <ideasman42@gmail.com>2010-02-23 22:32:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-23 22:32:32 +0300
commit55d0ae8ed94d3dd714a54040a28aa4f0e2e70914 (patch)
tree676e9302d46d6543803706b003c4950d2de2be00
parent3f5786a00ed78b32f11b448ee0e568706602d6c8 (diff)
- use search box for adding actions in the NLA
- use less complicated string conversion for saving keymaps
-rw-r--r--release/scripts/ui/space_userpref.py23
-rw-r--r--source/blender/editors/space_nla/nla_edit.c38
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
4 files changed, 19 insertions, 49 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index ed0a1a429b1..9b03c58a06e 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -1614,27 +1614,10 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
def _string_value(value):
- result = ""
- if isinstance(value, str):
- if value != "":
- result = "\'%s\'" % value
- elif isinstance(value, bool):
- if value:
- result = "True"
- else:
- result = "False"
- elif isinstance(value, float):
- result = "%.10f" % value
- elif isinstance(value, int):
- result = "%d" % value
+ if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int):
+ result = repr(value)
elif getattr(value, '__len__', False):
- if len(value):
- result = "["
- for i in range(0, len(value)):
- result += _string_value(value[i])
- if i != len(value)-1:
- result += ", "
- result += "]"
+ repr(list(value))
else:
print("Export key configuration: can't write ", value)
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 1cc8fc37e77..543fa1dfed7 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -246,27 +246,6 @@ void NLA_OT_tweakmode_exit (wmOperatorType *ot)
/* ******************** Add Action-Clip Operator ***************************** */
/* Add a new Action-Clip strip to the active track (or the active block if no space in the track) */
-/* pop up menu allowing user to choose the action to use */
-// TODO: at some point, we may have to migrate to a search menu to manage the case where there are many actions
-static int nlaedit_add_actionclip_invoke (bContext *C, wmOperator *op, wmEvent *evt)
-{
- Main *m= CTX_data_main(C);
- bAction *act;
- uiPopupMenu *pup;
- uiLayout *layout;
-
- pup= uiPupMenuBegin(C, "Add Action Clip", 0);
- layout= uiPupMenuLayout(pup);
-
- /* loop through Actions in Main database, adding as items in the menu */
- for (act= m->action.first; act; act= act->id.next)
- uiItemStringO(layout, act->id.name+2, 0, "NLA_OT_actionclip_add", "action", act->id.name+2);
- uiItemS(layout);
-
- uiPupMenuEnd(C, pup);
-
- return OPERATOR_CANCELLED;
-}
/* add the specified action as new strip */
static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
@@ -277,9 +256,9 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter, items;
-
- bAction *act = NULL;
- char actname[20];
+
+ bAction *act;
+
float cfra;
/* get editor data */
@@ -290,8 +269,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
cfra= (float)CFRA;
/* get action to use */
- RNA_string_get(op->ptr, "action", actname);
- act= (bAction *)find_id("AC", actname);
+ act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "type"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid Action to add.");
@@ -350,13 +328,15 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
void NLA_OT_actionclip_add (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name= "Add Action Strip";
ot->idname= "NLA_OT_actionclip_add";
ot->description= "Add an Action-Clip strip (i.e. an NLA Strip referencing an Action) to the active track";
/* api callbacks */
- ot->invoke= nlaedit_add_actionclip_invoke;
+ ot->invoke= WM_enum_search_invoke;
ot->exec= nlaedit_add_actionclip_exec;
ot->poll= nlaop_poll_tweakmode_off;
@@ -365,7 +345,9 @@ void NLA_OT_actionclip_add (wmOperatorType *ot)
/* props */
// TODO: this would be nicer as an ID-pointer...
- ot->prop = RNA_def_string(ot->srna, "action", "", 19, "Action", "Name of Action to add as a new Action-Clip Strip.");
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", "");
+ RNA_def_enum_funcs(prop, RNA_action_itemf);
+ ot->prop= prop;
}
/* ******************** Add Transition Operator ***************************** */
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 2ed365ad79f..ddd6dfef653 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -88,6 +88,7 @@ EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct Poin
/* Generic functions, return an enum from library data, index is the position
* in the linked list can add more for different types as needed */
+EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b52588f2e75..2261dbe81de 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2997,7 +2997,11 @@ static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, I
return item;
}
-/* can add more */
+/* can add more as needed */
+EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->action.first : NULL);
+}
EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, int *free)
{
return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->group.first : NULL);