|
PublicWiki / ConvertingGeomCustomToObjFileGeom |
SearchWiki PublicWiki.RecentChanges Edit Page Page Revisions |
prop something
{
geomCustom
{
numbVerts 3920
numbTVerts 0
numbTSets 0
numbElems 7724
numbSets 23172
v -0.000000 0.184900 -0.001009
v 0.045431 0.184900 -0.001009
v 0.042691 0.184900 -0.016548
...
f 3917 3920 3918
f 3918 3920 3919
f 3919 3920 3908
}
}
If you still have the object handy, you can refer directly to it by removing the geomCustom section altogether and referring to it with an objFileGeom directive. Traditionally, you also add a storageOffset directive at this point, before th objFileGeom directive. The storageOffset directive is, traditionally, set to (0 0.3487 0) for objFileGeom-read geometry.
The result will look something like this:
prop something
{
storageOffset 0 0.3487 0
objFileGeom 0 0 :Runtime:Geometries:YourProps?:something.obj
}
Note those zeroes after the objFileGeom directive but before the file path. These are generally considered necessary. The prop will load if you leave them out, but it will save wrong if you save out a PZ3 file. When you try to load back in the PZ3 thus saved you will get the can't-find-geometry error and the stupid 'out-of-memory-we-didn't-change-this-for-the-PC' error. Both of which are wrong and misleading in the extreme. If you examine the PZ3 file, you will find those zeroes are there automatically, except that they aren't zeroes -- they're very long numbers, sometimes in the negative. This is what messes up the opening of the file. Make sure you include those zeroes.
Now, if you haven't saved that OBJect? file, or if you've changed it in the grouping editor or something after importing (lets say you've flipped facets and assigned groups and materials or something), then you can't just point it at the original because the original is either not there or not the same as what your prop is meant to be.
There's a way around this, too, and it's not as hard as exporting the object and starting all over again. It's actually pretty simple if you have a good text editor.
All you have to do is open up two text editors. Open the PP2? file in one. Then extract the entirety of the contents of the geomCustom block (i.e., stuff between the { and }. but not the { and } themselves, nor the geomCustom itself).
Paste this into the other text editor window. Then, in that other window, use a global search and replace to remove all leading whitespace. If you use the vim editor (the one I recommend), then you can do this with the command :%s/^^I// (the character '^I' is a tab, which you can get either by pressing TAB or CTRL-I). The idea is to simply remove all that leading space so that all those V's and F's are against the side, not halfway across the page.
Next, add the character '#' before all those numbVerts and such lines right at the beginning. The results will look sort of like this:
numbVerts 3920 numbTVerts 0 numbTSets 0 numbElems 7724 numbSets 23172 v -0.000000 0.184900 -0.001009 v 0.045431 0.184900 -0.001009 v 0.042691 0.184900 -0.016548 ... f 3917 3920 3918 f 3918 3920 3919 f 3919 3920 3908Save this text file to a new file with the extention '.obj'. That's a wavefront object file, which is what this now is. Next, use the above directions to point the PP2? file at the OBJect? file, removing the geomCustom section entirely.