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:
authorJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
committerJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
commitf01261d040be27337db9f9996d648a279c89b7c4 (patch)
treec448230939b3c90d53ce8852dd00925d6052e3a4 /source/blender/editors/space_outliner/outliner.c
parentdcaeda5c4e3a0687251b8511de4f2e8b85ef75c0 (diff)
parent2198cfdb2deec8b2e85e242c74a032f43d0b26ca (diff)
merge with/from trunk at r35190
Diffstat (limited to 'source/blender/editors/space_outliner/outliner.c')
-rw-r--r--source/blender/editors/space_outliner/outliner.c797
1 files changed, 454 insertions, 343 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 2f32c54a1a5..91a2754545b 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -51,6 +51,7 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#if defined WIN32 && !defined _LIBC
# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
@@ -120,7 +121,7 @@
/* ************* XXX **************** */
-static void error(const char *dummy, ...) {}
+static void error(const char *UNUSED(arg), ...) {}
/* ********************************** */
@@ -187,7 +188,7 @@ static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short ty
/* case 1; no TreeStore */
if(soops->treestore==NULL) {
- ts= soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
+ soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
}
ts= soops->treestore;
@@ -240,7 +241,7 @@ void outliner_free_tree(ListBase *lb)
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
- if(te->flag & TE_FREE_NAME) MEM_freeN(te->name);
+ if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
MEM_freeN(te);
}
}
@@ -324,7 +325,7 @@ static ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
struct treesort {
TreeElement *te;
ID *id;
- char *name;
+ const char *name;
short idcode;
};
@@ -340,7 +341,7 @@ static int treesort_alpha(const void *v1, const void *v2)
if(comp==1) return 1;
else if(comp==2) return -1;
else if(comp==3) {
- int comp= strcmp(x1->name, x2->name);
+ comp= strcmp(x1->name, x2->name);
if( comp>0 ) return 1;
else if( comp<0) return -1;
@@ -1112,8 +1113,8 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
c= RNA_property_array_item_char(prop, index);
te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
- if(c) sprintf(te->name, " %c", c);
- else sprintf(te->name, " %d", index+1);
+ if(c) sprintf((char *)te->name, " %c", c);
+ else sprintf((char *)te->name, " %d", index+1);
te->flag |= TE_FREE_NAME;
}
}
@@ -1188,7 +1189,7 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb)
}
/* Helped function to put duplicate sequence in the same tree. */
-int need_add_seq_dup(Sequence *seq)
+static int need_add_seq_dup(Sequence *seq)
{
Sequence *p;
@@ -1225,7 +1226,7 @@ int need_add_seq_dup(Sequence *seq)
return(1);
}
-void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
+static void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
{
TreeElement *ch;
Sequence *p;
@@ -1243,7 +1244,7 @@ void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
}
}
-static int outliner_filter_has_name(TreeElement *te, char *name, int flags)
+static int outliner_filter_has_name(TreeElement *te, const char *name, int flags)
{
#if 0
int found= 0;
@@ -1308,7 +1309,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
- if(te->flag & TE_FREE_NAME) MEM_freeN(te->name);
+ if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
MEM_freeN(te);
}
}
@@ -1408,7 +1409,6 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
for(group= mainvar->group.first; group; group= group->id.next) {
if(group->gobject.first) {
te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
- tselem= TREESTORE(te);
for(go= group->gobject.first; go; go= go->next) {
ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
@@ -1509,6 +1509,42 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
/* **************** INTERACTIVE ************* */
+
+static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
+{
+ ARegion *ar= CTX_wm_region(C);
+ int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
+ int up= 0;
+
+ if(RNA_boolean_get(op->ptr, "up"))
+ up= 1;
+
+ if(up == 0) dy= -dy;
+ ar->v2d.cur.ymin+= dy;
+ ar->v2d.cur.ymax+= dy;
+
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+
+void OUTLINER_OT_scroll_page(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Scroll Page";
+ ot->idname= "OUTLINER_OT_scroll_page";
+ ot->description= "Scroll page up or down";
+
+ /* callbacks */
+ ot->exec= outliner_scroll_page_exec;
+ ot->poll= ED_operator_outliner_active;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page.");
+}
+
+
static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
{
TreeElement *te;
@@ -1553,17 +1589,44 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short
/* --- */
-void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+/* same check needed for both object operation and restrict column button func
+ * return 0 when in edit mode (cannot restrict view or select)
+ * otherwise return 1 */
+static int common_restrict_check(bContext *C, Object *ob)
+{
+ /* Don't allow hide an object in edit mode,
+ * check the bug #22153 and #21609, #23977
+ */
+ Object *obedit= CTX_data_edit_object(C);
+ if (obedit && obedit == ob) {
+ /* found object is hidden, reset */
+ if (ob->restrictflag & OB_RESTRICT_VIEW)
+ ob->restrictflag &= ~OB_RESTRICT_VIEW;
+ /* found object is unselectable, reset */
+ if (ob->restrictflag & OB_RESTRICT_SELECT)
+ ob->restrictflag &= ~OB_RESTRICT_SELECT;
+ return 0;
+ }
+
+ return 1;
+}
+
+static void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
- if(base || (base= object_in_scene((Object *)tselem->id, scene))) {
+ Object *ob = (Object *)tselem->id;
+
+ /* add check for edit mode */
+ if(!common_restrict_check(C, ob)) return;
+
+ if(base || (base= object_in_scene(ob, scene))) {
if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
ED_base_object_select(base, BA_DESELECT);
}
}
}
-static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1571,6 +1634,7 @@ static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op)
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
@@ -1579,20 +1643,20 @@ static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Toggle Visability";
+ ot->name= "Toggle Visibility";
ot->idname= "OUTLINER_OT_visibility_toggle";
ot->description= "Toggle the visibility of selected items";
/* callbacks */
ot->exec= outliner_toggle_visibility_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->poll= ED_operator_outliner_active_no_editobject;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* --- */
-static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -1602,7 +1666,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen
}
}
-static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1610,6 +1674,7 @@ static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op)
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
@@ -1624,12 +1689,12 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
/* callbacks */
ot->exec= outliner_toggle_selectability_exec;
- ot->poll= ED_operator_outliner_active;
+ ot->poll= ED_operator_outliner_active_no_editobject;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -1639,7 +1704,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te,
}
}
-static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1668,7 +1733,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
/* --- */
-static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
@@ -1699,10 +1764,11 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
/* --- */
-static int outliner_toggle_selected_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
+ Scene *scene= CTX_data_scene(C);
if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1))
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
@@ -1711,6 +1777,7 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *op)
soops->storeflag |= SO_TREESTORE_REDRAW;
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
@@ -1778,6 +1845,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
/* identifiers */
ot->name= "Show/Hide One Level";
ot->idname= "OUTLINER_OT_show_one_level";
+ ot->description= "Expand/collapse all entries by one level";
/* callbacks */
ot->exec= outliner_one_level_exec;
@@ -1789,6 +1857,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep.");
}
+/* This is not used anywhere at the moment */
+#if 0
/* return 1 when levels were opened */
static int outliner_open_back(SpaceOops *soops, TreeElement *te)
{
@@ -1805,8 +1875,6 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te)
return retval;
}
-/* This is not used anywhere at the moment */
-#if 0
static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found)
{
TreeElement *te;
@@ -1832,7 +1900,7 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
#endif
// XXX just use View2D ops for this?
-void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up)
+static void outliner_page_up_down(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int up)
{
int dy= ar->v2d.mask.ymax-ar->v2d.mask.ymin;
@@ -1900,15 +1968,14 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
scene_deselect_all(scene);
ED_base_object_select(base, BA_SELECT);
}
- if(C)
+ if(C) {
ED_base_object_activate(C, base); /* adds notifier */
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ }
}
if(ob!=scene->obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
-
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
-
}
static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
@@ -1955,13 +2022,13 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
TreeElement *tep;
- TreeStoreElem *tselem, *tselemp;
+ TreeStoreElem /* *tselem,*/ *tselemp;
Object *ob=OBACT;
SpaceButs *sbuts=NULL;
if(ob==NULL) return 0; // no active object
- tselem= TREESTORE(te);
+ /*tselem= TREESTORE(te);*/ /*UNUSED*/
/* find buttons area (note, this is undefined really still, needs recode in blender) */
/* XXX removed finding sbuts */
@@ -2019,12 +2086,14 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
}
}
- WM_event_add_notifier(C, NC_TEXTURE, NULL);
+ if(set)
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
+
return 0;
}
-static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
Object *ob;
@@ -2040,6 +2109,16 @@ static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops,
return 0;
}
+static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+{
+ Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
+
+ if(set)
+ return 0;
+
+ return scene->camera == ob;
+}
+
static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
TreeElement *tep;
@@ -2077,7 +2156,7 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
ob= (Object *)tselem->id;
if(set) {
ob->actdef= te->index+1;
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
}
else {
@@ -2114,13 +2193,11 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
if(set) {
if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
- if(set==2) ED_pose_deselectall(ob, 2, 0); // 2 = clear active tag
- else ED_pose_deselectall(ob, 0, 0); // 0 = deselect
+ if(set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
+ else ED_pose_deselectall(ob, 0); // 0 = deselect
if(set==2 && (pchan->bone->flag & BONE_SELECTED)) {
pchan->bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==pchan->bone)
- arm->act_bone= NULL;
} else {
pchan->bone->flag |= BONE_SELECTED;
arm->act_bone= pchan->bone;
@@ -2145,13 +2222,11 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
if(set) {
if(!(bone->flag & BONE_HIDDEN_P)) {
- if(set==2) ED_pose_deselectall(OBACT, 2, 0); // 2 is clear active tag
- else ED_pose_deselectall(OBACT, 0, 0);
+ if(set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
+ else ED_pose_deselectall(OBACT, 0);
if(set==2 && (bone->flag & BONE_SELECTED)) {
bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==bone)
- arm->act_bone= NULL;
} else {
bone->flag |= BONE_SELECTED;
arm->act_bone= bone;
@@ -2172,32 +2247,54 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
/* ebones only draw in editmode armature */
-static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
{
- EditBone *ebone= te->directdata;
-
- if(set) {
- if(!(ebone->flag & BONE_HIDDEN_A)) {
- bArmature *arm= scene->obedit->data;
- if(set==2) ED_armature_deselectall(scene->obedit, 2, 0); // only clear active tag
- else ED_armature_deselectall(scene->obedit, 0, 0); // deselect
+ if(sel) {
+ ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
+ arm->act_edbone= ebone;
+ // flush to parent?
+ if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
+ }
+ else {
+ ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
+ // flush to parent?
+ if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
+ }
- ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
- arm->act_edbone= ebone;
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
+}
+static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
+{
+ bArmature *arm= scene->obedit->data;
+ EditBone *ebone= te->directdata;
- // flush to parent?
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
-
- WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
+ if(set==1) {
+ if(!(ebone->flag & BONE_HIDDEN_A)) {
+ ED_armature_deselect_all(scene->obedit, 0); // deselect
+ tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
+ return 1;
}
}
- else {
- if (ebone->flag & BONE_SELECTED) return 1;
+ else if (set==2) {
+ if(!(ebone->flag & BONE_HIDDEN_A)) {
+ if(!(ebone->flag & BONE_SELECTED)) {
+ tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
+ return 1;
+ }
+ else {
+ /* entirely selected, so de-select */
+ tree_element_active_ebone__sel(C, scene, arm, ebone, FALSE);
+ return 0;
+ }
+ }
+ }
+ else if (ebone->flag & BONE_SELECTED) {
+ return 1;
}
return 0;
}
-static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2210,7 +2307,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreE
return 0;
}
-static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2223,7 +2320,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te,
return 0;
}
-static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2235,7 +2332,7 @@ static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStor
return 0;
}
-static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set))
{
// XXX removed
return 0;
@@ -2256,11 +2353,13 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree
return tree_element_active_texture(C, scene, soops, te, set);
case ID_TXT:
return tree_element_active_text(C, scene, soops, te, set);
+ case ID_CA:
+ return tree_element_active_camera(C, scene, soops, te, set);
}
return 0;
}
-static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
Object *ob= (Object *)tselem->id;
Base *base= object_in_scene(ob, scene);
@@ -2280,7 +2379,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te,
return 0;
}
-static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
Sequence *seq= (Sequence*) te->directdata;
@@ -2294,7 +2393,7 @@ static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreE
return(0);
}
-static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
Sequence *seq, *p;
Editing *ed= seq_give_editing(scene, FALSE);
@@ -2321,7 +2420,7 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme
return(0);
}
-static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
wmKeyMapItem *kmi= te->directdata;
@@ -2366,9 +2465,9 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
case TSE_POSEGRP:
return tree_element_active_posegroup(C, scene, te, tselem, set);
case TSE_SEQUENCE:
- return tree_element_active_sequence(C, te, tselem, set);
+ return tree_element_active_sequence(te, tselem, set);
case TSE_SEQUENCE_DUP:
- return tree_element_active_sequence_dup(C, scene, te, tselem, set);
+ return tree_element_active_sequence_dup(scene, te, tselem, set);
case TSE_KEYMAP_ITEM:
return tree_element_active_keymap_item(C, te, tselem, set);
@@ -2446,19 +2545,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
- Object *obedit= CTX_data_edit_object(C);
- if(obedit)
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
- else {
- Object *ob= CTX_data_active_object(C);
-
- /* Don't allow edit mode if the object is hide!
- * check the bug #22153 and #21609
- */
- if (ob && (!(ob->restrictflag & OB_RESTRICT_VIEW)))
- ED_object_enter_editmode(C, EM_WAITCURSOR);
- // XXX extern_set_butspace(F9KEY, 0);
- }
+ WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
} else { // rest of types
tree_element_active(C, scene, soops, te, 1);
}
@@ -2485,9 +2572,12 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
TreeElement *te;
float fmval[2];
int extend= RNA_boolean_get(op->ptr, "extend");
-
+
UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
-
+
+ if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
+ return OPERATOR_CANCELLED;
+
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
}
@@ -2520,6 +2610,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
{
ot->name= "Activate Item";
ot->idname= "OUTLINER_OT_item_activate";
+ ot->description= "Handle mouse clicks to activate/select items";
ot->invoke= outliner_item_activate;
@@ -2582,6 +2673,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
{
ot->name= "Open/Close Item";
ot->idname= "OUTLINER_OT_item_openclose";
+ ot->description= "Toggle whether item under cursor is enabled or closed";
ot->invoke= outliner_item_openclose;
@@ -2612,9 +2704,11 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
error("Cannot edit sequence name");
else if(tselem->id->lib) {
// XXX error_libdata();
- } else if(te->idcode == ID_LI && te->parent) {
+ }
+ else if(te->idcode == ID_LI && te->parent) {
error("Cannot edit the path of an indirectly linked library");
- } else {
+ }
+ else {
tselem->flag |= TSE_TEXTBUT;
ED_region_tag_redraw(ar);
}
@@ -2628,7 +2722,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
return 0;
}
-static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event)
+static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= CTX_wm_space_outliner(C);
@@ -2649,45 +2743,13 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot)
{
ot->name= "Rename Item";
ot->idname= "OUTLINER_OT_item_rename";
+ ot->description= "Rename item under cursor";
ot->invoke= outliner_item_rename;
ot->poll= ED_operator_outliner_active;
}
-
-
-/* recursive helper for function below */
-static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
-{
- TreeStoreElem *tselem= TREESTORE(te);
-
- /* store coord and continue, we need coordinates for elements outside view too */
- te->xs= (float)startx;
- te->ys= (float)(*starty);
- *starty-= OL_H;
-
- if((tselem->flag & TSE_CLOSED)==0) {
- TreeElement *ten;
- for(ten= te->subtree.first; ten; ten= ten->next) {
- outliner_set_coordinates_element(soops, ten, startx+OL_X, starty);
- }
- }
-
-}
-
-/* to retrieve coordinates with redrawing the entire tree */
-static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
-{
- TreeElement *te;
- int starty= (int)(ar->v2d.tot.ymax)-OL_H;
- int startx= 0;
-
- for(te= soops->tree.first; te; te= te->next) {
- outliner_set_coordinates_element(soops, te, startx, &starty);
- }
-}
-
static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
{
TreeElement *te, *tes;
@@ -2698,7 +2760,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
if(tselem->type==0) {
if(tselem->id==id) return te;
/* only deeper on scene or object */
- if( te->idcode==ID_OB || te->idcode==ID_SCE) {
+ if( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
tes= outliner_find_id(soops, &te->subtree, id);
if(tes) return tes;
}
@@ -2707,7 +2769,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
return NULL;
}
-static int outliner_show_active_exec(bContext *C, wmOperator *op)
+static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *so= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -2753,8 +2815,66 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
/* callbacks */
ot->exec= outliner_show_active_exec;
ot->poll= ED_operator_outliner_active;
+}
+
+/* tse is not in the treestore, we use its contents to find a match */
+static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
+{
+ TreeStore *ts= soops->treestore;
+ TreeStoreElem *tselem;
+ int a;
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ if(tse->id==NULL) return NULL;
+
+ /* check if 'tse' is in treestore */
+ tselem= ts->data;
+ for(a=0; a<ts->usedelem; a++, tselem++) {
+ if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
+ if(tselem->id==tse->id) {
+ break;
+ }
+ }
+ }
+ if(tselem)
+ return outliner_find_tree_element(&soops->tree, a);
+
+ return NULL;
+}
+
+
+/* Called to find an item based on name.
+ */
+#if 0
+
+/* recursive helper for function below */
+static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
+{
+ TreeStoreElem *tselem= TREESTORE(te);
+
+ /* store coord and continue, we need coordinates for elements outside view too */
+ te->xs= (float)startx;
+ te->ys= (float)(*starty);
+ *starty-= OL_H;
+
+ if((tselem->flag & TSE_CLOSED)==0) {
+ TreeElement *ten;
+ for(ten= te->subtree.first; ten; ten= ten->next) {
+ outliner_set_coordinates_element(soops, ten, startx+OL_X, starty);
+ }
+ }
+
+}
+
+/* to retrieve coordinates with redrawing the entire tree */
+static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
+{
+ TreeElement *te;
+ int starty= (int)(ar->v2d.tot.ymax)-OL_H;
+ int startx= 0;
+
+ for(te= soops->tree.first; te; te= te->next) {
+ outliner_set_coordinates_element(soops, te, startx, &starty);
+ }
}
/* find next element that has this name */
@@ -2786,34 +2906,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
return NULL;
}
-/* tse is not in the treestore, we use its contents to find a match */
-static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
-{
- TreeStore *ts= soops->treestore;
- TreeStoreElem *tselem;
- int a;
-
- if(tse->id==NULL) return NULL;
-
- /* check if 'tse' is in treestore */
- tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
- if(tselem->id==tse->id) {
- break;
- }
- }
- }
- if(tselem)
- return outliner_find_tree_element(&soops->tree, a);
-
- return NULL;
-}
-
-
-/* Called to find an item based on name.
- */
-void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags)
+static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
{
TreeElement *te= NULL;
TreeElement *last_find;
@@ -2885,6 +2978,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again,
error("Not found: %s", name);
}
}
+#endif
/* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/
static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
@@ -2927,7 +3021,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
}
/* show entire object level hierarchy */
-static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op)
+static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
@@ -3045,7 +3139,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
}
-static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
Material **matar=NULL;
int a, totcol=0;
@@ -3079,7 +3173,7 @@ static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeS
}
}
-static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
MTex **mtex= NULL;
int a;
@@ -3108,7 +3202,7 @@ static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeSt
}
}
-static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
@@ -3145,7 +3239,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
/* */
-static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3156,7 +3250,7 @@ static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
}
}
-static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3167,7 +3261,7 @@ static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeS
}
}
-static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3182,12 +3276,10 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
te->directdata= NULL;
tselem->id= NULL;
}
-
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
-static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
tselem->id->lib= NULL;
@@ -3196,7 +3288,7 @@ static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreEle
}
}
-static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
GroupObject *gob;
@@ -3220,7 +3312,7 @@ static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, T
}
}
-static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb,
+static void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb,
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
{
TreeElement *te;
@@ -3231,23 +3323,25 @@ static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *s
if(tselem->flag & TSE_SELECTED) {
if(tselem->type==0 && te->idcode==ID_OB) {
// when objects selected in other scenes... dunno if that should be allowed
- Scene *sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
- if(sce && scene != sce) {
- ED_screen_set_scene(C, sce);
+ Scene *scene_owner= (Scene *)outliner_search_back(soops, te, ID_SCE);
+ if(scene_owner && scene_act != scene_owner) {
+ ED_screen_set_scene(C, scene_owner);
}
-
- operation_cb(C, scene, te, NULL, tselem);
+ /* important to use 'scene_owner' not scene_act else deleting objects can crash.
+ * only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
+ * outliner isnt showing scenes: Visible Layer draw mode for eg. */
+ operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
}
}
if((tselem->flag & TSE_CLOSED)==0) {
- outliner_do_object_operation(C, scene, soops, &te->subtree, operation_cb);
+ outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
}
}
}
/* ******************************************** */
-static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
@@ -3263,7 +3357,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem)
pchan->bone->flag &= ~BONE_HIDDEN_P;
}
-static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
Bone *bone= (Bone *)te->directdata;
@@ -3279,7 +3373,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
bone->flag &= ~BONE_HIDDEN_P;
}
-static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
EditBone *ebone= (EditBone *)te->directdata;
@@ -3295,7 +3389,7 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
ebone->flag &= ~BONE_HIDDEN_A;
}
-static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
{
// Sequence *seq= (Sequence*) te->directdata;
if(event==1) {
@@ -3322,7 +3416,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
}
}
-void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops)
+static void outliner_del(bContext *C, Scene *scene, ARegion *UNUSED(ar), SpaceOops *soops)
{
if(soops->outlinevis==SO_SEQUENCE)
@@ -3331,6 +3425,7 @@ void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops)
outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
DAG_scene_sort(CTX_data_main(C), scene);
ED_undo_push(C, "Delete Objects");
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
}
@@ -3352,7 +3447,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
SpaceOops *soops= CTX_wm_space_outliner(C);
int event;
- char *str= NULL;
+ const char *str= NULL;
/* check for invalid states */
if (soops == NULL)
@@ -3368,34 +3463,38 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
str= "Select Objects";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
else if(event==2) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb);
str= "Deselect Objects";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
else if(event==4) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
DAG_scene_sort(bmain, scene);
str= "Delete Objects";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
- else if(event==5) { /* disabled, see above (ton) */
+ else if(event==5) { /* disabled, see above enum (ton) */
outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
str= "Localized Objects";
}
else if(event==6) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
str= "Toggle Visibility";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
}
else if(event==7) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
str= "Toggle Selectability";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
else if(event==8) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
str= "Toggle Renderability";
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
}
-
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
ED_undo_push(C, str);
@@ -3677,7 +3776,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
}
-static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event)
+static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
@@ -3699,6 +3798,7 @@ void OUTLINER_OT_operation(wmOperatorType *ot)
{
ot->name= "Execute Operation";
ot->idname= "OUTLINER_OT_operation";
+ ot->description= "Context menu for item operations";
ot->invoke= outliner_operation;
@@ -3727,7 +3827,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
* this function does not do that yet
*/
static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem,
- ID **id, char **path, int *array_index, short *flag, short *groupmode)
+ ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode))
{
ListBase hierarchy = {NULL, NULL};
LinkData *ld;
@@ -3865,12 +3965,12 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
enum {
DRIVERS_EDITMODE_ADD = 0,
DRIVERS_EDITMODE_REMOVE,
-} eDrivers_EditModes;
+} /*eDrivers_EditModes*/;
/* Utilities ---------------------------------- */
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short mode)
+static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportList *reports, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -3895,6 +3995,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
/* only if ID and path were set, should we perform any actions */
if (id && path) {
+ short dflags = CREATEDRIVER_WITH_DEFAULT_DVAR;
int arraylen = 1;
/* array checks */
@@ -3916,13 +4017,13 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
case DRIVERS_EDITMODE_ADD:
{
/* add a new driver with the information obtained (only if valid) */
- ANIM_add_driver(id, path, array_index, flag, DRIVER_TYPE_PYTHON);
+ ANIM_add_driver(reports, id, path, array_index, dflags, DRIVER_TYPE_PYTHON);
}
break;
case DRIVERS_EDITMODE_REMOVE:
{
/* remove driver matching the information obtained (only if valid) */
- ANIM_remove_driver(id, path, array_index, flag);
+ ANIM_remove_driver(reports, id, path, array_index, dflags);
}
break;
}
@@ -3937,7 +4038,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
/* go over sub-tree */
if ((tselem->flag & TSE_CLOSED)==0)
- do_outliner_drivers_editop(soops, &te->subtree, mode);
+ do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
}
}
@@ -3952,10 +4053,10 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* recursively go into tree, adding selected items */
- do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_ADD);
+ do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
/* send notifiers */
- WM_event_add_notifier(C, ND_KEYS, NULL); // XXX
+ WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX
return OPERATOR_FINISHED;
}
@@ -3972,7 +4073,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
ot->poll= ed_operator_outliner_datablocks_active;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -3987,7 +4088,7 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* recursively go into tree, adding selected items */
- do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_REMOVE);
+ do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE);
/* send notifiers */
WM_event_add_notifier(C, ND_KEYS, NULL); // XXX
@@ -4007,7 +4108,7 @@ void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
ot->poll= ed_operator_outliner_datablocks_active;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** KEYINGSET OPERATIONS *************** */
@@ -4018,7 +4119,7 @@ void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
enum {
KEYINGSET_EDITMODE_ADD = 0,
KEYINGSET_EDITMODE_REMOVE,
-} eKeyingSet_EditModes;
+} /*eKeyingSet_EditModes*/;
/* Utilities ---------------------------------- */
@@ -4089,12 +4190,9 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
if (ksp) {
/* free path's data */
- // TODO: we probably need an API method for this
- if (ksp->rna_path) MEM_freeN(ksp->rna_path);
+ BKE_keyingset_free_path(ks, ksp);
+
ks->active_path= 0;
-
- /* remove path from set */
- BLI_freelinkN(&ks->paths, ksp);
}
}
break;
@@ -4140,20 +4238,21 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
{
/* identifiers */
ot->idname= "OUTLINER_OT_keyingset_add_selected";
- ot->name= "Keyingset Add Selected";
+ ot->name= "Keying Set Add Selected";
+ ot->description= "Add selected items (blue-grey rows) to active Keying Set";
/* api callbacks */
ot->exec= outliner_keyingset_additems_exec;
ot->poll= ed_operator_outliner_datablocks_active;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* Remove Operator ---------------------------------- */
-static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op)
+static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soutliner= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -4176,14 +4275,15 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
{
/* identifiers */
ot->idname= "OUTLINER_OT_keyingset_remove_selected";
- ot->name= "Keyingset Remove Selected";
+ ot->name= "Keying Set Remove Selected";
+ ot->description = "Remove selected items (blue-grey rows) from active Keying Set";
/* api callbacks */
ot->exec= outliner_keyingset_removeitems_exec;
ot->poll= ed_operator_outliner_datablocks_active;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ***************** DRAW *************** */
@@ -4474,7 +4574,6 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
if(level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
/* active blocks get white circle */
- active= 0;
if(tselem->type==0) {
if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
else if(scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context?
@@ -4505,6 +4604,21 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
}
+/* closed tree element */
+static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
+{
+ TreeElement *ten;
+
+ /* store coord and continue, we need coordinates for elements outside view too */
+ te->xs= (float)startx;
+ te->ys= (float)(*starty);
+
+ for(ten= te->subtree.first; ten; ten= ten->next) {
+ outliner_set_coord_tree_element(soops, ten, startx+OL_X, starty);
+ }
+}
+
+
static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty)
{
TreeElement *ten;
@@ -4659,13 +4773,18 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
te->ys= (float)*starty;
te->xend= startx+offsx;
- *starty-= OL_H;
-
if((tselem->flag & TSE_CLOSED)==0) {
- for(ten= te->subtree.first; ten; ten= ten->next) {
+ *starty-= OL_H;
+
+ for(ten= te->subtree.first; ten; ten= ten->next)
outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+OL_X, starty);
- }
}
+ else {
+ for(ten= te->subtree.first; ten; ten= ten->next)
+ outliner_set_coord_tree_element(soops, te, startx, starty);
+
+ *starty-= OL_H;
+ }
}
static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, int *starty)
@@ -4779,7 +4898,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
}
-static void outliner_back(ARegion *ar, SpaceOops *soops)
+static void outliner_back(ARegion *ar)
{
int ystart;
@@ -4793,7 +4912,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops)
}
}
-static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
+static void outliner_draw_restrictcols(ARegion *ar)
{
int ystart;
@@ -4835,16 +4954,8 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
{
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
- Object *obedit= CTX_data_edit_object(C);
- /* Don't allow hide an objet in edit mode,
- * check the bug #22153 and #21609
- */
- if (obedit && obedit == ob) {
- if (ob->restrictflag & OB_RESTRICT_VIEW)
- ob->restrictflag &= ~OB_RESTRICT_VIEW;
- return;
- }
+ if(!common_restrict_check(C, ob)) return;
/* deselect objects that are invisible */
if (ob->restrictflag & OB_RESTRICT_VIEW) {
@@ -4861,6 +4972,8 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
+ if(!common_restrict_check(C, ob)) return;
+
/* if select restriction has just been turned on */
if (ob->restrictflag & OB_RESTRICT_SELECT) {
/* Ouch! There is no backwards pointer from Object to Base,
@@ -4871,26 +4984,26 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
}
-static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, poin);
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin);
}
-static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin);
}
-static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Object *ob = (Object *)poin2;
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
-static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Bone *bone= (Bone *)poin2;
if(bone && (bone->flag & BONE_HIDDEN_P))
@@ -4898,7 +5011,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2)
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
}
-static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
EditBone *ebone= (EditBone *)poin2;
if(ebone && (ebone->flag & BONE_HIDDEN_A))
@@ -4930,7 +5043,7 @@ static int group_select_flag(Group *gr)
return 0;
}
-static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2, int flag)
+static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
{
Scene *scene = (Scene *)poin;
GroupObject *gob;
@@ -4947,28 +5060,31 @@ static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2
}
else {
for(gob= gr->gobject.first; gob; gob= gob->next) {
- gob->ob->restrictflag |= flag;
+ /* not in editmode */
+ if(scene->obedit!=gob->ob) {
+ gob->ob->restrictflag |= flag;
- if(flag==OB_RESTRICT_VIEW)
- if((gob->ob->flag & SELECT) == 0)
- ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
+ if(flag==OB_RESTRICT_VIEW)
+ if((gob->ob->flag & SELECT) == 0)
+ ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
+ }
}
}
}
static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_VIEW);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_SELECT);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_RENDER);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
@@ -5003,7 +5119,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (te->idcode == ID_LI) {
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
- BLI_path_abs(expanded, G.sce);
+ BLI_path_abs(expanded, G.main->name);
if (!BLI_exists(expanded)) {
error("This path does not exist, correct this before saving");
}
@@ -5022,11 +5138,11 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
bArmature *arm= (bArmature *)tselem->id;
if(arm->edbo) {
EditBone *ebone= te->directdata;
- char newname[32];
+ char newname[sizeof(ebone->name)];
/* restore bone name */
- BLI_strncpy(newname, ebone->name, 32);
- BLI_strncpy(ebone->name, oldname, 32);
+ BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
+ BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
ED_armature_bone_rename(obedit->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, OBACT);
}
@@ -5037,15 +5153,15 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
Bone *bone= te->directdata;
Object *ob;
- char newname[32];
+ char newname[sizeof(bone->name)];
// always make current object active
tree_element_set_active_object(C, scene, soops, te, 1);
ob= OBACT;
/* restore bone name */
- BLI_strncpy(newname, bone->name, 32);
- BLI_strncpy(bone->name, oldname, 32);
+ BLI_strncpy(newname, bone->name, sizeof(bone->name));
+ BLI_strncpy(bone->name, oldname, sizeof(bone->name));
ED_armature_bone_rename(ob->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
}
@@ -5054,15 +5170,15 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
bPoseChannel *pchan= te->directdata;
Object *ob;
- char newname[32];
+ char newname[sizeof(pchan->name)];
// always make current object active
tree_element_set_active_object(C, scene, soops, te, 1);
ob= OBACT;
/* restore bone name */
- BLI_strncpy(newname, pchan->name, 32);
- BLI_strncpy(pchan->name, oldname, 32);
+ BLI_strncpy(newname, pchan->name, sizeof(pchan->name));
+ BLI_strncpy(pchan->name, oldname, sizeof(pchan->name));
ED_armature_bone_rename(ob->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
}
@@ -5104,17 +5220,17 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1,
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1,
&ptr, "hide", -1, 0, 0, -1, -1, NULL);
uiButSetFunc(bt, restrictbutton_view_cb, scene, ob);
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1,
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1,
&ptr, "hide_select", -1, 0, 0, -1, -1, NULL);
uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob);
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1,
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1,
&ptr, "hide_render", -1, 0, 0, -1, -1, NULL);
uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob);
@@ -5128,15 +5244,15 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_VIEW);
- bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
+ bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr);
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_SELECT);
- bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
+ bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr);
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_RENDER);
- bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow renderability");
+ bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1, 0, 0, 0, 0, 0, "Restrict/Allow renderability");
uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -5146,7 +5262,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -5159,13 +5275,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
bt= uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT-1,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass");
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
layflag++; /* is lay_xor */
if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -5176,11 +5292,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
}
else if(tselem->type==TSE_POSE_CHANNEL) {
@@ -5189,11 +5305,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
uiButSetFunc(bt, restrictbutton_bone_cb, NULL, bone);
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
}
else if(tselem->type==TSE_EBONE) {
@@ -5201,11 +5317,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, ebone);
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
- (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
+ (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, NULL);
}
}
@@ -5214,10 +5330,10 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
-static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex)
+static void outliner_draw_rnacols(ARegion *ar, int sizex)
{
View2D *v2d= &ar->v2d;
-
+
float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
if(miny<v2d->tot.ymin) miny = v2d->tot.ymin;
@@ -5252,13 +5368,13 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
prop= te->directdata;
if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
- uiDefAutoButR(block, ptr, prop, -1, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
+ uiDefAutoButR(block, ptr, prop, -1, "", ICON_NULL, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
}
else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
ptr= &te->rnaptr;
prop= te->directdata;
- uiDefAutoButR(block, ptr, prop, te->index, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
+ uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NULL, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
}
}
@@ -5266,7 +5382,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
-static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
+static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2)
{
wmOperatorType *ot= arg2;
wmKeyMapItem *kmi= arg_kmi;
@@ -5275,7 +5391,7 @@ static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
}
-static void operator_search_cb(const struct bContext *C, void *arg_kmi, char *str, uiSearchItems *items)
+static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), const char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -5344,89 +5460,79 @@ static short keymap_menu_type(short type)
return 0;
}
-static char *keymap_type_menu(void)
+static const char *keymap_type_menu(void)
{
- static char string[500];
- static char formatstr[] = "|%s %%x%d";
- char *str= string;
-
- str += sprintf(str, "Event Type %%t");
-
- str += sprintf(str, formatstr, "Keyboard", OL_KM_KEYBOARD);
- str += sprintf(str, formatstr, "Mouse", OL_KM_MOUSE);
- str += sprintf(str, formatstr, "Tweak", OL_KM_TWEAK);
-// str += sprintf(str, formatstr, "Specials", OL_KM_SPECIALS);
-
+ static const char string[]=
+ "Event Type%t"
+ "|Keyboard%x" STRINGIFY(OL_KM_KEYBOARD)
+ "|Mouse%x" STRINGIFY(OL_KM_MOUSE)
+ "|Tweak%x" STRINGIFY(OL_KM_TWEAK)
+// "|Specials%x" STRINGIFY(OL_KM_SPECIALS)
+ ;
+
return string;
-}
-
-static char *keymap_mouse_menu(void)
-{
- static char string[500];
- static char formatstr[] = "|%s %%x%d";
- char *str= string;
-
- str += sprintf(str, "Mouse Event %%t");
-
- str += sprintf(str, formatstr, "Left Mouse", LEFTMOUSE);
- str += sprintf(str, formatstr, "Middle Mouse", MIDDLEMOUSE);
- str += sprintf(str, formatstr, "Right Mouse", RIGHTMOUSE);
- str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE);
- str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE);
- str += sprintf(str, formatstr, "Action Mouse", ACTIONMOUSE);
- str += sprintf(str, formatstr, "Select Mouse", SELECTMOUSE);
- str += sprintf(str, formatstr, "Mouse Move", MOUSEMOVE);
- str += sprintf(str, formatstr, "Wheel Up", WHEELUPMOUSE);
- str += sprintf(str, formatstr, "Wheel Down", WHEELDOWNMOUSE);
- str += sprintf(str, formatstr, "Wheel In", WHEELINMOUSE);
- str += sprintf(str, formatstr, "Wheel Out", WHEELOUTMOUSE);
- str += sprintf(str, formatstr, "Mouse/Trackpad Pan", MOUSEPAN);
- str += sprintf(str, formatstr, "Mouse/Trackpad Zoom", MOUSEZOOM);
- str += sprintf(str, formatstr, "Mouse/Trackpad Rotate", MOUSEROTATE);
-
+}
+
+static const char *keymap_mouse_menu(void)
+{
+ static const char string[]=
+ "Mouse Event%t"
+ "|Left Mouse%x" STRINGIFY(LEFTMOUSE)
+ "|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
+ "|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
+ "|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
+ "|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
+ "|Button4 Mouse%x" STRINGIFY(BUTTON4MOUSE)
+ "|Button5 Mouse%x" STRINGIFY(BUTTON5MOUSE)
+ "|Action Mouse%x" STRINGIFY(ACTIONMOUSE)
+ "|Select Mouse%x" STRINGIFY(SELECTMOUSE)
+ "|Mouse Move%x" STRINGIFY(MOUSEMOVE)
+ "|Wheel Up%x" STRINGIFY(WHEELUPMOUSE)
+ "|Wheel Down%x" STRINGIFY(WHEELDOWNMOUSE)
+ "|Wheel In%x" STRINGIFY(WHEELINMOUSE)
+ "|Wheel Out%x" STRINGIFY(WHEELOUTMOUSE)
+ "|Mouse/Trackpad Pan%x" STRINGIFY(MOUSEPAN)
+ "|Mouse/Trackpad Zoom%x" STRINGIFY(MOUSEZOOM)
+ "|Mouse/Trackpad Rotate%x" STRINGIFY(MOUSEROTATE)
+ ;
+
return string;
}
-static char *keymap_tweak_menu(void)
+static const char *keymap_tweak_menu(void)
{
- static char string[500];
- static char formatstr[] = "|%s %%x%d";
- char *str= string;
-
- str += sprintf(str, "Tweak Event %%t");
-
- str += sprintf(str, formatstr, "Left Mouse", EVT_TWEAK_L);
- str += sprintf(str, formatstr, "Middle Mouse", EVT_TWEAK_M);
- str += sprintf(str, formatstr, "Right Mouse", EVT_TWEAK_R);
- str += sprintf(str, formatstr, "Action Mouse", EVT_TWEAK_A);
- str += sprintf(str, formatstr, "Select Mouse", EVT_TWEAK_S);
-
+ static const char string[]=
+ "Tweak Event%t"
+ "|Left Mouse%x" STRINGIFY(EVT_TWEAK_L)
+ "|Middle Mouse%x" STRINGIFY(EVT_TWEAK_M)
+ "|Right Mouse%x" STRINGIFY(EVT_TWEAK_R)
+ "|Action Mouse%x" STRINGIFY(EVT_TWEAK_A)
+ "|Select Mouse%x" STRINGIFY(EVT_TWEAK_S)
+ ;
+
return string;
}
-static char *keymap_tweak_dir_menu(void)
+static const char *keymap_tweak_dir_menu(void)
{
- static char string[500];
- static char formatstr[] = "|%s %%x%d";
- char *str= string;
-
- str += sprintf(str, "Tweak Direction %%t");
-
- str += sprintf(str, formatstr, "Any", KM_ANY);
- str += sprintf(str, formatstr, "North", EVT_GESTURE_N);
- str += sprintf(str, formatstr, "North-East", EVT_GESTURE_NE);
- str += sprintf(str, formatstr, "East", EVT_GESTURE_E);
- str += sprintf(str, formatstr, "Sout-East", EVT_GESTURE_SE);
- str += sprintf(str, formatstr, "South", EVT_GESTURE_S);
- str += sprintf(str, formatstr, "South-West", EVT_GESTURE_SW);
- str += sprintf(str, formatstr, "West", EVT_GESTURE_W);
- str += sprintf(str, formatstr, "North-West", EVT_GESTURE_NW);
-
+ static const char string[]=
+ "Tweak Direction%t"
+ "|Any%x" STRINGIFY(KM_ANY)
+ "|North%x" STRINGIFY(EVT_GESTURE_N)
+ "|North-East%x" STRINGIFY(EVT_GESTURE_NE)
+ "|East%x" STRINGIFY(EVT_GESTURE_E)
+ "|Sout-East%x" STRINGIFY(EVT_GESTURE_SE)
+ "|South%x" STRINGIFY(EVT_GESTURE_S)
+ "|South-West%x" STRINGIFY(EVT_GESTURE_SW)
+ "|West%x" STRINGIFY(EVT_GESTURE_W)
+ "|North-West%x" STRINGIFY(EVT_GESTURE_NW)
+ ;
+
return string;
}
-static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v)
+static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
{
wmKeyMapItem *kmi= kmi_v;
short maptype= keymap_menu_type(kmi->type);
@@ -5464,7 +5570,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
tselem= TREESTORE(te);
if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
uiBut *but;
- char *str;
+ const char *str;
int xstart= 240;
int butw1= 20; /* operator */
int butw2= 90; /* event type, menus */
@@ -5513,7 +5619,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5;
uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
- uiDefButS(block, OPTION, 0, "Cmd", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
+ uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
xstart+= 5;
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code");
xstart+= butw3+5;
@@ -5559,8 +5665,8 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
if(dx<100) dx= 100;
spx=te->xs+2*OL_X-4;
if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
-
- bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
+
+ bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, OL_H-1, (void *)te->name, 1.0, (float)len, 0, 0, "");
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
@@ -5627,17 +5733,19 @@ void draw_outliner(const bContext *C)
/* update size of tot-rect (extents of data/viewable area) */
UI_view2d_totRect_set(v2d, sizex, sizey);
+ /* force display to pixel coords */
+ v2d->flag |= (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
/* set matrix for 2d-view controls */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* draw outliner stuff (background, hierachy lines and names) */
- outliner_back(ar, soops);
+ outliner_back(ar);
block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
- outliner_draw_rnacols(ar, soops, sizex_rna);
+ outliner_draw_rnacols(ar, sizex_rna);
outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree);
}
else if(soops->outlinevis == SO_KEYMAP) {
@@ -5645,10 +5753,13 @@ void draw_outliner(const bContext *C)
}
else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
/* draw restriction columns */
- outliner_draw_restrictcols(ar, soops);
+ outliner_draw_restrictcols(ar);
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
}
-
+
+ /* draw edit buttons if nessecery */
+ outliner_buttons(C, block, ar, soops, &soops->tree);
+
/* draw edit buttons if nessecery */
outliner_buttons(C, block, ar, soops, &soops->tree);