Revision: 20612
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20612
Author:   ben2610
Date:     2009-06-04 00:33:41 +0200 (Thu, 04 Jun 2009)

Log Message:
-----------
GLSL material export: unvoid unnecessary undo buffer, export library as 
lib_shader.glsl. The function used in the fragment shader can be found in this 
library.

Modified Paths:
--------------
    branches/bb_dev/source/blender/gpu/intern/gpu_material.c

Modified: branches/bb_dev/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/bb_dev/source/blender/gpu/intern/gpu_material.c    2009-06-03 
22:28:59 UTC (rev 20611)
+++ branches/bb_dev/source/blender/gpu/intern/gpu_material.c    2009-06-03 
22:33:41 UTC (rev 20612)
@@ -72,6 +72,8 @@
 #endif
 #endif
 
+extern char datatoc_gpu_shader_material_glsl[];
+
 /* Structs */
 
 typedef enum DynMatProperty {
@@ -226,6 +228,7 @@
 
                if (material->ma->shade_flag & MA_EXPORT) {
                        Text *text;
+                       int undostate;
                        char name[24];
 
                        if (fragshader) {
@@ -234,9 +237,25 @@
                                if (!text)
                                        text = add_empty_text(name);
                                if (text) {
+                                       undostate = txt_get_undostate(  );
+                                       txt_set_undostate( 1 );
                                        txt_sel_all(text);
                                        txt_insert_buf(text, fragshader);
+                                       txt_move_bof(text, 0);
+                                       txt_set_undostate( undostate );
                                }
+                               snprintf(name, 24, "shader_lib.glsl");
+                               text = find_script(name);
+                               if (!text)
+                                       text = add_empty_text(name);
+                               if (text) {
+                                       undostate = txt_get_undostate(  );
+                                       txt_set_undostate( 1 );
+                                       txt_sel_all(text);
+                                       txt_insert_buf(text, 
datatoc_gpu_shader_material_glsl);
+                                       txt_move_bof(text, 0);
+                                       txt_set_undostate( undostate );
+                               }
                        }
                        if (vertexshader) {
                                snprintf(name, 24, "%s.vx", 
material->ma->id.name+2);
@@ -244,8 +263,12 @@
                                if (!text)
                                        text = add_empty_text(name);
                                if (text) {
+                                       undostate = txt_get_undostate(  );
+                                       txt_set_undostate( 1 );
                                        txt_sel_all(text);
                                        txt_insert_buf(text, vertexshader);
+                                       txt_move_bof(text, 0);
+                                       txt_set_undostate( undostate );
                                }
                        }
                        /* export only once */


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to