merging trunk 17457:17485
authorMartin Poirier <theeth@yahoo.com>
Mon, 17 Nov 2008 22:19:05 +0000 (22:19 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 17 Nov 2008 22:19:05 +0000 (22:19 +0000)
14 files changed:
config/darwin-config.py
config/linux2-config.py
config/linuxcross-config.py
config/openbsd3-config.py
config/sunos5-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
release/scripts/import_dxf.py
source/blender/blenlib/intern/arithb.c
source/blender/makesdna/intern/SConscript
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
source/gameengine/Rasterizer/RAS_2DFilterManager.h
tools/Blender.py
tools/btools.py

index 7c118b7886134413e9f771e5eb1b3c02ab943238..ee0cd6e2a875e0364a13d9fa7584961aed173df7 100644 (file)
@@ -261,6 +261,7 @@ CC_WARN = ['-Wall', '-Wno-long-double']
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
+BF_PROFILE_LINKFLAGS = ['-pg']
 BF_PROFILE = False
 
 BF_DEBUG = False
index 19b62dd2395ca63c018e077256e6366f9b53a7a4..70bb827a67c3595fd621b875bb54a62b6345e7a2 100644 (file)
@@ -199,6 +199,7 @@ LLIBS = 'util c m dl pthread stdc++'
 
 BF_PROFILE = False
 BF_PROFILE_CCFLAGS = ['-pg','-g']
+BF_PROFILE_LINKFLAGS = ['-pg']
 
 BF_DEBUG = False
 BF_DEBUG_CCFLAGS = ['-g']
index f3ac6d905f7b2c0b3a85baccb789e6fe7f39d59b..5981c8b96e518e5d3fcfcdbd4947a5d4a2388732 100644 (file)
@@ -149,6 +149,10 @@ LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lw
 BF_DEBUG = False
 BF_DEBUG_CCFLAGS= []
 
+BF_PROFILE = False
+BF_PROFILE_CCFLAGS = ['-pg','-g']
+BF_PROFILE_LINKFLAGS = ['-pg']
+
 BF_BUILDDIR = '../build/linuxcross'
 BF_INSTALLDIR='../install/linuxcross'
 BF_DOCDIR='../install/doc'
index cd46d11867edd7ab7d57f239eb29ede4ec84b9ec..49a0c824cd7b84d712f84b33e26bec4db848f8c3 100644 (file)
@@ -155,8 +155,9 @@ LLIBS = 'm stdc++ pthread util'
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_CCFLAGS = ['-pg', '-g']
 BF_PROFILE = False
+BF_PROFILE_CCFLAGS = ['-pg','-g']
+BF_PROFILE_LINKFLAGS = ['-pg']
 
 BF_DEBUG = False
 BF_DEBUG_CCFLAGS = ['-g']
index 4e7e99bc88495bdf48079147faf36c8726ce94fc..3b76753399d0db7686cd078f9a8f040f69cefa59 100644 (file)
@@ -169,7 +169,8 @@ LLIBS = 'c m dl pthread stdc++'
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_CCFLAGS = ['-pg','-g']
+BF_PROFILE_CCFLAGS = ['-pg', '-g ']
+BF_PROFILE_LINKFLAGS = ['-pg']
 BF_PROFILE = False
 
 BF_DEBUG = False
index 22666851f289f552490f78c9f5d504f60425506c..6278672ca3df936baecf56863a846edf541a45ff 100644 (file)
@@ -164,7 +164,8 @@ LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32
 BF_DEBUG = False
 BF_DEBUG_CCFLAGS= ['-g']
 
-BF_PROFILE_CCFLAGS = ['-pg','-g']
+BF_PROFILE_CCFLAGS = ['-pg', '-g ']
+BF_PROFILE_LINKFLAGS = ['-pg']
 BF_PROFILE = False
 
 BF_BUILDDIR = '..\\build\\win32-mingw'
index fe51abe0a89300bbf1c0ee342c41bb6ebc6c1f38..f25d8e223085be18642e366626463150e993d638 100644 (file)
@@ -197,6 +197,11 @@ PLATFORM_LINKFLAGS = '''
                        /LARGEADDRESSAWARE
                    '''
 
+# # Todo
+# BF_PROFILE_CCFLAGS = ['-pg', '-g ']
+# BF_PROFILE_LINKFLAGS = ['-pg']
+# BF_PROFILE = False
+
 BF_BUILDDIR = '..\\build\\win32-vc'
 BF_INSTALLDIR='..\\install\\win32-vc'
 BF_DOCDIR='..\\install\\doc'
index bb0119a9a813596dfddda1ed91bb6676b34a79b6..6a1981bb262590e503cfb6cded8c50c5ac01eff4 100644 (file)
@@ -7,7 +7,7 @@ Group: 'Import'
 Tooltip: 'Import for DXF geometry data (Drawing eXchange Format).'
 """
 __author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
-__version__ = '1.12 - 2008.08.03 by migius'
+__version__ = '1.12 - 2008.11.16 by migius'
 __url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
         "http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
 __email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"]
@@ -111,6 +111,9 @@ History:
  -- support ortho mode for VIEWs and VPORTs as cameras 
 
 
+ v1.12 - 2008.11.16 by migius
+ d1 remove try_finally: cause not supported in python <2.5
+ d1 add Bezier curves bevel radius support (default 1.0)
  v1.12 - 2008.08.03 by migius
  c2 warningfix: relocating of globals: layersmap, oblist 
  c2 modif UI: buttons newScene+targetLayer moved to start panel
@@ -299,7 +302,7 @@ History:
 import Blender
 from Blender import *
 #from Blender.Mathutils import Vector, Matrix
-import bpy
+#import bpy #not used yet
 #import BPyMessages
 
 from dxfReader import readDXF
@@ -311,7 +314,7 @@ from math import *
 
 try:
        import os
-       if os.name:# != 'mac':
+       if os.name != 'mac':
                import psyco
                psyco.log(Blender.Get('tempdir')+"/blender.log-psyco")
                #psyco.log()
@@ -320,7 +323,7 @@ try:
                psyco.profile(0.2)
                #print 'psyco imported'
 except ImportError:
-       #print 'psyco not imported'
+       print 'psyco not imported'
        pass
 
 #try: Curve.orderU
@@ -346,7 +349,7 @@ THIN_RESOLUTION = 8   #(4-64) thin_cylinder arc_resolution - number of segments
 MIN_THICK = MIN_DIST * 10.0  #minimal thickness by forced thickness
 MIN_WIDTH = MIN_DIST * 10.0  #minimal width by forced width
 TRIM_LIMIT = 3.0        #limit for triming of polylines-wide-segments (values:0.0 - 5.0)
-ELEVATION = 0.0 #standard elevation = coordinate Z
+ELEVATION = 0.0 #standard elevation = coordinate Z value
 
 BYBLOCK = 0
 BYLAYER = 256
@@ -817,6 +820,7 @@ class Line:  #-----------------------------------------------------------------
                        curve.append(BezTriple.New(points[1]))
                        for point in curve:
                                point.handleTypes = [VECT, VECT]
+                               point.radius = 1.0
                        curve.flagU = 0 # 0 sets the curve not cyclic=open
                        c.setResolu(settings.var['curve_res'])
                        c.update() #important for handles calculation
@@ -1341,9 +1345,11 @@ class Polyline:  #--------------------------------------------------------------
                                nurbs_points.append(pkt)
                        firstpoint = nurbs_points[0]
                        curve = pline.appendNurb(firstpoint)
-                       curve.setType(4) # set curvetype NURBS
+                       curve.setType(4) # set curve_type NURBS
+                       print 'deb: dir(curve):', dir(curve[-1]) #----------------
                        for point in nurbs_points[1:]:
                                curve.append(point)
+                               #TODO: what is the trick for bevel radius? curve[-1].radius = 1.0
                        if self.closed:
                                curve.flagU = 1+0 # Set curve cyclic=close and uni
                        else:
@@ -1359,6 +1365,7 @@ class Polyline:  #--------------------------------------------------------------
                                curve.append(BezTriple.New(p))
                        for point in curve:
                                point.handleTypes = [AUTO, AUTO]
+                               point.radius = 1.0
                        if self.closed:
                                curve.flagU = 1 # Set curve cyclic=close
                        else:
@@ -1380,6 +1387,7 @@ class Polyline:  #--------------------------------------------------------------
                                curve.append(BezTriple.New(p))
                        for point in curve:
                                point.handleTypes = [AUTO, AUTO]
+                               point.radius = 1.0
                        #curve.setType(1) #Bezier curve
                        if self.closed:
                                curve.flagU = 5 #1 # Set curve cyclic=close
@@ -1392,6 +1400,7 @@ class Polyline:  #--------------------------------------------------------------
                                        p0h1 = [p0h1[i]+begtangent[i] for i in range(3)]
                                        curve.__setitem__(0,BezTriple.New(p0h1+p0+p0h2))
                                curve[0].handleTypes = [FREE, ALIGN]   #remi--todo-----
+                               curve[0].radius = 1.0
                                if endtangent:
                                        #print 'deb:polyline2dCurve.draw curve[-1].vec:', curve[-1].vec #-----
                                        #print 'deb:polyline2dCurve.draw endtangent:', endtangent #-----
@@ -1401,6 +1410,7 @@ class Polyline:  #--------------------------------------------------------------
                                        curve.__setitem__(-1,BezTriple.New(p0h1+p0+p0h2))
                                        #print 'deb:polyline2dCurve.draw curve[-1].vec:', curve[-1].vec #-----
                                curve[-1].handleTypes = [ALIGN, FREE]   #remi--todo-----
+                               curve[-1].radius = 1.0
 
 
 
@@ -1420,13 +1430,16 @@ class Polyline:  #--------------------------------------------------------------
                                                if i == 0: curve = pline.appendNurb(BezTriple.New(verts[0]))
                                                else: curve.append(BezTriple.New(verts[0]))
                                                curve[-1].handleTypes = [VECT, VECT]  #--todo--calculation of bezier-tangents
+                                               curve[-1].radius = 1.0
                                                for p in verts[1:]:
                                                        curve.append(BezTriple.New(p))
                                                        curve[-1].handleTypes = [AUTO, AUTO]
+                                                       curve[-1].radius = 1.0
                                        else:
                                                if i == 0: curve = pline.appendNurb(BezTriple.New(point1.loc))
                                                else: curve.append(BezTriple.New(point1.loc))
                                                curve[-1].handleTypes = [VECT, VECT]   #--todo--calculation of bezier-tangents
+                                               curve[-1].radius = 1.0
 
                                elif True:   #----- optimised Bezier-Handles calculation --------------------------------
                                        #print 'deb:drawPlineCurve: i:', i #---------
@@ -1446,10 +1459,12 @@ class Polyline:  #--------------------------------------------------------------
                                                if i == 0: curve = pline.appendNurb(BezTriple.New(VectorTriples[0]))
                                                else: curve.append(BezTriple.New(VectorTriples[0]))
                                                curve[-1].handleTypes = [prevHandleType, FREE]
+                                               curve[-1].radius = 1.0
 
                                                for p in VectorTriples[1:-1]:
                                                        curve.append(BezTriple.New(p))
                                                        curve[-1].handleTypes = [FREE, FREE]
+                                                       curve[-1].radius = 1.0
 
                                                prevHandleVect = VectorTriples[-1][:3]
                                                prevHandleType = FREE
@@ -1462,11 +1477,13 @@ class Polyline:  #--------------------------------------------------------------
                                                        curve.append(BezTriple.New(VectorTriples))
                                                        curve[-1].handleTypes = [FREE, VECT]
                                                        prevHandleType = VECT
+                                                       curve[-1].radius = 1.0
                                                else:
                                                        if i == 0: curve = pline.appendNurb(BezTriple.New(point1.loc))
                                                        else: curve.append(BezTriple.New(point1.loc))
                                                        curve[-1].handleTypes = [VECT, VECT]
-                                                       
+                                                       curve[-1].radius = 1.0
+
 
 
                                        #print 'deb:drawPlineCurve: curve[-1].vec[0]', curve[-1].vec[0] #----------
@@ -1486,10 +1503,12 @@ class Polyline:  #--------------------------------------------------------------
                                        curve.__setitem__(0,BezTriple.New(p0h1+p0+p0h2))
 
                                        curve[0].handleTypes = [FREE,prevHandleType2]
+                                       curve[0].radius = 1.0
                                        #print 'deb:drawPlineCurve:closed curve[0].vec:', curve[0].vec #----------
                                        #print 'deb:drawPlineCurve:closed curve[0].handleTypes:', curve[0].handleTypes #----------
                                else: 
                                        curve[0].handleTypes[0] = VECT
+                                       curve[0].radius = 1.0
                        else: 
                                curve.flagU = 0 # Set curve not cyclic=open
 
@@ -2177,9 +2196,10 @@ DXF: X value; APP: 3D point, Y and Z values of control points (in WCS) (one entr
                self.ctrlpk_len = getit(obj, 73, 0) # Number of control points
                self.fit_pk_len = getit(obj, 74, 0) # Number of fit points (if any)
 
+               #TODO: import SPLINE as Bezier curve directly, possible?
                #print 'deb:Spline self.fit_pk_len=', self.fit_pk_len #------------------------
                #self.fit_pk_len = 0 # temp for debug
-               if self.fit_pk_len and 'spline_as'==5:
+               if self.fit_pk_len and settings.var['splines_as']==5:
                        self.spline = False
                        self.curved = True
                else:
@@ -2675,6 +2695,7 @@ class Circle:  #----------------------------------------------------------------
                                        curve.append(BezTriple.New(p))
                                for point in curve:
                                        point.handleTypes = [FREE, FREE]
+                                       point.radius = 1.0
                        else:   # standard version
                                c = Curve.New(obname)   # create new curve data
                                p1 = (0, -radius, 0)
@@ -2693,6 +2714,7 @@ class Circle:  #----------------------------------------------------------------
                                curve.append(p4)
                                for point in curve:
                                        point.handleTypes = [AUTO, AUTO]
+                                       point.radius = 1.0
 
                        curve.flagU = 1  # 1 sets the curve cyclic=closed
                        if settings.var['fill_on']:
@@ -2893,6 +2915,7 @@ class Arc:  #-----------------------------------------------------------------
                                curve.append(BezTriple.New(p))
                        for point in curve:
                                point.handleTypes = [FREE, FREE]
+                               point.radius = 1.0
                        curve.flagU = 0 # 0 sets the curve not cyclic=open
                        arc.setResolu(settings.var['curve_res'])
 
@@ -3449,6 +3472,7 @@ class Ellipse:  #---------------------------------------------------------------
                                        curve.append(BezTriple.New(p))
                                for point in curve:
                                        point.handleTypes = [FREE, FREE]
+                                       point.radius = 1.0
                                curve.flagU = 1 # 0 sets the curve not cyclic=open
                                if settings.var['fill_on']:
                                        arc.setFlag(6) # 2+4 set top and button caps
@@ -3459,6 +3483,7 @@ class Ellipse:  #---------------------------------------------------------------
                                        curve.append(BezTriple.New(p))
                                for point in curve:
                                        point.handleTypes = [FREE, FREE]
+                                       point.radius = 1.0
                                curve.flagU = 0 # 0 sets the curve not cyclic=open
 
                        arc.setResolu(settings.var['curve_res'])
@@ -4397,8 +4422,7 @@ def       analyzeDXF(dxfFile): #---------------------------------------
                Draw.PupMenu('DXF importer: report saved in INF-file:%t|' + '\'%s\'' %infFile)
        except:
                Draw.PupMenu('DXF importer: ERROR by writing report in INF-file:%t|' + '\'%s\'' %infFile)
-       finally:
-               f.close()
+       #finally: f.close()
 
 
 
@@ -4417,7 +4441,8 @@ def main(dxfFile):  #---------------#############################-----------
        global cur_COUNTER  #counter for progress_bar
        cur_COUNTER = 0
 
-       try:
+       #try:
+       if 1:
                #print "Getting settings..."
                global GUI_A, GUI_B, g_scale_as
                if not GUI_A['g_scale_on'].val:
@@ -4500,7 +4525,7 @@ def main(dxfFile):  #---------------#############################-----------
                #settings.write(message)
                if UI_MODE: Draw.PupMenu('DXF importer: Done!|finished in %.4f sec.' % time_text)
 
-       finally:
+       #finally:
                # restore state even if things didn't work
                #print 'deb:drawEntities finally!' #-----------------------
                Window.WaitCursor(False)
@@ -5190,6 +5215,7 @@ def drawCurveCircle(circle):  #--- no more used --------------------------------
        curve.append(p4)
        for point in curve:
                point.handleTypes = [AUTO, AUTO]
+               point.radius = 1.0
        curve.flagU = 1 # Set curve cyclic
        c.update()
 
@@ -5231,6 +5257,7 @@ def drawCurveArc(self):  #---- only for ELLIPSE --------------------------------
        curve.append(p4)
        for point in curve:
                point.handleTypes = [AUTO, AUTO]
+               point.radius = 1.0
        curve.flagU = 1 # Set curve cyclic
        a.update()
 
@@ -5270,12 +5297,12 @@ GUI_B = {}  # GUI-buttons dictionary for drawingTypes
 # settings default, initialize ------------------------
 
 points_as_menu  = "convert to: %t|empty %x1|mesh.vertex %x2|thin sphere %x3|thin box %x4|*curve.vertex %x5"
-lines_as_menu   = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
+lines_as_menu   = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|thin box %x4|Bezier-curve %x5|*NURBS-curve %x6"
 mlines_as_menu  = "convert to: %t|*edge %x1|*mesh %x2|*thin cylinder %x3|*thin box %x|*curve %x5"
 plines_as_menu  = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
-splines_as_menu = "convert to: %t|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
+splines_as_menu = "convert to: %t|mesh %x2|*thin cylinder %x3|*thin box %x4|*Bezier-curve %x5|NURBS-curve %x6"
 plines3_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
-plmesh_as_menu  = "convert to: %t|*edge %x1|mesh %x2|NURBS-surface %x6"
+plmesh_as_menu  = "convert to: %t|*edge %x1|mesh %x2|*NURBS-surface %x6"
 solids_as_menu  = "convert to: %t|*edge %x1|mesh %x2"
 blocks_as_menu  = "convert to: %t|dupliGroup %x1|*real.Group %x2|*exploded %x3"
 texts_as_menu   = "convert to: %t|text %x1|*mesh %x2|*curve %x5"
@@ -5456,11 +5483,9 @@ def saveConfig():  #--todo-----------------------------------------------
                else:
                        #if BPyMessages.Warning_SaveOver(iniFile): #<- remi find it too abstarct
                        if sys.exists(iniFile):
-                               try:
-                                       f = file(iniFile, 'r')
-                                       try: header_str = f.readline()
-                                       finally: f.close()
-                               except: pass
+                               f = file(iniFile, 'r')
+                               header_str = f.readline()
+                               f.close()
                                if header_str.startswith(INIFILE_HEADER[0:13]):
                                        if Draw.PupMenu('  OK ? %t|SAVE OVER: ' + '\'%s\'' %iniFile) == 1:
                                                save_ok = True
@@ -5480,10 +5505,9 @@ def saveConfig():  #--todo-----------------------------------------------
                                output_str = '{\n'.join(output_str.split('{'))
                                try:
                                        f = file(iniFile, 'w')
-                                       try:
-                                               f.write(INIFILE_HEADER + '\n# this is a comment line\n')
-                                               f.write(output_str)
-                                       finally: f.close()
+                                       f.write(INIFILE_HEADER + '\n# this is a comment line\n')
+                                       f.write(output_str)
+                                       f.close()
                                        #Draw.PupMenu('DXF importer: INI-file: Done!%t|config-data saved in ' + '\'%s\'' %iniFile)
                                except:
                                        Draw.PupMenu('DXF importer: INI-file: Error!%t|failure by writing to ' + '\'%s\'|no config-data saved!' %iniFile)
@@ -5508,25 +5532,22 @@ def loadConfig():  #remi--todo-----------------------------------------------
        update_RegistryKey('iniFileName', iniFile)
        #print 'deb:loadConfig iniFile: ', iniFile #----------------------
        if iniFile.lower().endswith(INIFILE_EXTENSION) and sys.exists(iniFile):
-               try:
-                       f = file(iniFile, 'r')
-                       try:
-                               header_str = f.readline()
-                               if header_str.startswith(INIFILE_HEADER):
-                                       data_str = f.read()
-                                       f.close()
-                                       #print 'deb:loadConfig data_str from %s: \n' %iniFile , data_str #-----------------
-                                       data = eval(data_str)
-                                       for k, v in data[0].iteritems():
-                                               try: GUI_A[k].val = v
-                                               except: GUI_A[k] = Draw.Create(v)
-                                       for k, v in data[1].iteritems():
-                                               try: GUI_B[k].val = v
-                                               except: GUI_B[k] = Draw.Create(v)
-                               else:
-                                       Draw.PupMenu('DXF importer: INI-file:  Alert!%t|no valid header in INI-file: ' + '\'%s\'' %iniFile)
-                       finally: f.close()
-               except: pass
+               f = file(iniFile, 'r')
+               header_str = f.readline()
+               if header_str.startswith(INIFILE_HEADER):
+                       data_str = f.read()
+                       f.close()
+                       #print 'deb:loadConfig data_str from %s: \n' %iniFile , data_str #-----------------
+                       data = eval(data_str)
+                       for k, v in data[0].iteritems():
+                               try: GUI_A[k].val = v
+                               except: GUI_A[k] = Draw.Create(v)
+                       for k, v in data[1].iteritems():
+                               try: GUI_B[k].val = v
+                               except: GUI_B[k] = Draw.Create(v)
+               else:
+                       f.close()
+                       Draw.PupMenu('DXF importer: INI-file:  Alert!%t|no valid header in INI-file: ' + '\'%s\'' %iniFile)
        else:
                Draw.PupMenu('DXF importer: INI-file:  Alert!%t|no valid INI-file selected!')
                print "DXF importer: Alert!: no valid INI-file selected."
index 0db87a819bd850ab08a62d0fc7539ff590c983c9..783acb9cc971d24e5ab822f48754a936516cf5c2 100644 (file)
@@ -1351,8 +1351,8 @@ void Mat4ToQuat( float m[][4], float *q)
 
 void QuatOne(float *q)
 {
-       q[0]= q[2]= q[3]= 0.0;
-       q[1]= 1.0;
+       q[0]= 1.0;
+       q[1]= q[2]= q[3]= 0.0;
 }
 
 void NormalQuat(float *q)
index 7d4f6d2d76b375358321ff684cde58f933593b79..c8c8bd1ba68e51ebce1316a42025dceb7d659835 100644 (file)
@@ -36,7 +36,7 @@ if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
        targetdir = '#'+targetdir
 makesdna_tool.Append (LIBPATH = targetdir)
 if env['BF_PROFILE']:
-       makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
+       makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_LINKFLAGS'])
 
 targetdir = root_build_dir + '/makesdna'
 
index d2cfa7d07f9612e3c6dba89663f0409216d4c492..282c730628591f29c43e1b355f45997db498890f 100644 (file)
@@ -58,7 +58,7 @@
 RAS_2DFilterManager::RAS_2DFilterManager():
 texturewidth(-1), textureheight(-1),
 canvaswidth(-1), canvasheight(-1),
-numberoffilters(0)
+numberoffilters(0), need_tex_update(true)
 {
        isshadersupported = GLEW_ARB_shader_objects &&
                GLEW_ARB_fragment_shader && GLEW_ARB_multitexture;
@@ -217,50 +217,50 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
        glActiveTextureARB(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, texname[0]);
 
-    if (uniformLoc != -1)
-    {
+       if (uniformLoc != -1)
+       {
                glUniform1iARB(uniformLoc, 0);
-    }
+       }
 
-    /* send depth texture to glsl program if it needs */
+       /* send depth texture to glsl program if it needs */
        if(texflag[passindex] & 0x1){
-       uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture");
-       glActiveTextureARB(GL_TEXTURE1);
-       glBindTexture(GL_TEXTURE_2D, texname[1]);
+               uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture");
+               glActiveTextureARB(GL_TEXTURE1);
+               glBindTexture(GL_TEXTURE_2D, texname[1]);
 
-       if (uniformLoc != -1)
-       {
-               glUniform1iARB(uniformLoc, 1);
-       }
-    }
+               if (uniformLoc != -1)
+               {
+                       glUniform1iARB(uniformLoc, 1);
+               }
+       }
 
-    /* send luminance texture to glsl program if it needs */
+       /* send luminance texture to glsl program if it needs */
        if(texflag[passindex] & 0x2){
-       uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture");
-       glActiveTextureARB(GL_TEXTURE2);
-       glBindTexture(GL_TEXTURE_2D, texname[2]);
-
-       if (uniformLoc != -1)
-       {
-               glUniform1iARB(uniformLoc, 2);
-       }
+               uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture");
+               glActiveTextureARB(GL_TEXTURE2);
+               glBindTexture(GL_TEXTURE_2D, texname[2]);
+
+               if (uniformLoc != -1)
+               {
+                       glUniform1iARB(uniformLoc, 2);
+               }
        }
        
        uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_TextureCoordinateOffset");
-    if (uniformLoc != -1)
-    {
-        glUniform2fvARB(uniformLoc, 9, textureoffsets);
-    }
+       if (uniformLoc != -1)
+       {
+               glUniform2fvARB(uniformLoc, 9, textureoffsets);
+       }
        uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_RenderedTextureWidth");
-    if (uniformLoc != -1)
-    {
+       if (uniformLoc != -1)
+       {
                glUniform1fARB(uniformLoc,texturewidth);
-    }
+       }
        uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_RenderedTextureHeight");
-    if (uniformLoc != -1)
-    {
+       if (uniformLoc != -1)
+       {
                glUniform1fARB(uniformLoc,textureheight);
-    }
+       }
 
        int i, objProperties = m_properties[passindex].size();
        for(i=0; i<objProperties; i++)
@@ -332,20 +332,20 @@ void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
        RAS_Rect canvas_rect = canvas->GetWindowArea();
        canvaswidth = canvas->GetWidth();
        canvasheight = canvas->GetHeight();
-       texturewidth = canvaswidth;
-       textureheight = canvasheight;
 
+       texturewidth = canvaswidth + canvas_rect.GetLeft();
+       textureheight = canvasheight + canvas_rect.GetBottom();
        GLint i,j;
        i = 0;
-    while ((1 << i) <= texturewidth)
-        i++;
-    texturewidth = (1 << (i));
+       while ((1 << i) <= texturewidth)
+               i++;
+       texturewidth = (1 << (i));
 
-    // Now for height
-    i = 0;
-    while ((1 << i) <= textureheight)
-        i++;
-    textureheight = (1 << (i));
+       // Now for height
+       i = 0;
+       while ((1 << i) <= textureheight)
+               i++;
+       textureheight = (1 << (i));
 
        GLfloat xInc = 1.0f / (GLfloat)texturewidth;
        GLfloat yInc = 1.0f / (GLfloat)textureheight;
@@ -360,6 +360,23 @@ void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
        }
 }
 
+void RAS_2DFilterManager::UpdateCanvasTextureCoord(unsigned int * viewport)
+{
+       /*
+       This function update canvascoord[].
+       These parameters are used to create texcoord[1]
+       That way we can access the texcoord relative to the canvas:
+       (0.0,0.0) bottom left, (1.0,1.0) top right, (0.5,0.5) center
+       */
+       canvascoord[0] = (GLfloat) viewport[0] / viewport[2];
+       canvascoord[0] *= -1;
+       canvascoord[1] = (GLfloat) (texturewidth - viewport[0]) / viewport[2];
+       canvascoord[2] = (GLfloat) viewport[1] / viewport[3];
+       canvascoord[2] *= -1;
+       canvascoord[3] = (GLfloat)(textureheight - viewport[1]) / viewport[3];
+}
+
 void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 {
        bool need_depth=false;
@@ -387,27 +404,35 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
        if(num_filters <= 0)
                return;
 
+       GLuint  viewport[4]={0};
+       glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
+
        if(canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight())
        {
                UpdateOffsetMatrix(canvas);
+               UpdateCanvasTextureCoord((unsigned int*)viewport);
+               need_tex_update = true;
+       }
+       
+       if(need_tex_update)
+       {
                SetupTextures(need_depth, need_luminance);
+               need_tex_update = false;
        }
-       GLuint  viewport[4]={0};
 
        if(need_depth){
                glActiveTextureARB(GL_TEXTURE1);
                glBindTexture(GL_TEXTURE_2D, texname[1]);
-               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, viewport[0], viewport[1], texturewidth,textureheight, 0);
+               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0, 0, texturewidth,textureheight, 0);
        }
        
        if(need_luminance){
                glActiveTextureARB(GL_TEXTURE2);
                glBindTexture(GL_TEXTURE_2D, texname[2]);
-               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, viewport[0], viewport[1] , texturewidth,textureheight, 0);
+               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0);
        }
 
-       glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
-       glViewport(viewport[0],viewport[1], texturewidth, textureheight);
+       glViewport(0,0, texturewidth, textureheight);
 
        glDisable(GL_DEPTH_TEST);
        glMatrixMode(GL_TEXTURE);
@@ -425,20 +450,15 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 
                        glActiveTextureARB(GL_TEXTURE0);
                        glBindTexture(GL_TEXTURE_2D, texname[0]);
-                       glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, viewport[0], viewport[1], texturewidth, textureheight, 0);
+                       glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, texturewidth, textureheight, 0);
                        glClear(GL_COLOR_BUFFER_BIT);
 
-                       float canvascoordx, canvascoordy;
-
-                       canvascoordx = (GLfloat) texturewidth / canvaswidth;
-                       canvascoordy = (GLfloat) textureheight / canvasheight;
-
                        glBegin(GL_QUADS);
                                glColor4f(1.f, 1.f, 1.f, 1.f);
-                               glTexCoord2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, canvascoordx, canvascoordy); glVertex2f(1,1);
-                               glTexCoord2f(0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, canvascoordy);          glVertex2f(-1,1);
-                               glTexCoord2f(0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0);                   glVertex2f(-1,-1);
-                               glTexCoord2f(1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, canvascoordx, 0.0);          glVertex2f(1,-1);
+                               glTexCoord2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1,1);
+                               glTexCoord2f(0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1,1);
+                               glTexCoord2f(0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1,-1);
+                               glTexCoord2f(1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1,-1);
                        glEnd();
                }
        }
@@ -454,7 +474,7 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game
                return;
        if(pass<0 || pass>=MAX_RENDER_PASS)
                return;
-
+       need_tex_update = true;
        if(mode == RAS_2DFILTER_DISABLED)
        {
                m_enabled[pass] = 0;
index 454643a5077099345ccb0cbc782052c397978e5c..6a420a974d444a904c43aed7a406556acde23c86 100644 (file)
@@ -44,7 +44,9 @@ private:
        void FreeTextures();
 
        void UpdateOffsetMatrix(RAS_ICanvas* canvas);
-
+       void UpdateCanvasTextureCoord(unsigned int * viewport);
+       float                   canvascoord[4];
        float                   textureoffsets[18];
        float                   view[4];
        /* texname[0] contains render to texture, texname[1] contains depth texture,  texname[2] contains luminance texture*/
@@ -60,6 +62,7 @@ private:
 
        bool                    isshadersupported;
        bool                    errorprinted;
+       bool                    need_tex_update;
 
        unsigned int    m_filters[MAX_RENDER_PASS];
        short           m_enabled[MAX_RENDER_PASS];
index 3b5e33eda593854a9996c02e1c1070b783b292c3..97b855c630bbfd000b3004e6b64c7d2db9a52d75 100644 (file)
@@ -476,7 +476,7 @@ class BlenderEnvironment(SConsEnvironment):
                                lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
                        lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS'])
                if lenv['BF_PROFILE']:
-                               lenv.Append(LINKFLAGS = lenv['BF_PROFILE_FLAGS'])
+                       lenv.Append(LINKFLAGS = lenv['BF_PROFILE_LINKFLAGS'])
                lenv.Append(CPPPATH=includes)
                if root_build_dir[0]==os.sep or root_build_dir[1]==':':
                        lenv.Append(LIBPATH=root_build_dir + '/lib')
index 66d5ecc6b9a1c7638fb0f30769f450a91da23108..b86bb592970ffe9e89ecace8c8975a67907dc8f9 100755 (executable)
@@ -54,7 +54,7 @@ def validate_arguments(args, bc):
                        'WITH_BF_BINRELOC',
                        'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
                        'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
-                       'BF_PROFILE_FLAGS', 'BF_PROFILE_FLAGS', 'BF_PROFILE_CXXFLAGS',
+                       'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS',
                        'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
                        'C_WARN', 'CC_WARN', 'CXX_WARN',
                        'LLIBS', 'PLATFORM_LINKFLAGS',
@@ -340,6 +340,7 @@ def read_opts(cfg, args):
                ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
                ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
                ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
+               ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', ''),
 
                (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
                ('BF_DEBUG_CFLAGS', 'C only debug flags', ''),