SOLVED SetBit vs. SetAllBits etc... flags documentation?

Here's a documentation question I just stumbled over:

The functions BaseList2D.Set/Del/ToggleBit() all accept a bitfield as parameter (of type int), in which several bits can be set. They work fine that way.
However, there is an additional function SetAllBits() which... does the same as SetBit()? I just can't see a difference in behavior. Having such a function suggests (by its name) that the other three functions are meant to accept only a single bit as argument? So, is there a difference between SetBit() and SetAllBits() that I fail to see?

The function GetBit() is documented as returning an int. It does return a bool though. (So in this case, there is a significant difference to GetAllBits() which indeed returns an int containing the full bitfield.)
GetBit() accepts a bitfield with multiple bits set, just like the other "singular" functions above. The return value seems to be True when all bits from this bitfield are actually set in the object. Docs don't say so though.

Third, there are some flags which are dubious. BIT_OFOLD has been replaced by NBIT_OM1/2/3/4_FOLD some time ago, but the documentation still says Folded in object manager. Even in the C++ documentation. Reading on, I find the hint that this flag is now used to mark folded layers in the Layer Manager - so it's not deprecated at least. (I didn't verify this usage yet.) And what's BIT_MFOLD currently doing?

There is also still no formal constant BIT_SELECTRENDERDATA to denote selected render data entries - searching this forum yields the numeric value 0x08 so I guess that still counts as undocumented functionality. (Again, I didn't verify yet.)

Hi @Cairyn

  1. SetBit as the name suggest will only set the passed bit doing l_bitfeld = l_bitfeld | mask; where mask is the Int32 input bit (so you can toggle multiple bit passing a BitField), while SetAllBit do l_bitfeld = bits; where bits is the Int32 bitfield, so if you pass only BIT_ACTIVE to SetAllBit only BIT_ACTIVE will be set and not the other.
  2. GetBit should return a bool this is a python doc issue, thanks for reporting it, it's going to be fixed. The issue is not here in C++.
  3. GetBit can accept a bitfield and return True only when all bits of the bitfield is set in the object. in fact GetBit is nothing more than return (bits & InputBitSetToTest) == InputBitSetToTest;.
  4. BIT_OFOLD is still used to determine in treeview (e.g. Layer TreeView but also in some other parts). I will fix both C++ and Python doc.
  5. BIT_MFOLD means folded in the material manager when used as a Texture Layer mode (in bodypaint).
  6. Yes, unfortunately, some old part of Cinema 4D are still hardcoded... And the RenderSetting treeview ID is one of them. Here are the values:

I hope I didn't miss any questions, if yes feel free to ask,

@m_adam Thanks for the info! I knew I was still missing a few flags 😉