PDA

View Full Version : Reducing objects easily via ExportObjects.vis



dmitri
Apr 6 2008, 12:33
Needed to find a way to automate the reduction of a specific piece of foliage down from 22 000 to about half that number.

Found a cheap non-scripting solution, thought I'd share it here. Maybe I've missed an obvious way to do this properly, if so..share. http://forums.bistudio.com/oldsmileys/smile_o.gif

There really doesn't seem to be any alternative save spending a few days reducing object count manually. Could have removed all the objects in Visitor, but that'd mean having to do the placement from scratch.

My cheap solution was to use exportobjects.vis script to dump out a text list of all the objects. Select object in the script's list, untick header, tick "objects from list" and all other options, make sure data separator is set to semi-colon.

This gives you a text list. I then use a piece of software that randomly removes half the lines in a text document. I had to purchase a cheap-ish little app that does this. Tried finding a text editor that can remove every second line of text, but I became impatient..and didn't have time to mess with macros http://forums.bistudio.com/oldsmileys/wink_o.gif . You could manually remove every few lines in notepad. Slow, but still easier than reducing object count manually in Visitor.

Remove all instances of the object you're about to import via Visitor's tools --> replace object.
Once you've got your optimised text list, use importobjects.vis to reimport.

The only issue is that exportobjects.vis doesn't record the objects size. My objects are randomised. When I reimport from the text list, the object sizes are randomised again.

fasad
Apr 6 2008, 13:26
Macros were invented for repetitive tasks like this! Many good text editing programs can easily record and repeat macros. For example, if I wanted to create a macro to delete every second line in a text file in Notepad++ :

- Start recording macro.
- Delete the first line of text (including the break-return)
- Move the cursor down to the originally third line (now the second line).
- Stop recording.
- Run macro till end of file (a single command).

You could also achieve a more truly random result by creating a modified version of exportObjects.vis that will only export an object if some condition is true, for example (random 1) > 0.5.