On 30/01/2017 at 08:41, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13
Platform: Windows ;
Language(s) : C++ ; PYTHON ;
---------
Hi,
I'm have a devil of a time getting the correct parent of each UD item using DESC_PARENTGROUP.
It returns a DescID type value, and for life of me I cannot extract the values from it. :angry:
I need the first value. That's the level# for the UD item's parent. But I just cannot get it.
These are the things I've tried so far.
This is written in Python because it's quicker to play around with. But I need to get the parent's level#s in C++ as well as in Python.
How the heck do we get the values from DESC_PARENTGROUP?
import c4d
def main() :
obj = doc.GetActiveObject()
if obj is None: return
for UD_ID, bc in obj.GetUserDataContainer() :
pgroup = bc[c4d.DESC_PARENTGROUP]
#This prints the correct group the UD entry belongs to
#But it's returned in a DescID format. example: (5,1,0)
print pgroup
#This prints c4d.DescLevel object at hex number
#How do I use that?
print pgroup[0]
#This prints (700, 5, 0) for all UD items!?
print pgroup[0].id
#This also returns incorrect values
#It prints (700, 5, 0) for every UD item!?
print c4d.DescID(pgroup[0])
#This also returns incorrect values
#It prints (700, 0, 0) for every UD item!?
ID = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(pgroup[0].id))
print ID
#How do I get the correct first value of the pgroup DescID object??
c4d.EventAdd()
if __name__=='__main__':
main()
-ScottA