POV-Ray : Newsgroups : povray.general : ERROR: no matching } in object, object found instead : Re: ERROR: no matching } in object, object found instead Server Time
19 Apr 2024 23:15:09 EDT (-0400)
  Re: ERROR: no matching } in object, object found instead  
From: Sven Littkowski
Date: 31 Jan 2018 17:44:04
Message: <5a7246b4$1@news.povray.org>
On 29.01.2018 11:11, clipka wrote:
> Am 29.01.2018 um 11:51 schrieb Stephen:
>> On 29/01/2018 10:25, Sven Littkowski wrote:
>>> Why am I getting an error "no matching } in object, object found
>>> instead"?
>>
>> Commenting out the line below allows the script to run.
>> So you can take it from there. I'm not very good with macros. It looks
>> complicated to me.
>>
>> // object { MyOrbisiana(MyRandom) rotate < MyX, MyY, MyZ > translate <
>> hisPX, ThisPY, ThisPZ > }
> 
> MyOrbisiana(R) essentially "unrolls"
> 
>     object { ... }
>     object { ... }
>     ...
> 
> etc., so the above line "unrolls" to
> 
>     object {
>       object { ... }
>       object { ... }
>       ...
>     }
> 
> You can't have multiple `object` statements in an `object` block. You
> probably want a `union` somewhere.
> 
Yes, Clipka, you are right, once more. I see what you mean. Great
advise, very helpful, and i really thank you for this advise, highly
appreciated.

I made a change to the scene, and put the macro object inside a union,
with the result that the scene now functions but nothing than the
background appears on the screen. :-D

Here's the updated scene code on which I am breaking and smashing my brain:

--------------------------------------------

#version 3.7;

#declare MyRadiosity = on;
#declare MyClouds = off;
#declare MyLight = on;
#declare MySuns = off;
#declare MyForest = off;
#declare MyPlanet = off;
#declare MyAir = off;
#declare MyTowers = off;
#declare MyBubble = on;
#declare MyBubbleTextures = off;


#declare MyNature = pigment { color rgb < 0.16863,  0.32941,  0.070588 > 
};


global_settings
{
 assumed_gamma 1.4
 #if(MyRadiosity=on)
  radiosity
  {
   media on
//   pretrace_start 0.08
//   pretrace_end   0.001
   count 400
//   error_bound 0.75
//   recursion_limit 1
   normal on
  }
 #end
 subsurface        {}
 adc_bailout       0.0039
 ambient_light     rgb < 0.000, 0.000, 0.000 >
 assumed_gamma     1.000
 irid_wavelength   rgb < 0.250, 0.180, 0.140 >
 max_trace_level   5
 number_of_waves   10
 noise_generator   3
 charset           ascii
}

#default
{
 finish { ambient 0.0 diffuse 1.0 }
}

//------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "functions.inc"
#include "shapes.inc"
//------------------------------------------------------------------------

light_source
{
 < -3000, 1000, -3000 >
 color rgb < 0.7019608,  0.9490196,  0.4509804 >
}

//------------------------------------------------------------------------

camera
{
 location  < -3.0 , 0.0 , -5.0 >
 look_at   < 0.0 , 0.0 , 0.0 >
}

// Element ---------------------------------------------------------------

