|
@@ -21,20 +21,43 @@ public class FbxToObjController {
|
|
|
@Value("${server.file.location}")
|
|
|
private String path;
|
|
|
|
|
|
+ @Value("${fbxToObj.combineFbxClassPath}")
|
|
|
+ private String combineFbxClassPath;
|
|
|
+
|
|
|
+ @Value("${fbxToObj.compressImagePath}")
|
|
|
+ private String compressImagePath;
|
|
|
+
|
|
|
+ @Value("${fbxToObjNoImg.fbxMeshReducePath}")
|
|
|
+ private String fbxMeshReducePath;
|
|
|
+
|
|
|
+ @Value("${maxToDatasmithPath.detachModelPyPath}")
|
|
|
+ private String detachModelPyPath;
|
|
|
+
|
|
|
+ @Value("${maxToDatasmithPath.detachModelBatPath}")
|
|
|
+ private String detachModelBatPath;
|
|
|
+
|
|
|
+ @Value("${objToObj.reduceObjOnlyPath}")
|
|
|
+ private String reduceObjOnlyPath;
|
|
|
+
|
|
|
+ @Value("${objToObjPercentage.reduceObjOnlyPercentPath}")
|
|
|
+ private String reduceObjOnlyPercentPath;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 上传模型文件
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/fbxToObj")
|
|
|
- public String fbxToObj(HttpServletRequest request){
|
|
|
+ public String fbxToObj(HttpServletRequest request) {
|
|
|
String uuid = request.getParameter("uuid");
|
|
|
String fbx = request.getParameter("fbx");
|
|
|
String obj = request.getParameter("obj");
|
|
|
String jpg = request.getParameter("jpg");
|
|
|
String r = request.getParameter("r");
|
|
|
|
|
|
- if(StringUtils.isEmpty(r)){
|
|
|
+ if (StringUtils.isEmpty(r)) {
|
|
|
r = "30";
|
|
|
}
|
|
|
String filePath = path + uuid + File.separator;
|
|
@@ -43,13 +66,14 @@ public class FbxToObjController {
|
|
|
// String command = "hython C:\\user\\FbxMeshReduce.py -i " + filePath + fbx + " -obj " + filePath + obj +
|
|
|
// " -oj " + filePath + "baker.jpg -r " + r;
|
|
|
|
|
|
- String command = "hython C:\\user\\CombineFbxClass.py -i " + filePath + fbx + " -obj " + filePath + obj +
|
|
|
+ String command = "hython " + combineFbxClassPath + " -i " + filePath + fbx + " -obj " + filePath + obj +
|
|
|
" -oj " + filePath + "baker.jpg -r " + r;
|
|
|
callshell(command);
|
|
|
log.info(("fbx转换obj完毕:" + command));
|
|
|
|
|
|
log.info(("图片开始压缩"));
|
|
|
- command = "python C:\\user\\compressImage\\CompressImage.cpython-39.pyc -i " + filePath + "baker.jpg -o " + filePath + jpg;
|
|
|
+ command = "python " + compressImagePath + " -i " + filePath + "baker.jpg -o " + filePath + jpg;
|
|
|
+
|
|
|
callshell(command);
|
|
|
log.info(("图片压缩完毕:" + command));
|
|
|
return "0";
|
|
@@ -57,54 +81,56 @@ public class FbxToObjController {
|
|
|
|
|
|
/**
|
|
|
* 上传模型文件不烘焙图片
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/fbxToObjNoImg")
|
|
|
- public String fbxToObjNoImg(HttpServletRequest request){
|
|
|
+ public String fbxToObjNoImg(HttpServletRequest request) {
|
|
|
String uuid = request.getParameter("uuid");
|
|
|
String fbx = request.getParameter("fbx");
|
|
|
String obj = request.getParameter("obj");
|
|
|
String r = request.getParameter("r");
|
|
|
|
|
|
- if(StringUtils.isEmpty(r)){
|
|
|
+ if (StringUtils.isEmpty(r)) {
|
|
|
r = "30";
|
|
|
}
|
|
|
String filePath = path + uuid + File.separator;
|
|
|
FileUtils.deleteFile(filePath + obj);
|
|
|
log.info(("fbx转换obj开始"));
|
|
|
- String command = "hython C:\\user\\FbxMeshReduce.py -i " + filePath + fbx + " -obj " + filePath + obj +
|
|
|
+ String command = "hython " + fbxMeshReducePath + " -i " + filePath + fbx + " -obj " + filePath + obj +
|
|
|
" -r " + r + " -ba a ";
|
|
|
callshell(command);
|
|
|
log.info(("fbx转换obj完毕:" + command));
|
|
|
return "0";
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 上传.max文件转成datasmith
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/maxToDatasmith")
|
|
|
- public String maxToDatasmith(HttpServletRequest request){
|
|
|
+ @RequestMapping({"/maxToDatasmith"})
|
|
|
+ public String maxToDatasmith(HttpServletRequest request) {
|
|
|
String uuid = request.getParameter("uuid");
|
|
|
String max = request.getParameter("max");
|
|
|
+ String flag = request.getParameter("flag");
|
|
|
|
|
|
+ if (flag == null || flag.equals("")) {
|
|
|
+ flag = "false";
|
|
|
+ }
|
|
|
String filePath = path + uuid;
|
|
|
- String command = "hython C:\\Users\\Administrator\\Documents\\fbxTodatasmith\\DetachModel.py C:\\Users\\Administrator\\Documents\\fbxTodatasmith\\DetachModel.bat " + filePath + " " + filePath + File.separator + max;
|
|
|
- log.info(("max转换datasmith开始: " + command));
|
|
|
+ String command = "hython " + detachModelPyPath + " " + detachModelBatPath + " " + filePath + " " + filePath + File.separator + max + " " + flag;
|
|
|
+ ;
|
|
|
+ log.info("max转换datasmith开始: " + command);
|
|
|
callshell(command);
|
|
|
- log.info(("max转换datasmith完毕:" + command));
|
|
|
+ log.info("max转换datasmith完毕:" + command);
|
|
|
return "0";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* obj转成obj并进行压缩
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/objToObj")
|
|
|
- public String objToObj(HttpServletRequest request) throws Exception{
|
|
|
+ public String objToObj(HttpServletRequest request) throws Exception {
|
|
|
String uuid = request.getParameter("uuid");
|
|
|
String inObj = request.getParameter("inObj");
|
|
|
String outObj = request.getParameter("outObj");
|
|
@@ -112,8 +138,7 @@ public class FbxToObjController {
|
|
|
|
|
|
String filePath = path + uuid + File.separator;
|
|
|
|
|
|
- String command = "hython C:\\Users\\Administrator\\Documents\\user\\ReduceObjOnly.py -i " + filePath + inObj +
|
|
|
- " -o " + filePath + outObj + " -r " + r;
|
|
|
+ String command = "hython " + reduceObjOnlyPath + " -i " + filePath + inObj + " -o " + filePath + outObj + " -r " + r;
|
|
|
|
|
|
// String faceTxt = r + "\n" + filePath + inObj + "\n" + filePath + outObj + "\n";
|
|
|
// FileUtils.writeFile(filePath + "face.txt", faceTxt);
|
|
@@ -133,19 +158,18 @@ public class FbxToObjController {
|
|
|
|
|
|
/**
|
|
|
* obj转成obj并进行压缩
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/objToObjPercentage")
|
|
|
- public String objToObjPercentage(HttpServletRequest request) throws Exception{
|
|
|
+ public String objToObjPercentage(HttpServletRequest request) throws Exception {
|
|
|
String inObj = request.getParameter("inObj");
|
|
|
String outObj = request.getParameter("outObj");
|
|
|
String r = request.getParameter("r");
|
|
|
|
|
|
-// String filePath = path + uuid + File.separator;
|
|
|
|
|
|
- String command = "hython C:\\Users\\Administrator\\Documents\\user\\ReduceObjOnly_percent.py -i " + inObj +
|
|
|
- " -o " + outObj + " -r " + r;
|
|
|
+ String command = "hython " + reduceObjOnlyPercentPath + " -i " + inObj + " -o " + outObj + " -r " + r;
|
|
|
|
|
|
log.info(("obj转换obj百分比压缩开始: " + command));
|
|
|
callshell(command);
|
|
@@ -153,8 +177,10 @@ public class FbxToObjController {
|
|
|
return "0";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@RequestMapping(value = "/testRun")
|
|
|
- public String testRun(HttpServletRequest request){
|
|
|
+ public String testRun(HttpServletRequest request) {
|
|
|
|
|
|
return "isRunning";
|
|
|
}
|
|
@@ -176,8 +202,7 @@ public class FbxToObjController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void callshell(String command)
|
|
|
- {
|
|
|
+ public void callshell(String command) {
|
|
|
try {
|
|
|
Process process = Runtime.getRuntime().exec(command);
|
|
|
|