Revision: 18556
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18556
Author:   blendix
Date:     2009-01-17 23:14:08 +0100 (Sat, 17 Jan 2009)

Log Message:
-----------
2.5: uv editor
- mouse select, loop select, select linked, unlink selection operators.
- added edge selection mode.
- fix 2.45 bug with unitialized theme colors, which caused the active face
  and face centers to be not drawn.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/interface/resources.c
    
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
    branches/blender2.5/blender/source/blender/editors/space_image/space_image.c
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_draw.c
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_intern.h
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_ops.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c

Modified: 
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c     
2009-01-17 18:35:33 UTC (rev 18555)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c     
2009-01-17 22:14:08 UTC (rev 18556)
@@ -8492,8 +8492,12 @@
                        do_versions_windowmanager_2_50(screen);
                
                /* struct audio data moved to renderdata */
-               for(scene= main->scene.first; scene; scene= scene->id.next)
+               for(scene= main->scene.first; scene; scene= scene->id.next) {
                        scene->r.audio = scene->audio;
+
+                       if(!scene->toolsettings->uv_selectmode)
+                               scene->toolsettings->uv_selectmode= 
UV_SELECT_VERTEX;
+               }
                
                /* shader, composit and texture node trees have id.name empty, 
put something in
                 * to have them show in RNA viewer and accessible otherwise.
@@ -8501,7 +8505,8 @@
                for(ma= main->mat.first; ma; ma= ma->id.next) {
                        if(ma->nodetree && strlen(ma->nodetree->id.name)==0)
                                strcpy(ma->nodetree->id.name, "NTShader 
Nodetree");
-       }
+               }
+
                /* and composit trees */
                for(sce= main->scene.first; sce; sce= sce->id.next) {
                        if(sce->nodetree && strlen(sce->nodetree->id.name)==0)

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/resources.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/resources.c    
2009-01-17 18:35:33 UTC (rev 18555)
+++ branches/blender2.5/blender/source/blender/editors/interface/resources.c    
2009-01-17 22:14:08 UTC (rev 18556)
@@ -511,8 +511,10 @@
        SETCOL(btheme->tima.vertex, 0xff, 0x70, 0xff, 255);
        SETCOL(btheme->tima.vertex_select, 0xff, 0xff, 0x70, 255);
        btheme->tima.vertex_size= 2;
+       btheme->tima.facedot_size= 2;
        SETCOL(btheme->tima.face,   0, 50, 150, 40);
        SETCOL(btheme->tima.face_select, 200, 100, 200, 80);
+       SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
 
        /* space imageselect */
        btheme->timasel= btheme->tv3d;

Modified: 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c   
    2009-01-17 18:35:33 UTC (rev 18555)
+++ 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c   
    2009-01-17 22:14:08 UTC (rev 18556)
@@ -223,12 +223,6 @@
        case 8: /* Border Select Pinned */
                borderselect_sima(UV_SELECT_PINNED);
                break;
-       case 2: /* Unlink Selection */
-               unlink_selection();
-               break;
-       case 3: /* Linked UVs */
-               select_linked_tface_uv(2);
-               break;
        case 7: /* Pinned UVs */
                select_pinned_tface_uv();
                break;
@@ -1207,9 +1201,11 @@
                        uiBlockBeginAlign(block);
                        
                        uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_REDR, 
ICON_VERTEXSEL,
-                               xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 
0, 0, "Vertex select mode (Ctrl Tab 1)");
+                               xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 
0, 0, "Vertex select mode");
+                       uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_REDR, 
ICON_EDGESEL,
+                               xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 
0.0, 0, 0, "Edge select mode");
                        uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_REDR, 
ICON_FACESEL,
-                               xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 
0.0, 0, 0, "Face select mode (Ctrl Tab 3)");
+                               xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 
0.0, 0, 0, "Face select mode");
 
                        uiBlockEndAlign(block);
                }
