POV-Ray : Newsgroups : povray.general : "To Render" pointer in include files. : Re: "To Render" pointer in include files. Server Time
1 Aug 2024 22:23:33 EDT (-0400)
  Re: "To Render" pointer in include files.  
From: andrel
Date: 28 Mar 2005 08:13:44
Message: <42480294.3030101@hotmail.com>
Mike Williams wrote:
> Wasn't it brandon who wrote:
> 
>>Just an idea for a possible feature.
>>
>>I'm often stuck tunning some parameter in an include file. It'd be nice if
>>there were some way to "point" POV-Ray to the actual source to render
>>rather than the include. That way, I wouldn't have to modify, switch back
>>to main pov file, render, switch back to include, repeat.
>>
>>So, in someinclude.inc I would put something like:
>>#render "myfile.pov"
>>If I tried to render the include file, it would render myfile.pov instead.
>>
>>I know...I'm lazy.
> 
> 
> 
> Such functionality is already available. The thing to notice is that POV
> doesn't distinguish a .POV file from a .INC file, so you can just as
> easily #include the POV from the INC.
> 
> If you #include in both directions, you get into a loop, unless you
> #declare variables to manage the control flow.
> 
> It's possible to code things slightly simpler than this example if you
> are willing to lose some flexibility in the order in which the code gets
> executed, and whether you can call the include file more than once, but
> the method used in this example gives you total flexibility.
> 
> // --- FOO.POV ------------------------------------------
> #declare Foo_Pov_Temp = 1;
> 
> #version 3.6;
> global_settings {assumed_gamma 1.0}
> camera {location  <0,0,-10> look_at <0,0,0> angle 30}
> background {rgb 1}
> light_source {<-30, 100, -30> color rgb 1}
> 
> #declare T = texture{pigment {rgb 1}}
> #include "bar.inc"
> object {Thing}
> 
> #declare T=texture{pigment {rgb x}}
> #include "bar.inc"
> object {Thing translate x}
> //-------------------------------------------------------
> 
> 
> // --- BAR.INC ------------------------------------------
> #ifndef(Foo_Pov_Temp)
>   #include "foo.pov"
> #else
>   // Replace this with your included code
>   #declare Thing = sphere {0,1 texture {T}}
> #end
> //-------------------------------------------------------
> 
> If you run FOO.POV, it sets the special variable. When BAR.INC gets
> called it checks the special variable, and since it is defined, it
> performs the included code.
> 
> If you run BAR.POV, it checks the special variable. In this case it is
> defined, so it calls FOO.POV and skips the included code. Then FOO.POV
> calls BAR.INC with the special variable defined and the included code
> gets performed.
> 
a couple of remarks
1) brandon's solution is more simple and more logical
2) both don't work in general. It only works for include files that
  are unique to one POV file. I know this happens often and has been
  the case whenever I had the same problem as brandon It is not a rule
  (think about all those usefull packages) and from a developers point
  of view I would say that it possibly should be discouraged.
  For any include file shared by more than one povfile no system
  that associates that include with a povfile can work.
3) What would work is if we had a method to select the previous
  render to rerender. Guess what, that does already exist, only
  it takes 3 clicks to do, so I seldom use it. Possibly the fastest
  way to increase the useability of it would be to have one button or
  shortcut to rerender the latest pov file. And perhaps even that exists
  already.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.