povray
povray copied to clipboard
Port of FS335 - macro works in variable but not in array
Port of FS335 - macro works in variable but not in array
http://bugs.povray.org/task/335 (Mike H (SharkD))
(Behavior unchanged to 3.7.2 master. Created test SDL at bottom)
Details:
This doesn' work:
#declare pavement_object = array[2]
{
object {trash_can_macro() scale 3/4 translate -x * 1/2},
object {potted_plant_macro(_CT_rand2) scale 3/4 scale 3/2 translate -x * 1/2}
}
This does work:
#declare trash_can_object = object {trash_can_macro()};
#declare potted_plant_object = object {potted_plant_macro(_CT_rand2)};
#declare pavement_object = array[2]
{
object {trash_can_object scale 3/4 translate -x * 1/2},
object {potted_plant_object scale 3/4 scale 3/2 translate -x * 1/2}
}
Logically, I cannot see a reason for this to be so.
//-------------------------- Test SDL start -------------------
#macro trash_can_macro()
sphere { 0, 1 }
#end
#macro potted_plant_macro(_CT_rand2)
sphere { 0, _CT_rand2 }
#end
// ------- Works --------
#declare _CT_rand2=1;
#declare trash_can_object = object {trash_can_macro()};
#declare potted_plant_object = object {potted_plant_macro(_CT_rand2)};
#declare pavement_object = array[2]
{
object {trash_can_object scale 3/4 translate -x * 1/2},
object {potted_plant_object scale 3/4 scale 3/2 translate -x * 1/2}
}
// ------- Fails --------
#declare pavement_object2 = array[2]
{
object {trash_can_macro() scale 3/4 translate -x * 1/2},
object {potted_plant_macro(_CT_rand2) scale 3/4 scale 3/2 translate -x * 1/2}
}
//-------------------------- Test SDL end -------------------
For the records: As this is a parser issue, and doesn't causes a crash, I presume we don't even want to touch it with a 10-foot pole while preparing for v3.8.0 release proper.
Agree - not for v3.8.0.