Hi,
I’m using a software called Structure Synth (http://structuresynth.sourceforge.net/index.php). There exists import scripts for older Blender versions, but the one that I found and want to use does something wrong when it places cube primitives.
I think there is something wrong with the translation matrix, but I can’t figure out what it is…
Maybe one of you can see the problem…
The problem looks like that:
But cubes should placed in that way:
argsIndex += 1
transMatrix = ((float(args[argsIndex + 0]), float(args[argsIndex + 1]), float(args[argsIndex + 2]), float(args[argsIndex + 12])),
(float(args[argsIndex + 4]), float(args[argsIndex + 5]), float(args[argsIndex + 6]), float(args[argsIndex + 13])),
(float(args[argsIndex + 8]), float(args[argsIndex + 9]), float(args[argsIndex + 10]), float(args[argsIndex + 14])),
(float(args[argsIndex + 3]), float(args[argsIndex + 7]), float(args[argsIndex + 11]), float(args[argsIndex + 15])))
print (transMatrix)
mat = mathutils.Matrix(transMatrix)
print(mat)
loc, rot, sca = mat.decompose()
print(loc, rot, sca)
loc = tuple(loc)
sca = tuple(sca)
rot = tuple(mat.to_euler())
print (loc, sca, rot)
argsIndex += 16
colR = eval(args[argsIndex])
argsIndex += 1
colG = eval(args[argsIndex])
argsIndex += 1
colB = eval(args[argsIndex])
argsIndex += 1
alpha = 1.0
bpy.context.object.color = (colR, colG, colB, alpha)
objColor = bpy.context.object.color
create_CubeMesh('cubePrimary', objColor, loc, rot, sca)
Complete import script: http://pastebin.com/22d7wxgB
Gegards and thx,
Stefan