[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16038] branches/blender-2.47: branches/ blender-2.47

Diego Borghetti bdiego at gmail.com
Sat Aug 9 17:59:21 CEST 2008


Revision: 16038
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16038
Author:   bdiego
Date:     2008-08-09 17:59:21 +0200 (Sat, 09 Aug 2008)

Log Message:
-----------
branches/blender-2.47

Merge from trunk:
	Revision: 16014
	Revision: 16022
	Revision: 16024
	Revision: 16026
	Revision: 16028
	Revision: 16036

Modified Paths:
--------------
    branches/blender-2.47/release/scripts/flt_export.py
    branches/blender-2.47/release/scripts/flt_palettemanager.py
    branches/blender-2.47/release/scripts/import_dxf.py
    branches/blender-2.47/source/blender/blenkernel/intern/anim.c
    branches/blender-2.47/source/blender/blenkernel/intern/particle_system.c
    branches/blender-2.47/source/blender/src/transform_conversions.c
    branches/blender-2.47/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: branches/blender-2.47/release/scripts/flt_export.py
===================================================================
--- branches/blender-2.47/release/scripts/flt_export.py	2008-08-09 14:47:51 UTC (rev 16037)
+++ branches/blender-2.47/release/scripts/flt_export.py	2008-08-09 15:59:21 UTC (rev 16038)
@@ -525,8 +525,8 @@
 	def __init__(self):
 		self.vertex_index_lst = []
 		self.mface = None
-		self.texture_index = -1
-		self.material_index = -1
+		self.texture_index = 65535
+		self.material_index = 65535
 		self.color_index = 127
 		self.renderstyle = 0
 		self.twoside = 0
@@ -979,8 +979,14 @@
 			self.header.fw.write_char(0)                                    # Reserved
 			self.header.fw.write_char(alpha)                                    # Template
 			self.header.fw.write_short(-1)                                  # Detail tex pat index
-			self.header.fw.write_short(face_desc.texture_index)             # Tex pattern index
-			self.header.fw.write_short(face_desc.material_index)            # material index
+			if face_desc.texture_index == -1:
+				self.header.fw.write_ushort(65535)
+			else:
+				self.header.fw.write_ushort(face_desc.texture_index)	# Tex pattern index
+			if face_desc.material_index == -1:
+				self.header.fw.write_ushort(65535)
+			else:
+				self.header.fw.write_ushort(face_desc.material_index)		# material index
 			self.header.fw.write_short(0)                                   # SMC code
 			self.header.fw.write_short(0)                                   # Feature 					code
 			self.header.fw.write_int(0)                                     # IR material code
@@ -1015,7 +1021,10 @@
 				self.header.fw.write_ushort(8 + (mtex * 8))		# Length
 				self.header.fw.write_uint(uvmask)								# UV mask
 				for i in xrange(mtex):
-					self.header.fw.write_ushort(face_desc.images[i])			# Tex pattern index
+					if face_desc.images[i] == -1:
+						self.header.fw.write_ushort(65535)
+					else:
+						self.header.fw.write_ushort(face_desc.images[i])			# Tex pattern index
 					self.header.fw.write_ushort(0)								# Tex effect
 					self.header.fw.write_ushort(0)								# Tex Mapping index
 					self.header.fw.write_ushort(0)								# Tex data. User defined
@@ -1092,7 +1101,7 @@
 				write_prop(self.header.fw,ftype,self.object.properties['FLT']['EXT'][propname],length)
 			#write extension data
 			for i in xrange(datalen):
-				self.header.fw.write_char(self.object.properties['FLT']['EXT']['data'][i])
+				self.header.fw.write_uchar(struct.unpack('>B', struct.pack('>B', self.object.properties['FLT']['EXT']['data'][i]))[0])
 			self.write_pop_extension()
 
 
@@ -1180,8 +1189,8 @@
 			desc = self.GRR.request_vertex_desc(i)
 			self.fw.write_short(70)                         # Vertex with color normal and uv opcode.
 			self.fw.write_ushort(64)                        # Length of record
