mirror of
https://github.com/OpenFusionProject/scripts.git
synced 2024-11-26 07:10:06 +00:00
Compare commits
No commits in common. "249af1d2d3f5e20dd665540ea818ed25180109d2" and "b70816fa64140d5802d2ef781906f509834e7da0" have entirely different histories.
249af1d2d3
...
b70816fa64
@ -4,9 +4,9 @@ import bpy
|
||||
import bmesh
|
||||
import os
|
||||
|
||||
dongpath = (os.path.expandvars('%userprofile%') + "/AppData/LocalLow/Unity/Web Player/Cache/FusionFall")
|
||||
dongpath = r'C:\Users\gents\AppData\LocalLow\Unity\Web Player\Cache\Fusionfall'
|
||||
env = UnityEnvironment(base_path=dongpath)
|
||||
outpath = (os.path.expandvars('%userprofile%') + "/3D Objects/FFTerrainMeshes")
|
||||
outpath = r'C:\Users\gents\3D Objects\FFTerrainMeshes'
|
||||
|
||||
def uvs_from_vert(uv_layer, v):
|
||||
uvs = []
|
||||
@ -15,12 +15,6 @@ def uvs_from_vert(uv_layer, v):
|
||||
uvs.append(uv_data.uv)
|
||||
return uvs
|
||||
|
||||
def delete_all_objects():
|
||||
for i in bpy.context.scene.objects:
|
||||
i.select_set(True)
|
||||
|
||||
bpy.ops.object.delete()
|
||||
|
||||
def rip_terrain_mesh(f, outpath, clear=False):
|
||||
dong = Asset.from_file(f, environment=env)
|
||||
|
||||
@ -134,11 +128,13 @@ def rip_terrain_mesh(f, outpath, clear=False):
|
||||
# export
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
name = terrainData['m_Name']
|
||||
outfile = f"{name}.fbx"
|
||||
bpy.ops.export_scene.fbx(filepath=os.path.join(outpath, outfile))
|
||||
outfile = f"{name}.obj"
|
||||
bpy.ops.export_scene.obj(filepath=os.path.join(outpath, outfile))
|
||||
|
||||
if(clear):
|
||||
delete_all_objects()
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete()
|
||||
|
||||
dongs = os.listdir(dongpath)
|
||||
for dongname in dongs:
|
||||
@ -151,4 +147,4 @@ for dongname in dongs:
|
||||
with open(os.path.join(dongpath, dongname, assetname), "rb") as f:
|
||||
outdir = os.path.join(outpath, dongname, assetname)
|
||||
os.makedirs(outdir, exist_ok=True)
|
||||
rip_terrain_mesh(f, outdir, True)
|
||||
rip_terrain_mesh(f, outdir)
|
Loading…
Reference in New Issue
Block a user