From c669e9b3f4d21809494a4499aa53178e6cf8a23f Mon Sep 17 00:00:00 2001 From: "stathis.nikolaidis" Date: Wed, 8 Nov 2017 14:11:59 +0200 Subject: [PATCH] Issue #222 -> Compile problems Energy obj references mtl as txt --- includes/wpunity-core-functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/wpunity-core-functions.php b/includes/wpunity-core-functions.php index f45e831c..3cf19cb6 100644 --- a/includes/wpunity-core-functions.php +++ b/includes/wpunity-core-functions.php @@ -385,7 +385,9 @@ function wpunity_create_asset_3DFilesExtra_frontend($asset_newID, $assetTitleFor $mtlFile_filename = basename(get_attached_file($mtlFile_id)); // OBJ - $obj_content = preg_replace("/.*\b" . 'mtllib' . "\b.*\n/ui", "mtllib " . $mtlFile_filename . "\n", $obj_content); + $mtlFile_filename_notxt = substr( $mtlFile_filename, 0, -4 ); + $mtlFile_filename_withMTLext = $mtlFile_filename_notxt . '.mtl'; + $obj_content = preg_replace("/.*\b" . 'mtllib' . "\b.*\n/ui", "mtllib " . $mtlFile_filename_withMTLext . "\n", $obj_content); $objFile_id = wpunity_upload_AssetText($obj_content, 'obj'.$assetTitleForm, $asset_newID, $gameSlug); // SCREENSHOT