Tom Melly wrote:
>
> Two questions regarding .inc files:
>
> 1. Is there any way to make an include file automatically detect whether it
> was called or not? In my case I have an include file/macro that will
> generate a bolt of lightning. I would like the file to generate an sample
> scene if run directly, but not when called (without the user having to
> set/change a variable).
I always do at the top of a file:
#ifndef (True)
#declare True=1; // So whoever is parsed first will declare
True and generate a camera.
#declare False=0;
#declare TestThisObject=1; // flag to generate a test object at the
bottom.
#declare my_other_constants...; // usually turn on dummy textures or what
not.
#include "other_objects.inc" // whatever other objects i am testing with.
camera { location here look_at there } // generate a test camera
#end
#declare ThisObject=
union {
...
}
// And then at the bottom of the file i put:
#ifdef (TestThisObject)
object {ThisObject}
#end
dik
Post a reply to this message
|