[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2511] trunk/py/scripts/addons/ io_export_unreal_psk_psa.py: material fix id.
John Phan
darkneter at gmail.com
Mon Oct 24 06:31:06 CEST 2011
Revision: 2511
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2511
Author: darknet
Date: 2011-10-24 04:31:03 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
material fix id. uv limited boolean added.
Modified Paths:
--------------
trunk/py/scripts/addons/io_export_unreal_psk_psa.py
Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py 2011-10-23 23:04:00 UTC (rev 2510)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py 2011-10-24 04:31:03 UTC (rev 2511)
@@ -18,8 +18,8 @@
bl_info = {
"name": "Export Unreal Engine Format(.psk/.psa)",
"author": "Darknet/Optimus_P-Fat/Active_Trash/Sinsoft/VendorX",
- "version": (2, 3),
- "blender": (2, 5, 7),
+ "version": (2, 4),
+ "blender": (2, 6, 0),
"api": 36079,
"location": "File > Export > Skeletal Mesh/Animation Data (.psk/.psa)",
"description": "Export Skeleletal Mesh/Animation Data",
@@ -257,6 +257,7 @@
self.LodStyle = 0
def dump(self):
+ print("DATA MATERIAL:",self.MaterialName)
data = pack('64siLiLii', str.encode(self.MaterialName), self.TextureIndex, self.PolyFlags, self.AuxMaterial, self.AuxFlags, self.LodBias, self.LodStyle)
return data
@@ -667,15 +668,37 @@
current_mesh = current_obj.data
#collect a list of the material names
+ print("== MATERIAL EXPORT LIST & INDEX")
if len(current_obj.material_slots) > 0:
counter = 0
+
while counter < len(current_obj.material_slots):
+ print("[MATERIAL IDX:",counter,"=]")
MaterialName.append(current_obj.material_slots[counter].name)
- print("Material Name:",current_obj.material_slots[counter].name)
+ #print("Material Name:",current_obj.material_slots[counter].name)
+ #print("Material Name:",dir(current_obj.material_slots[counter].material))
+ #print("TEXTURE:",dir(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath))
+ #print("Imagepath:",(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath))
+ #print("TEXTURES:",len(current_obj.material_slots[counter].material.texture_slots))
+ #while slot in current_obj.material_slots[counter].material.texture_slots:
+ #print(dir(slot))
+ #if slot.texture.image.filepath != None:
+ #print("file path:",slot.texture.image.filepath)
+ if current_obj.material_slots[counter].material.texture_slots[0] != None:
+ if current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath != None:
+ print("TEXTURE PATH:",current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath)
+ #print("Imagepath:",(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath_raw))
+ #print("Imagepath2:",dir(current_obj.material_slots[counter].material.texture_slots[0].texture.image))
#create the current material
- psk_file.GetMatByIndex(counter)
+ matdata = psk_file.GetMatByIndex(counter)
+ matdata.MaterialName = current_obj.material_slots[counter].name
+ matdata.TextureIndex = counter
+ matdata.AuxMaterial = counter
#print("materials: ",MaterialName[counter])
counter += 1
+ print("PSK INDEX:",matdata.TextureIndex)
+ print("=====")
+ print("")
# object_mat = current_obj.materials[0]
object_material_index = current_obj.active_material_index
@@ -758,16 +781,20 @@
uv[1] = 1.0 - uv[1]
#deal with the min and max value
+ #check if limit boolean
#if value is over the set limit it will null the uv texture
- if (uv[0] > 1):
- uv[0] = 1
- if (uv[0] < 0):
- uv[0] = 0
- if (uv[1] > 1):
- uv[1] = 1
- if (uv[1] < 0):
- uv[1] = 0
-
+ if bpy.context.scene.limituv:
+ if (uv[0] > 1):
+ uv[0] = 1
+ if (uv[0] < 0):
+ uv[0] = 0
+ if (uv[1] > 1):
+ uv[1] = 1
+ if (uv[1] < 0):
+ uv[1] = 0
+ #print("limited on")
+ #else:
+ #print("limited off")
# RE - Append untransformed vector (for normal calc below)
# TODO: convert to Blender.Mathutils
@@ -849,7 +876,7 @@
tri.SmoothingGroups = 1
else:
tri.SmoothingGroups = 0
-
+ #tri.SmoothingGroups = 1
tri.MatIndex = object_material_index
#print(tri)
psk_file.AddFace(tri)
@@ -1822,6 +1849,11 @@
name="bool export psa",
description="bool for exporting this psa format",
default=True)
+
+bpy.types.Scene.limituv = BoolProperty(
+ name="bool limit UV",
+ description="limit UV co-ordinates to [0-1]",
+ default=False)
class UEAPropertyGroup(bpy.types.PropertyGroup):
## create Properties for the collection entries:
@@ -1938,6 +1970,11 @@
"animation data",
default= False,
)
+ limituvbool = BoolProperty(
+ name="Limit UV Co-ordinates",
+ description="Limit UV co-ordinates to [0-1]",
+ default= False,
+ )
@classmethod
def poll(cls, context):
@@ -1965,6 +2002,10 @@
else:
bpy.context.scene.unrealignoreactionmatchcount = False
+ if(self.limituvbool):
+ bpy.types.Scene.limituv = True
+ else:
+ bpy.types.Scene.limituv = False
write_data(self.filepath, context)
self.report({'WARNING', 'INFO'}, exportmessage)
@@ -1993,9 +2034,9 @@
#FPS #it use the real data from your scene
layout.prop(rd.render, "fps")
+ layout.prop(rd, "limituv")
layout.operator(OBJECT_OT_UnrealExport.bl_idname)
-
layout.prop(rd, "unrealdisplayactionsets")
ArmatureSelect = None
@@ -2322,8 +2363,12 @@
#print("[vertex id, weight]",v[0],":",v[1]) #array (0,0)
bpy.context.scene.objects.link(obmesh)
print("Mesh Material Count:",len(me_ob.materials))
+ matcount = 0
+ print("MATERIAL ID OREDER:")
for mat in me_ob.materials:
- print("-Material:",mat.name)
+ print("-Material:",mat.name,"INDEX:",matcount)
+ matcount += 1
+ print("")
print("Object Name:",obmesh.name)
bpy.context.scene.update()
#bpy.ops.wm.console_toggle()
More information about the Bf-extensions-cvs
mailing list