Skip to content

Commit 4998236

Browse files
author
archibate
committed
fix export obj
1 parent 52ebb2a commit 4998236

File tree

2 files changed

+81
-5
lines changed

2 files changed

+81
-5
lines changed

assets/zhxxgraphs/arts/tutor2.zsg

+79-3
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,58 @@
242242
-334.0
243243
],
244244
"options": []
245+
},
246+
"9bb7bef1-ExportObjPrimitive": {
247+
"name": "ExportObjPrimitive",
248+
"inputs": {
249+
"path": [
250+
"7a62547d-MakeWritePath",
251+
"path",
252+
null
253+
],
254+
"prim": [
255+
"573956c4-PrimitiveCalcNormal",
256+
"prim",
257+
null
258+
],
259+
"SRC": [
260+
null,
261+
null,
262+
null
263+
]
264+
},
265+
"params": {},
266+
"uipos": [
267+
1121.6000000000004,
268+
-72.80000000000001
269+
],
270+
"options": [
271+
"VIEW"
272+
]
273+
},
274+
"7a62547d-MakeWritePath": {
275+
"name": "MakeWritePath",
276+
"inputs": {
277+
"SRC": [
278+
null,
279+
null,
280+
null
281+
]
282+
},
283+
"params": {
284+
"path": "/tmp/monkey{frame:06d}.obj"
285+
},
286+
"uipos": [
287+
816.8,
288+
-247.20000000000002
289+
],
290+
"options": []
245291
}
246292
},
247293
"view": {
248-
"scale": 1.0,
249-
"trans_x": -366,
250-
"trans_y": -626
294+
"scale": 1.25,
295+
"trans_x": 534,
296+
"trans_y": -427
251297
}
252298
}
253299
},
@@ -1547,6 +1593,36 @@
15471593
"trimesh"
15481594
]
15491595
},
1596+
"ExportObjPrimitive": {
1597+
"inputs": [
1598+
[
1599+
"",
1600+
"path",
1601+
""
1602+
],
1603+
[
1604+
"",
1605+
"prim",
1606+
""
1607+
],
1608+
[
1609+
"",
1610+
"SRC",
1611+
""
1612+
]
1613+
],
1614+
"outputs": [
1615+
[
1616+
"",
1617+
"DST",
1618+
""
1619+
]
1620+
],
1621+
"params": [],
1622+
"categories": [
1623+
"primitive"
1624+
]
1625+
},
15501626
"ExportParticles": {
15511627
"inputs": [
15521628
[

zeno/nodes/prim/PrimitiveObjIO.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static void writeobj(
7979
std::vector<zeno::vec3i> const &indices,
8080
const char *path)
8181
{
82-
FILE *fp = fopen(path, "r");
82+
FILE *fp = fopen(path, "w");
8383
if (!fp) {
8484
perror(path);
8585
abort();
@@ -90,7 +90,7 @@ static void writeobj(
9090
}
9191

9292
for (auto const &ind: indices) {
93-
fprintf(fp, "f %d %d %d\n", ind[0], ind[1], ind[2]);
93+
fprintf(fp, "f %d %d %d\n", ind[0] + 1, ind[1] + 1, ind[2] + 1);
9494
}
9595
fclose(fp);
9696
}

0 commit comments

Comments
 (0)