[Closed] daylight system bug?
I am using max 2013 and trying to control a daylight objects position. I wrote a very simple script
days = for d = 193 to 195 collect d
sun2=$daylight001
na=1
for da = 1 to days.count do
(
--format "da:% na:%
" days[da] na
with animate on at time na sun2.solar_date.controller.value = days[da]
na+=10
)
it works the second time I run it but not the first.Is there a bug with the daylight system?
Changed the code so that I add the keys, then add the value. Works great. Makes me think the original problem was some kind of screen refresh or something?
days = for d = 193 to 195 collect d
sun2=$daylight001
na=1
for da = 1 to days.count do
(
addNewKey sun2.solar_date.controller na
sun2.solar_date.controller.keys[i].value = days[da]
na+=10
)
Just a short notice about the sunsystems date and time controllers for maxscript
You have no access to absolute dates using that method, it’s always just an OFFSET from the summer solstice or similar, which gets stored with the daylight system in the moment when it gets created.
As far i remember it even depends on the year (according to the system date) the daylight system you want to controll was created in the scene ( no joke ). So essentially you can’t specifiy an exact date for sun positioning, because the value you have to assign to the controllers to get a certain date TOTALLY DEPENDS ON THE DATE the daylight system was created… This is a horrible maxscript interface design oversight
I internally did a recompile of the daylight system plugin which exposes absolut date and time properties ( meaning they are not an offset to some internally stored date, but absolut dates)
Thanks spacefrog! I did write a time/date translator based on the daylight controller values that is working out pretty good so far.