The state of the material buttons are stored as a single bitmask. Meaning every bit specifies if a buttons state is off or on.
If you are using 223 or lower, then you have to use the material.Mode value to test if bit 1 (counting from zero) is 1 (on) or 0 (off) to find the the state of the shadow button:
mt = Blender.Material.Get(name)
# bit 1 is 2 to power of 1 which means two in decimal.
# to find the value, mask out everything but this bit with the and operator
# and if the result is nonzero, the button is on
if (mt.Mode & 2):
print "Shadow is on"
else:
print "Shadow is off"
in 225 or higer, things are a lot easier:
mt = Blender.Material.get(name)
if 'shadow' in mt.getMode():
print "Shadow is on"
else:
print "Shadow is off"
Lamps are similar, they also use a bitmask, the shadow button is the state of bit 0
first in 223:
lp = Blender.Lamp.Get(name)
if (lp.mode & 1):
print "Shadow is on"
else:
print "Shadow is off"
and again a lot easier in 225 and higher and the same as for materials:
lp = Blender.Lamp.get(name)
if 'shadow' in lp.getMode():
print "Shadow is on"
else:
print "Shadow is off"
Unfortunately, the add slider seems to be one of the forgotten buttons, no access (yet) with either API.
# Material Mode bits:
# No Halo: | With Halo:
#---------------|--------------
# 0: Traceable | Not Used
# 1: Shadow | Not Used
# 2: Shadeless | Not Used
# 3: Wire | Not Used
# 4: VCol Light | Not Used
# 5: Halo | --------
# 6: ZTransp | Not Used
# 7: VCol Paint | Not Used
# 8: ZInvert | Rings
# 9: Env | Lines
#10: OnlyShadow | X Alpha
#11: TexFace | Star
#12: Not Used | HaloTex
#13: Not Used | HaloPuno
#14: No Mist | Shaded
#15: Not Used | Flare
Of course this is not needed any longer, in the new API setMode() and getMode() use strings, which is a lot simpler.