I’m trying to batch convert obj files in shapenet that is stored locally.
I’ve edited code on top of the conversion sample in Nvidia docs. It mostly seems to work, but I’m getting the following error.
[Error] [omni.kit.asset_converter.impl.omni_client_wrapper] Cannot copy from /path/to/ShapeNetCore.v2/02958343/b3ffbbb2e8a5376d4ed9aac513001a31/models/images/alfa-romeo-159-2007_1_.PNG to /path/to/ShapeNetCore.v2/02958343/b3ffbbb2e8a5376d4ed9aac513001a31/models/materials/textures/alfa-romeo-159-2007_1_.PNG, error code: Result.ERROR_NOT_FOUND.
I have two questions
-
When I check on assets already converted the model path in error shared above does show up. So does this error mean asset conversion has multiple stages and one of them failed or is it one shot?
-
Is there anyway to skip problem files and try to convert other files? Here’s the async convert function I’m using.
I can share more of the code if necessary.
async def convert(input_asset_path, s3_client):
# def convert(input_asset_path, output_asset_path):
converter_context = omni.kit.asset_converter.AssetConverterContext()
# setup converter and flags
converter_context.ignore_materials = False
converter_context.ignore_animation = False
converter_context.ignore_cameras = True
converter_context.single_mesh = True
converter_context.smooth_normals = True
converter_context.preview_surface = False
converter_context.support_point_instancer = False
converter_context.embed_mdl_in_usd = False
converter_context.use_meter_as_world_unit = True
converter_context.create_world_as_default_root_prim = False
task_manager = omni.kit.asset_converter.get_instance()
carb.log_info(f"input path exists?: {os.path.exists(input_asset_path)}")
# /path/to/shapeNetCore.v2/*/*/models/model_normalized.obj -> model_normalized.obj
input_asset_filename = os.path.basename(input_asset_path)
# /path/to/shapeNetCore.v2/*/*/models/model_normalized.obj -> /path/to/shapeNetCore.v2/*/*/models/
input_asset_path = os.path.dirname(input_asset_path)
# model_normalized.obj -> model_normalized.usd
output_asset_filename = f"{os.path.splitext(os.path.basename(input_asset_filename))[0]}.usd"
output_asset_path = os.path.join(input_asset_path, output_asset_filename)
# /path/to/shapeNetCore.v2/*/*/models/model_normalized.obj -> assets/shapeNetCore.v2/*/*/models/model_normalized.usd
output_s3_path = input_asset_path.replace("/data", "assets_usd")
output_s3_path = os.path.join(output_s3_path, output_asset_filename)
input_asset_path = os.path.join(input_asset_path, input_asset_filename)
carb.log_info(f"Converting {input_asset_path}")
task = task_manager.create_converter_task(input_asset_path, output_asset_path, progress_callback, converter_context)
success = await task.wait_until_finished()
if not success:
detailed_status_code = task.get_status()
detailed_status_error_string = task.get_error_message()
carb.log_error(f"Conversion failed with status code:\n{detailed_status_code}\n******\n error message:\n {detailed_status_error_string}")
else:
carb.log_info(f"Conversion finished successfully")
upload2S3(s3_client, output_asset_path, output_s3_path)
carb.log_info(f"Uploaded {output_s3_path} to S3")
os.remove(output_asset_path)
carb.log_info(f"Removed {output_asset_path}")