Сброшены трансформации в asp_sdf_to_asset.py и унифицированы за счет freecad_to_asset.py
This commit is contained in:
parent
748fcd1351
commit
1ea7e50ecd
8 changed files with 116 additions and 121 deletions
|
@ -12,30 +12,55 @@ sys.path.append('../blender/')
|
|||
from import_fcstd.importer import importer
|
||||
from utils.remove_collections import remove_collections
|
||||
from utils.cleanup_orphan_data import cleanup_orphan_data
|
||||
from utils.sdf_mesh_selector import sdf_mesh_selector
|
||||
from remesh import asset_setup
|
||||
from export.dae import export_dae
|
||||
from export.collision import export_col_stl
|
||||
|
||||
sys.path.append('/home/bm/bin/blender-git/blender_bin') # import blender module
|
||||
import bpy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
def freecad_asset_pipeline(fcstd_path, export_path, tessellation=20):
|
||||
def freecad_asset_pipeline(fcstd_path,
|
||||
mesh_export_path,
|
||||
tessellation=10,
|
||||
blend_path=None,
|
||||
sdf_path=None):
|
||||
""" Setup FreeCAD scene to CG asset """
|
||||
remove_collections()
|
||||
cleanup_orphan_data()
|
||||
importer(fcstd_path, tessellation)
|
||||
if sdf_path is not None:
|
||||
sdf_mesh_selector(sdf_path)
|
||||
asset_setup()
|
||||
bpy.ops.wm.save_as_mainfile(filepath="/home/bm/test.blend")
|
||||
export_dae(export_path)
|
||||
export_col_stl(export_path)
|
||||
if blend_path is not None:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=blend_path)
|
||||
export_dae(mesh_export_path)
|
||||
export_col_stl(mesh_export_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
fcstd_path = '/media/disk/robossembler/io-import-fcstd/test/solids.FCStd'
|
||||
export_path = 'asset_generator/'
|
||||
freecad_asset_pipeline(fcstd_path, export_path, tessellation=20)
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Convert and setup FreeCAD solid objects to 3d assets mesh files.')
|
||||
parser.add_argument(
|
||||
'--fcstd_path', type=str, help='Path to source FreeCAD scene', required=True)
|
||||
parser.add_argument(
|
||||
'--mesh_export_path', type=str, help='Path for export meshes', required=True)
|
||||
parser.add_argument(
|
||||
'--tessellation', type=int, help='Tessellation number', default=10, required=False)
|
||||
parser.add_argument(
|
||||
'--blend_path', type=str, help='Path for export blend assembly file', required=False)
|
||||
parser.add_argument(
|
||||
'--sdf_path', type=str, help='Path to source SDF assembly file', required=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
freecad_asset_pipeline(args.fcstd_path,
|
||||
args.mesh_export_path,
|
||||
args.tessellation,
|
||||
args.blend_path,
|
||||
args.sdf_path)
|
||||
|
||||
logger.info("Assets setup finished without errors")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue