At last... this merge should finally do the trick!
[blender.git] / source / blender / editors / space_outliner / outliner.c
index 46f8bc7714917934c91abb217382e5a2a436da51..6563a7dc7df77c8622480bbbc2dc26f232846b25 100644 (file)
 #include "RNA_access.h"
 
 #include "ED_armature.h"
+#include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 
@@ -948,7 +949,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                
                /* NLA Data */
                if (adt->nla_tracks.first) {
-#if 0
                        TreeElement *tenla= outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
                        NlaTrack *nlt;
                        int a= 0;
@@ -956,17 +956,18 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        tenla->name= "NLA Tracks";
                        
                        for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
-                               TreeElement *tenlt= outliner_add_element(soops, &te->subtree, nlt, te, TSE_NLA_TRACK, a);
-                               bActionStrip *strip;
+                               TreeElement *tenlt= outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
+                               NlaStrip *strip;
                                TreeElement *ten;
                                int b= 0;
                                
-                               for (strip=nlt->strips.first; strip; strip=strip->next, a++) {
-                                       ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
+                               tenlt->name= nlt->name;
+                               
+                               for (strip=nlt->strips.first; strip; strip=strip->next, b++) {
+                                       ten= outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
                                        if(ten) ten->directdata= strip;
                                }
                        }
-#endif
                }
        }
        else if(type==TSE_SEQUENCE) {
@@ -1030,7 +1031,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
        }
        else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
                PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
-               PropertyRNA *prop, *iterprop, *nameprop;
+               PropertyRNA *prop, *iterprop;
                PropertyType proptype;
                PropertySubType propsubtype;
                int a, tot;
