new question, forked from this thread
Thanks for the detailed explanation about type, will try following it from now on.
Tested FIeldLists implementation and it seems to work very well so far, the only thing I struggle is with "half selected" (bold orange) elements in fieldlists, is there a way to deselect them all like with volumebuilder, where you simply call:
for i in xrange(0, obj.GetListEntryCount()):
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)
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.
for layer in sel:
# Sets back the field list to update its content.
op.SetParameter(c4d.FIELDS, fl, c4d.DESCFLAGS_SET_NONE)
The linked object is still selected, but that reproduce what the "select none" popup menu does.
you could try your luck with BaseList2D.DelBit(), but I wouldn't hold my breath, since FieldLists are presented in a very specialized GUI gadget. Something like this (I did not try this):
for layer in get_field_layers(my_fieldlist):
I've forked the other thread as this is a new question.
I'm not sure what you are talking about "half selected" element. Are you talking about the field object in the object manager ?
A screenshot showing what you mean by that would be apreciate.
@m_magalhaes I am talking about the bold orange Highlight on selected field object when it is not actually selected in the OM but trough the field list
I would like to remove this, deselect everything inside Field list, if possible.
@zipit Thanks for this, I tried, doesn't seem to work with DelBit(), it does change the state, so if I read it back with GetBit() it says false, but it doesn't reflect in OM or AM.
But thanks anyway, this is more a visual thing anyway, would be cool to fix but it works without it too, just more confusing
Added the code you provided and it works nicely, thanks so much!