Skip to content

Commit

Permalink
make batch detection more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Feb 12, 2023
1 parent 8cf3df1 commit 882cf87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blender/MapsModelsImporter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
bl_info = {
"name": "Maps Models Importer",
"author": "Elie Michel",
"version": (0, 6, 0),
"version": (0, 6, 1),
"blender": (3, 1, 0),
"location": "File > Import > Google Maps Capture",
"description": "Import meshes from a Google Maps or Google Earth capture",
Expand Down
12 changes: 9 additions & 3 deletions blender/MapsModelsImporter/google_maps_rd.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
MAX_BLOCKS = int(MAX_BLOCKS_STR)

def numpySave(array, file):
np.array([array.ndim], dtype=np.int).tofile(file)
np.array(array.shape, dtype=np.int).tofile(file)
np.array([array.ndim], dtype=np.int32).tofile(file)
np.array(array.shape, dtype=np.int32).tofile(file)
dt = array.dtype.descr[0][1][1:3].encode('ascii')
file.write(dt)
array.tofile(file)
Expand Down Expand Up @@ -190,11 +190,17 @@ def extractRelevantCalls(self, drawcalls, _strategy=4):
first_call = "" # Try from the beginning on
last_call = "Draw()"
drawcall_prefix = "DrawIndexed"
min_drawcall = 0
while True:
skipped_drawcalls, new_min_drawcall = self.findDrawcallBatch(drawcalls[min_drawcall:], first_call, drawcall_prefix, last_call)
if not skipped_drawcalls or self.hasUniform(skipped_drawcalls[0], "_w"):
break
min_drawcall += new_min_drawcall
else:
print("Error: Could not find the beginning of the relevant 3D draw calls")
return [], "none"

print(f"Trying scraping strategy #{_strategy}...")
print(f"Trying scraping strategy #{_strategy} (from draw call #{min_drawcall})...")
relevant_drawcalls, _ = self.findDrawcallBatch(
drawcalls[min_drawcall:],
first_call,
Expand Down

0 comments on commit 882cf87

Please sign in to comment.