Notifications
Clear all

[Closed] maxscript bug?

So, i create a target spot.
Enable shadow checkbox, it prints in the listener:

$.castShadows = on

i run this script:

print $.castShadows

it returns:

"true"

Disable shadow checkbox,
It prints in listener:

$.castShadows = off

run the command:

print $.castShadows

it still prints:

true

when it should return false…

I ran across it since I’m checking if the shadows are enabled \ disabled.
but it always returns true…

2 Replies

Read the Help, it explains it quite clearly

Light Common Properties, Operators, and Methods

<light>.castShadows Boolean default: false

When on, the light will cast shadows on objects.

NOTE:
In 3ds Max, all node-level properties are searched before base-object-level properties. If a base-object property has the same name as a node-level property, you need to search in the base object for the base object property. You should use <light>.baseObject.castShadows instead,

FOR EXAMPLE:
$Omni01.baseObject.castShadows = false

This is because every NODE has a property .castShadows (seen in the Object Properties modal dialog next to Receive Shadows), and a light uses the same node as a box for example. So if you try to access .castShadows in a light, you hit the node property which has no real effect on the light, but is still there and cannot go away because all scene nodes have it, renderable or not.

The MacroRecorder does not know this. I never used it. Never use it. It is evil! 😈

thanks, I had no idea it had to be done that way.
It just was strange to me because I expected it to output
what it said in the listener when activating \ deactivating.

But this sorts it.

thank you Bobo