hello,
you have to set back the field list like so:
Warning : I discovered that GetSelected is actually bugged and if you set the includeChildren
to False, it will crash.
I've opened a bug report for that.
you can use this with children or retrieves the layer using your own function as you can do with an object hierarchy (fieldlayer are BaseList2D)
import c4d
def main():
if op is None:
raise TypeError("no object selected")
data = op.GetDataInstance()
# Retrieves the fieldlist
fl = data.GetCustomDataType(c4d.FIELDS)
if fl is None:
raise ValueError("no field list found")
root = fl.GetLayersRoot()
sel = list()
# Retrieves the selected layers.
fl.GetSelected(sel, True)
for layer in sel:
layer.SetStrength(0.5)
layer.DelBit(c4d.BIT_ACTIVE)
# Sets back the field list to update its content.
op.SetParameter(c4d.FIELDS, fl, c4d.DESCFLAGS_SET_NONE)
c4d.EventAdd()
if __name__=='__main__':
main()
The linked object is still selected, but that reproduce what the "select none" popup menu does.
Cheers,
Manuel