POV-Ray : Newsgroups : povray.general : Object on or off ??? Server Time
4 Aug 2024 04:18:38 EDT (-0400)
  Object on or off ??? (Message 1 to 6 of 6)  
From: BorisW37
Subject: Object on or off ???
Date: 12 Aug 2003 20:30:01
Message: <web.3f39862ac76d2e2e6af901ee0@news.povray.org>
I saw it in somebody elses scripts but cant remember where...
I need to easily turn certain object on or off.
Let say i have object my_sphere, used as a trouble shooting marker for
development purpose only. But intsead of puting /* ..... */ every time in
need to get rid of it, can i write
my_sphere = true/false, or something along those lines


Post a reply to this message

From: Kevin Loney
Subject: Re: Object on or off ???
Date: 12 Aug 2003 21:12:51
Message: <3f399093@news.povray.org>
#declare ShowObject = true/false/yes/no/on/off;

#if(ShowObject)
    object {
        obj_Whatever
    }
#end

-- 
Kevin
http://www.geocities.com/qsquared_1999/
#macro _(r)#if(r<12)#local i=asc(substr(
"oqshilacefg",r,1))-97;disc{<mod(i,7)-3,
div(i,7)-1,6>,z,.4pigment{rgb 10}}_(r+1)
#end#end _(1)//KL


Post a reply to this message

From: ABX
Subject: Re: Object on or off ???
Date: 13 Aug 2003 01:42:09
Message: <4mjjjvkpemumpq96i6jvi367pjrupce7o7@4ax.com>
On Tue, 12 Aug 2003 19:15:02 -0600, "Kevin Loney" <kev### [at] ekoikcom> wrote:
> #declare ShowObject = true/false/yes/no/on/off;
>
> #if(ShowObject)
>    object {
>        obj_Whatever
>     }
> #end

additionally ShowObject can be controlled from command line/ini option box

Ini Option:

  Declare=ShowObject=1

POV Script:

  #ifndef(ShowObject)
    #declare ShowObject = true/false/yes/no/on/off/0/1;
  #endif

  // [...] some POV code

  #if(ShowObject)
     object {
         obj_Whatever
      }
  #end
    

ABX


Post a reply to this message

From:
Subject: Re: Object on or off ???
Date: 13 Aug 2003 13:30:37
Message: <3f3a75bd$1@news.povray.org>
Hi Boris,

as usual, there are many solutions, for example:


(1) COMMENT/UNCOMMENT

//*
  // SDL of object goes here
// */

To switch the object off, delete one of the "/" of "//*".
(A really nice trick I've seen somewhere here, but can't remember
who invented it. Don't omit the space in "// */".)


(2) DECLARE AND USE OR DON'T USE

#declare myObject = ...

object { myObject } // in scene
//object { myObject } // not in scene



(3) INCLUDE OR DON'T INCLUDE

#include "myObject.inc" // in scene
//#include "myObject.inc" // not in scene



(4) ACTIVATE OBJECTS BY A STRING

#declare Enabled = "abcdefg" // string of "one-character-names"
                             // of enabled objects
#macro Use(U)
  #local I = 1;
  #while (I<=strlen(Enabled))
    #if (strcmp(substr(Enabled,I,1),U)=0)
      #declare I = 999; // exit loop
      #end//if
    #local I = I+1;
    #end//while I
  (I=1000)
  #end//macro Use

#if (Use("a"))
  // SDL for object "a" goes here; displayed when Enabled contains "a"
  #end//"a"

#if (Use("b"))
  // SDL for object "b" goes here; displayed when Enabled contains "b"
  #end//"b"


And of course all the other solutions in this thread ...

   Sputnik


Post a reply to this message

From: Kurts
Subject: Re: Object on or off ???
Date: 14 Aug 2003 17:11:54
Message: <kurtzlepirate-B30287.23115314082003@netplex.aussie.org>
In article <web.3f39862ac76d2e2e6af901ee0@news.povray.org>, "BorisW37"
<Bor### [at] yahoocom> wrote:

> I saw it in somebody elses scripts but cant remember where...
> I need to easily turn certain object on or off.
> Let say i have object my_sphere, used as a trouble shooting marker for
> development purpose only. But intsead of puting /* ..... */ every time in
> need to get rid of it, can i write
> my_sphere = true/false, or something along those lines
> 

some methods :

1) one variable, multiple object

  #declare troubleShooting=true/false;
  
  source
  ...
  #if (troubleShooting)
    object {...}
    object {...}
  #end
  ...
  #if (troubleShooting)
    object {...}
    object {...}
  #end

2) one variable, one object

  #declare drawPlane = true/false;
  #declare drawSky = true/fase;


  source
  ...
  ...
  #if (drawPlane)
    plane { }
  #end
  ...
  #if (drawSky)
    sky_sphre { }
  #end
  ...

hope this help


Post a reply to this message

From: Peter Ketting
Subject: Re: Object on or off ???
Date: 16 Aug 2003 12:39:02
Message: <3f3e5e26$1@news.povray.org>
"BorisW37" wrote in message

> I saw it in somebody elses scripts but cant remember where...
> I need to easily turn certain object on or off.
> Let say i have object my_sphere, used as a trouble shooting marker for
> development purpose only. But intsead of puting /* ..... */ every time in
> need to get rid of it, can i write
> my_sphere = true/false, or something along those lines

This is the way I do it. If I need a fast test render of a complex object, I
declare a variable named "DEBUG" in my main pov source.

#declare DEBUG = true;

Then in my object code I put blocks like these

#declare MyComplexObject = object {
    object { blah blah }
#ifndef (DEBUG)
    object { more complex shapes blah blah }
#end
}

This way you only have to remove the DEBUG declare statement if you need a
full render.

Please note that there really is no right ot wrong way to do this, everyone
prefers a different method but it all comes down to the same results. Just
thought I would share my method :)

Cheers,
Peter


Post a reply to this message

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