-			self.fw.write_ushort(0)							# Color name index
-			self.fw.write_short(0x20000000)					# Flags
+			self.fw.write_ushort(0)				# Color name index
+			self.fw.write_short(1 << 14)			# Frozen Normal
 			self.fw.write_double(desc.x)
 			self.fw.write_double(desc.y)
 			self.fw.write_double(desc.z)
@@ -1199,7 +1208,7 @@
 			print 'Writing texture palette.'
 		# Write record for texture palette
 		for i, img in enumerate(self.GRR.texture_lst):
-			filename = tex_files[img.name].replace("\\", "/")
+			filename = tex_files[img.name]
 			self.fw.write_short(64)                                         # Texture palette opcode.
 			self.fw.write_short(216)                                        # Length of record
 			self.fw.write_string(filename, 200) # Filename
@@ -1245,7 +1254,7 @@
 			cpalette = defaultp.pal
 		count = len(cpalette)
 		for i in xrange(count):
-			color = struct.unpack('>BBBB',struct.pack('>I',cpalette[i]))
+			color = struct.unpack('>BBBB',struct.pack('>i',cpalette[i]))
 			self.fw.write_uchar(color[3])               # alpha
 			self.fw.write_uchar(color[2])               # b
 			self.fw.write_uchar(color[1])               # g