@@ -1042,20 +1043,18 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                }
                else if(type == TSE_RNA_STRUCT) {
                        /* struct */
-                       nameprop= RNA_struct_name_property(ptr);
+                       te->name= RNA_struct_name_get_alloc(ptr, NULL, 0);
 
-                       if(nameprop) {
-                               te->name= RNA_property_string_get_alloc(ptr, nameprop, NULL, 0);
+                       if(te->name)
                                te->flag |= TE_FREE_NAME;
-                       }
                        else
-                               te->name= (char*)RNA_struct_ui_name(ptr);
+                               te->name= (char*)RNA_struct_ui_name(ptr->type);
 
-                       iterprop= RNA_struct_iterator_property(ptr);
+                       iterprop= RNA_struct_iterator_property(ptr->type);
                        tot= RNA_property_collection_length(ptr, iterprop);
 
                        /* auto open these cases */
-                       if(!parent || (RNA_property_type(&parent->rnaptr, parent->directdata)) == PROP_POINTER)
+                       if(!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
                                if(!tselem->used)
                                        tselem->flag &= ~TSE_CLOSED;
 
@@ -1070,13 +1069,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                }
                else if(type == TSE_RNA_PROPERTY) {
                        /* property */
-                       iterprop= RNA_struct_iterator_property(ptr);
+                       iterprop= RNA_struct_iterator_property(ptr->type);
                        RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
 
                        prop= propptr.data;
-                       proptype= RNA_property_type(ptr, prop);
+                       proptype= RNA_property_type(prop);
 
-                       te->name= (char*)RNA_property_ui_name(ptr, prop);
+                       te->name= (char*)RNA_property_ui_name(prop);
                        te->directdata= prop;
                        te->rnaptr= *ptr;
 
@@ -1103,7 +1102,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                                        te->flag |= TE_LAZY_CLOSED;
                        }
                        else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
-                               tot= RNA_property_array_length(ptr, prop);
+                               tot= RNA_property_array_length(prop);
 
                                if(!(tselem->flag & TSE_CLOSED)) {
                                        for(a=0; a<tot; a++)
@@ -1120,9 +1119,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        static char *coloritem[4]= {"  r", "  g", "  b", "  a"};
 
                        prop= parent->directdata;
-                       proptype= RNA_property_type(ptr, prop);
-                       propsubtype= RNA_property_subtype(ptr, prop);
-                       tot= RNA_property_array_length(ptr, prop);
+                       proptype= RNA_property_type(prop);
+                       propsubtype= RNA_property_subtype(prop);
+                       tot= RNA_property_array_length(prop);
 
                        te->directdata= prop;
                        te->rnaptr= *ptr;
@@ -1749,7 +1748,7 @@ static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeEleme
 
                if(set) {
                        if(sbuts) {
-                               sbuts->tabo= TAB_SHADING_TEX;   // hack from header_buttonswin.c
+                               // XXX sbuts->tabo= TAB_SHADING_TEX;    // hack from header_buttonswin.c
                                sbuts->texfrom= 1;
                        }
 // XXX                 extern_set_butspace(F6KEY, 0);  // force shading buttons texture
@@ -1763,7 +1762,7 @@ static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeEleme
                Lamp *la= (Lamp *)tselemp->id;
                if(set) {
                        if(sbuts) {
-                               sbuts->tabo= TAB_SHADING_TEX;   // hack from header_buttonswin.c
+                               // XXX sbuts->tabo= TAB_SHADING_TEX;    // hack from header_buttonswin.c
                                sbuts->texfrom= 2;
                        }
 // XXX                 extern_set_butspace(F6KEY, 0);  // force shading buttons texture
@@ -3047,18 +3046,9 @@ void outliner_operation_menu(Scene *scene, ARegion *ar, SpaceOops *soops)
        }
 }
 
-/* ***************** KEYINGSET OPERATIONS *************** */
-
-/* These operators are only available in databrowser mode for now, as
- * they depend on having RNA paths and/or hierarchies available.
- */
-enum {
-       KEYINGSET_EDITMODE_ADD  = 0,
-       KEYINGSET_EDITMODE_REMOVE,
-} eKeyingSet_EditModes;
+/* ***************** ANIMATO OPERATIONS ********************************** */
+/* KeyingSet and Driver Creation - Helper functions */
 
-/* Utilities ---------------------------------- */
 /* specialised poll callback for these operators to work in Datablocks view only */
 static int ed_operator_outliner_datablocks_active(bContext *C)
 {
@@ -3069,33 +3059,9 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
        }
        return 0;
 }
-/* find the 'active' KeyingSet, and add if not found (if adding is allowed) */
-// TODO: should this be an API func?
-static KeyingSet *verify_active_keyingset(Scene *scene, short add)
-{
-       KeyingSet *ks= NULL;
-       
-       /* sanity check */
-       if (scene == NULL)
-               return NULL;
-       
-       /* try to find one from scene */
-       if (scene->active_keyingset > 0)
-               ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
-               
-       /* add if none found */
-       // XXX the default settings have yet to evolve
-       if ((add) && (ks==NULL)) {
-               ks= BKE_keyingset_add(&scene->keyingsets, "Keying Set", KEYINGSET_ABSOLUTE, 0);
-               scene->active_keyingset= BLI_countlist(&scene->keyingsets);
-       }
-       
-       return ks;
-}
 
-/* Helper func to extract an RNA path from seleted tree element 
+
+/* Helper func to extract an RNA path from selected tree element 
  * NOTE: the caller must zero-out all values of the pointers that it passes here first, as
  * this function does not do that yet 
  */
@@ -3107,7 +3073,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
        TreeElement *tem, *temnext, *temsub;
        TreeStoreElem *tse, *tsenext;
        PointerRNA *ptr, *nextptr;
-       PropertyRNA *prop, *nameprop;
+       PropertyRNA *prop;
        char *newpath=NULL;
        
        /* optimise tricks:
@@ -3146,22 +3112,21 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                         *      - to prevent memory leaks, we must write to newpath not path, then free old path + swap them
                         */
                        if(tse->type == TSE_RNA_PROPERTY) {
-                               if(RNA_property_type(ptr, prop) == PROP_POINTER) {
+                               if(RNA_property_type(prop) == PROP_POINTER) {
                                        /* for pointer we just append property name */
                                        newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
                                }
-                               else if(RNA_property_type(ptr, prop) == PROP_COLLECTION) {
+                               else if(RNA_property_type(prop) == PROP_COLLECTION) {
+                                       char buf[128], *name;
+
                                        temnext= (TreeElement*)(ld->next->data);
                                        tsenext= TREESTORE(temnext);
                                        
                                        nextptr= &temnext->rnaptr;
-                                       nameprop= RNA_struct_name_property(nextptr);
+                                       name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf));
                                        
-                                       if(nameprop) {
+                                       if(name) {
                                                /* if possible, use name as a key in the path */
-                                               char buf[128], *name;
-                                               name= RNA_property_string_get_alloc(nextptr, nameprop, buf, sizeof(buf));
-                                               
                                                newpath= RNA_path_append(*path, NULL, prop, 0, name);
                                                
                                                if(name != buf)
@@ -3192,7 +3157,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                        /* no ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock to extract info from */
                        if (tse->type == TSE_RNA_STRUCT) {
                                /* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */
-                               if(RNA_struct_is_ID(ptr)) {
+                               if(RNA_struct_is_ID(ptr->type)) {
                                        *id= (ID *)ptr->data;
                                        
                                        /* clear path */
@@ -3216,7 +3181,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                        /* item is part of an array, so must set the array_index */
                        *array_index= te->index;
                }
-               else if (RNA_property_array_length(ptr, prop)) {
+               else if (RNA_property_array_length(prop)) {
                        /* entire array was selected, so keyframe all */
                        *flag |= KSP_FLAG_WHOLE_ARRAY;
                }
@@ -3231,6 +3196,178 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
        BLI_freelistN(&hierarchy);
 }
 
+/* ***************** KEYINGSET OPERATIONS *************** */
+
+/* These operators are only available in databrowser mode for now, as
+ * they depend on having RNA paths and/or hierarchies available.
+ */
+enum {
+       DRIVERS_EDITMODE_ADD    = 0,
+       DRIVERS_EDITMODE_REMOVE,
+} 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)
+{
+       TreeElement *te;
+       TreeStoreElem *tselem;
+       
+       for (te= tree->first; te; te=te->next) {
+               tselem= TREESTORE(te);
+               
+               /* if item is selected, perform operation */
+               if (tselem->flag & TSE_SELECTED) {
+                       ID *id= NULL;
+                       char *path= NULL;
+                       int array_index= 0;
+                       short flag= 0;
+                       short groupmode= KSP_GROUP_KSNAME;
+                       
+                       /* check if RNA-property described by this selected element is an animateable prop */
+                       if ((tselem->type == TSE_RNA_PROPERTY) && RNA_property_animateable(&te->rnaptr, te->directdata)) {
+                               /* get id + path + index info from the selected element */
+                               tree_element_to_path(soops, te, tselem, 
+                                               &id, &path, &array_index, &flag, &groupmode);
+                       }
+                       
+                       /* only if ID and path were set, should we perform any actions */
+                       if (id && path) {
+                               /* action depends on mode */
+                               switch (mode) {
+                                       case DRIVERS_EDITMODE_ADD:
+                                       {
+                                               /* add a new driver with the information obtained (only if valid) */
+                                               ANIM_add_driver(id, path, array_index, flag);
+                                       }
+                                               break;
+                                       case DRIVERS_EDITMODE_REMOVE:
+                                       {
+                                               /* remove driver matching the information obtained (only if valid) */
+                                               ANIM_remove_driver(id, path, array_index, flag);
+                                       }
+                                               break;
+                               }
+                               
+                               /* free path, since it had to be generated */
+                               MEM_freeN(path);
+                       }
+                       
+                       
+               }
+               
+               /* go over sub-tree */
+               if ((tselem->flag & TSE_CLOSED)==0)
+                       do_outliner_drivers_editop(soops, &te->subtree, mode);
+       }
+}
+
+/* Add Operator ---------------------------------- */
+
+static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
+{
+       SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
+       
+       /* check for invalid states */
+       if (soutliner == NULL)
+               return OPERATOR_CANCELLED;
+       
+       /* recursively go into tree, adding selected items */
+       do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_ADD);
+       
+       /* send notifiers */
+       WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_drivers_add(wmOperatorType *ot)
+{
+       /* api callbacks */
+       ot->idname= "OUTLINER_OT_drivers_add";
+       ot->name= "Add Drivers";
+       ot->description= "Add drivers to selected items.";
+       
+       /* api callbacks */
+       ot->exec= outliner_drivers_addsel_exec;
+       ot->poll= ed_operator_outliner_datablocks_active;
+       
+       /* flags */
+       ot->flag = OPTYPE_UNDO;
+}
+
+
+/* Remove Operator ---------------------------------- */
+
+static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
+{
+       SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
+       
+       /* check for invalid states */
+       if (soutliner == NULL)
+               return OPERATOR_CANCELLED;
+       
+       /* recursively go into tree, adding selected items */
+       do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_REMOVE);
+       
+       /* send notifiers */
+       WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_drivers_delete(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->idname= "OUTLINER_OT_drivers_delete";
+       ot->name= "Delete Drivers";
+       ot->description= "Delete drivers assigned to selected items.";
+       
+       /* api callbacks */
+       ot->exec= outliner_drivers_deletesel_exec;
+       ot->poll= ed_operator_outliner_datablocks_active;
+       
+       /* flags */
+       ot->flag = OPTYPE_UNDO;
+}
+
+/* ***************** KEYINGSET OPERATIONS *************** */
+
+/* These operators are only available in databrowser mode for now, as
+ * they depend on having RNA paths and/or hierarchies available.
+ */
+enum {
+       KEYINGSET_EDITMODE_ADD  = 0,
+       KEYINGSET_EDITMODE_REMOVE,
+} eKeyingSet_EditModes;
+
+/* Utilities ---------------------------------- */ 
+/* find the 'active' KeyingSet, and add if not found (if adding is allowed) */
+// TODO: should this be an API func?
+static KeyingSet *verify_active_keyingset(Scene *scene, short add)
+{
+       KeyingSet *ks= NULL;
+       
+       /* sanity check */
+       if (scene == NULL)
+               return NULL;
+       
+       /* try to find one from scene */
+       if (scene->active_keyingset > 0)
+               ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
+               
+       /* add if none found */
+       // XXX the default settings have yet to evolve
+       if ((add) && (ks==NULL)) {
+               ks= BKE_keyingset_add(&scene->keyingsets, "Keying Set", KEYINGSET_ABSOLUTE, 0);
+               scene->active_keyingset= BLI_countlist(&scene->keyingsets);
+       }
+       
+       return ks;
+}
+
 /* Recursively iterate over tree, finding and working on selected items */
 static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBase *tree, short mode)
 {
@@ -3381,10 +3518,12 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                                UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
                        case TSE_NLA:
                                UI_icon_draw(x, y, ICON_NLA); break;
+                       case TSE_NLA_TRACK:
+                               UI_icon_draw(x, y, ICON_NLA); break; // XXX
                        case TSE_NLA_ACTION:
                                UI_icon_draw(x, y, ICON_ACTION); break;
                        case TSE_DEFGROUP_BASE:
-                               UI_icon_draw(x, y, ICON_VGROUP); break;
+                               UI_icon_draw(x, y, ICON_GROUP_VERTEX); break;
                        case TSE_BONE:
                        case TSE_EBONE:
                                UI_icon_draw(x, y, ICON_BONE_DATA); break;
@@ -3424,7 +3563,7 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                                        case eModifierType_Boolean: 
                                                UI_icon_draw(x, y, ICON_MOD_BOOLEAN); break;
                                        case eModifierType_ParticleSystem: 
-                                               UI_icon_draw(x, y, ICON_MOD_PARTICLEINSTANCE); break;
+                                               UI_icon_draw(x, y, ICON_MOD_PARTICLES); break;
                                        case eModifierType_ParticleInstance:
                                                UI_icon_draw(x, y, ICON_MOD_PARTICLES); break;
                                        case eModifierType_EdgeSplit:
@@ -3435,6 +3574,30 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                                                UI_icon_draw(x, y, ICON_MOD_UVPROJECT); break;
                                        case eModifierType_Displace:
                                                UI_icon_draw(x, y, ICON_MOD_DISPLACE); break;
+                                       case eModifierType_Shrinkwrap:
+                                               UI_icon_draw(x, y, ICON_MOD_SHRINKWRAP); break;
+                                       case eModifierType_Cast:
+                                               UI_icon_draw(x, y, ICON_MOD_CAST); break;
+                                       case eModifierType_MeshDeform:
+                                               UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break;
+                                       case eModifierType_Bevel:
+                                               UI_icon_draw(x, y, ICON_MOD_BEVEL); break;
+                                       case eModifierType_Smooth:
+                                               UI_icon_draw(x, y, ICON_MOD_SMOOTH); break;
+                                       case eModifierType_SimpleDeform:
+                                               UI_icon_draw(x, y, ICON_MOD_SIMPLEDEFORM); break;
+                                       case eModifierType_Mask:
+                                               UI_icon_draw(x, y, ICON_MOD_MASK); break;
+                                       case eModifierType_Cloth:
+                                               UI_icon_draw(x, y, ICON_MOD_CLOTH); break;
+                                       case eModifierType_Explode:
+                                               UI_icon_draw(x, y, ICON_MOD_EXPLODE); break;
+                                       case eModifierType_Collision:
+                                               UI_icon_draw(x, y, ICON_MOD_PHYSICS); break;
+                                       case eModifierType_Fluidsim:
+                                               UI_icon_draw(x, y, ICON_MOD_FLUIDSIM); break;
+                                       case eModifierType_Multires:
+                                               UI_icon_draw(x, y, ICON_MOD_MULTIRES); break;
                                        default:
                                                UI_icon_draw(x, y, ICON_DOT); break;
                                }
@@ -3479,7 +3642,7 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                                UI_icon_draw(x, y, ICON_OBJECT_DATA);
                                break;
                        case TSE_RNA_STRUCT:
-                               UI_icon_draw(x, y, UI_GetIconRNA(&te->rnaptr));
+                               UI_icon_draw(x, y, RNA_struct_ui_icon(te->rnaptr.type));
                                break;
                        default:
                                UI_icon_draw(x, y, ICON_DOT); break;
@@ -3524,7 +3687,25 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                        case ID_LT:
                                UI_icon_draw(x, y, ICON_OUTLINER_DATA_LATTICE); break;
                        case ID_LA:
-                               UI_icon_draw(x, y, ICON_OUTLINER_DATA_LAMP); break;
+                       {
+                               Lamp *la= (Lamp *)tselem->id;
+                               
+                               switch(la->type) {
+                                       case LA_LOCAL:
+                                               UI_icon_draw(x, y, ICON_LAMP_POINT); break;
+                                       case LA_SUN:
+                                               UI_icon_draw(x, y, ICON_LAMP_SUN); break;
+                                       case LA_SPOT:
+                                               UI_icon_draw(x, y, ICON_LAMP_SPOT); break;
+                                       case LA_HEMI:
+                                               UI_icon_draw(x, y, ICON_LAMP_HEMI); break;
+                                       case LA_AREA:
+                                               UI_icon_draw(x, y, ICON_LAMP_AREA); break;
+                                       default:
+                                               UI_icon_draw(x, y, ICON_OUTLINER_DATA_LAMP); break;
+                               }
+                               break;
+                       }
                        case ID_MA:
                                UI_icon_draw(x, y, ICON_MATERIAL_DATA); break;
                        case ID_TE:
@@ -3824,6 +4005,9 @@ static void outliner_draw_tree(Scene *scene, ARegion *ar, SpaceOops *soops)
        float col[4];
        
 #if 0 // XXX was #ifdef INTERNATIONAL
+       /* Maybe the INTERNATIONAL was really for check about freetype2 ?
+        * anyway I think that we can remove this now - Diego
+        */
        FTF_SetFontSize('l');
        BIF_SetScale(1.0);
 #endif
@@ -4088,17 +4272,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                                bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, 0, ICON_RESTRICT_VIEW_OFF, 
                                                (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
                                uiButSetFunc(bt, restrictbutton_view_cb, scene, ob);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                                
                                bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_SELECT, 0, ICON_RESTRICT_SELECT_OFF, 
                                                (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
                                uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                                
                                bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, 0, ICON_RESTRICT_RENDER_OFF, 
                                                (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability");
                                uiButSetFunc(bt, restrictbutton_rend_cb, NULL, NULL);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                                
                                uiBlockSetEmboss(block, UI_EMBOSS);
                        }
@@ -4137,12 +4318,10 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                                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");
                                uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                                
                                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");
                                uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                        }
                        else if(tselem->type==TSE_POSE_CHANNEL)  {
                                bPoseChannel *pchan= (bPoseChannel *)te->directdata;
@@ -4152,7 +4331,6 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                                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");
                                uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                        }
                        else if(tselem->type==TSE_EBONE)  {
                                EditBone *ebone= (EditBone *)te->directdata;
@@ -4161,7 +4339,6 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                                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");
                                uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
-                               uiButSetFlag(bt, UI_NO_HILITE);
                        }
                }
                
@@ -4203,7 +4380,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
                                ptr= &te->rnaptr;
                                prop= te->directdata;
                                
-                               if(!(RNA_property_type(ptr, prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
+                               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);
                        }
                        else if(tselem->type == TSE_RNA_ARRAY_ELEM) {