At last... this merge should finally do the trick!
[blender.git] / source / blender / editors / space_outliner / outliner.c
index 6394e38c6e7b5d6d657288a12378b531c2fd9928..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,12 +1043,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                }
                else if(type == TSE_RNA_STRUCT) {
                        /* struct */
-                       nameprop= RNA_struct_name_property(ptr->type);
+                       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->type);
 
@@ -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
@@ -3074,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:
@@ -3118,17 +3117,16 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                                        newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
                                }
                                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->type);
+                                       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)
@@ -3270,7 +3268,6 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
 static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
 {
        SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
-       Scene *scene= CTX_data_scene(C);
        
        /* check for invalid states */
        if (soutliner == NULL)
@@ -3306,7 +3303,6 @@ void OUTLINER_OT_drivers_add(wmOperatorType *ot)
 static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
 {
        SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
-       Scene *scene= CTX_data_scene(C);
        
        /* check for invalid states */
        if (soutliner == NULL)
@@ -3522,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;
@@ -3565,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:
@@ -3576,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;
                                }
@@ -3620,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;
@@ -3665,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:
@@ -3965,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
@@ -4229,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);
                        }
@@ -4278,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;
@@ -4293,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;
@@ -4302,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);
                        }
                }