Blender: Bake Wrangler Wrapper
This commit is contained in:
parent
9222104a1a
commit
10d5ed451a
23 changed files with 11362 additions and 5 deletions
|
@ -22,6 +22,7 @@ from blender.processing.highpoly_setup import setup_meshes
|
|||
from blender.processing.midpoly_setup import hightpoly_collections_to_midpoly
|
||||
from blender.processing.lowpoly_setup import parts_to_shells
|
||||
from blender.processing.uv_setup import uv_unwrap
|
||||
from blender.texturing.bake_submitter import bw_submit
|
||||
from blender.export.dae import export_dae
|
||||
from blender.export.stl import export_stl
|
||||
import bpy
|
||||
|
@ -74,6 +75,7 @@ def cg_pipeline(**kwargs):
|
|||
config = kwargs.pop('config', None)
|
||||
|
||||
# prepare blend file
|
||||
|
||||
remove_collections()
|
||||
cleanup_orphan_data()
|
||||
|
||||
|
@ -88,16 +90,16 @@ def cg_pipeline(**kwargs):
|
|||
)
|
||||
)
|
||||
|
||||
# restructuring hierarchy by lcs points
|
||||
if imported_objects['objs_lcs']:
|
||||
restruct_hierarchy(imported_objects['objs_lcs'])
|
||||
|
||||
# save import in blender scene
|
||||
if blend_path is not None:
|
||||
if not os.path.isdir(os.path.dirname(blend_path)):
|
||||
os.makedirs(os.path.dirname(blend_path))
|
||||
bpy.ops.wm.save_as_mainfile(filepath=blend_path)
|
||||
|
||||
# restructuring hierarchy by lcs points
|
||||
if imported_objects['objs_lcs']:
|
||||
restruct_hierarchy(imported_objects['objs_lcs'])
|
||||
|
||||
# prepare highpoly
|
||||
if imported_objects['objs_foreground']:
|
||||
setup_meshes(imported_objects['objs_foreground'], sharpness=True, shading=True)
|
||||
|
@ -115,7 +117,6 @@ def cg_pipeline(**kwargs):
|
|||
)
|
||||
hightpoly_collections_to_midpoly(part_names)
|
||||
|
||||
|
||||
# prepare lowpoly
|
||||
lowpoly_obj_names = parts_to_shells(part_names)
|
||||
uv_unwrap(lowpoly_obj_names)
|
||||
|
@ -126,6 +127,10 @@ def cg_pipeline(**kwargs):
|
|||
os.makedirs(os.path.dirname(blend_path))
|
||||
bpy.ops.wm.save_as_mainfile(filepath=blend_path)
|
||||
|
||||
# bake textures
|
||||
bpy.ops.wm.open_mainfile(filepath=blend_path)
|
||||
bw_submit(lowpoly_obj_names)
|
||||
|
||||
# export object meshes and urdf
|
||||
to_urdf = collections.defaultdict(list)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue