-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconverter.html
More file actions
47 lines (44 loc) · 1.72 KB
/
converter.html
File metadata and controls
47 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<body>
<textarea style="height:300px;width:1000px" id="ss"></textarea>
<br /><br />
<button onclick="run();">run</button>
<br /><br />
<textarea style="height:500px;width:1000px" id="result"></textarea>
<script>
function run(){
var data = "";
var className = "";
var codeLine = [];
var m0 = "";
var map = "";
data = $("#ss").val();
className = data.substring(data.indexOf("class")+6,data.indexOf(" extends"));
var d = data.substring(data.indexOf("()"));
codeLine = d.substring(0,d.indexOf("}")).split("\n");
for(i in codeLine){
var line = codeLine[i];
if(line.indexOf("Shape")!=-1){
//console.log(line.trim());
if(line.indexOf("LODModelPart")>-1){
m0+="ModelPart "+line.substring("Shape",line.indexOf("=")).trim()+";\n"
map+="\nLODModelPart.simpleCreate(\""+line.substring("Shape",line.indexOf("=")).trim()+"\",partdefinition,";
map+=line.split(",")[1]+","+line.split(",")[2].split(")")[0]+", ";
}
if(line.indexOf("addBox")>-1){
map+=line.substring(line.indexOf("(")+1,line.indexOf(")"))+",";
}
if(line.indexOf("setRotationPoint")>-1){
map+=line.substring(line.indexOf("(")+1,line.indexOf(")"))+",";
}
if(line.indexOf("setRotation(")>-1){
map+=line.split(",")[1]+","+line.split(",")[2]+","+line.split(",")[3].split(");")[0]+");";
}
}
}
$("#result").val(m0+"\n\n\n\n\n\n"+map);
}
</script>
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
</body>
</html>