Skip to content

Commit 0f86d19

Browse files
committedNov 21, 2023
clean some stuff
1 parent 3f8b289 commit 0f86d19

8 files changed

+8
-1065
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dist/
33
__pycache__
44
result.csv
55
*.spec
6+
.vscode/
67
ExportObj
78
lm_samples
89
missing_files*

‎.vscode/launch.json

-16
This file was deleted.

‎.vscode/settings.json

-3
This file was deleted.

‎export_obj.py

+5-18
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,12 @@ def extract_solid2model(root_node, node):
189189
if len(obj_chunk.materials_names) > 0:
190190
mat = obj_chunk.materials_names[geom.material_index]
191191
else:
192-
if (
193-
obj_chunk.material_insts_lt_v16 is not None
194-
and len(obj_chunk.material_insts_lt_v16) > 0
195-
):
192+
if obj_chunk.material_insts_lt_v16 is not None and len(obj_chunk.material_insts_lt_v16) > 0:
196193
mat_idx = obj_chunk.material_insts_lt_v16[geom.material_index]
197194
elif obj_chunk.materials is not None and len(obj_chunk.materials) > 0:
198195
mat_idx = obj_chunk.materials[geom.material_index]
199196
else:
200-
mat_idx = obj_chunk.custom_materials[
201-
geom.material_index
202-
].material_user_inst
197+
mat_idx = obj_chunk.custom_materials[geom.material_index].material_user_inst
203198

204199
if type(root_node.nodes[mat_idx]) == str:
205200
mat = root_node.nodes[mat_idx].split(".")[0]
@@ -211,11 +206,7 @@ def extract_solid2model(root_node, node):
211206
for chunk in visual_node.body:
212207
if isinstance(chunk, Container) and chunk.chunkId == 0x0900600F:
213208
if len(chunk.chunk.vertexStreams) == 0:
214-
meshes.append(
215-
export_CPlugVisualIndexedTriangles_without_vertex_stream(
216-
visual_node, mat
217-
)
218-
)
209+
meshes.append(export_CPlugVisualIndexedTriangles_without_vertex_stream(visual_node, mat))
219210
continue_meshes = True
220211
if continue_meshes:
221212
continue
@@ -308,9 +299,7 @@ def extract_mesh(data, static_node, lod, offset_index, ent_idx, off_pos, off_rot
308299
final_pos = [ent.pos, *off_pos]
309300
final_rot = [ent.rot, *off_rot]
310301

311-
meshes = extract_mesh(
312-
data, model, 1, offset_index, ent_idx, final_pos, final_rot
313-
)
302+
meshes = extract_mesh(data, model, 1, offset_index, ent_idx, final_pos, final_rot)
314303
filename = (
315304
os.path.basename(file).split(".")[0]
316305
+ ("_" if len(offset_index) > 0 else "")
@@ -341,9 +330,7 @@ def extract_meshes(root_data, data, off_pos=None, off_rot=None, extracted_files=
341330
final_pos = [ent.pos, *off_pos]
342331
final_rot = [ent.rot, *off_rot]
343332

344-
result += extract_meshes(
345-
root_data, model, final_pos, final_rot, extracted_files
346-
)
333+
result += extract_meshes(root_data, model, final_pos, final_rot, extracted_files)
347334
return result
348335
elif data.classId == 0x900C000:
349336
# print("skip surf (for now?)")

‎lightmap.py

-202
This file was deleted.

‎src/experiments.py

-726
This file was deleted.

‎src/gbx_structs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2919,7 +2919,8 @@ def check(obj, ctx):
29192919
StopIf(this.version < 13),
29202920
"vfxFile" / GbxNodeRef,
29212921
StopIf(this.version < 15),
2922-
"MaterialModifier" / If(this.EntityModel >= 0, GbxNodeRef),
2922+
"MaterialModifier"
2923+
/ If(lambda this: this.EntityModel >= 0 or (this.EntityModel == -1 and this.EntityModelEdition == -1), GbxNodeRef),
29232924
)
29242925
body_chunks[0x2E00201A] = Struct("u01" / GbxNodeRef)
29252926
body_chunks[0x2E00201C] = Struct(

‎utils_bloc.py

-99
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.