#declare Element = union
{
 union
 {
  torus
  {
   0.425, 0.075
   rotate < 0.0, 0.0, 90.0 >
   scale < 4.5, 1.125, 1.125 >
  }
  torus
  {
   0.425, 0.075
   rotate < 0.0, 0.0, 90.0 >
   translate < -0.25, 0.0, 0.0 >
  }
  torus
  {
   0.425, 0.075
   rotate < 0.0, 0.0, 90.0 >
   translate < 0.25, 0.0, 0.0 >
  }
  texture
  {
   pigment
   {
    onion
    color_map
    {
     [ 0.0 color rgb 1 ]
     [ 1.0 color rgb < 0.075,  0.0751,  0.075 > ]
    }
    rotate < 0.0, 0.0, 90.0 >
    scale 0.6000
   }
   normal
   {
    granite 0.15 scale 1.0
   }
   finish { phong 0.1 }
  }
 }

 union
 {
  cylinder { < -0.323, 0.0, 0.0 > < -0.322, 0.0, 0.0 > 0.425 }
  cylinder { <  0.323, 0.0, 0.0 > <  0.322, 0.0, 0.0 > 0.425 }
  texture
  {
   pigment
   {
    onion
    color_map
    {
     [ 0.0 color rgbt < 0.7764706,  0.8941176,  0.545098, 0.45 > ]
     [ 1.0 color rgbt < 0.075,  0.0755,  0.075, 0.45 > ]
    }
    rotate < 0.0, 0.0, 90.0 >
    scale 0.52
   }
   normal
   {
    granite 0.15 scale 1.0
   }
   finish { phong 0.1 }
  }
 }
 sphere
 {
  < 0.0, 0.0, 0.0 > 0.315
  scale < 1.0, 1.0, 1.0 >
  texture
  {
   pigment
   {
    onion
    color_map
    {
     [ 0.0 color rgb < 0.5019608,  0.772549,  0.227451 > ]
     [ 1.0 color rgb < 0.5019608,  0.772549,  0.227451 > ]
    }
    rotate < 0.0, 0.0, 90.0 >
    scale 0.52
   }
   normal
   {
    granite 0.75 scale 0.5
   }
   finish { phong 0.1 }
  }
 }
}

// ---------------------------------------------------------


#macro MyOrbisiana(MyRandomizer)
 #declare MyRandomer = seed (MyRandomizer);
 #declare MyLength   = int(rand(MyRandomer)*200);   // Anzahl der Glieder

 #declare MyNegative = rand(MyRandomer);
 #if(MyNegative<0.5)
  #declare Negative = -1;
 #else
  #declare Negative =  1;
 #end
 #declare MyX        = rand(MyRandomer)*04*Negative;
 #declare MyY        = rand(MyRandomer)*01*Negative;
 #declare MyZ        = rand(MyRandomer)*00*Negative;
 #declare MyPosition = 0.00;
 #declare MyElement  = 0;

 union
 {
  #while (MyElement<MyLength)
   object { Element translate < 0.0, 0.0, MyPosition > rotate < MyX,
MyY, MyZ > }
   #declare MyNegative = rand(MyRandomer);
   #if(MyNegative<0.5)
    #declare Negative = -1;
   #else
    #declare Negative =  1;
   #end
   #declare MyX        = MyX+rand(MyRandomer)*04*Negative;
   #declare MyY        = MyY+rand(MyRandomer)*01*Negative;
   #declare MyZ        = MyZ+rand(MyRandomer)*00*Negative;
   #declare MyPosition = MyPosition+0.925;
   #declare MyElement  = MyElement+1;
  #end
 }
#end

// Water -----------------------------------------------------------------

background { color rgb < 0.1843137,  0.4666667,  0.5490196 > * 0.5 }

#declare ThisRandom   = seed (27053);
#declare ThisNegative = rand(ThisRandom);
#if(ThisNegative<0.5)
 #declare ANegative   = -1;
#else
 #declare ANegative   =  1;
#end
#declare ThisX        = rand(ThisRandom)*02*ANegative;
#declare ThisY        = rand(ThisRandom)*05*ANegative;
#declare ThisZ        = rand(ThisRandom)*02*ANegative;
#declare ThisPX       = rand(ThisRandom)*50*ANegative;
#declare ThisPY       = rand(ThisRandom)*50*ANegative;
#declare ThisPZ       = rand(ThisRandom)*50*ANegative;
#declare ThisLife     = int(rand(ThisRandom)*50);   // Anzahl der
Orbisianas
#declare ALife        = 0;

#while (ALife<ThisLife)
 #declare MyRandom     = int(rand(ThisRandom)*1000);
 object { MyOrbisiana(MyRandom) rotate < MyX, MyY, MyZ > translate <
ThisPX, ThisPY, ThisPZ > }
 #declare ThisX        = ThisX+(rand(ThisRandom)*02*ANegative);
 #declare ThisY        = ThisY+(rand(ThisRandom)*05*ANegative);
 #declare ThisZ        = ThisZ+(rand(ThisRandom)*02*ANegative);
 #declare ThisPX       = ThisPX+(rand(ThisRandom)*50*ANegative);
 #declare ThisPY       = ThisPY+(rand(ThisRandom)*50*ANegative);
 #declare ThisPZ       = ThisPZ+(rand(ThisRandom)*50*ANegative);
 #declare ALife        = ALife+1;
#end


---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

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