soc-2008-mxcurioni: merged changes to revision 15705
[blender.git] / source / blender / src / buttons_scene.c
index 1c98950080a50a867f71481a85ca9bc4c1cf6796..8b35f90ea9d4d96a68a3e27aaaa68be7ad10f431 100644 (file)
@@ -137,36 +137,42 @@ static void load_new_sample(char *str)    /* called from fileselect */
        bSample *sample, *newsample;
 
        sound = G.buts->lockpoin;
+       
+       /* No Sound or Selected the same sample as we alredy have, just ignore */
+       if (sound==NULL || str==sound->name)
+               return;
+               
+       if (sizeof(sound->sample->name) < strlen(str)) {
+               error("Path too long: %s", str);
+               return;
+       }
+               
+       // save values
+       sample = sound->sample;
+       strcpy(name, sound->sample->name);      
+       strcpy(sound->name, str);
+       sound_set_sample(sound, NULL);
+       sound_initialize_sample(sound);
 
-       if (sound) {
-               // save values
-               sample = sound->sample;
-               strcpy(name, sound->sample->name);
-
-               strcpy(sound->name, str);
-               sound_set_sample(sound, NULL);
-               sound_initialize_sample(sound);
-
-               if (sound->sample->type == SAMPLE_INVALID) {
-                       error("Not a valid sample: %s", str);
+       if (sound->sample->type == SAMPLE_INVALID) {
+               error("Not a valid sample: %s", str);
 
-                       newsample = sound->sample;
+               newsample = sound->sample;
 
-                       // restore values
-                       strcpy(sound->name, name);
-                       sound_set_sample(sound, sample);
+               // restore values
+               strcpy(sound->name, name);
+               sound_set_sample(sound, sample);
 
-                       // remove invalid sample
+               // remove invalid sample
 
-                       sound_free_sample(newsample);
-                       BLI_remlink(samples, newsample);
-                       MEM_freeN(newsample);
-               }
+               sound_free_sample(newsample);
+               BLI_remlink(samples, newsample);
+               MEM_freeN(newsample);
+               return;
        }
-
+       
        BIF_undo_push("Load new audio file");
        allqueue(REDRAWBUTSSCENE, 0);
-
 }
 
 
@@ -403,7 +409,7 @@ static void sound_panel_sound(bSound *sound)
                sample = sound->sample;
 
                /* info string */
-               if (sound->sample && sound->sample->len) {
+               if (sound->sample && sound->sample->len && sound->sample->channels && sound->sample->bits) {
                        char *tmp;
                        if (sound->sample->channels == 1) tmp= "Mono";
                        else if (sound->sample->channels == 2) tmp= "Stereo";
@@ -499,7 +505,7 @@ static char* seq_panel_blend_modes()
          so that would collide also.
        */
 
-       if (!(last_seq->type & SEQ_EFFECT)) {
+       if ( seq_can_blend(last_seq) ) {
                int i;
 
                for (i = SEQ_EFFECT; i <= SEQ_EFFECT_MAX; i++) {
@@ -1174,18 +1180,18 @@ static void seq_panel_proxy()
                             130,140,120,19, &last_seq->flag, 
                             0.0, 21.0, 100, 0, 
                             "Use a custom directory to store data");
-       }
 
-       if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
-               uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_DIR, 
-                            ICON_FILESEL, 10, 120, 20, 20, 0, 0, 0, 0, 0, 
-                            "Select the directory/name for "
-                            "the proxy storage");
+               if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+                       uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_DIR, 
+                                    ICON_FILESEL, 10, 120, 20, 20, 0, 0, 0, 0, 0, 
+                                    "Select the directory/name for "
+                                    "the proxy storage");
 
-               uiDefBut(block, TEX, 
-                        B_SEQ_BUT_RELOAD, "Dir: ", 
-                        30,120,220,20, last_seq->strip->proxy->dir, 
-                        0.0, 160.0, 100, 0, "");
+                       uiDefBut(block, TEX, 
+                                B_SEQ_BUT_RELOAD, "Dir: ", 
+                                30,120,220,20, last_seq->strip->proxy->dir, 
+                                0.0, 160.0, 100, 0, "");
+               }
        }
 
        if (last_seq->flag & SEQ_USE_PROXY) {
@@ -2108,7 +2114,8 @@ static void render_panel_output(void)
        /* Toon shading buttons */
        uiBlockBeginAlign(block);
        uiDefButBitI(block, TOG, R_EDGE, B_NOP,"Edge",   115, 89, 60, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon Edge-enhance");
-       uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 175, 89, 135, 20, "Display Edge settings");
+       uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 175, 89, 75, 20, "Display Edge settings");
+       uiDefButBitI(block, TOG, R_EDGE_FRS, B_NOP,"Freestyle",   250, 89, 60, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Freestyle");
        uiBlockEndAlign(block);
        
        uiBlockBeginAlign(block);
@@ -2209,10 +2216,10 @@ static void render_panel_render(void)
        uiDefBut(block, BUT,B_DORENDER,"RENDER",        369, 164, 191,37, 0, 0, 0, 0, 0, "Render the current frame (F12)");
 #ifndef DISABLE_YAFRAY
        /* yafray: on request, render engine menu is back again, and moved to Render panel */
-       uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|YafRay %x1", 
+       uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|YafRay %x1|Freestyle %x2", 
                                                                                                369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");        
 #else
-       uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0", 
+       uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|Freestyle %x1", 
                                                                                                369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");        
 #endif /* disable yafray */
 
@@ -3384,8 +3391,10 @@ static void render_panel_layers(void)
        uiDefButBitI(block, TOG, SCE_LAY_HALO, B_NOP,"Halo",    95,  85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Halos in this Layer (on top of Solid)");    
        uiDefButBitI(block, TOG, SCE_LAY_ZTRA, B_NOP,"Ztra",    135, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Z-Transparent faces in this Layer (On top of Solid and Halos)");    
        uiDefButBitI(block, TOG, SCE_LAY_SKY, B_NOP,"Sky",              175, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Sky or backbuffer in this Layer");  
-       uiDefButBitI(block, TOG, SCE_LAY_EDGE, B_NOP,"Edge",    215, 85, 45, 20, &srl->layflag, 0, 0, 0, 0, "Render Edge-enhance in this Layer (only works for Solid faces)");  
-       uiDefButBitI(block, TOG, SCE_LAY_STRAND, B_NOP,"Strand",260, 85, 50, 20, &srl->layflag, 0, 0, 0, 0, "Render Strands in this Layer");    
+       uiDefButBitI(block, TOG, SCE_LAY_EDGE, B_NOP,"Edge",    215, 85, 25, 20, &srl->layflag, 0, 0, 0, 0, "Render Edge-enhance in this Layer (only works for Solid faces)");
+       uiDefButBitI(block, TOG, SCE_LAY_FRS, B_NOP,"FrSt",     240, 85, 30, 20, &srl->layflag, 0, 0, 0, 0, "Render Freestyle in this Layer");  
+       uiDefButBitI(block, TOG, SCE_LAY_STRAND, B_NOP,"Strand",270, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Strands in this Layer");    
+       
        
        uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_SET_PASS, "Light:",  50, 65, 130, 20, &(srl->light_override), "Name of Group to use as Lamps instead");
        uiDefIDPoinBut(block, test_matpoin_but, ID_MA, B_SET_PASS, "Mat:",      180, 65, 130, 20, &(srl->mat_override), "Name of Material to use as Materials instead");