Hi,
works fine for me. But the code is missing import statements and a call to main()
. Also the indentation is all messed up when you copy the code from their homepage. I just mangled the code through an autopeper, added import and invoked main()
.
On a side note: I am not sure if this is code you should learn from. This fine if you just want to get something done. For a learning site I find this unsuitable, but maybe I am to picky.
import c4d
def GetKeyframeSelection(op):
"""
"""
if not op or not op.KeyframeSelectionContent():
return None
keySelection = []
desc = op.GetDescription(c4d.DESCFLAGS_DESC_0)
for bc, paramid, groupid in desc:
# print paramid
# Handle Vectors - seems desc iterator only does top level
if paramid[0].dtype == c4d.DTYPE_VECTOR:
for i in xrange(c4d.VECTOR_X, c4d.VECTOR_Z+1):
did = c4d.DescID(
paramid[0], c4d.DescLevel(i, c4d.DTYPE_REAL, 0))
if op.FindKeyframeSelection(did):
keySelection.append(did)
# Handle top level DescIDs
elif op.FindKeyframeSelection(paramid):
keySelection.append(paramid)
return keySelection
def main():
"""
"""
keySelection = GetKeyframeSelection(op)
if keySelection:
print "*"*4, "Keyframe Select IDs", "*"*4
print keySelection
if __name__ == "__main__":
main()
Cheers
zipit