Get all Descriptions of an object
On 28/12/2015 at 21:33, xxxxxxxx wrote:
How does one gather all the descriptions of an object? Or to be able to iterate through them all in Python?
Let's say I'd like to get all the attributes of an object, all of the keyable, or linkable(via Xpresso) attributes of an object. Is there a way to get all of them through python? Like specifically, all of the specific attributes for that object(Layers, Coordinates, Names, etc. are all the same).
I know I can do op[c4d.SOME_ID_NAME], but I have no way to procedurally iterate through all available unique descriptions for that object?
The idea behind this, is I'd like to be able to get all the descriptions so I could store any keyframes and rebuild key tracks if needed.
Can anyone help me out in this realm?
On 29/12/2015 at 01:51, xxxxxxxx wrote:
On 29/12/2015 at 08:30, xxxxxxxx wrote:
Hey Thanks for that, Illya. That definitely helps. I somehow managed to miss it.
So that is grabbing everything , which is kind of nice. But how do I exclude cerktain ones? Like say I want to ignore the Basic, Coordinates, and/or Falloff Tabs, but grab everything else?
I was thinking that maybe the group id's would match per group, but then like theres some settings from say the falloff that don't seem to follow the group ID's or Description ID's.
Does anyone have any insight there?
On 29/12/2015 at 09:49, xxxxxxxx wrote:
Here is an example that also gets the IDs and the data types that you can use to filter out what you want/don't want.
#This script gets the description values on the selected object import c4d def main() : if op is None: return description = op.GetDescription(c4d.DESCFLAGS_DESC_0) # Get the description of the active object for bc, paramid, groupid in description: # Iterate over the parameters of the description print bc[c4d.DESC_NAME] # Print the current parameter name print bc[c4d.DESC_IDENT] # Print the current parameter ID #Check if the description is a long type #Look up the other DTYPE options in the docs print bc[c4d.DTYPE_LONG] if __name__=='__main__': main()
On 29/12/2015 at 14:38, xxxxxxxx wrote:
Thank you for that Scott, that is helpful, however it's not quite what I am looking for.
I'm kind of wanting to gather all the information, almost by Tab in the Attribute Manager, rather than by type. The idea here is I need to be able to create an Xpresso node of that object, with all of it's possible unique object attributes(So ignoring things like everything in the Basic, Coords, and Falloff Tabs). When I print the names, I can see that the name of the tab, but I don't see anything that is tying a description to that tab. Since I'd like this to be agnostic and work on nearly everything, I can't hard code logic since it may not work for everything.
Does that make any sense? Is that at all possible?
On 30/12/2015 at 08:33, xxxxxxxx wrote:
You can filter the groupid variable in the for loop for all the description parameters.
For instance to print only the parameters in the Object tab group:
if op is None: return description = op.GetDescription(c4d.DESCFLAGS_DESC_0) for bc, paramid, groupid in description: if groupid.id==c4d.ID_OBJECTPROPERTIES: if bc[c4d.DESC_NAME] and bc[c4d.DESC_IDENT]: print bc[c4d.DESC_NAME], bc[c4d.DESC_IDENT]
Use Tbaselist2d to check for the Basic group parameters.
Use FALLOFF_GROUPFALLOFF to check for the Falloff group parameters.
For the Coord group I'm afraid you'll have to check each parameter for ID_BASEOBJECT_REL_POSITION, ID_BASEOBJECT_REL_ROTATION, ID_BASEOBJECT_REL_SCALE, ID_BASEOBJECT_ROTATION_ORDER etc.
This is because these parameters groups seem to be dynamically created.
Alternatively you can filter the ID name of the description parameter and discard the names that begin with ID_BASEOBJECT...
Here's the code I used:
import c4d def main() : if op is None: return description = op.GetDescription(c4d.DESCFLAGS_DESC_0) for bc, paramid, groupid in description: isgroup = paramid.dtype==c4d.DTYPE_GROUP if isgroup: continue group = groupid.id filtergroup = group!=c4d.Tbaselist2d and group!=c4d.FALLOFF_GROUPFALLOFF idname = bc[c4d.DESC_IDENT] if idname: filtergroup = filtergroup and not idname.startswith("ID_BASEOBJECT") if filtergroup: if bc[c4d.DESC_NAME] and bc[c4d.DESC_IDENT]: print bc[c4d.DESC_NAME], bc[c4d.DESC_IDENT] if __name__=='__main__': main()