@@ -1218,6 +1214,8 @@
 
                        uiDefIconButS(block, ROW, B_REDR, ICON_VERTEXSEL,
                                xco,yco,XIC,YIC, 
&scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_VERTEX, 0, 0, "Vertex 
select mode");
+                       uiDefIconButS(block, ROW, B_REDR, ICON_EDGESEL,
+                               xco+=XIC,yco,XIC,YIC, 
&scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_EDGE, 0, 0, "Edge select 
mode");
                        uiDefIconButS(block, ROW, B_REDR, ICON_FACESEL,
                                xco+=XIC,yco,XIC,YIC, 
&scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_FACE, 0, 0, "Face select 
mode");
                        uiDefIconButS(block, ROW, B_REDR, ICON_MESH,

Modified: 
branches/blender2.5/blender/source/blender/editors/space_image/space_image.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_image/space_image.c    
    2009-01-17 18:35:33 UTC (rev 18555)
+++ 
branches/blender2.5/blender/source/blender/editors/space_image/space_image.c    
    2009-01-17 22:14:08 UTC (rev 18556)
@@ -493,7 +493,7 @@
 #endif
                        ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
 
-               if(ibuf->rect || ibuf->rect_float)
+               if(ibuf && (ibuf->rect || ibuf->rect_float))
                        return ibuf;
        }
 

Modified: 
branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_draw.c     
2009-01-17 18:35:33 UTC (rev 18555)
+++ branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_draw.c     
2009-01-17 22:14:08 UTC (rev 18556)
@@ -412,25 +412,26 @@
 /* draws uv's in the image space */
 static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 {
+       ToolSettings *settings;
        EditMesh *em;
        EditFace *efa, *efa_act;
        MTFace *tf, *activetf = NULL;
        DerivedMesh *finaldm, *cagedm;
        char col1[4], col2[4];
        float pointsize;
-       int drawfaces, lastsel, sel;
+       int drawfaces, interpedges, lastsel, sel;
        Image *ima= sima->image;
        
        em= ((Mesh*)obedit->data)->edit_mesh;
        activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set 
to NULL if hidden */
 
+       settings= scene->toolsettings;
+
        drawfaces= draw_uvs_face_check(scene);
-       
-#if 0
-       calc_image_view(G.sima, 'f');   /* float */
-       myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, 
G.v2d->cur.ymax);
-       glLoadIdentity();
-#endif
+       if(settings->uv_flag & UV_SYNC_SELECTION)
+               interpedges= (scene->selectmode & SCE_SELECT_VERTEX);
+       else
+               interpedges= (settings->uv_selectmode == UV_SELECT_VERTEX);
 
        /* 1. draw shadow mesh */
        
@@ -442,7 +443,7 @@
 
                        /* when sync selection is enabled, all faces are drawn 
(except for hidden)
                         * so if cage is the same as the final, theres no point 
in drawing this */
-                       if(!((scene->toolsettings->uv_flag & UV_SYNC_SELECTION) 
&& (cagedm == finaldm)))
+                       if(!((settings->uv_flag & UV_SYNC_SELECTION) && (cagedm 
== finaldm)))
                                draw_uvs_dm_shadow(finaldm);
                        
                        /* release derivedmesh again */
@@ -614,37 +615,75 @@
                        glColor4ubv((unsigned char *)col2); 
                        
                        if(G.f & G_DRAWEDGES) {
-                               glShadeModel(GL_SMOOTH);
                                UI_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
                                lastsel = sel = 0;
 
-                               for(efa= em->faces.first; efa; efa= efa->next) {
-                                       tf= (MTFace *)efa->tmp.p; /* visible 
faces cached */
+                               if(interpedges) {
+                                       glShadeModel(GL_SMOOTH);
 
-                                       if(tf) {
-                                               glBegin(GL_LINE_LOOP);
-                                               sel = 
(uvedit_uv_selected(scene, efa, tf, 0) ? 1 : 0);
-                                               if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-                                               glVertex2fv(tf->uv[0]);
-                                               
-                                               sel = uvedit_uv_selected(scene, 
efa, tf, 1) ? 1 : 0;
-                                               if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-                                               glVertex2fv(tf->uv[1]);
-                                               
-                                               sel = uvedit_uv_selected(scene, 
efa, tf, 2) ? 1 : 0;
-                                               if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-                                               glVertex2fv(tf->uv[2]);
-                                               
-                                               if(efa->v4) {
-                                                       sel = 
uvedit_uv_selected(scene, efa, tf, 3) ? 1 : 0;
+                                       for(efa= em->faces.first; efa; efa= 
efa->next) {
+                                               tf= (MTFace *)efa->tmp.p; /* 
visible faces cached */
+
+                                               if(tf) {
+                                                       glBegin(GL_LINE_LOOP);
+                                                       sel = 
(uvedit_uv_selected(scene, efa, tf, 0)? 1 : 0);
                                                        if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-                                                       glVertex2fv(tf->uv[3]);
+                                                       glVertex2fv(tf->uv[0]);
+                                                       
+                                                       sel = 
uvedit_uv_selected(scene, efa, tf, 1)? 1 : 0;
+                                                       if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+                                                       glVertex2fv(tf->uv[1]);
+                                                       
+                                                       sel = 
uvedit_uv_selected(scene, efa, tf, 2)? 1 : 0;
+                                                       if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+                                                       glVertex2fv(tf->uv[2]);
+                                                       
+                                                       if(efa->v4) {
+                                                               sel = 
uvedit_uv_selected(scene, efa, tf, 3)? 1 : 0;
+                                                               if(sel != 
lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; 
}
+                                                               
glVertex2fv(tf->uv[3]);
+                                                       }
+                                                       
+                                                       glEnd();
                                                }
-                                               
-                                               glEnd();
                                        }
+
+                                       glShadeModel(GL_FLAT);
                                }
-                               glShadeModel(GL_FLAT);
+                               else {
+                                       for(efa= em->faces.first; efa; efa= 
efa->next) {
+                                               tf= (MTFace *)efa->tmp.p; /* 
visible faces cached */
+
+                                               if(tf) {
+                                                       glBegin(GL_LINES);
+                                                       sel = 
(uvedit_edge_selected(scene, efa, tf, 0)? 1 : 0);
+                                                       if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+                                                       glVertex2fv(tf->uv[0]);
+                                                       glVertex2fv(tf->uv[1]);
+                                                       
+                                                       sel = 
uvedit_edge_selected(scene, efa, tf, 1)? 1 : 0;
+                                                       if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+                                                       glVertex2fv(tf->uv[1]);
+                                                       glVertex2fv(tf->uv[2]);
+                                                       
+                                                       sel = 
uvedit_edge_selected(scene, efa, tf, 2)? 1 : 0;
+                                                       if(sel != lastsel) { 
glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+                                                       glVertex2fv(tf->uv[2]);
+                                                       
+                                                       if(efa->v4) {
+                                                               
glVertex2fv(tf->uv[3]);
+
+                                                               sel = 
uvedit_edge_selected(scene, efa, tf, 3)? 1 : 0;
+                                                               if(sel != 
lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; 
}
+                                                               
glVertex2fv(tf->uv[3]);
+                                                       }
+
+                                                       glVertex2fv(tf->uv[0]);
+                                                       
+                                                       glEnd();
+                                               }
+                                       }
+                               }
                        }
                        else {
                                /* no nice edges */

Modified: 
branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_intern.h   
2009-01-17 18:35:33 UTC (rev 18555)
+++ branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_intern.h   
2009-01-17 22:14:08 UTC (rev 18556)
@@ -56,6 +56,10 @@
 void uvedit_face_select(struct Scene *scene, struct EditFace *efa, struct 
MTFace *tf);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to