2.5/Posemode:
[blender-staging.git] / source / blender / editors / space_outliner / outliner.c
index 21ba9cfa7070d2537e736fea2272492bab8bf8bf..33119317a6da246d837e834fa7dcba6eeea95e90 100644 (file)
@@ -620,7 +620,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                                        
                                        tenla->name= "Pose";
                                        
-                                       if(arm->edbo==NULL && (ob->flag & OB_POSEMODE)) {       // channels undefined in editmode, but we want the 'tenla' pose icon itself
+                                       if(arm->edbo==NULL && (ob->mode & OB_MODE_POSE)) {      // channels undefined in editmode, but we want the 'tenla' pose icon itself
                                                int a= 0, const_index= 1000;    /* ensure unique id for bone constraints */
                                                
                                                for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
@@ -887,7 +887,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                                else {
                                        /* do not extend Armature when we have posemode */
                                        tselem= TREESTORE(te->parent);
-                                       if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->flag & OB_POSEMODE);
+                                       if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
                                        else {
                                                Bone *curBone;
                                                for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
@@ -1016,7 +1016,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
                PropertyRNA *prop, *iterprop;
                PropertyType proptype;
-               PropertySubType propsubtype;
                int a, tot;
 
                /* we do lazy build, for speed and to avoid infinite recusion */
@@ -1096,31 +1095,20 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        }
                }
                else if(type == TSE_RNA_ARRAY_ELEM) {
-                       /* array property element */
-                       static char *vectoritem[4]= {"  x", "  y", "  z", "  w"};
-                       static char *quatitem[4]= {"  w", "  x", "  y", "  z"};
-                       static char *coloritem[4]= {"  r", "  g", "  b", "  a"};
+                       char c;
 
                        prop= parent->directdata;
-                       proptype= RNA_property_type(prop);
-                       propsubtype= RNA_property_subtype(prop);
-                       tot= RNA_property_array_length(prop);
 
                        te->directdata= prop;
                        te->rnaptr= *ptr;
                        te->index= index;
 
-                       if(tot == 4 && propsubtype == PROP_ROTATION)
-                               te->name= quatitem[index];
-                       else if(tot <= 4 && (propsubtype == PROP_VECTOR || propsubtype == PROP_ROTATION))
-                               te->name= vectoritem[index];
-                       else if(tot <= 4 && propsubtype == PROP_COLOR)
-                               te->name= coloritem[index];
-                       else {
-                               te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
-                               sprintf(te->name, "  %d", index+1);
-                               te->flag |= TE_FREE_NAME;
-                       }
+                       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);
+                       te->flag |= TE_FREE_NAME;
                }
        }
        else if(type == TSE_KEYMAP) {
@@ -1132,8 +1120,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                te->name= km->nameid;
                
                if(!(tselem->flag & TSE_CLOSED)) {
+                       a= 0;
                        
-                       for (kmi= km->keymap.first; kmi; kmi= kmi->next) {
+                       for (kmi= km->keymap.first; kmi; kmi= kmi->next, a++) {
                                const char *key= WM_key_event_string(kmi->type);
                                
                                if(key[0]) {
@@ -2188,13 +2177,13 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te,
                if(scene->obedit) 
                        ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                
-               if(ob->flag & OB_POSEMODE) 
+               if(ob->mode & OB_MODE_POSE) 
                        ED_armature_exit_posemode(C, base);
                else 
                        ED_armature_enter_posemode(C, base);
        }
        else {
-               if(ob->flag & OB_POSEMODE) return 1;
+               if(ob->mode & OB_MODE_POSE) return 1;
        }
        return 0;
 }
@@ -3072,10 +3061,6 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
                if(scene->obedit==base->object) 
                        ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                
-               if(base==BASACT) {
-                       ED_view3d_exit_paint_modes(C);
-               }
-               
                ED_base_object_free_and_unlink(scene, base);
                te->directdata= NULL;
                tselem->id= NULL;
@@ -3513,56 +3498,6 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
 }
 
 
-/* ****** Drag & Drop ****** */
-
-static int outliner_drag_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       Object *ob= CTX_data_active_object(C);
-       PointerRNA ptr;
-
-       RNA_pointer_create(NULL, &RNA_Object, ob, &ptr);
-
-       return OPERATOR_RUNNING_MODAL;
-}
-
-static int outliner_drag_modal(bContext *C, wmOperator *op, wmEvent *event)
-{
-       switch(event->type) {
-               case MOUSEDRAG:
-
-                       break;
-               case MOUSEDROP:
-                       return OPERATOR_FINISHED;
-               case ESCKEY:
-                       return OPERATOR_CANCELLED;
-       }
-
-       return OPERATOR_RUNNING_MODAL;
-}
-
-static int outliner_drag_exec(bContext *C, wmOperator *op)
-{
-       return OPERATOR_FINISHED;
-}
-
-void OUTLINER_OT_drag(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Drag";
-       ot->idname= "OUTLINER_OT_drag";
-
-       /* api callbacks */
-       ot->invoke= outliner_drag_invoke;
-       ot->modal= outliner_drag_modal;
-       ot->exec= outliner_drag_exec;
-
-       ot->poll= ED_operator_outliner_active;
-
-       /* flags */
-       /* ot->flag= OPTYPE_UNDO; */
-}
-
-
 /* ******************** */
 
 
@@ -3723,7 +3658,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                                }
                                else if(RNA_property_type(prop) == PROP_COLLECTION) {
                                        char buf[128], *name;
-
+                                       
                                        temnext= (TreeElement*)(ld->next->data);
                                        tsenext= TREESTORE(temnext);
                                        
@@ -4227,13 +4162,13 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
                        case TSE_POSEGRP_BASE:
                                UI_icon_draw(x, y, ICON_VERTEXSEL); break;
                        case TSE_SEQUENCE:
-                               if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND))
+                               if(te->idcode==SEQ_MOVIE)
                                        UI_icon_draw(x, y, ICON_SEQUENCE);
                                else if(te->idcode==SEQ_META)
                                        UI_icon_draw(x, y, ICON_DOT);
                                else if(te->idcode==SEQ_SCENE)
                                        UI_icon_draw(x, y, ICON_SCENE);
-                               else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND))
+                               else if(te->idcode==SEQ_SOUND)
                                        UI_icon_draw(x, y, ICON_SOUND);
                                else if(te->idcode==SEQ_IMAGE)
                                        UI_icon_draw(x, y, ICON_IMAGE_COL);