Page MenuHome

OutlinerRename.patch

OutlinerRename.patch

Index: source/blender/editors/space_outliner/outliner.c
===================================================================
--- source/blender/editors/space_outliner/outliner.c (revision 31422)
+++ source/blender/editors/space_outliner/outliner.c (working copy)
@@ -2594,6 +2594,25 @@
/* ********************************************** */
+void object_rename_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+{
+ if(tselem) {
+ /* can't rename rna datablocks entries */
+ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
+ ;
+ else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ error("Cannot edit builtin name");
+ else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
+ error("Cannot edit sequence name");
+ else if(tselem->id->lib) {
+ // XXX error_libdata();
+ } else if(te->idcode == ID_LI && te->parent) {
+ error("Cannot edit the path of an indirectly linked library");
+ } else {
+ tselem->flag |= TSE_TEXTBUT;
+ }
+ }
+}
static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, float *mval)
{
@@ -2603,22 +2622,7 @@
/* name and first icon */
if(mval[0]>te->xs && mval[0]<te->xend) {
-
- /* can't rename rna datablocks entries */
- if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
- ;
- else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
- error("Cannot edit builtin name");
- else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
- error("Cannot edit sequence name");
- else if(tselem->id->lib) {
- // XXX error_libdata();
- } else if(te->idcode == ID_LI && te->parent) {
- error("Cannot edit the path of an indirectly linked library");
- } else {
- tselem->flag |= TSE_TEXTBUT;
- ED_region_tag_redraw(ar);
- }
+ object_rename_cb(C, NULL, te, NULL, tselem);
}
return 1;
}
@@ -2641,7 +2645,9 @@
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_rename(C, ar, soops, te, fmval)) break;
}
-
+
+ ED_region_tag_redraw(ar);
+
return OPERATOR_FINISHED;
}
@@ -3341,9 +3347,10 @@
{1, "SELECT", 0, "Select", ""},
{2, "DESELECT", 0, "Deselect", ""},
{4, "DELETE", 0, "Delete", ""},
- {6, "TOGVIS", 0, "Toggle Visible", ""},
- {7, "TOGSEL", 0, "Toggle Selectable", ""},
- {8, "TOGREN", 0, "Toggle Renderable", ""},
+ {5, "RENAME", 0, "Rename", ""},
+ {7, "TOGVIS", 0, "Toggle Visible", ""},
+ {8, "TOGSEL", 0, "Toggle Selectable", ""},
+ {9, "TOGREN", 0, "Toggle Renderable", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -3379,19 +3386,23 @@
DAG_scene_sort(bmain, scene);
str= "Delete Objects";
}
- else if(event==5) { /* disabled, see above (ton) */
+ else if(event==5) {
+ outliner_do_object_operation(C, scene, soops, &soops->tree, object_rename_cb);
+ str= "Rename Objects";
+ }
+ else if(event==6) { /* disabled, see above (ton) */
outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
str= "Localized Objects";
}
- else if(event==6) {
+ else if(event==7) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
str= "Toggle Visibility";
}
- else if(event==7) {
+ else if(event==8) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
str= "Toggle Selectability";
}
- else if(event==8) {
+ else if(event==9) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
str= "Toggle Renderability";
}
@@ -3487,6 +3498,7 @@
static EnumPropertyItem prop_id_op_types[] = {
{1, "UNLINK", 0, "Unlink", ""},
{2, "LOCAL", 0, "Make Local", ""},
+ {3, "RENAME", 0, "Rename", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -3523,7 +3535,10 @@
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
ED_undo_push(C, "Localized Data");
}
-
+ else if(event==3) {
+ outliner_do_libdata_operation(C, scene, soops, &soops->tree, object_rename_cb);
+ ED_undo_push(C, "Rename Objects");
+ }
/* wrong notifier still... */
WM_event_add_notifier(C, NC_OBJECT, NULL);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
36/62/a4753979717c0a9373663402866e

Event Timeline