Blender shell protocol fixes

This commit is contained in:
Jack Andersen 2016-08-12 09:41:51 -10:00
parent 719c62f09f
commit eb5cdf40b0
3 changed files with 20 additions and 4 deletions

View File

@ -395,6 +395,10 @@ public:
std::unordered_map<std::string, int32_t> iprops;
Material(BlenderConnection& conn);
bool operator==(const Material& other) const
{
return source == other.source && texs == other.texs && iprops == other.iprops;
}
};
std::vector<std::vector<Material>> materialSets;

View File

@ -249,7 +249,14 @@ def cookcol(writebuf, mesh_obj):
for m in copy_mesh.materials:
writebuf(struct.pack('I', len(m.name)))
writebuf(m.name.encode())
writebuf(struct.pack('Ib', m.retro_collision_type, m.retro_projectile_passthrough))
cType = 0
if 'retro_collision_type' in m:
cType = m['retro_collision_type']
projPassthrough = False
if 'retro_projectile_passthrough' in m:
projPassthrough = m['retro_projectile_passthrough']
writebuf(struct.pack('Ib', cType, projPassthrough))
# Send verts
writebuf(struct.pack('I', len(copy_mesh.vertices)))

View File

@ -156,8 +156,13 @@ def dataout_loop():
return
elif cmdargs[0] == 'MESHLIST':
meshCount = 0
for meshobj in bpy.data.objects:
if meshobj.type == 'MESH':
if meshobj.type == 'MESH' and not meshobj.library:
meshCount += 1
writepipebuf(struct.pack('I', meshCount))
for meshobj in bpy.data.objects:
if meshobj.type == 'MESH' and not meshobj.library:
writepipeline(meshobj.name.encode())
elif cmdargs[0] == 'MESHCOMPILE':
@ -214,7 +219,7 @@ def dataout_loop():
elif cmdargs[0] == 'LIGHTCOMPILEALL':
writepipeline(b'OK')
lampCount = 0;
for obj in bpy.context.scene:
for obj in bpy.context.scene.objects:
if obj.type == 'LAMP':
lampCount += 1
@ -239,7 +244,7 @@ def dataout_loop():
writepipebuf(struct.pack('fff', ambient_color[0], ambient_color[1], ambient_color[2]))
writepipebuf(struct.pack('IIfffffb', 0, 0, ambient_energy, 0.0, 1.0, 0.0, 0.0, False))
for obj in bpy.context.scene:
for obj in bpy.context.scene.objects:
if obj.type == 'LAMP':
wmtx = obj.matrix_world
writepipebuf(struct.pack('ffffffffffffffff',