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