If somebody need, this is the blender script for loading Tomb Raider hair files (don't need to enter numbers by himself)
Code: Select all
import bpy
from mathutils import Vector
import struct
#w = 1 # weight
listOfVectors = []
model = open("C:\\Users\\User\\Documents\\test1.hair", "rb")
for i in range(1500):
arr = []
for i in range(3):
buf = model.read(76)
arr.append(Vector((list(struct.unpack("19f", buf))[:3])))
listOfVectors.append(arr)
model.close()
def MakePolyLine(objname, curvename, cList):
curvedata = bpy.data.curves.new(name=curvename, type='CURVE')
curvedata.dimensions = '3D'
objectdata = bpy.data.objects.new(objname, curvedata)
objectdata.location = (0,0,0) #object origin
bpy.context.scene.objects.link(objectdata)
polyline = curvedata.splines.new('NURBS')
polyline.points.add(len(cList)-1)
for num in range(len(cList)):
x, y, z = cList[num]
polyline.points[num].co = (x, y, z, 1)
polyline.order_u = len(polyline.points)-1
polyline.use_endpoint_u = True
for stred in listOfVectors:
MakePolyLine("NameOfMyCurveObject", "NameOfMyCurve", stred)