Modified: branches/blender-2.47/release/scripts/flt_palettemanager.py
===================================================================
--- branches/blender-2.47/release/scripts/flt_palettemanager.py	2008-08-09 14:47:51 UTC (rev 16037)
+++ branches/blender-2.47/release/scripts/flt_palettemanager.py	2008-08-09 15:59:21 UTC (rev 16038)
@@ -1,388 +1,505 @@
-#!BPY
-
-"""
-Name: 'FLT Palette Manager'
-Blender: 240
-Group: 'Misc'
-Tooltip: 'Manage FLT colors'
-"""
-
-__author__ = "Geoffrey Bantle"
-__version__ = "1.0 11/21/2007"
-__email__ = ('scripts', 'Author, ')
-__url__ = ('blender', 'blenderartists.org')
-
-__bpydoc__ ="""\
-
-This script manages colors in OpenFlight databases. OpenFlight is a
-registered trademark of MultiGen-Paradigm, Inc.
-
-Todo:
--Figure out whats causing the PC speaker to beep when initializing...
-
-Feature overview and more availible at:
-http://wiki.blender.org/index.php/Scripts/Manual/FLTools
-"""
-
-# --------------------------------------------------------------------------
-# flt_palettemanager.py version 0.1 2005/04/08
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Copyright (C) 2007: Blender Foundation
-#
-# 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
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
-
-import Blender.Draw as Draw
-from Blender.BGL import *
-import Blender
-import flt_properties
-import flt_defaultp as defaultp
-from flt_properties import *
-
-
-palette_size = 12
-palette_x = 0
-palette_y = 0
-
-colors = list()
-curint = 1.0
-curswatch = 0
-#make a default palette, not very useful.
-cinc = 1.0 / 1024.0
-cstep = 0.0
-picker = None
-ptt = ""
-for i in xrange(1024):
-	colors.append([cstep,cstep,cstep])
-	cstep = cstep + cinc
-def update_state():
-	state = dict()
-	state["activeScene"] = Blender.Scene.getCurrent()
-	state["activeObject"] = state["activeScene"].getActiveObject()
-	state["activeMesh"] = None
-	if state["activeObject"] and state["activeObject"].type == 'Mesh':
-		state["activeMesh"] = state["activeObject"].getData(mesh=True)
-	
-	state["activeFace"] = None
-	if state["activeMesh"]:
-		if state["activeMesh"].faceUV and state["activeMesh"].activeFace != None:
-			state["activeFace"] = state["activeMesh"].faces[state["activeMesh"].activeFace]
-		
-	return state
-	
-def pack_face_index(index, intensity):
-	return ((127*intensity)+(128*index))
-def unpack_face_index(face_index):
-	index = face_index / 128
-	intensity = float(face_index - 128.0 * index) / 127.0
-	return(index,intensity)
-
-def event(evt,val):
-	global palette_size
-	global palette_x
-	global palette_y
-	global colors
-	global curint
-	global curswatch
-	
-	areas = Blender.Window.GetScreenInfo()
-	curarea = Blender.Window.GetAreaID()
-	curRect = None
-	editmode = 0
-
-	for area in areas:
-		if area['id'] == curarea:
-			curRect = area['vertices']
-			break
-		
-	if evt == Draw.LEFTMOUSE:
-		mval = Blender.Window.GetMouseCoords()
-		rastx = mval[0] - curRect[0]
-		rasty = mval[1] - curRect[1]
-		
-		swatchx = (rastx -palette_x) / palette_size #+state["palette_x"]
-		swatchy = (rasty -palette_y) / palette_size #+state["palette_y"]
-                if rastx > palette_x and rastx < (palette_x + palette_size * 32) and rasty > palette_y and rasty < (palette_y+ palette_size* 32):
-                        if swatchx < 32 and swatchy < 32:
-                                curswatch = (swatchx * 32) + swatchy
-                                Draw.Redraw(1)
-		
-                elif swatchy < 34 and swatchx < 32:
-                        curint = 1.0 - (float(rastx-palette_x)/(palette_size*32.0))
-                        Draw.Redraw(1)
-	
-	#copy current color and intensity to selected faces.
-	elif evt == Draw.CKEY:
-		
-		if Blender.Window.EditMode():
-			Blender.Window.EditMode(0)
-			editmode = 1
-		state = update_state()
-		
-		#retrieve color from palette
-		color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
-		actmesh = state["activeMesh"]
-		if actmesh: 
-			if(Blender.Window.GetKeyQualifiers() != Blender.Window.Qual["CTRL"]):
-				selfaces = list()
-				for face in actmesh.faces:
-					if face.sel:
-						selfaces.append(face)
-				
-				if not "FLT_COL" in actmesh.faces.properties:
-					actmesh.faces.addPropertyLayer("FLT_COL",Blender.Mesh.PropertyTypes["INT"])
-					for face in actmesh.faces:
-						face.setProperty("FLT_COL",127) #default
-				try:
-					actmesh.activeColorLayer = "FLT_Fcol"
-				except:
-					actmesh.addColorLayer("FLT_Fcol")
-					actmesh.activeColorLayer = "FLT_Fcol"
-				
-
-				for face in selfaces:
-					#First append packed index + color and store in face property
-					face.setProperty("FLT_COL",int(pack_face_index(curswatch,curint))) 
-					#Save baked color to face vertex colors
-					for col in face.col:
-						col.r = int(color[0] * curint)
-						col.g = int(color[1] * curint)
-						col.b = int(color[2] * curint)
-						col.a = int(color[3] * curint)
-			else:
-				if Blender.Mesh.Mode() == Blender.Mesh.SelectModes['VERTEX']:
-					if not 'FLT_VCOL' in actmesh.verts.properties:
-						actmesh.verts.addPropertyLayer("FLT_VCOL",Blender.Mesh.PropertyTypes["INT"])
-						for vert in actmesh.verts:
-							vert.setProperty("FLT_VCOL",127)
-					else:
-						for vert in actmesh.verts:
-							if vert.sel:
-								vert.setProperty("FLT_VCOL",int(pack_face_index(curswatch,curint)))
-			
-			if editmode:
-				Blender.Window.EditMode(1)
-			
-			Blender.Window.RedrawAll()
-	
-	#grab color and intensity from active face
-	elif evt == Draw.VKEY:
-		if Blender.Window.EditMode():
-			Blender.Window.EditMode(0)
-			editmode = 1
-		state = update_state()
-		
-		actmesh = state["activeMesh"]

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list