Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-26 00:59:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-26 00:59:09 +0400
commit1b142434055e2b56b23991f0c9d695b6d4f33390 (patch)
tree8689574221e0d98697af406292b0383c14fc0c3b
parentdff9dce1cdcb5250797f529456649510d2396096 (diff)
parent1c00eacca2b084d7189de33cb75e8612cb542030 (diff)
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r20937:21899
missing commits from peter 20942, 21165, 21170, 21174, 21597 these files still need manual merging source/blender/makesdna/DNA_sequence_types.h source/blender/src/sequence.c source/blender/src/seqeffects.c source/blender/src/editseq.c source/blender/include/BSE_sequence.h
-rw-r--r--blenderplayer/CMakeLists.txt1
-rw-r--r--config/win32-mingw-config.py1
-rw-r--r--release/datafiles/splash.jpgbin196913 -> 197158 bytes
-rw-r--r--release/scripts/bvh_import.py11
-rw-r--r--release/scripts/export_dxf.py771
-rw-r--r--release/scripts/export_fbx.py2
-rw-r--r--release/scripts/export_map.py15
-rw-r--r--release/scripts/export_obj.py10
-rw-r--r--release/scripts/import_dxf.py19
-rw-r--r--release/scripts/import_obj.py16
-rw-r--r--release/scripts/object_active_to_other.py6
-rw-r--r--release/scripts/vertexpaint_selfshadow_ao.py71
-rw-r--r--source/blender/avi/intern/avi.c7
-rw-r--r--source/blender/blenkernel/BKE_softbody.h4
-rw-r--r--source/blender/blenkernel/intern/mesh.c7
-rw-r--r--source/blender/blenkernel/intern/softbody.c63
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/imbuf/intern/iris.c312
-rw-r--r--source/blender/imbuf/intern/util.c3
-rw-r--r--source/blender/makesdna/DNA_object_force.h16
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c44
-rw-r--r--source/blender/render/intern/source/shadeoutput.c8
-rw-r--r--source/blender/render/intern/source/texture.c42
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp9
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp58
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h2
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.h1
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp16
-rw-r--r--source/gameengine/PyDoc/API_intro.py2
-rw-r--r--source/gameengine/PyDoc/GameTypes.py7
33 files changed, 1078 insertions, 455 deletions
diff --git a/blenderplayer/CMakeLists.txt b/blenderplayer/CMakeLists.txt
index 2d8fc6ff4b9..28fe13cbf64 100644
--- a/blenderplayer/CMakeLists.txt
+++ b/blenderplayer/CMakeLists.txt
@@ -69,7 +69,6 @@ IF(UNIX)
bf_blenkernel
verse
bf_blenkernel
- bf_decimation
bf_blenloader
bf_blenpluginapi
bf_blroutines
diff --git a/config/win32-mingw-config.py b/config/win32-mingw-config.py
index 375b8c36ce8..d9585d7cfda 100644
--- a/config/win32-mingw-config.py
+++ b/config/win32-mingw-config.py
@@ -4,6 +4,7 @@ LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.1'
#BF_PYTHON_VERSION = '2.6'
+#BF_PYTHON_VERSION = '2.6'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
diff --git a/release/datafiles/splash.jpg b/release/datafiles/splash.jpg
index deae8155ff4..1c34cf36f75 100644
--- a/release/datafiles/splash.jpg
+++ b/release/datafiles/splash.jpg
Binary files differ
diff --git a/release/scripts/bvh_import.py b/release/scripts/bvh_import.py
index 5cdd8a71231..4134503c511 100644
--- a/release/scripts/bvh_import.py
+++ b/release/scripts/bvh_import.py
@@ -277,12 +277,17 @@ def read_bvh(file_path, GLOBAL_SCALE=1.0):
for bvh_node in bvh_nodes.itervalues():
if not bvh_node.rest_tail_world:
- if len(bvh_node.children)==1:
+ if len(bvh_node.children)==0:
+ # could just fail here, but rare BVH files have childless nodes
+ bvh_node.rest_tail_world = Vector(bvh_node.rest_head_world)
+ bvh_node.rest_tail_local = Vector(bvh_node.rest_head_local)
+ elif len(bvh_node.children)==1:
bvh_node.rest_tail_world= Vector(bvh_node.children[0].rest_head_world)
bvh_node.rest_tail_local= Vector(bvh_node.children[0].rest_head_local)
else:
- if not bvh_node.children:
- raise 'error, bvh node has no end and no children. bad file'
+ # allow this, see above
+ #if not bvh_node.children:
+ # raise 'error, bvh node has no end and no children. bad file'
# Removed temp for now
rest_tail_world= Vector(0,0,0)
diff --git a/release/scripts/export_dxf.py b/release/scripts/export_dxf.py
index b32962241cc..17f2132fbe8 100644
--- a/release/scripts/export_dxf.py
+++ b/release/scripts/export_dxf.py
@@ -1,13 +1,13 @@
#!BPY
"""
- Name: 'Autodesk DXF (.dxf)'
+ Name: 'Autodesk DXF (.dxf/dwg)'
Blender: 249
Group: 'Export'
Tooltip: 'Export geometry to DXF/DWG-r12 (Drawing eXchange Format).'
"""
-__version__ = "1.34 - 2009.06.08"
+__version__ = "1.35 - 2009.06.18"
__author__ = "Remigiusz Fiedler (AKA migius)"
__license__ = "GPL"
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
@@ -31,19 +31,27 @@ IDEAs:
- HPGL output, usefull for correct scaled printing of 2d drawings
TODO:
-- export dupligroups and dupliverts as blocks (option for the user to decide)
+- export dupligroups and dupliverts as blocks (as option)
- optimize POLYFACE routine: remove double-vertices
-- more stable support for X,Y-rotated curves(to POLYLINEs): fix blender negative-matrix.invert()
+- fix support for X,Y-rotated curves(to POLYLINEs): fix blender negative-matrix.invert()
- support hierarchies: groups, instances, parented structures
- support n/f-gons as POLYFACEs with invisible edges
- mapping materials to DXF-styles
- ProgressBar
+- export rotation of Camera to VIEW/VPORT
+- export parented Cameras to VIEW/VPORT
- wip: write drawing extends for automatic view positioning in CAD
-- wip: correct text-objects in persp-projection
-- wip: translate Camera to VPORT/VIEW
+- wip: fix text-objects in persp-projection
- wip: translate current 3D-View to *ACTIVE-VPORT
+- wip: fix support Include-Duplis, cause not conform with INSERT-method
History
+v1.35 - 2009.06.18 by migius
+- export multiple-instances of Curve-Objects as BLOCK/INSERTs
+- added export Cameras (ortho and persp) to VPORTs, incl. clipping
+- added export Cameras (ortho and persp) to VIEWs, incl. clipping
+- export multiple-instances of Mesh-Objects as BLOCK/INSERTs
+- on start prints dxfLibrary version
v1.34 - 2009.06.08 by migius
- export Lamps and Cameras as POINTs
- export passepartout for perspective projection
@@ -55,7 +63,7 @@ v1.34 - 2009.06.08 by migius
- support XYmirrored 2d-curves to 2dPOLYLINEs
- support thickness and elevation for curve-objects
- fix extrusion 210-code (3d orientation vector)
-- fix POLYFACE export, synchronized with dxfLibrary.py
+- fix POLYFACE export, synchronized also dxfLibrary.py
- changed to the new 2.49 method Vector.cross()
- output style manager (first try)
v1.33 - 2009.05.25 by migius
@@ -139,10 +147,16 @@ from Blender import Registry, Object, Mesh, Curve
import os
import subprocess
-import dxfLibrary as DXF
-#reload(DXF)
-#reload(dxfLibrary)
-#from dxfLibrary import *
+try:
+ import dxfLibrary as DXF
+ #reload(DXF)
+ #reload(dxfLibrary)
+ #from dxfLibrary import *
+except:
+ DXF=None
+ print "DXF-Exporter: error! found no dxfLibrary.py module in Blender script folder"
+ Draw.PupMenu("Error%t|found no dxfLibrary.py module in script folder")
+
import math
from math import atan, atan2, log10, sin, cos
@@ -152,9 +166,8 @@ from math import atan, atan2, log10, sin, cos
r2d = 180.0 / math.pi
d2r = math.pi / 180.0
#note: d2r * angle == math.radians(angle)
+#note: r2d * angle == math.degrees(angle)
-print '\n\n\n'
-print 'DXF-Exporter v%s *** start ***' %(__version__) #---------------------
#DEBUG = True #activates debug mode
@@ -170,6 +183,7 @@ SHADOWS = 0 # sun/shadows simulation
CAMERA = 1 # selected camera index
PERSPECTIVE = 0 # projection (camera) type: perspective, opposite to orthographic
CAMERAVIEW = 0 # use camera for projection, opposite is 3d-view
+INSTANCES = 1 # Export instances of Mesh/Curve as BLOCK/INSERTs on/off
APPLY_MODIFIERS = 1
INCLUDE_DUPLIS = 0
OUTPUT_DWG = 0 #optional save to DWG with extern converter
@@ -187,6 +201,7 @@ LAYERLTYPE_DEF = 0 #'CONTINUOUS' - default layer lineType
ENTITYLAYER_DEF = LAYERNAME_DEF #default entity color index
ENTITYCOLOR_DEF = BYLAYER #default entity color index
ENTITYLTYPE_DEF = BYLAYER #default entity lineType
+
E_M = 0
LAB = "scroll MMB/WHEEL . wip .. todo" #"*) parts under construction"
M_OBJ = 0
@@ -198,6 +213,7 @@ INIFILE_EXTENSION = '.ini'
INIFILE_HEADER = '#ExportDXF.py ver.1.0 config data'
INFFILE_HEADER = '#ExportDXF.py ver.1.0 analyze of DXF-data'
+BLOCKREGISTRY = {} # registry and map for BLOCKs
SCENE = None
WORLDX = Mathutils.Vector((1,0,0))
WORLDY = Mathutils.Vector((0,1,0))
@@ -496,92 +512,136 @@ def isLeftHand(matrix):
def exportMesh(ob, mx, mx_n, me=None, **common):
"""converts Mesh-Object to desired projection and representation(DXF-Entity type)
"""
+ global BLOCKREGISTRY
entities = []
- #print 'deb:exportMesh() common=', common #---------
+ block = None
+ #print 'deb:exportMesh() given common=', common #---------
if me==None:
me = ob.getData(mesh=1)
else:
me.getFromObject(ob)
- # me.transform(mx); get verts data; me.transform(mx_inv)= back to the origin state
- # above .transform method is faster, but bad, cause invasive:
+ # idea: me.transform(mx); get verts data; me.transform(mx_inv)= back to the origin state
+ # the .transform-method is fast, but bad, cause invasive:
# it manipulates original geometry and by retransformation lefts back rounding-errors
# we dont want to manipulate original data!
#temp_verts = me.verts[:] #doesn't work on ubuntu(Yorik), bug?
if me.verts:
#print 'deb:exportMesh() started' #---------
- allpoints = [v.co for v in me.verts]
- allpoints = projected_co(allpoints, mx)
- allpoints = toNewOrigin(allpoints)
- faces=[]
- edges=[]
- if me.faces and PROJECTION and HIDDEN_LINES:
- #if DEBUG: print 'deb:exportMesh HIDDEN_LINES mode' #---------
- faces, edges = hidden_status(me.faces, mx, mx_n)
- faces = [[v.index for v in me.faces[f_nr].verts] for f_nr in faces]
- else:
- #if DEBUG: print 'deb:exportMesh STANDARD mode' #---------
- for e in me.edges: edges.append(e.key)
- #faces = [f.index for f in me.faces]
- faces = [[v.index for v in f.verts] for f in me.faces]
- #faces = [[allpoints[v.index] for v in f.verts] for f in me.faces]
- #print 'deb: allpoints=\n', allpoints #---------
- #print 'deb: edges=\n', edges #---------
- #print 'deb: faces=\n', faces #---------
- if isLeftHand(mx): # then change vertex-order in every face
- for f in faces:
- f.reverse()
- #f = [f[-1]] + f[:-1] #TODO: might be needed
- #print 'deb: faces=\n', faces #---------
-
- c = mesh_as_list[GUI_A['mesh_as'].val]
- if 'POINTs'==c: # export Mesh as multiple POINTs
- for p in allpoints:
- dxfPOINT = DXF.Point(points=[p],**common)
- entities.append(dxfPOINT)
- elif 'LINEs'==c or (not faces):
- if edges and allpoints:
- if DEBUG: mesh_drawBlender(allpoints, edges, None) #deb: draw to blender scene
- for e in edges:
- points = [allpoints[e[0]], allpoints[e[1]]]
- dxfLINE = DXF.Line(points, **common)
- entities.append(dxfLINE)
- elif faces:
- if c in ('POLYFACE','POLYLINE'):
- if allpoints:
- #TODO: purge allpoints: left only vertices used by faces
- if DEBUG: mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
- if not (PROJECTION and HIDDEN_LINES):
- faces = [[v+1 for v in f] for f in faces]
- else:
- # for back-Faces-mode remove face-free verts
- map=verts_state= [0]*len(allpoints)
- for f in faces:
- for v in f:
- verts_state[v]=1
- if 0 in verts_state: # if dirty state
- i,newverts=0,[]
- for used_i,used in enumerate(verts_state):
- if used:
- newverts.append(allpoints[used_i])
- map[used_i]=i
- i+=1
- allpoints = newverts
- faces = [[map[v]+1 for v in f] for f in faces]
- dxfPOLYFACE = DXF.PolyLine([allpoints, faces], flag=64, **common)
- #print '\n deb: dxfPOLYFACE=',dxfPOLYFACE #-------------
- entities.append(dxfPOLYFACE)
- elif '3DFACEs'==c:
- if DEBUG: mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
+
+ #print 'deb:exportMesh() ob.name=', ob.name #---------
+ #print 'deb:exportMesh() me.name=', me.name #---------
+ #print 'deb:exportMesh() me.users=', me.users #---------
+ # check if there are more instances of this mesh (if used by other objects), then write to BLOCK/INSERT
+ if GUI_A['instances_on'].val and me.users>1 and not PROJECTION:
+ if me.name in BLOCKREGISTRY.keys():
+ insert_name = BLOCKREGISTRY[me.name]
+ # write INSERT to entities
+ entities = exportInsert(ob, mx,insert_name, **common)
+ else:
+ # generate geom_output in ObjectCS
+ allpoints = [v.co for v in me.verts]
+ identity_matrix = Mathutils.Matrix().identity()
+ allpoints = projected_co(allpoints, identity_matrix)
+ #allpoints = toGlobalOrigin(allpoints)
+ faces=[]
+ edges=[]
+ for e in me.edges: edges.append(e.key)
+ faces = [[v.index for v in f.verts] for f in me.faces]
+ entities = writeMeshEntities(allpoints, edges, faces, **common)
+ if entities: # if not empty block
+ # write BLOCK definition and INSERT entity
+ # BLOCKREGISTRY = dictionary 'blender_name':'dxf_name'.append(me.name)
+ BLOCKREGISTRY[me.name]=validDXFr12name(('ME_'+ me.name))
+ insert_name = BLOCKREGISTRY[me.name]
+ block = DXF.Block(insert_name,flag=0,base=(0,0,0),entities=entities)
+ # write INSERT as entity
+ entities = exportInsert(ob, mx, insert_name, **common)
+
+ else: # no other instances, so go the standard way
+ allpoints = [v.co for v in me.verts]
+ allpoints = projected_co(allpoints, mx)
+ allpoints = toGlobalOrigin(allpoints)
+ faces=[]
+ edges=[]
+ if me.faces and PROJECTION and HIDDEN_LINES:
+ #if DEBUG: print 'deb:exportMesh HIDDEN_LINES mode' #---------
+ faces, edges = hidden_status(me.faces, mx, mx_n)
+ faces = [[v.index for v in me.faces[f_nr].verts] for f_nr in faces]
+ else:
+ #if DEBUG: print 'deb:exportMesh STANDARD mode' #---------
+ for e in me.edges: edges.append(e.key)
+ #faces = [f.index for f in me.faces]
+ faces = [[v.index for v in f.verts] for f in me.faces]
+ #faces = [[allpoints[v.index] for v in f.verts] for f in me.faces]
+ #print 'deb: allpoints=\n', allpoints #---------
+ #print 'deb: edges=\n', edges #---------
+ #print 'deb: faces=\n', faces #---------
+ if isLeftHand(mx): # then change vertex-order in every face
for f in faces:
- #print 'deb: face=', f #---------
- points = [allpoints[key] for key in f]
- #points = [p.co[:3] for p in points]
- #print 'deb: pointsXX=\n', points #---------
- dxfFACE = DXF.Face(points, **common)
- entities.append(dxfFACE)
-
+ f.reverse()
+ #f = [f[-1]] + f[:-1] #TODO: might be needed
+ #print 'deb: faces=\n', faces #---------
+ entities = writeMeshEntities(allpoints, edges, faces, **common)
+
+ return entities, block
+
+
+#-------------------------------------------------
+def writeMeshEntities(allpoints, edges, faces, **common):
+ """help routine for exportMesh()
+ """
+ entities = []
+
+ c = mesh_as_list[GUI_A['mesh_as'].val]
+ if 'POINTs'==c: # export Mesh as multiple POINTs
+ for p in allpoints:
+ dxfPOINT = DXF.Point(points=[p],**common)
+ entities.append(dxfPOINT)
+ elif 'LINEs'==c or (not faces):
+ if edges and allpoints:
+ if DEBUG: mesh_drawBlender(allpoints, edges, None) #deb: draw to blender scene
+ for e in edges:
+ points = [allpoints[e[0]], allpoints[e[1]]]
+ dxfLINE = DXF.Line(points, **common)
+ entities.append(dxfLINE)
+ elif faces:
+ if c in ('POLYFACE','POLYLINE'):
+ if allpoints:
+ #TODO: purge allpoints: left only vertices used by faces
+ if DEBUG: mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
+ if not (PROJECTION and HIDDEN_LINES):
+ faces = [[v+1 for v in f] for f in faces]
+ else:
+ # for back-Faces-mode remove face-free verts
+ map=verts_state= [0]*len(allpoints)
+ for f in faces:
+ for v in f:
+ verts_state[v]=1
+ if 0 in verts_state: # if dirty state
+ i,newverts=0,[]
+ for used_i,used in enumerate(verts_state):
+ if used:
+ newverts.append(allpoints[used_i])
+ map[used_i]=i
+ i+=1
+ allpoints = newverts
+ faces = [[map[v]+1 for v in f] for f in faces]
+ dxfPOLYFACE = DXF.PolyLine([allpoints, faces], flag=64, **common)
+ #print '\n deb: dxfPOLYFACE=',dxfPOLYFACE #-------------
+ entities.append(dxfPOLYFACE)
+ elif '3DFACEs'==c:
+ if DEBUG: mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
+ for f in faces:
+ #print 'deb: face=', f #---------
+ points = [allpoints[key] for key in f]
+ #points = [p.co[:3] for p in points]
+ #print 'deb: pointsXX=\n', points #---------
+ dxfFACE = DXF.Face(points, **common)
+ entities.append(dxfFACE)
+
return entities
+
#-----------------------------------------------------
def mesh_drawBlender(vertList, edgeList, faceList, name="dxfMesh", flatten=False, AT_CUR=True, link=True):
#print 'deb:mesh_drawBlender started XXXXXXXXXXXXXXXXXX' #---------
@@ -640,7 +700,7 @@ def curve_drawBlender(vertList, org_point=[0.0,0.0,0.0], closed=0, name="dxfCurv
#-----------------------------------------------------
-def toNewOrigin(points):
+def toGlobalOrigin(points):
"""relocates points to the new location
needs a list of points [x,y,z]
"""
@@ -658,7 +718,7 @@ def exportEmpty(ob, mx, mw, **common):
"""
p = Mathutils.Vector(ob.loc)
[p] = projected_co([p], mx)
- [p] = toNewOrigin([p])
+ [p] = toGlobalOrigin([p])
entities = []
c = empty_as_list[GUI_A['empty_as'].val]
@@ -671,16 +731,50 @@ def exportEmpty(ob, mx, mw, **common):
def exportCamera(ob, mx, mw, **common):
"""converts Camera-Object to desired projection and representation(DXF-Entity type)
"""
- p = Mathutils.Vector(ob.loc)
- [p] = projected_co([p], mx)
- [p] = toNewOrigin([p])
-
- entities = []
+ location = Mathutils.Vector(ob.loc)
+ [location] = projected_co([location], mx)
+ [location] = toGlobalOrigin([location])
+ view_name=validDXFr12name(('CAM_'+ ob.name))
+
+ camera = Camera.Get(ob.getData(name_only=True))
+ #print 'deb: camera=', dir(camera) #------------------
+ if camera.type=='persp':
+ mode = 1+2+4+16
+ # mode flags: 1=persp, 2=frontclip, 4=backclip,16=FrontZ
+ elif camera.type=='ortho':
+ mode = 0+2+4+16
+
+ leftBottom=(0.0,0.0) # default
+ rightTop=(1.0,1.0) # default
+ center=(0.0,0.0) # default
+
+ direction = Mathutils.Vector(0.0,0.0,1.0) * mx.rotationPart() # in W-C-S
+ direction.normalize()
+ target=Mathutils.Vector(ob.loc) - direction # in W-C-S
+ #ratio=1.0
+ width=height= camera.scale # for ortho-camera
+ lens = camera.lens # for persp-camera
+ frontClipping = -(camera.clipStart - 1.0)
+ backClipping = -(camera.clipEnd - 1.0)
+
+ entities, vport, view = [], None, None
c = camera_as_list[GUI_A['camera_as'].val]
if c=="POINT": # export as POINT
- dxfPOINT = DXF.Point(points=[p],**common)
+ dxfPOINT = DXF.Point(points=[location],**common)
entities.append(dxfPOINT)
- return entities
+ elif c=="VIEW": # export as VIEW
+ view = DXF.View(name=view_name,
+ center=center, width=width, height=height,
+ frontClipping=frontClipping,backClipping=backClipping,
+ direction=direction,target=target,lens=lens,mode=mode
+ )
+ elif c=="VPORT": # export as VPORT
+ vport = DXF.VPort(name=view_name,
+ center=center, ratio=1.0, height=height,
+ frontClipping=frontClipping,backClipping=backClipping,
+ direction=direction,target=target,lens=lens,mode=mode
+ )
+ return entities, vport, view
#-----------------------------------------------------
def exportLamp(ob, mx, mw, **common):
@@ -688,7 +782,7 @@ def exportLamp(ob, mx, mw, **common):
"""
p = Mathutils.Vector(ob.loc)
[p] = projected_co([p], mx)
- [p] = toNewOrigin([p])
+ [p] = toGlobalOrigin([p])
entities = []
c = lamp_as_list[GUI_A['lamp_as'].val]
@@ -698,6 +792,75 @@ def exportLamp(ob, mx, mw, **common):
return entities
#-----------------------------------------------------
+def exportInsert(ob, mx, insert_name, **common):
+ """converts Object to DXF-INSERT in given orientation
+ """
+ WCS_loc = ob.loc # WCS_loc is object location in WorldCoordSystem
+ sizeX = ob.SizeX
+ sizeY = ob.SizeY
+ sizeZ = ob.SizeZ
+ rotX = ob.RotX
+ rotY = ob.RotY
+ rotZ = ob.RotZ
+ #print 'deb: sizeX=%s, sizeY=%s' %(sizeX, sizeY) #---------
+
+ Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
+
+ AXaxis = mx[0].copy().resize3D() # = ArbitraryXvector
+ if not PROJECTION:
+ #Extrusion, ZRotation, Elevation = getExtrusion(mx)
+ Extrusion, AXaxis = getExtrusion(mx)
+
+ entities = []
+
+ if 1:
+ if not PROJECTION:
+ ZRotation,Zrotmatrix,OCS_origin,ECS_origin = getTargetOrientation(mx,Extrusion,\
+ AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ)
+ ZRotation *= r2d
+ point = ECS_origin
+ else: #TODO: fails correct location
+ point1 = Mathutils.Vector(ob.loc)
+ [point] = projected_co([point1], mx)
+ if PERSPECTIVE:
+ clipStart = 10.0
+ coef = -clipStart / (point1*mx)[2]
+ #print 'deb: coef=', coef #--------------
+ #TODO: ? sizeX *= coef
+ #sizeY *= coef
+ #sizeZ *= coef
+
+ #print 'deb: point=', point #--------------
+ [point] = toGlobalOrigin([point])
+
+ #if DEBUG: text_drawBlender(textstr,points,OCS_origin) #deb: draw to scene
+ common['extrusion']= Extrusion
+ #common['elevation']= Elevation
+ #print 'deb: common=', common #------------------
+ if 0: #DEBUG
+ #linepoints = [[0,0,0], [AXaxis[0],AXaxis[1],AXaxis[2]]]
+ linepoints = [[0,0,0], point]
+ dxfLINE = DXF.Line(linepoints,**common)
+ entities.append(dxfLINE)
+
+ xscale=sizeX
+ yscale=sizeY
+ zscale=sizeZ
+ cols=None
+ colspacing=None
+ rows=None
+ rowspacing=None
+
+ dxfINSERT = DXF.Insert(insert_name,point=point,rotation=ZRotation,\
+ xscale=xscale,yscale=yscale,zscale=zscale,\
+ cols=cols,colspacing=colspacing,rows=rows,rowspacing=rowspacing,\
+ **common)
+ entities.append(dxfINSERT)
+
+ return entities
+
+
+#-----------------------------------------------------
def exportText(ob, mx, mw, **common):
"""converts Text-Object to desired projection and representation(DXF-Entity type)
"""
@@ -755,7 +918,7 @@ def exportText(ob, mx, mw, **common):
#print 'deb: coef=', coef #--------------
#print 'deb: point=', point #--------------
- [point] = toNewOrigin([point])
+ [point] = toGlobalOrigin([point])
point2 = point
#if DEBUG: text_drawBlender(textstr,points,OCS_origin) #deb: draw to scene
@@ -835,132 +998,197 @@ def exportCurve(ob, mx, mw, **common):
"""converts Curve-Object to desired projection and representation(DXF-Entity type)
"""
entities = []
+ block = None
curve = ob.getData()
- WCS_loc = ob.loc # WCS_loc is object location in WorldCoordSystem
- #WCS_loc = [0.0,0.0,0.0]
- #print 'deb: WCS_loc=', WCS_loc #---------
- sizeX = ob.SizeX
- sizeY = ob.SizeY
- sizeZ = ob.SizeZ
- rotX = ob.RotX
- rotY = ob.RotY
- rotZ = ob.RotZ
- #print 'deb: sizeX=%s, sizeY=%s' %(sizeX, sizeY) #---------
+ #print 'deb: curve=', dir(curve) #---------
+ # TODO: should be: if curve.users>1 and not (PERSPECTIVE or (PROJECTION and HIDDEN_MODE):
+ if GUI_A['instances_on'].val and curve.users>1 and not PROJECTION:
+ if curve.name in BLOCKREGISTRY.keys():
+ insert_name = BLOCKREGISTRY[curve.name]
+ # write INSERT to entities
+ entities = exportInsert(ob, mx,insert_name, **common)
+ else:
+ # generate geom_output in ObjectCS
+ imx = Mathutils.Matrix().identity()
+ WCS_loc = [0,0,0] # WCS_loc is object location in WorldCoordSystem
+ #print 'deb: WCS_loc=', WCS_loc #---------
+ sizeX = sizeY = sizeZ = 1.0
+ rotX = rotY = rotZ = 0.0
+ Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
+ ZRotation,Zrotmatrix,OCS_origin,ECS_origin = None,None,None,None
+ AXaxis = imx[0].copy().resize3D() # = ArbitraryXvector
+ OCS_origin = [0,0,0]
+ if not PROJECTION:
+ #Extrusion, ZRotation, Elevation = getExtrusion(mx)
+ Extrusion, AXaxis = getExtrusion(imx)
+
+ # no thickness/width for POLYLINEs converted into Screen-C-S
+ #print 'deb: curve.ext1=', curve.ext1 #---------
+ if curve.ext1: Thickness = curve.ext1 * sizeZ
+ if curve.ext2 and sizeX==sizeY:
+ Width = curve.ext2 * sizeX
+ if "POLYLINE"==curve_as_list[GUI_A['curve_as'].val]: # export as POLYLINE
+ ZRotation,Zrotmatrix,OCS_origin,ECS_origin = getTargetOrientation(imx,Extrusion,\
+ AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ)
+
+ entities = writeCurveEntities(curve, imx,
+ Thickness,Extrusion,ZRotation,Elevation,AXaxis,Zrotmatrix,
+ WCS_loc,OCS_origin,ECS_origin,sizeX,sizeY,sizeZ,
+ **common)
+
+ if entities: # if not empty block
+ # write BLOCK definition and INSERT entity
+ # BLOCKREGISTRY = dictionary 'blender_name':'dxf_name'.append(me.name)
+ BLOCKREGISTRY[curve.name]=validDXFr12name(('CU_'+ curve.name))
+ insert_name = BLOCKREGISTRY[curve.name]
+ block = DXF.Block(insert_name,flag=0,base=(0,0,0),entities=entities)
+ # write INSERT as entity
+ entities = exportInsert(ob, mx, insert_name, **common)
+
+ else: # no other instances, so go the standard way
+ WCS_loc = ob.loc # WCS_loc is object location in WorldCoordSystem
+ #print 'deb: WCS_loc=', WCS_loc #---------
+ sizeX = ob.SizeX
+ sizeY = ob.SizeY
+ sizeZ = ob.SizeZ
+ rotX = ob.RotX
+ rotY = ob.RotY
+ rotZ = ob.RotZ
+ #print 'deb: sizeX=%s, sizeY=%s' %(sizeX, sizeY) #---------
+
+ Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
+ ZRotation,Zrotmatrix,OCS_origin,ECS_origin = None,None,None,None
+ AXaxis = mx[0].copy().resize3D() # = ArbitraryXvector
+ OCS_origin = [0,0,0]
+ if not PROJECTION:
+ #Extrusion, ZRotation, Elevation = getExtrusion(mx)
+ Extrusion, AXaxis = getExtrusion(mx)
+
+ # no thickness/width for POLYLINEs converted into Screen-C-S
+ #print 'deb: curve.ext1=', curve.ext1 #---------
+ if curve.ext1: Thickness = curve.ext1 * sizeZ
+ if curve.ext2 and sizeX==sizeY:
+ Width = curve.ext2 * sizeX
+ if "POLYLINE"==curve_as_list[GUI_A['curve_as'].val]: # export as POLYLINE
+ ZRotation,Zrotmatrix,OCS_origin,ECS_origin = getTargetOrientation(mx,Extrusion,\
+ AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ)
+ entities = writeCurveEntities(curve, mx,
+ Thickness,Extrusion,ZRotation,Elevation,AXaxis,Zrotmatrix,
+ WCS_loc,OCS_origin,ECS_origin,sizeX,sizeY,sizeZ,
+ **common)
+
+ return entities, block
- Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
- AXaxis = mx[0].copy().resize3D() # = ArbitraryXvector
- OCS_origin = [0,0,0]
- if not PROJECTION:
- #Extrusion, ZRotation, Elevation = getExtrusion(mx)
- Extrusion, AXaxis = getExtrusion(mx)
- # no thickness/width for POLYLINEs converted into ScreenCS
- #print 'deb: curve.ext1=', curve.ext1 #---------
- if curve.ext1: Thickness = curve.ext1 * sizeZ
- if curve.ext2 and sizeX==sizeY:
- Width = curve.ext2 * sizeX
- if "POLYLINE"==curve_as_list[GUI_A['curve_as'].val]: # export as POLYLINE
- ZRotation,Zrotmatrix,OCS_origin,ECS_origin = getTargetOrientation(mx,Extrusion,\
- AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ)
+#-------------------------------------------------
+def writeCurveEntities(curve, mx,
+ Thickness,Extrusion,ZRotation,Elevation,AXaxis,Zrotmatrix,
+ WCS_loc,OCS_origin,ECS_origin,sizeX,sizeY,sizeZ,
+ **common):
+ """help routine for exportCurve()
+ """
+ entities = []
- for cur in curve:
- #print 'deb: START cur=', cur #--------------
- points = []
- if cur.isNurb():
- for point in cur:
- #print 'deb:isNurb point=', point #---------
- vec = point[0:3]
- #print 'deb: vec=', vec #---------
- pkt = Mathutils.Vector(vec)
- #print 'deb: pkt=', pkt #---------
- points.append(pkt)
- else:
- for point in cur:
- #print 'deb:isBezier point=', point.getTriple() #---------
- vec = point.getTriple()[1]
- #print 'deb: vec=', vec #---------
- pkt = Mathutils.Vector(vec)
- #print 'deb: pkt=', pkt #---------
- points.append(pkt)
-
- #print 'deb: points', points #--------------
- if len(points)>1:
- c = curve_as_list[GUI_A['curve_as'].val]
-
- if c=="POLYLINE": # export Curve as POLYLINE
- if not PROJECTION:
- # recalculate points(2d=X,Y) into Entity-Coords-System
- for p in points: # list of vectors
- p[0] *= sizeX
- p[1] *= sizeY
- p2 = p * Zrotmatrix
- p2[0] += ECS_origin[0]
- p2[1] += ECS_origin[1]
- p[0],p[1] = p2[0],p2[1]
- else:
- points = projected_co(points, mx)
- #print 'deb: points', points #--------------
-
- if cur.isCyclic(): closed = 1
- else: closed = 0
- points = toNewOrigin(points)
-
- if DEBUG: curve_drawBlender(points,OCS_origin,closed) #deb: draw to scene
- common['extrusion']= Extrusion
- ##common['rotation']= ZRotation
- ##common['elevation']= Elevation
- common['thickness']= Thickness
- #print 'deb: common=', common #------------------
-
- if 0: #DEBUG
- p=AXaxis[:3]
- entities.append(DXF.Line([[0,0,0], p],**common))
- p=ECS_origin[:3]
- entities.append(DXF.Line([[0,0,0], p],**common))
- common['color']= 5
- p=OCS_origin[:3]
- entities.append(DXF.Line([[0,0,0], p],**common))
- #OCS_origin=[0,0,0] #only debug----------------
- dxfPLINE = DXF.PolyLine(points,OCS_origin,closed,**common)
- entities.append(dxfPLINE)
+ if 1:
+ for cur in curve:
+ #print 'deb: START cur=', cur #--------------
+ points = []
+ if cur.isNurb():
+ for point in cur:
+ #print 'deb:isNurb point=', point #---------
+ vec = point[0:3]
+ #print 'deb: vec=', vec #---------
+ pkt = Mathutils.Vector(vec)
+ #print 'deb: pkt=', pkt #---------
+ points.append(pkt)
+ else:
+ for point in cur:
+ #print 'deb:isBezier point=', point.getTriple() #---------
+ vec = point.getTriple()[1]
+ #print 'deb: vec=', vec #---------
+ pkt = Mathutils.Vector(vec)
+ #print 'deb: pkt=', pkt #---------
+ points.append(pkt)
+
+ #print 'deb: points', points #--------------
+ if len(points)>1:
+ c = curve_as_list[GUI_A['curve_as'].val]
+
+ if c=="POLYLINE": # export Curve as POLYLINE
+ if not PROJECTION:
+ # recalculate points(2d=X,Y) into Entity-Coords-System
+ for p in points: # list of vectors
+ p[0] *= sizeX
+ p[1] *= sizeY
+ p2 = p * Zrotmatrix
+ p2[0] += ECS_origin[0]
+ p2[1] += ECS_origin[1]
+ p[0],p[1] = p2[0],p2[1]
+ else:
+ points = projected_co(points, mx)
+ #print 'deb: points', points #--------------
+
+ if cur.isCyclic(): closed = 1
+ else: closed = 0
+ points = toGlobalOrigin(points)
+
+ if DEBUG: curve_drawBlender(points,OCS_origin,closed) #deb: draw to scene
- dxfPLINE = DXF.PolyLine(points,OCS_origin,closed,**common)
- entities.append(dxfPLINE)
- if Thickness:
- common['thickness']= -Thickness
+ common['extrusion']= Extrusion
+ ##common['rotation']= ZRotation
+ ##common['elevation']= Elevation
+ common['thickness']= Thickness
+ #print 'deb: common=', common #------------------
+
+ if 0: #DEBUG
+ p=AXaxis[:3]
+ entities.append(DXF.Line([[0,0,0], p],**common))
+ p=ECS_origin[:3]
+ entities.append(DXF.Line([[0,0,0], p],**common))
+ common['color']= 5
+ p=OCS_origin[:3]
+ entities.append(DXF.Line([[0,0,0], p],**common))
+ #OCS_origin=[0,0,0] #only debug----------------
+ dxfPLINE = DXF.PolyLine(points,OCS_origin,closed,**common)
+ entities.append(dxfPLINE)
+
dxfPLINE = DXF.PolyLine(points,OCS_origin,closed,**common)
entities.append(dxfPLINE)
-
- elif c=="LINEs": # export Curve as multiple LINEs
- points = projected_co(points, mx)
- if cur.isCyclic(): points.append(points[0])
- #print 'deb: points', points #--------------
- points = toNewOrigin(points)
-
- if DEBUG: curve_drawBlender(points,WCS_loc,closed) #deb: draw to scene
- common['extrusion']= Extrusion
- common['elevation']= Elevation
- common['thickness']= Thickness
- #print 'deb: common=', common #------------------
- for i in range(len(points)-1):
- linepoints = [points[i], points[i+1]]
- dxfLINE = DXF.Line(linepoints,**common)
- entities.append(dxfLINE)
- if Thickness:
- common['thickness']= -Thickness
+ if Thickness:
+ common['thickness']= -Thickness
+ dxfPLINE = DXF.PolyLine(points,OCS_origin,closed,**common)
+ entities.append(dxfPLINE)
+
+ elif c=="LINEs": # export Curve as multiple LINEs
+ points = projected_co(points, mx)
+ if cur.isCyclic(): points.append(points[0])
+ #print 'deb: points', points #--------------
+ points = toGlobalOrigin(points)
+
+ if DEBUG: curve_drawBlender(points,WCS_loc,closed) #deb: draw to scene
+ common['extrusion']= Extrusion
+ common['elevation']= Elevation
+ common['thickness']= Thickness
+ #print 'deb: common=', common #------------------
for i in range(len(points)-1):
linepoints = [points[i], points[i+1]]
dxfLINE = DXF.Line(linepoints,**common)
entities.append(dxfLINE)
-
- elif c=="POINTs": # export Curve as multiple POINTs
- points = projected_co(points, mx)
- for p in points:
- dxfPOINT = DXF.Point(points=[p],**common)
- entities.append(dxfPOINT)
-
+ if Thickness:
+ common['thickness']= -Thickness
+ for i in range(len(points)-1):
+ linepoints = [points[i], points[i+1]]
+ dxfLINE = DXF.Line(linepoints,**common)
+ entities.append(dxfLINE)
+
+ elif c=="POINTs": # export Curve as multiple POINTs
+ points = projected_co(points, mx)
+ for p in points:
+ dxfPOINT = DXF.Point(points=[p],**common)
+ entities.append(dxfPOINT)
return entities
+
#-----------------------------------------------------
def getClipBox(camera):
"""calculates Field-of-View-Clipping-Box of given Camera
@@ -1075,12 +1303,12 @@ def drawClipBox(clip_box):
verts.append([max_X2, max_Y2, max_Z])
verts.append([min_X2, max_Y2, max_Z])
faces = [[0,1,2,3],[4,5,6,7]]
- nme = Mesh.New()
- nme.verts.extend(verts)
- nme.faces.extend(faces)
+ newmesh = Mesh.New()
+ newmesh.verts.extend(verts)
+ newmesh.faces.extend(faces)
plan = Object.New('Mesh','clip_box')
- plan.link(nme)
+ plan.link(newmesh)
sce = Scene.GetCurrent()
sce.objects.link(plan)
plan.setMatrix(sce.objects.camera.matrix)
@@ -1170,19 +1398,35 @@ def getCommons(ob):
#-----------------------------------------------------
def do_export(export_list, filepath):
- global PERSPECTIVE, CAMERAVIEW
+ global PERSPECTIVE, CAMERAVIEW, BLOCKREGISTRY
Window.WaitCursor(1)
t = Blender.sys.time()
# init Drawing ---------------------
d=DXF.Drawing()
# add Tables -----------------
- #d.blocks.append(b) #table blocks
- #goes automatic: d.styles.append(DXF.Style()) #table styles
+ # initialized automatic: d.blocks.append(b) #section BLOCKS
+ # initialized automatic: d.styles.append(DXF.Style()) #table STYLE
+
+ #table LTYPE ---------------
+ #d.linetypes.append(DXF.LineType(name='CONTINUOUS',description='--------',elements=[0.0]))
+ d.linetypes.append(DXF.LineType(name='DOT',description='. . . . . . .',elements=[0.25, 0.0, -0.25]))
+ d.linetypes.append(DXF.LineType(name='DASHED',description='__ __ __ __ __',elements=[0.8, 0.5, -0.3]))
+ d.linetypes.append(DXF.LineType(name='DASHDOT',description='__ . __ . __ .',elements=[1.0, 0.5, -0.25, 0.0, -0.25]))
+ d.linetypes.append(DXF.LineType(name='DIVIDE',description='____ . . ____ . . ',elements=[1.25, 0.5, -0.25, 0.0, -0.25, 0.0, -0.25]))
+ d.linetypes.append(DXF.LineType(name='BORDER',description='__ __ . __ __ . ',elements=[1.75, 0.5, -0.25, 0.5, -0.25, 0.0, -0.25]))
+ d.linetypes.append(DXF.LineType(name='HIDDEN',description='__ __ __ __ __',elements=[0.4, 0.25, -0.25]))
+ d.linetypes.append(DXF.LineType(name='CENTER',description='____ _ ____ _ __',elements=[2.0, 1.25, -0.25, 0.25, -0.25]))
+
+ #d.vports.append(DXF.VPort('*ACTIVE'))
+ d.vports.append(DXF.VPort('*ACTIVE',center=(-5.0,1.0),height=10.0))
+ #d.vports.append(DXF.VPort('*ACTIVE',leftBottom=(-100.0,-60.0),rightTop=(100.0,60.0)))
#d.views.append(DXF.View('Normal')) #table view
d.views.append(DXF.ViewByWindow('BF_TOPVIEW',leftBottom=(-100,-60),rightTop=(100,60))) #idem
# add Entities --------------------
+ BLOCKREGISTRY = {} # registry and map for BLOCKs
+ PERSPECTIVE = 0
something_ready = 0
selected_len = len(export_list)
sce = Scene.GetCurrent()
@@ -1246,9 +1490,10 @@ def do_export(export_list, filepath):
layernames = []
for ob,mx in export_list:
entities = []
+ block = None
#mx = ob.matrix.copy()
#print 'deb: ob =', ob #---------
- print 'deb: ob.type =', ob.type #---------
+ #print 'deb: ob.type =', ob.type #---------
#print 'deb: mx =\n', mx #---------
#print 'deb: mw0 =\n', mw0 #---------
#mx_n is trans-matrix for normal_vectors for front-side faces
@@ -1274,10 +1519,10 @@ def do_export(export_list, filepath):
d.layers.append(DXF.Layer(color=tempcolor, name=elayer))
if (ob.type == 'Mesh') and GUI_B['bmesh'].val:
- entities = exportMesh(ob, mx, mx_n, tmp_me,\
+ entities, block = exportMesh(ob, mx, mx_n, tmp_me,\
paperspace=espace, color=ecolor, layer=elayer, lineType=eltype)
elif (ob.type == 'Curve') and GUI_B['bcurve'].val:
- entities = exportCurve(ob, mx, mw, \
+ entities, block = exportCurve(ob, mx, mw, \
paperspace=espace, color=ecolor, layer=elayer, lineType=eltype)
elif (ob.type == 'Empty') and GUI_B['empty'].val:
entities = exportEmpty(ob, mx, mw, \
@@ -1286,8 +1531,10 @@ def do_export(export_list, filepath):
entities = exportText(ob, mx, mw, \
paperspace=espace, color=ecolor, layer=elayer, lineType=eltype)
elif (ob.type == 'Camera') and GUI_B['camera'].val:
- entities = exportCamera(ob, mx, mw, \
+ entities, vport, view = exportCamera(ob, mx, mw, \
paperspace=espace, color=ecolor, layer=elayer, lineType=eltype)
+ if vport: d.vports.append(vport)
+ if view: d.views.append(view)
elif (ob.type == 'Lamp') and GUI_B['lamp'].val:
entities = exportLamp(ob, mx, mw, \
paperspace=espace, color=ecolor, layer=elayer, lineType=eltype)
@@ -1297,16 +1544,26 @@ def do_export(export_list, filepath):
for e in entities:
d.append(e)
+ if block:
+ d.blocks.append(block) #add to BLOCK-section
+
+
if something_ready:
- if PERSPECTIVE: # draw view border
- mw2 = Mathutils.Matrix().identity()
- points = projected_co(border, mw2)
+ if PERSPECTIVE: # generate view border - passepartout
+ identity_matrix = Mathutils.Matrix().identity()
+ points = projected_co(border, identity_matrix)
closed = 1
- points = toNewOrigin(points)
-
- dxfPLINE = DXF.PolyLine(points,points[0],closed,\
- paperspace=espace, color=LAYERCOLOR_DEF)
- d.append(dxfPLINE)
+ points = toGlobalOrigin(points)
+ c = curve_as_list[GUI_A['curve_as'].val]
+ if c=="LINEs": # export Curve as multiple LINEs
+ for i in range(len(points)-1):
+ linepoints = [points[i], points[i+1]]
+ dxfLINE = DXF.Line(linepoints,paperspace=espace,color=LAYERCOLOR_DEF)
+ entities.append(dxfLINE)
+ else:
+ dxfPLINE = DXF.PolyLine(points,points[0],closed,\
+ paperspace=espace, color=LAYERCOLOR_DEF)
+ d.append(dxfPLINE)
if not GUI_A['outputDWG_on'].val:
@@ -1573,7 +1830,7 @@ parent_as_menu = prepareMenu("export to: %t", parent_as_list)
proxy_as_list = ["..BLOCK","..XREF","..ungroup","..POINT"]
proxy_as_menu = prepareMenu("export to: %t", proxy_as_list)
-camera_as_list = ["..BLOCK","..A_CAMERA","..VPORT","..VIEW","POINT"]
+camera_as_list = ["..BLOCK","..A_CAMERA","VPORT","VIEW","POINT"]
camera_as_menu = prepareMenu("export to: %t", camera_as_list)
lamp_as_list = ["..BLOCK","..A_LAMP","POINT"]
@@ -1655,6 +1912,7 @@ keywords_org = {
'outputDWG_on' : OUTPUT_DWG,
'to_polyline_on': POLYLINES,
'to_polyface_on': POLYFACES,
+ 'instances_on': INSTANCES,
'apply_modifiers_on': APPLY_MODIFIERS,
'include_duplis_on': INCLUDE_DUPLIS,
'camera_selected': CAMERA,
@@ -1691,7 +1949,7 @@ keywords_org = {
'group_as' : 0,
'parent_as' : 0,
'proxy_as' : 0,
- 'camera_as': 4,
+ 'camera_as': 3,
'lamp_as' : 2,
}
@@ -2066,7 +2324,7 @@ def draw_UI(): #---------------------------------------------------------------
but_3c = common_column #button 3.column
menu_w = (3 * butt_margin) + but_0c + but_1c + but_2c + but_3c #menu width
- simple_menu_h = 240
+ simple_menu_h = 260
extend_menu_h = 345
menu_h = simple_menu_h # y is menu upper.y
if config_UI.val:
@@ -2361,6 +2619,11 @@ def draw_UI(): #---------------------------------------------------------------
y -= 20
b0, b0_ = but0c, but_0c + butt_margin +but_1c
+ GUI_A['instances_on'] = Draw.Toggle('Instances as BLOCKs', EVENT_NONE, b0, y, b0_, 20, GUI_A['instances_on'].val, "Export instances (multi-users) of Mesh/Curve as BLOCK/INSERTs on/off")
+ #b0, b0_ = but2c, but_2c + butt_margin + but_3c
+
+ y -= 20
+ b0, b0_ = but0c, but_0c + butt_margin +but_1c
GUI_A['apply_modifiers_on'] = Draw.Toggle('Apply Modifiers', EVENT_NONE, b0, y, b0_, 20, GUI_A['apply_modifiers_on'].val, "Apply modifier stack to mesh objects before export on/off")
#b0, b0_ = but2c, but_2c + butt_margin + but_3c
@@ -2750,23 +3013,29 @@ def multi_export(DIR): #TODO:
#-----------------------------------------------------
if __name__=='__main__':
- if not DXF.copy:
- Draw.PupMenu('Error%t|The dxfLibrary.py script requires a full python install')
- #Window.FileSelector(dxf_export_ui, 'EXPORT DXF', Blender.sys.makename(ext='.dxf'))
- # recall last used DXF-file and INI-file names
- dxffilename = check_RegistryKey('dxfFileName')
- #print 'deb:start dxffilename:', dxffilename #----------------
- if dxffilename: dxfFileName.val = dxffilename
- else:
- dirname = Blender.sys.dirname(Blender.Get('filename'))
- #print 'deb:start dirname:', dirname #----------------
- dxfFileName.val = Blender.sys.join(dirname, '')
- inifilename = check_RegistryKey('iniFileName')
- if inifilename: iniFileName.val = inifilename
-
- updateMenuCAMERA()
- updateCAMERA()
-
- Draw.Register(draw_UI, event, bevent)
-
+ if DXF:
+ print '\n\n\n'
+ print 'DXF-Exporter v%s *** start ***' %(__version__) #---------------------
+ print 'with Library %s' %(DXF.__version__) #---------------------
+ if not DXF.copy:
+ print "DXF-Exporter: dxfLibrary.py script requires a full Python install"
+ Draw.PupMenu('Error%t|The dxfLibrary.py script requires a full Python install')
+ else:
+ #Window.FileSelector(dxf_export_ui, 'EXPORT DXF', Blender.sys.makename(ext='.dxf'))
+ # recall last used DXF-file and INI-file names
+ dxffilename = check_RegistryKey('dxfFileName')
+ #print 'deb:start dxffilename:', dxffilename #----------------
+ if dxffilename: dxfFileName.val = dxffilename
+ else:
+ dirname = Blender.sys.dirname(Blender.Get('filename'))
+ #print 'deb:start dirname:', dirname #----------------
+ dxfFileName.val = Blender.sys.join(dirname, '')
+ inifilename = check_RegistryKey('iniFileName')
+ if inifilename: iniFileName.val = inifilename
+
+ updateMenuCAMERA()
+ updateCAMERA()
+
+ Draw.Register(draw_UI, event, bevent)
+
\ No newline at end of file
diff --git a/release/scripts/export_fbx.py b/release/scripts/export_fbx.py
index 4115140a852..50357cbfa75 100644
--- a/release/scripts/export_fbx.py
+++ b/release/scripts/export_fbx.py
@@ -1464,7 +1464,7 @@ def write(filename, batch_objects = None, \
# Write Edge Smoothing
file.write('''
- LayerElementSmoothing: 0 {
+ LayerElementSmoothing: 1 {
Version: 101
Name: ""
MappingInformationType: "ByEdge"
diff --git a/release/scripts/export_map.py b/release/scripts/export_map.py
index 7df78fc3c9a..ab32f6d5ff5 100644
--- a/release/scripts/export_map.py
+++ b/release/scripts/export_map.py
@@ -2,14 +2,14 @@
"""
Name: 'Quake 3 (.map)'
-Blender: 243
+Blender: 249
Group: 'Export'
Tooltip: 'Export to Quake map format'
"""
__author__ = 'Campbell Barton'
-__version__ = '0.1'
-__email__ = "cbarton@metavr.com"
+__version__ = '0.1a'
+__email__ = "ideasman42@gmail.com"
__bpydoc__ = """\
This script Exports a Quake 3 map format.
@@ -234,7 +234,7 @@ def write_node_map(file, ob):
as a MAP node as long as it has the property name - classname
returns True/False based on weather a node was written
'''
- props= [(p.name, p.data) for p in ob.properties]
+ props= [(p.name, p.data) for p in ob.game_properties]
IS_MAP_NODE= False
for name, value in props:
@@ -287,7 +287,7 @@ def export_map(filepath):
TOTBRUSH= TOTLAMP= TOTNODE= 0
for ob in Object.GetSelected():
- type= ob.getType()
+ type= ob.type
if type == 'Mesh': obs_mesh.append(ob)
elif type == 'Surf': obs_surf.append(ob)
elif type == 'Lamp': obs_lamp.append(ob)
@@ -406,9 +406,10 @@ NULL
else:
print "NOT EXPORTING PATCH", surf_name, u,v, 'Unsupported'
-
- file.write('}\n') # end worldspan
+
+ if obs_mesh or obs_surf:
+ file.write('}\n') # end worldspan
print '\twriting lamps'
diff --git a/release/scripts/export_obj.py b/release/scripts/export_obj.py
index 739b02bcbb3..7dffb5d2048 100644
--- a/release/scripts/export_obj.py
+++ b/release/scripts/export_obj.py
@@ -2,14 +2,14 @@
"""
Name: 'Wavefront (.obj)...'
-Blender: 248
+Blender: 249
Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File'
"""
__author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
-__version__ = "1.21"
+__version__ = "1.22"
__bpydoc__ = """\
This script is an exporter to OBJ file format.
@@ -23,11 +23,11 @@ will be exported as mesh data.
"""
-# --------------------------------------------------------------------------
-# OBJ Export v1.1 by Campbell Barton (AKA Ideasman)
-# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
+# Script copyright (C) Campbell J Barton 2007-2009
+# - V1.22- bspline import/export added (funded by PolyDimensions GmbH)
+#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
diff --git a/release/scripts/import_dxf.py b/release/scripts/import_dxf.py
index 36a1a048075..b3bee11c464 100644
--- a/release/scripts/import_dxf.py
+++ b/release/scripts/import_dxf.py
@@ -7,7 +7,7 @@ Group: 'Import'
Tooltip: 'Import for DWG/DXF geometry data.'
"""
__author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
-__version__ = '1.12 - 2009.05.27 by migius'
+__version__ = '1.12 - 2009.06.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"]
@@ -100,7 +100,7 @@ History:
-- better support for long dxf-layer-names
-- add configuration file.ini handles multiple material setups
-- added f_layerFilter
- -- to-check: obj/mat/group/_mapping-idea from ideasman42:
+ -- to-check: obj/mat/group/_mapping-idea from ideasman42
-- curves: added "fill/non-fill" option for closed curves: CIRCLEs,ELLIPSEs,POLYLINEs
-- "normalize Z" option to correct non-planar figures
-- LINEs need "width" in 3d-space incl vGroups
@@ -108,11 +108,13 @@ History:
-- add better support for color_index BYLAYER=256, BYBLOCK=0
-- bug: "oneMesh" produces irregularly errors
-- bug: Registry recall from hd_cache ?? only win32 bug??
- -- support DXF-definitions of scene, lights and cameras
+ -- support DXF-definitions of autoshade: scene, lights and cameras
-- support ortho mode for VIEWs and VPORTs as cameras
+ v1.12 - 2009.06.16 by migius
+ d7 fix for ignored BLOCKs (e.g. *X) which are members of other BLOCKs
v1.12 - 2009.05.27 by migius
- d6 todo: bugfix negative scaled INSERTs - isLeftHand(Matrix) check
+ d6 bugfix negative scaled INSERTs - isLeftHand(Matrix) check
v1.12 - 2009.05.26 by migius
d5 changed to the new 2.49 method Vector.cross()
d5 bugfix WORLDY(1,1,0) to (0,1,0)
@@ -161,7 +163,7 @@ History:
a4 added to analyzeTool: report about VIEWs, VPORTs, unused/xref BLOCKs
a4 bugfix: individual support for 2D/3DPOLYLINE/POLYMESH
a4 added to UI: (*wip)BLOCK-(F): name filtering for BLOCKs
- a4 added to UI: BLOCK-(n): filter anoname/hatch BLOCKs *X...
+ a4 added to UI: BLOCK-(n): filter noname/hatch BLOCKs *X...
a2 g_scale_as is no more GUI_A-variable
a2 bugfix "material": negative sign color_index
a2 added support for BLOCKs defined with origin !=(0,0,0)
@@ -4520,7 +4522,7 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
item2str = [item2.name, item2.layer]
childList.append(item2str)
try: usedblocks[item.name] = [used, childList]
- except KeyError: print 'Cannot map "%s" - "%s" as Block!' %(item.name, item)
+ except KeyError: print 'Cannot find "%s" Block!' %(item.name)
#print 'deb:getBlocksmap: usedblocks=' , usedblocks #-------------
#print 'deb:getBlocksmap: layersmap=' , layersmap #-------------
@@ -4528,7 +4530,7 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
if type(item) != list and item.type == 'insert':
if not layersmap or (not layersmap[item.layer].frozen or layFrozen_on): #if insert_layer is not frozen
try: usedblocks[item.name][0] = True
- except: pass
+ except KeyError: print 'Cannot find "%s" Block!' %(item.name)
key_list = usedblocks.keys()
key_list.reverse()
@@ -4536,7 +4538,8 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
if usedblocks[key][0]: #if parent used, then set used also all child blocks
for child in usedblocks[key][1]:
if not layersmap or (layersmap and not layersmap[child[1]].frozen): #if insert_layer is not frozen
- usedblocks[child[0]][0] = True # marked as used BLOCK
+ try: usedblocks[child[0]][0] = True # marked as used BLOCK
+ except KeyError: print 'Cannot find "%s" Block!' %(child[0])
usedblocks = [i for i in usedblocks.keys() if usedblocks[i][0]]
#print 'deb:getBlocksmap: usedblocks=' , usedblocks #-------------
diff --git a/release/scripts/import_obj.py b/release/scripts/import_obj.py
index d88f06a2a47..81230bfcf03 100644
--- a/release/scripts/import_obj.py
+++ b/release/scripts/import_obj.py
@@ -9,7 +9,7 @@ Tooltip: 'Load a Wavefront OBJ File, Shift: batch import all dir.'
__author__= "Campbell Barton", "Jiri Hnidek", "Paolo Ciccone"
__url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org']
-__version__= "2.11"
+__version__= "2.13"
__bpydoc__= """\
This script imports a Wavefront OBJ files to Blender.
@@ -21,7 +21,8 @@ Note, This loads mesh objects and materials only, nurbs and curves are not suppo
# ***** BEGIN GPL LICENSE BLOCK *****
#
-# Script copyright (C) Campbell J Barton 2007
+# Script copyright (C) Campbell J Barton 2007-2009
+# - V2.12- bspline import/export added (funded by PolyDimensions GmbH)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -124,6 +125,16 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
has_data = image.has_data
texture.image = image
+
+ if not has_data:
+ try:
+ # first time using this image. We need to load it first
+ image.glLoad()
+ except:
+ # probably the image is crashed
+ pass
+ else:
+ has_data = image.has_data
# Adds textures for materials (rendering)
if type == 'Kd':
@@ -207,6 +218,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
context_material.setIOR( max(1, min(float(line_split[1]), 3))) # Between 1 and 3
elif line_lower.startswith('d') or line_lower.startswith('tr'):
context_material.setAlpha(float(line_split[1]))
+ context_material.mode |= Material.Modes.ZTRANSP
elif line_lower.startswith('map_ka'):
img_filepath= line_value(line.split())
if img_filepath:
diff --git a/release/scripts/object_active_to_other.py b/release/scripts/object_active_to_other.py
index 131d1f63d74..68aa6a3a039 100644
--- a/release/scripts/object_active_to_other.py
+++ b/release/scripts/object_active_to_other.py
@@ -38,13 +38,13 @@ def my_object_util(sce):
Draw.PupMenu('Error%t|No active object selected')
return
- mats = [ob.matrixWorld for ob in sce.objects.context if ob != ob_act]
+ mats = [(ob, ob.matrixWorld) for ob in sce.objects.context if ob != ob_act]
- for m in mats:
+ for ob, m in mats:
ob_copy = ob_act.copy()
sce.objects.link(ob_copy)
ob_copy.setMatrix(m)
- ob_copy.Layers = ob.Layers
+ ob_copy.Layers = ob.Layers & (1<<20)-1
def main():
diff --git a/release/scripts/vertexpaint_selfshadow_ao.py b/release/scripts/vertexpaint_selfshadow_ao.py
index 54c67fd27e2..3554e016f79 100644
--- a/release/scripts/vertexpaint_selfshadow_ao.py
+++ b/release/scripts/vertexpaint_selfshadow_ao.py
@@ -43,7 +43,7 @@ import bpy
import BPyMesh
-def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY):
+def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_STRENGTH, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY):
Window.WaitCursor(1)
Ang= Mathutils.AngleBetweenVecs
@@ -83,32 +83,34 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE
if vert_tone_count[i]:
vert_tone[i] = vert_tone[i] / vert_tone_count[i]
+
+ # Below we use edges to blur along so the edges need counting, not the faces
+ vert_tone_count= [0] * len(me.verts)
+ for ed in me.edges:
+ vert_tone_count[ed.v1.index] += 1
+ vert_tone_count[ed.v2.index] += 1
+
- # BLUR TONE
- edge_lengths= [ ed.length for ed in me.edges]
+ # Blur tone
+ blur = PREF_BLUR_STRENGTH
+ blur_inv = 1.0 - PREF_BLUR_STRENGTH
for i in xrange(PREF_BLUR_ITERATIONS):
+
+ # backup the original tones
orig_vert_tone= list(vert_tone)
- for ii, ed in enumerate(me.edges):
+
+ for ed in me.edges:
+
i1= ed.v1.index
i2= ed.v2.index
- l= edge_lengths[ii]
+
+ val1= (orig_vert_tone[i2]*blur) + (orig_vert_tone[i1]*blur_inv)
+ val2= (orig_vert_tone[i1]*blur) + (orig_vert_tone[i2]*blur_inv)
- f=1.0
- if l > PREF_MIN_EDLEN and l < PREF_BLUR_RADIUS:
- f= l/PREF_BLUR_RADIUS
-
- len_vert_tone_list_i1 = vert_tone_count[i1]
- len_vert_tone_list_i2 = vert_tone_count[i2]
-
- if not len_vert_tone_list_i1: len_vert_tone_list_i1=1
- if not len_vert_tone_list_i2: len_vert_tone_list_i2=1
-
- val1= (orig_vert_tone[i2]/len_vert_tone_list_i1)/ f
- val2= (orig_vert_tone[i1]/len_vert_tone_list_i2)/ f
-
- vert_tone[i1]+= val1
- vert_tone[i2]+= val2
+ # Apply the ton divided by the number of faces connected
+ vert_tone[i1]+= val1 / max(vert_tone_count[i1], 1)
+ vert_tone[i2]+= val2 / max(vert_tone_count[i2], 1)
min_tone= min(vert_tone)
@@ -144,21 +146,19 @@ def main():
me= ob.getData(mesh=1)
- PREF_BLUR_ITERATIONS= Draw.Create(1)
- PREF_BLUR_RADIUS= Draw.Create(0.05)
- PREF_MIN_EDLEN= Draw.Create(0.01)
+ PREF_BLUR_ITERATIONS= Draw.Create(1)
+ PREF_BLUR_STRENGTH= Draw.Create(0.5)
PREF_CLAMP_CONCAVE= Draw.Create(90)
PREF_CLAMP_CONVEX= Draw.Create(20)
PREF_SHADOW_ONLY= Draw.Create(0)
PREF_SEL_ONLY= Draw.Create(0)
pup_block= [\
'Post AO Blur',\
- (' Iterations:', PREF_BLUR_ITERATIONS, 0, 40, 'Number times to blur the colors. (higher blurs more)'),\
- (' Blur Radius:', PREF_BLUR_RADIUS, 0.01, 40.0, 'How much distance effects blur transfur (higher blurs more).'),\
- (' Min EdgeLen:', PREF_MIN_EDLEN, 0.00001, 1.0, 'Minimim edge length to blur (very low values can cause errors).'),\
+ ('Strength:', PREF_BLUR_STRENGTH, 0, 1, 'Blur strength per iteration'),\
+ ('Iterations:', PREF_BLUR_ITERATIONS, 0, 40, 'Number times to blur the colors. (higher blurs more)'),\
'Angle Clipping',\
- (' Highlight Angle:', PREF_CLAMP_CONVEX, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
- (' Shadow Angle:', PREF_CLAMP_CONCAVE, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
+ ('Highlight Angle:', PREF_CLAMP_CONVEX, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
+ ('Shadow Angle:', PREF_CLAMP_CONCAVE, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
('Shadow Only', PREF_SHADOW_ONLY, 'Dont calculate highlights for convex areas.'),\
('Sel Faces Only', PREF_SEL_ONLY, 'Only apply to UV/Face selected faces (mix vpain/uvface select).'),\
]
@@ -166,19 +166,16 @@ def main():
if not Draw.PupBlock('SelfShadow...', pup_block):
return
- PREF_BLUR_ITERATIONS= PREF_BLUR_ITERATIONS.val
- PREF_BLUR_RADIUS= PREF_BLUR_RADIUS.val
- PREF_MIN_EDLEN= PREF_MIN_EDLEN.val
- PREF_CLAMP_CONCAVE= PREF_CLAMP_CONCAVE.val
- PREF_CLAMP_CONVEX= PREF_CLAMP_CONVEX.val
- PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val
- PREF_SEL_ONLY= PREF_SEL_ONLY.val
-
if not me.vertexColors:
me.vertexColors= 1
t= sys.time()
- vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
+ vertexFakeAO(me, PREF_BLUR_ITERATIONS.val, \
+ PREF_BLUR_STRENGTH.val, \
+ PREF_CLAMP_CONCAVE.val, \
+ PREF_CLAMP_CONVEX.val, \
+ PREF_SHADOW_ONLY.val, \
+ PREF_SEL_ONLY.val)
if ob.modifiers:
me.update()
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 386597c6d85..005c05dec1d 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -214,6 +214,7 @@ int AVI_is_avi (char *name) {
AviMovie movie;
AviMainHeader header;
AviBitmapInfoHeader bheader;
+ int movie_tracks = 0;
DEBUG("opening movie\n");
@@ -303,6 +304,7 @@ int AVI_is_avi (char *name) {
fclose(movie.fp);
return 0;
}
+ movie_tracks++;
}
movie.streams[temp].sh.Flags = GET_FCC (movie.fp);
@@ -394,7 +396,10 @@ int AVI_is_avi (char *name) {
MEM_freeN(movie.streams);
fclose(movie.fp);
- return 1;
+
+ /* at least one video track is needed */
+ return (movie_tracks != 0);
+
}
AviError AVI_open_movie (char *name, AviMovie *movie) {
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index 05a9bfb0ca9..971ac7a5f01 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -44,7 +44,9 @@ typedef struct BodyPoint {
float choke,choke2,frozen;
float colball;
short flag;
- char octantflag;
+ //char octantflag;
+ float mass;
+ float springweight;
} BodyPoint;
/* allocates and initializes general main data */
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 3facf975992..c7454d3b832 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -795,6 +795,8 @@ void nurbs_to_mesh(Object *ob)
dl= cu->disp.first;
while(dl) {
+ int smooth= dl->rt & CU_SMOOTH ? 1 : 0;
+
if(dl->type==DL_SEGM) {
startvert= vertcount;
a= dl->parts*dl->nr;
@@ -811,6 +813,7 @@ void nurbs_to_mesh(Object *ob)
for(b=1; b<dl->nr; b++) {
mface->v1= startvert+ofs+b-1;
mface->v2= startvert+ofs+b;
+ if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
}
@@ -835,6 +838,7 @@ void nurbs_to_mesh(Object *ob)
mface->v1= startvert+ofs+b;
if(b==dl->nr-1) mface->v2= startvert+ofs;
else mface->v2= startvert+ofs+b+1;
+ if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
}
@@ -860,6 +864,7 @@ void nurbs_to_mesh(Object *ob)
mface->v4= 0;
test_index_face(mface, NULL, 0, 3);
+ if(smooth) mface->flag |= ME_SMOOTH;
mface++;
index+= 3;
}
@@ -907,6 +912,8 @@ void nurbs_to_mesh(Object *ob)
mface->v4= p2;
mface->mat_nr= (unsigned char)dl->col;
test_index_face(mface, NULL, 0, 4);
+
+ if(smooth) mface->flag |= ME_SMOOTH;
mface++;
p4= p3;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index bc6b487080c..fe63585ae1c 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -82,7 +82,7 @@ variables on the UI for now
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
#include "BKE_modifier.h"
-
+#include "BKE_deform.h"
//XXX #include "BIF_editdeform.h"
//XXX #include "BIF_graphics.h"
#include "PIL_time.h"
@@ -2051,7 +2051,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
BodyPoint *bp1,*bp2;
float dir[3],dvel[3];
- float distance,forcefactor,kd,absvel,projvel;
+ float distance,forcefactor,kd,absvel,projvel,kw;
int ia,ic;
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1){
@@ -2085,7 +2085,10 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
forcefactor = iks/bs->len;
else
forcefactor = iks;
- forcefactor *= bs->strength;
+ kw = (bp1->springweight+bp2->springweight)/2.0f;
+ kw = kw * kw;
+ kw = kw * kw;
+ forcefactor *= bs->strength * kw;
Vec3PlusStVec(bp1->force,(bs->len - distance)*forcefactor,dir);
/* do bp1 <--> bp2 viscous */
@@ -2185,14 +2188,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
VecMidf(velcenter, bp->vec, obp->vec);
VecSubf(dvel,velcenter,bp->vec);
- VecMulf(dvel,sb->nodemass);
+ VecMulf(dvel,bp->mass);
Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
Vec3PlusStVec(bp->force,sb->balldamp,dvel);
/* exploit force(a,b) == -force(b,a) part2/2 */
VecSubf(dvel,velcenter,obp->vec);
- VecMulf(dvel,sb->nodemass);
+ VecMulf(dvel,bp->mass);
Vec3PlusStVec(obp->force,sb->balldamp,dvel);
Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
@@ -2237,7 +2240,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* gravitation */
if (sb){
float gravity = sb->grav * sb_grav_force_scale(ob);
- bp->force[2]-= gravity*sb->nodemass; /* individual mass of node here */
+ bp->force[2]-= gravity*bp->mass; /* individual mass of node here */
}
/* particle field & vortex */
@@ -2549,7 +2552,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
VecMidf(velcenter, bp->vec, obp->vec);
VecSubf(dvel,velcenter,bp->vec);
- VecMulf(dvel,sb->nodemass);
+ VecMulf(dvel,bp->mass);
Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
Vec3PlusStVec(bp->force,sb->balldamp,dvel);
@@ -2580,7 +2583,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* exploit force(a,b) == -force(b,a) part2/2 */
VecSubf(dvel,velcenter,obp->vec);
- VecMulf(dvel,sb->nodemass);
+ VecMulf(dvel,(bp->mass+obp->mass)/2.0f);
Vec3PlusStVec(obp->force,sb->balldamp,dvel);
Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
@@ -2640,8 +2643,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* gravitation */
- bp->force[2]-= gravity*sb->nodemass; /* individual mass of node here */
- //bp->force[1]-= gravity*sb->nodemass; /* individual mass of node here */
+ bp->force[2]-= gravity*bp->mass; /* individual mass of node here */
/* particle field & vortex */
@@ -2850,11 +2852,20 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
+ /* old one with homogenous masses */
/* claim a minimum mass for vertex */
+ /*
if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass;
else timeovermass = forcetime/0.009999f;
+ */
for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+/* now we have individual masses */
+/* claim a minimum mass for vertex */
+ if (bp->mass > 0.009999f) timeovermass = forcetime/bp->mass;
+ else timeovermass = forcetime/0.009999f;
+
+
if(bp->goal < SOFTGOALSNAP){
/* this makes t~ = t */
if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec);
@@ -3228,10 +3239,36 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* to proove the concept
this would enable per vertex *mass painting*
- strcpy(name,"SOFTMASS");
- error = get_scalar_from_named_vertexgroup(ob,name, a,&temp);
- if (!error) bp->mass = temp * ob->rangeofmass;
*/
+ /* first set the default */
+ bp->mass = sb->nodemass;
+
+ if (sb->namedVG_Mass[0])
+ {
+ int grp= get_named_vertexgroup_num (ob,sb->namedVG_Mass);
+ /* printf("VGN %s %d \n",sb->namedVG_Mass,grp); */
+ if(grp > -1){
+ get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
+ bp->mass = bp->mass * sb->nodemass;
+ /* printf("bp->mass %f \n",bp->mass); */
+
+ }
+ }
+ /* first set the default */
+ bp->springweight = 1.0f;
+
+ if (sb->namedVG_Spring_K[0])
+ {
+ int grp= get_named_vertexgroup_num (ob,sb->namedVG_Spring_K);
+ //printf("VGN %s %d \n",sb->namedVG_Spring_K,grp);
+ if(grp > -1){
+ get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
+ //printf("bp->springweight %f \n",bp->springweight);
+
+ }
+ }
+
+
}
/* but we only optionally add body edge springs */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index afab6fe608f..7551d902ad8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4126,6 +4126,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
} else {
seq->strip->color_balance = 0;
}
+ if (seq->strip->color_balance) {
+ // seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
+ }
}
}
SEQ_END
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index aa3015812fc..7b8c383ddb9 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -104,7 +104,9 @@ static int writetab(FILE *outf, unsigned int *tab, int len);
static void readtab(FILE *inf, unsigned int *tab, int len);
static void expandrow(unsigned char *optr, unsigned char *iptr, int z);
+static void expandrow2(float *optr, unsigned char *iptr, int z);
static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n);
+static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n);
static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cnt);
static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n);
@@ -233,6 +235,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
{
unsigned int *base, *lptr = NULL;
+ float *fbase, *fptr = NULL;
unsigned int *zbase, *zptr;
unsigned char *rledat;
unsigned int *starttab, *lengthtab;
@@ -242,7 +245,6 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
int xsize, ysize, zsize;
int bpp, rle, cur, badorder;
ImBuf * ibuf;
- uchar * rect;
/*printf("new iris\n");*/
@@ -257,8 +259,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
rle = ISRLE(image.type);
bpp = BPP(image.type);
- if(bpp != 1 ) {
- fprintf(stderr,"longimagedata: image must have 1 byte per pix chan\n");
+ if(bpp != 1 && bpp != 2) {
+ fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n");
return(0);
}
@@ -273,6 +275,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
}
if (rle) {
+
tablen = ysize*zsize*sizeof(int);
starttab = (unsigned int *)malloc(tablen);
lengthtab = (unsigned int *)malloc(tablen);
@@ -280,7 +283,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
readtab(inf,starttab,tablen);
readtab(inf,lengthtab,tablen);
-
+
/* check data order */
cur = 0;
badorder = 0;
@@ -295,99 +298,201 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
if(badorder)
break;
}
-
- ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
- if (ibuf->depth > 32) ibuf->depth = 32;
- base = ibuf->rect;
- zbase = (unsigned int *)ibuf->zbuf;
-
- if (badorder) {
- for(z=0; z<zsize; z++) {
+
+ if (bpp == 1) {
+
+ ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
+ if (ibuf->depth > 32) ibuf->depth = 32;
+ base = ibuf->rect;
+ zbase = (unsigned int *)ibuf->zbuf;
+
+ if (badorder) {
+ for(z=0; z<zsize; z++) {
+ lptr = base;
+ for(y=0; y<ysize; y++) {
+ file_offset = starttab[y+z*ysize];
+
+ rledat = file_data + file_offset;
+ file_offset += lengthtab[y+z*ysize];
+
+ expandrow((uchar *)lptr, rledat, 3-z);
+ lptr += xsize;
+ }
+ }
+ } else {
lptr = base;
+ zptr = zbase;
for(y=0; y<ysize; y++) {
- file_offset = starttab[y+z*ysize];
-
- rledat = file_data + file_offset;
- file_offset += lengthtab[y+z*ysize];
-
- expandrow((uchar *)lptr, rledat, 3-z);
+
+ for(z=0; z<zsize; z++) {
+
+ file_offset = starttab[y+z*ysize];
+
+ rledat = file_data + file_offset;
+ file_offset += lengthtab[y+z*ysize];
+
+ if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
+ else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
+ }
lptr += xsize;
+ zptr += xsize;
}
}
- }
- else {
- lptr = base;
- zptr = zbase;
- for(y=0; y<ysize; y++) {
+
+ } else { /* bpp == 2 */
+
+ ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
+
+ fbase = ibuf->rect_float;
+
+ if (badorder) {
for(z=0; z<zsize; z++) {
-
- file_offset = starttab[y+z*ysize];
+ fptr = fbase;
+ for(y=0; y<ysize; y++) {
+ file_offset = starttab[y+z*ysize];
+
+ rledat = file_data + file_offset;
+ file_offset += lengthtab[y+z*ysize];
+
+ expandrow2(fptr, rledat, 3-z);
+ fptr += xsize * 4;
+ }
+ }
+ } else {
+ fptr = fbase;
- rledat = file_data + file_offset;
- file_offset += lengthtab[y+z*ysize];
-
- if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
- else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
+ for(y=0; y<ysize; y++) {
+
+ for(z=0; z<zsize; z++) {
+
+ file_offset = starttab[y+z*ysize];
+
+ rledat = file_data + file_offset;
+ file_offset += lengthtab[y+z*ysize];
+
+ expandrow2(fptr, rledat, 3-z);
+
+ }
+ fptr += xsize * 4;
}
- lptr += xsize;
- zptr += xsize;
}
}
free(starttab);
- free(lengthtab);
- }
- else {
-
- ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
- if (ibuf->depth > 32) ibuf->depth = 32;
+ free(lengthtab);
- base = ibuf->rect;
- zbase = (unsigned int *)ibuf->zbuf;
-
- file_offset = 512;
- rledat = file_data + file_offset;
-
- for(z = 0; z < zsize; z++) {
+ } else {
+ if (bpp == 1) {
+
+ ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
+ if (ibuf->depth > 32) ibuf->depth = 32;
+
+ base = ibuf->rect;
+ zbase = (unsigned int *)ibuf->zbuf;
- if(z<4) lptr = base;
- else if(z<8) lptr= zbase;
+ file_offset = 512;
+ rledat = file_data + file_offset;
- for(y = 0; y < ysize; y++) {
+ for(z = 0; z < zsize; z++) {
+
+ if(z<4) lptr = base;
+ else if(z<8) lptr= zbase;
+
+ for(y = 0; y < ysize; y++) {
- interleaverow((uchar *)lptr, rledat, 3-z, xsize);
- rledat += xsize;
+ interleaverow((uchar *)lptr, rledat, 3-z, xsize);
+ rledat += xsize;
+
+ lptr += xsize;
+ }
+ }
+
+ } else { /* bpp == 2 */
+
+ ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
+
+ fbase = ibuf->rect_float;
+
+ file_offset = 512;
+ rledat = file_data + file_offset;
+
+ for(z = 0; z < zsize; z++) {
+
+ fptr = fbase;
- lptr += xsize;
+ for(y = 0; y < ysize; y++) {
+
+ interleaverow2(fptr, rledat, 3-z, xsize);
+ rledat += xsize * 2;
+
+ fptr += xsize * 4;
+ }
}
+
}
}
- if (image.zsize == 1){
- rect = (uchar *) ibuf->rect;
- for (x = ibuf->x * ibuf->y; x > 0; x--) {
- rect[0] = 255;
- rect[1] = rect[2] = rect[3];
- rect += 4;
+
+ if (bpp == 1) {
+ uchar * rect;
+
+ if (image.zsize == 1){
+ rect = (uchar *) ibuf->rect;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ rect[0] = 255;
+ rect[1] = rect[2] = rect[3];
+ rect += 4;
+ }
+ } else if (image.zsize == 2){
+ /* grayscale with alpha */
+ rect = (uchar *) ibuf->rect;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ rect[0] = rect[2];
+ rect[1] = rect[2] = rect[3];
+ rect += 4;
+ }
+ } else if (image.zsize == 3){
+ /* add alpha */
+ rect = (uchar *) ibuf->rect;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ rect[0] = 255;
+ rect += 4;
+ }
}
- } else if (image.zsize == 2){
- /* grayscale with alpha */
- rect = (uchar *) ibuf->rect;
- for (x = ibuf->x * ibuf->y; x > 0; x--) {
- rect[0] = rect[2];
- rect[1] = rect[2] = rect[3];
- rect += 4;
+
+ } else { /* bpp == 2 */
+
+ if (image.zsize == 1){
+ fbase = ibuf->rect_float;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ fbase[0] = 1;
+ fbase[1] = fbase[2] = fbase[3];
+ fbase += 4;
+ }
+ } else if (image.zsize == 2){
+ /* grayscale with alpha */
+ fbase = ibuf->rect_float;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ fbase[0] = fbase[2];
+ fbase[1] = fbase[2] = fbase[3];
+ fbase += 4;
+ }
+ } else if (image.zsize == 3){
+ /* add alpha */
+ fbase = ibuf->rect_float;
+ for (x = ibuf->x * ibuf->y; x > 0; x--) {
+ fbase[0] = 1;
+ fbase += 4;
+ }
}
- } else if (image.zsize == 3){
- /* add alpha */
- rect = (uchar *) ibuf->rect;
- for (x = ibuf->x * ibuf->y; x > 0; x--) {
- rect[0] = 255;
- rect += 4;
+
+ if (flags & IB_rect) {
+ IMB_rect_from_float(ibuf);
}
+
}
-
+
ibuf->ftype = IMAGIC;
if (flags & IB_ttob) IMB_flipy(ibuf);
@@ -412,6 +517,71 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n
}
}
+static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n)
+{
+ lptr += z;
+ while(n--) {
+ *lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF;
+ cptr += 2;
+ lptr += 4;
+ }
+}
+
+static void expandrow2(float *optr, unsigned char *iptr, int z)
+{
+ unsigned short pixel, count;
+ float pixel_f;
+
+ optr += z;
+ while(1) {
+ pixel = (iptr[0]<<8) | (iptr[1]<<0);
+ iptr += 2;
+
+ if ( !(count = (pixel & 0x7f)) )
+ return;
+ if(pixel & 0x80) {
+ while(count>=8) {
+ optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
+ optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF;
+ optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF;
+ optr[3*4] = ((iptr[6]<<8) | (iptr[7]<<0))/(float)0xFFFF;
+ optr[4*4] = ((iptr[8]<<8) | (iptr[9]<<0))/(float)0xFFFF;
+ optr[5*4] = ((iptr[10]<<8) | (iptr[11]<<0))/(float)0xFFFF;
+ optr[6*4] = ((iptr[12]<<8) | (iptr[13]<<0))/(float)0xFFFF;
+ optr[7*4] = ((iptr[14]<<8) | (iptr[15]<<0))/(float)0xFFFF;
+ optr += 8*4;
+ iptr += 8*2;
+ count -= 8;
+ }
+ while(count--) {
+ *optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
+ iptr+=2;
+ optr+=4;
+ }
+ } else {
+ pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
+ iptr += 2;
+
+ while(count>=8) {
+ optr[0*4] = pixel_f;
+ optr[1*4] = pixel_f;
+ optr[2*4] = pixel_f;
+ optr[3*4] = pixel_f;
+ optr[4*4] = pixel_f;
+ optr[5*4] = pixel_f;
+ optr[6*4] = pixel_f;
+ optr[7*4] = pixel_f;
+ optr += 8*4;
+ count -= 8;
+ }
+ while(count--) {
+ *optr = pixel_f;
+ optr+=4;
+ }
+ }
+ }
+}
+
static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
{
unsigned char pixel, count;
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index ffd5d3431af..26434583118 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -401,8 +401,6 @@ int imb_get_anim_type(char * name) {
if (ib_stat(name,&st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
- if (isavi(name)) return (ANIM_AVI);
-
if (ismovie(name)) return (ANIM_MOVIE);
# ifdef WITH_QUICKTIME
if (isqtime(name)) return (ANIM_QTIME);
@@ -410,6 +408,7 @@ int imb_get_anim_type(char * name) {
# ifdef WITH_FFMPEG
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
+ if (isavi(name)) return (ANIM_AVI);
#endif
#ifdef WITH_REDCODE
if (isredcode(name)) return (ANIM_REDCODE);
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index d640e37f48d..b5b33610bfe 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -165,12 +165,17 @@ typedef struct SoftBody {
int totpoint, totspring;
struct BodyPoint *bpoint; /* not saved in file */
struct BodySpring *bspring; /* not saved in file */
- float pad;
+ char pad;
+ char msg_lock;
+ short msg_value;
/* part of UI: */
/* general options */
float nodemass; /* softbody mass of *vertex* */
+ char namedVG_Mass[32]; /* along with it introduce mass painting
+ starting to fix old bug .. nastyness that VG are indexes
+ rather find them by name tag to find it -> jow20090613 */
float grav; /* softbody amount of gravitaion to apply */
float mediafrict; /* friction to env */
float rklimit; /* error limit for ODE solver */
@@ -183,13 +188,18 @@ typedef struct SoftBody {
float maxgoal;
float defgoal; /* default goal for vertices without vgroup */
short vertgroup; /* index starting at 1 */
+ char namedVG_Softgoal[32]; /* starting to fix old bug .. nastyness that VG are indexes
+ rather find them by name tag to find it -> jow20090613 */
short fuzzyness; /* */
/* springs */
float inspring; /* softbody inner springs */
float infrict; /* softbody inner springs friction */
-
+ char namedVG_Spring_K[32]; /* along with it introduce Spring_K painting
+ starting to fix old bug .. nastyness that VG are indexes
+ rather find them by name tag to find it -> jow20090613 */
+
/* baking */
int sfra, efra;
int interval;
@@ -291,7 +301,7 @@ typedef struct SoftBody {
#define OB_SB_FACECOLL 1024
#define OB_SB_EDGECOLL 2048
#define OB_SB_COLLFINAL 4096
-//#define OB_SB_PROTECT_CACHE 8192
+#define OB_SB_BIG_UI 8192
#define OB_SB_AERO_ANGLE 16384
/* sb->solverflags */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
index ae3e5875aae..0a46b02e886 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
@@ -65,18 +65,48 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
if(x>0 && x<sx-1 && y>0 && y<sy-1) {
if(uv[2]!=0.0f) {
+ float uv_l, uv_r;
/* adaptive sampling, red (U) channel */
- dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3]));
- dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3]));
- dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3]));
+ /* prevent alpha zero UVs to be used */
+ uv_l= uv[-1]!=0.0f? fabs(uv[0]-uv[-3]) : 0.0f;
+ uv_r= uv[ 5]!=0.0f? fabs(uv[0]-uv[ 3]) : 0.0f;
+
+ //dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3]));
+ dx= 0.5f*(uv_l + uv_r);
+
+ uv_l= uvprev[-1]!=0.0f? fabs(uv[0]-uvprev[-3]) : 0.0f;
+ uv_r= uvnext[-1]!=0.0f? fabs(uv[0]-uvnext[-3]) : 0.0f;
+
+ //dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3]));
+ dx+= 0.25f*(uv_l + uv_r);
+
+ uv_l= uvprev[ 5]!=0.0f? fabs(uv[0]-uvprev[+3]) : 0.0f;
+ uv_r= uvnext[ 5]!=0.0f? fabs(uv[0]-uvnext[+3]) : 0.0f;
+
+ //dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3]));
+ dx+= 0.25f*(uv_l + uv_r);
/* adaptive sampling, green (V) channel */
- dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1]));
-
- dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3]));
- dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3]));
+
+ uv_l= uv[-row+2]!=0.0f? fabs(uv[1]-uv[-row+1]) : 0.0f;
+ uv_r= uv[ row+2]!=0.0f? fabs(uv[1]-uv[ row+1]) : 0.0f;
+
+ //dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1]));
+ dy= 0.5f*(uv_l + uv_r);
+
+ uv_l= uvprev[-1]!=0.0f? fabs(uv[1]-uvprev[+1-3]) : 0.0f;
+ uv_r= uvnext[-1]!=0.0f? fabs(uv[1]-uvnext[+1-3]) : 0.0f;
+
+ //dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3]));
+ dy+= 0.25f*(uv_l + uv_r);
+
+ uv_l= uvprev[ 5]!=0.0f? fabs(uv[1]-uvprev[+1+3]) : 0.0f;
+ uv_r= uvnext[ 5]!=0.0f? fabs(uv[1]-uvnext[+1+3]) : 0.0f;
+
+ //dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3]));
+ dy+= 0.25f*(uv_l + uv_r);
/* UV to alpha threshold */
alpha= 1.0f - threshold*(dx+dy);
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 130cda9f107..2fbd93df0ce 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -61,12 +61,14 @@ extern struct Render R;
static ListBase *get_lights(ShadeInput *shi)
{
+ if(R.r.scemode & R_PREVIEWBUTS)
+ return &R.lights;
if(shi->light_override)
return &shi->light_override->gobject;
- else if(shi->mat && shi->mat->group)
+ if(shi->mat && shi->mat->group)
return &shi->mat->group->gobject;
- else
- return &R.lights;
+
+ return &R.lights;
}
#if 0
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 66175194048..bb491efdaba 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -2571,7 +2571,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float *co = NULL, *dx = NULL, *dy = NULL, fact, stencilTin=1.0;
float texvec[3], dxt[3], dyt[3], tempvec[3];
- int tex_nr, rgb= 0;
+ int i, tex_nr, rgb= 0;
if (R.r.scemode & R_NO_TEX) return;
tex_nr= 0;
@@ -2647,21 +2647,33 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
if(shi->osatex) {
- if(mtex->projx) {
- dxt[0]= mtex->size[0]*dx[mtex->projx-1];
- dyt[0]= mtex->size[0]*dy[mtex->projx-1];
- }
- else dxt[0]= 0.0;
- if(mtex->projy) {
- dxt[1]= mtex->size[1]*dx[mtex->projy-1];
- dyt[1]= mtex->size[1]*dy[mtex->projy-1];
- }
- else dxt[1]= 0.0;
- if(mtex->projx) {
- dxt[2]= mtex->size[2]*dx[mtex->projz-1];
- dyt[2]= mtex->size[2]*dy[mtex->projz-1];
+ if (!dx) {
+ for(i=0;i<2;i++) {
+ dxt[i] = dyt[i] = 0.0;
+ }
+ } else {
+ if(mtex->projx) {
+ dxt[0]= mtex->size[0]*dx[mtex->projx-1];
+ dyt[0]= mtex->size[0]*dy[mtex->projx-1];
+ } else {
+ dxt[0]= 0.0;
+ dyt[0]= 0.0;
+ }
+ if(mtex->projy) {
+ dxt[1]= mtex->size[1]*dx[mtex->projy-1];
+ dyt[1]= mtex->size[1]*dy[mtex->projy-1];
+ } else {
+ dxt[1]= 0.0;
+ dyt[1]= 0.0;
+ }
+ if(mtex->projz) {
+ dxt[2]= mtex->size[2]*dx[mtex->projz-1];
+ dyt[2]= mtex->size[2]*dy[mtex->projz-1];
+ } else {
+ dxt[2]= 0.0;
+ dyt[2]= 0.0;
+ }
}
- else dxt[2]= 0.0;
}
/* texture */
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index ffff7185fe4..8ed36e860b4 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -261,6 +261,12 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
// couldn't find something to cast the shadow on...
glMultMatrixd(oglmatrix);
}
+ else
+ { // we found the "ground", but the cast matrix doesn't take
+ // scaling in consideration, so we must apply the object scale
+ MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale();
+ glScalef(size[0], size[1], size[2]);
+ }
} else
{
@@ -384,5 +390,4 @@ void KX_BlenderRenderTools::Update2DFilter(vector<STR_String>& propNames, void*
void KX_BlenderRenderTools::Render2DFilters(RAS_ICanvas* canvas)
{
m_filtermanager.RenderFilters(canvas);
-}
-
+} \ No newline at end of file
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index bed99a4f502..30055a717e3 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -805,6 +805,10 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
bPoseChannel *pchan;
+ if(m_userpose==NULL && m_pose==NULL) {
+ BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ }
// get_pose_channel accounts for NULL pose, run on both incase one exists but
// the channel doesnt
@@ -950,14 +954,18 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
if (!m_userpose) {
- obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ if(!m_pose)
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
- pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+ // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+ pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
- VECCOPY (pchan->loc, matrix[3]);
- Mat4ToSize(matrix, pchan->size);
- Mat4ToQuat(matrix, pchan->quat);
+ if(pchan) {
+ VECCOPY (pchan->loc, matrix[3]);
+ Mat4ToSize(matrix, pchan->size);
+ Mat4ToQuat(matrix, pchan->quat);
+ }
}
else {
MT_Vector3 loc;
@@ -969,15 +977,24 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
// same as above
if (!m_userpose) {
- obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ if(!m_pose)
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
- pchan= verify_pose_channel(m_userpose, string);
+ // pchan= verify_pose_channel(m_userpose, string);
+ pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
// for some reason loc.setValue(pchan->loc) fails
- pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
- pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
- pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
+ if(pchan) {
+ pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
+ pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
+ pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
+ }
+ }
+
+ if(pchan==NULL) {
+ PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
+ return NULL;
}
pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
@@ -1051,6 +1068,7 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
+ KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
@@ -1094,3 +1112,23 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}
+
+PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+ PyObject *ret= PyList_New(0);
+ PyObject *item;
+
+ bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
+
+ if(pose) {
+ bPoseChannel *pchan;
+ for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+ item= PyUnicode_FromString(pchan->name);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ }
+
+ return ret;
+}
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index e328ce126ca..6003e23e315 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -114,7 +114,7 @@ public:
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
+ static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
/* attribute check */
static int CheckFrame(void *self, const PyAttributeDef*)
{
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index e1e176840a6..684d89d492b 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -60,6 +60,7 @@ public:
void GetMRDPose(struct bPose **pose);
void GetPose(struct bPose **pose);
void SetPose (struct bPose *pose);
+ struct bPose *GetOrigPose() {return m_pose;} // never edit this, only for accessing names
void ApplyPose();
void RestorePose();
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index 7cb287d02b2..de820ddaaae 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -146,7 +146,7 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName),
KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject),
KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody),
- KX_PYATTRIBUTE_STRING_RW("body", 0, 100, false, KX_NetworkMessageActuator, m_body),
+ KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
{ NULL } //Sentinel
};
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 748b0667061..db1595db36f 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -402,6 +402,8 @@ void KX_BulletPhysicsController::RestoreDynamics()
btRigidBody *body = GetRigidBody();
if (body && m_suspended)
{
+ // before make sure any position change that was done in this logic frame are accounted for
+ SetTransform();
GetPhysicsEnvironment()->updateCcdPhysicsController(this,
m_savedMass,
m_savedCollisionFlags,
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 96e8f61e4c8..606ba0e16c2 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -328,7 +328,7 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none
KX_MeshProxy *kx_mesh = static_cast<KX_MeshProxy*>BGE_PROXY_REF(value);
/* sets the error */
- if (*object==NULL) {
+ if (kx_mesh==NULL) {
PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix);
return false;
}
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 673f42283dd..39381182944 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -104,7 +104,8 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// do nothing on negative events, otherwise sounds are played twice!
bool bNegativeEvent = IsNegativeEvent();
-
+ bool bPositiveEvent = m_posevent;
+
RemoveAllEvents();
if (!m_soundObject)
@@ -153,8 +154,17 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// remember that we tried to stop the actuator
m_isplaying = false;
}
- else
- {
+
+#if 1
+ // Warning: when de-activating the actuator, after a single negative event this runs again with...
+ // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false
+ // and assumes this is a positive event.
+ // check that we actually have a positive event so as not to play sounds when being disabled.
+ else if(bPositiveEvent) { // <- added since 2.49
+#else
+ else { // <- works in most cases except a loop-end sound will never stop unless
+ // the negative pulse is done continuesly
+#endif
if (!m_isplaying)
{
switch (m_type)
diff --git a/source/gameengine/PyDoc/API_intro.py b/source/gameengine/PyDoc/API_intro.py
index 578b56eb2b0..0a687088627 100644
--- a/source/gameengine/PyDoc/API_intro.py
+++ b/source/gameengine/PyDoc/API_intro.py
@@ -24,7 +24,7 @@ The Blender Game Engine Python API Reference
Additional Modules:
-------------------
- These modules have no GameEngine spesific functionality but are useful in many cases.
+ These modules have no GameEngine specific functionality but are useful in many cases.
- L{Mathutils}
- L{Geometry}
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py
index 63dd1a7fabf..35d8cd63c44 100644
--- a/source/gameengine/PyDoc/GameTypes.py
+++ b/source/gameengine/PyDoc/GameTypes.py
@@ -310,6 +310,8 @@ class BL_ActionActuator(SCA_IActuator):
@ivar action: The name of the action to set as the current action.
@type action: string
+ @ivar channelNames: A list of channel names that may be used with L{setChannel} and L{getChannel}
+ @type channelNames: list of strings
@ivar frameStart: Specifies the starting frame of the animation.
@type frameStart: float
@ivar frameEnd: Specifies the ending frame of the animation.
@@ -340,7 +342,8 @@ class BL_ActionActuator(SCA_IActuator):
"""
Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported.
- @param channel: A string specifying the name of the bone channel, created if missing.
+ @note: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation.
+ @param channel: A string specifying the name of the bone channel, error raised if not in L{channelNames}.
@type channel: string
@param matrix: A 4x4 matrix specifying the overriding transformation
as an offset from the bone's rest position.
@@ -349,7 +352,7 @@ class BL_ActionActuator(SCA_IActuator):
def getChannel(channel):
"""
- @param channel: A string specifying the name of the bone channel. error raised if missing.
+ @param channel: A string specifying the name of the bone channel. error raised if not in L{channelNames}.
@type channel: string
@rtype: tuple
@return: (loc, size, quat)