[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14986] branches/soc-2008-unclezeiv: svn merge -r 14944:14984 https://svn.blender.org/svnroot/bf-blender/trunk/ blender
Davide Vercelli
davide.vercelli at gmail.com
Mon May 26 22:36:51 CEST 2008
Revision: 14986
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14986
Author: unclezeiv
Date: 2008-05-26 22:36:51 +0200 (Mon, 26 May 2008)
Log Message:
-----------
svn merge -r 14944:14984 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Modified Paths:
--------------
branches/soc-2008-unclezeiv/intern/ghost/intern/GHOST_WindowWin32.cpp
branches/soc-2008-unclezeiv/release/scripts/3ds_import.py
branches/soc-2008-unclezeiv/release/scripts/export_fbx.py
branches/soc-2008-unclezeiv/release/scripts/flt_import.py
branches/soc-2008-unclezeiv/source/blender/blenkernel/BKE_curve.h
branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/curve.c
branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/displist.c
branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/font.c
branches/soc-2008-unclezeiv/source/blender/blenlib/intern/freetypefont.c
branches/soc-2008-unclezeiv/source/blender/blenlib/intern/psfont.c
branches/soc-2008-unclezeiv/source/blender/include/BDR_editcurve.h
branches/soc-2008-unclezeiv/source/blender/nodes/intern/Makefile
branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Draw.c
branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Particle.c
branches/soc-2008-unclezeiv/source/blender/src/buttons_editing.c
branches/soc-2008-unclezeiv/source/blender/src/buttons_shading.c
branches/soc-2008-unclezeiv/source/blender/src/editarmature.c
branches/soc-2008-unclezeiv/source/blender/src/editcurve.c
branches/soc-2008-unclezeiv/source/blender/src/sequence.c
branches/soc-2008-unclezeiv/source/blender/src/transform_conversions.c
branches/soc-2008-unclezeiv/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
branches/soc-2008-unclezeiv/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
branches/soc-2008-unclezeiv/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/soc-2008-unclezeiv/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
branches/soc-2008-unclezeiv/source/gameengine/GamePlayer/common/GPC_RenderTools.h
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_Camera.cpp
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_Camera.h
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_GameObject.cpp
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_GameObject.h
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
branches/soc-2008-unclezeiv/source/gameengine/PyDoc/KX_GameObject.py
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_CameraData.h
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_IRasterizer.h
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_IRenderTools.h
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
branches/soc-2008-unclezeiv/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
Modified: branches/soc-2008-unclezeiv/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- branches/soc-2008-unclezeiv/intern/ghost/intern/GHOST_WindowWin32.cpp 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/intern/ghost/intern/GHOST_WindowWin32.cpp 2008-05-26 20:36:51 UTC (rev 14986)
@@ -871,12 +871,25 @@
for(i=1; i<=n; i++) { /* not the idiom, but it's right */
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
w = WeightPixelFormat(pfd);
- if(w > weight) {
- weight = w;
- iPixelFormat = i;
+ // be strict on stereo
+ if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
+ if(w > weight) {
+ weight = w;
+ iPixelFormat = i;
+ }
}
}
-
+ if (weight == 0) {
+ // we could find the correct stereo setting, just find any suitable format
+ for(i=1; i<=n; i++) { /* not the idiom, but it's right */
+ ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
+ w = WeightPixelFormat(pfd);
+ if(w > weight) {
+ weight = w;
+ iPixelFormat = i;
+ }
+ }
+ }
return iPixelFormat;
}
Modified: branches/soc-2008-unclezeiv/release/scripts/3ds_import.py
===================================================================
--- branches/soc-2008-unclezeiv/release/scripts/3ds_import.py 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/release/scripts/3ds_import.py 2008-05-26 20:36:51 UTC (rev 14986)
@@ -419,7 +419,7 @@
ob.setMatrix(contextMatrix_rot)
importedObjects.append(ob)
-
+ bmesh.calcNormals()
for matName, faces in myContextMeshMaterials.iteritems():
makeMeshMaterialCopy(matName, faces)
@@ -664,9 +664,8 @@
#print contextLamp.name,
elif (new_chunk.ID==OBJECT_MESH):
- ## @@ PATCH
- print 'Found an OBJECT_MESH chunk'
-
+ # print 'Found an OBJECT_MESH chunk'
+ pass
elif (new_chunk.ID==OBJECT_VERTICES):
'''
Worldspace vertex locations
Modified: branches/soc-2008-unclezeiv/release/scripts/export_fbx.py
===================================================================
--- branches/soc-2008-unclezeiv/release/scripts/export_fbx.py 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/release/scripts/export_fbx.py 2008-05-26 20:36:51 UTC (rev 14986)
@@ -1101,12 +1101,12 @@
file.write('\n\t\t\tProperty: "ShadingModel", "KString", "", "%s"' % mat_shader)
file.write('\n\t\t\tProperty: "MultiLayer", "bool", "",0')
file.write('\n\t\t\tProperty: "EmissiveColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_cold) # emit and diffuse color are he same in blender
- file.write('\n\t\t\tProperty: "EmissiveFactor", "double", "",%.4f' % mat_dif)
+ file.write('\n\t\t\tProperty: "EmissiveFactor", "double", "",%.4f' % mat_emit)
file.write('\n\t\t\tProperty: "AmbientColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_colamb)
file.write('\n\t\t\tProperty: "AmbientFactor", "double", "",%.4f' % mat_amb)
file.write('\n\t\t\tProperty: "DiffuseColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_cold)
- file.write('\n\t\t\tProperty: "DiffuseFactor", "double", "",%.4f' % mat_emit)
+ file.write('\n\t\t\tProperty: "DiffuseFactor", "double", "",%.4f' % mat_dif)
file.write('\n\t\t\tProperty: "Bump", "Vector3D", "",0,0,0')
file.write('\n\t\t\tProperty: "TransparentColor", "ColorRGB", "",1,1,1')
file.write('\n\t\t\tProperty: "TransparencyFactor", "double", "",%.4f' % (1.0 - mat_alpha))
Modified: branches/soc-2008-unclezeiv/release/scripts/flt_import.py
===================================================================
--- branches/soc-2008-unclezeiv/release/scripts/flt_import.py 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/release/scripts/flt_import.py 2008-05-26 20:36:51 UTC (rev 14986)
@@ -16,7 +16,7 @@
registered trademark of MultiGen-Paradigm, Inc.
Feature overview and more availible at:
-http://wiki.blender.org/index.php/Scripts/Manual/Import/openflight_flt
+http://wiki.blender.org/index.php/Scripts/Manual/Import/openflight_fltss
Note: This file is a grab-bag of old and new code. It needs some cleanup still.
"""
@@ -44,6 +44,7 @@
import BPyImage
import flt_filewalker
import flt_properties
+import sys
reload(flt_properties)
from flt_properties import *
@@ -1036,8 +1037,9 @@
else: # fgon
mesh_face_indicies = [i+vert_index for i in xrange(face_len)]
tri_ngons= ngon(self.mesh, mesh_face_indicies)
- new_faces.extend([ [mesh_face_indicies[t] for t in tri] for tri in tri_ngons])
- new_faces_props.extend( [ (None, image, (uvs[tri[0]], uvs[tri[1]], uvs[tri[2]]), [flt_face.uverts[tri[0]], flt_face.uverts[tri[1]], flt_face.uverts[tri[2]]], flt_face.uvlayers, flt_face.color_index, flt_face.props,FLT_OrigIndex,1, flt_face.subfacelevel) for tri in tri_ngons ])
+ if len(tri_ngons) != 1:
+ new_faces.extend([ [mesh_face_indicies[t] for t in tri] for tri in tri_ngons])
+ new_faces_props.extend( [ (None, image, (uvs[tri[0]], uvs[tri[1]], uvs[tri[2]]), [flt_face.uverts[tri[0]], flt_face.uverts[tri[1]], flt_face.uverts[tri[2]]], flt_face.uvlayers, flt_face.color_index, flt_face.props,FLT_OrigIndex,1, flt_face.subfacelevel) for tri in tri_ngons ])
vert_index+= face_len
FLT_OrigIndex+=1
@@ -2296,7 +2298,6 @@
for v in rmesh.verts:
v.co = v.co * smat
-
def reparent(root,childhash,sce):
for child in childhash[root]:
reparent(child,childhash,sce)
@@ -2452,7 +2453,7 @@
select_file(global_prefs['fltfile'], GRR)
except:
import traceback
- FLTWarn = Draw.PupBlock("Export Error", ["See console for output!"])
+ FLTWarn = Draw.PupBlock("Ixport Error", ["See console for output!"])
traceback.print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)
#choose base path for export
Modified: branches/soc-2008-unclezeiv/source/blender/blenkernel/BKE_curve.h
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/blenkernel/BKE_curve.h 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/source/blender/blenkernel/BKE_curve.h 2008-05-26 20:36:51 UTC (rev 14986)
@@ -39,8 +39,8 @@
struct BezTriple;
struct BevList;
-#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (nu->orderu-1)*((nu)->flagu & 1) )
-#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (nu->orderv-1)*((nu)->flagv & 1) )
+#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (nu->orderu-1)*((nu)->flagu & CU_CYCLIC) )
+#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (nu->orderv-1)*((nu)->flagv & CU_CYCLIC) )
void unlink_curve( struct Curve *cu);
@@ -84,5 +84,12 @@
float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
+/* nurb checks if they can be drawn, also clamp order func */
+int check_valid_nurb_u( struct Nurb *nu);
+int check_valid_nurb_v( struct Nurb *nu);
+
+int clamp_nurb_order_u( struct Nurb *nu);
+int clamp_nurb_order_v( struct Nurb *nu);
+
#endif
Modified: branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/curve.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/curve.c 2008-05-26 19:52:55 UTC (rev 14985)
+++ branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/curve.c 2008-05-26 20:36:51 UTC (rev 14986)
@@ -348,9 +348,9 @@
if(nu->bp) MEM_freeN(nu->bp);
nu->bp= 0;
if(nu->knotsu) MEM_freeN(nu->knotsu);
- nu->knotsu= 0;
+ nu->knotsu= NULL;
if(nu->knotsv) MEM_freeN(nu->knotsv);
- nu->knotsv= 0;
+ nu->knotsv= NULL;
/* if(nu->trim.first) freeNurblist(&(nu->trim)); */
MEM_freeN(nu);
@@ -393,7 +393,7 @@
(BPoint*)MEM_mallocN((len)* sizeof(BPoint),"duplicateNurb3");
memcpy(newnu->bp, nu->bp, len*sizeof(BPoint));
- newnu->knotsu=newnu->knotsv= 0;
+ newnu->knotsu= newnu->knotsv= NULL;
if(nu->knotsu) {
len= KNOTSU(nu);
@@ -506,6 +506,7 @@
}
}
else if(type==2) {
+ /* Warning, the order MUST be 2 or 4, if this is not enforced, the displist will be corrupt */
if(order==4) {
k= 0.34;
for(a=0;a<t;a++) {
@@ -520,6 +521,9 @@
knots[a]= (float)floor(k);
}
}
+ else {
+ printf("bez nurb curve order is not 3 or 4, should never happen\n");
+ }
}
}
@@ -529,8 +533,9 @@
int a, b, order2, c;
if(knots==0) return;
- order2=order-1;
+ order2=order-1;
+
/* do first long rows (order -1), remove identical knots at endpoints */
if(order>2) {
b= pnts+order2;
@@ -549,26 +554,35 @@
}
-void makeknots(Nurb *nu, short uv, short type) /* 0: uniform, 1: endpoints, 2: bezier */
+/* type - 0: uniform, 1: endpoints, 2: bezier, note, cyclic nurbs are always uniform */
+void makeknots(Nurb *nu, short uv, short type)
{
if( (nu->type & 7)==CU_NURBS ) {
- if(uv & 1) {
+ if(uv == 1) {
if(nu->knotsu) MEM_freeN(nu->knotsu);
- if(nu->pntsu>1) {
+ if(check_valid_nurb_u(nu)) {
nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
- calcknots(nu->knotsu, nu->pntsu, nu->orderu, type);
- if(nu->flagu & 1) makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
+ if(nu->flagu & CU_CYCLIC) {
+ calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */
+ makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
+ } else {
+ calcknots(nu->knotsu, nu->pntsu, nu->orderu, type);
+ }
}
- else nu->knotsu= 0;
- }
- if(uv & 2) {
+ else nu->knotsu= NULL;
+
+ } else if(uv == 2) {
if(nu->knotsv) MEM_freeN(nu->knotsv);
- if(nu->pntsv>1) {
+ if(check_valid_nurb_v(nu)) {
nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
- calcknots(nu->knotsv, nu->pntsv, nu->orderv, type);
- if(nu->flagv & 1) makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
+ if(nu->flagv & CU_CYCLIC) {
+ calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */
+ makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
+ } else {
+ calcknots(nu->knotsv, nu->pntsv, nu->orderv, type);
+ }
}
- else nu->knotsv= 0;
+ else nu->knotsv= NULL;
}
}
}
@@ -645,7 +659,7 @@
int i, j, iofs, jofs, cycl, len, resolu, resolv;
int istart, iend, jsta, jen, *jstart, *jend, ratcomp;
- if(nu->knotsu==0 || nu->knotsv==0) return;
+ if(nu->knotsu==NULL || nu->knotsv==NULL) return;
if(nu->orderu>nu->pntsu) return;
if(nu->orderv>nu->pntsv) return;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list