jim++at++cs.unm.edu
Mon, 13 Mar 95 10:23:32 MST
You can do this automagically with the following shell script. Just
put this in a file. I call it addcolor. Then run
chmod 744 addcolor
to make it executable. If you put the command in your personal bin
directory, you can access it from anywhere (i.e. you don't have to
be in the objects directory). It takes the name of the wavefront
project, the name of the object file, and adds to the beginning of the
file the text "mtllib colors.mtl". If you use a different name for
your material file, change that text.
syntax is: addcolor <project> <obj_file>
Once it has been added to the file, wavefront preserves it everytime
you edit the file in model --i.e. you don't have to run this on
a file more than once.
#-------------- cut here -----------------------------
#! /bin/sh #must be the FIRST line in the file
# shell to add "mtl_lib" statement to first line of an obj file
if awk 'BEGIN {print "mtllib colors.mtl"} {print}' \
<$HOME/projects/$1/objects/$2 >/tmp/addcolor_$$
then
mv /tmp/addcolor_$$ $HOME/projects/$1/objects/$2
else
rm /tmp/addcolor_$$
fi
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:04 PDT