I am playing with the Attribute Manager, and tried reading out the ToolData of some selection tools using following script:
# Read out the BaseContainer from ToolData
import c4d
def main():
print " --- read ToolData BaseContainer ---"
toolID = doc.GetAction()
tool = c4d.plugins.FindPlugin(toolID, c4d.PLUGINTYPE_TOOL)
print "Active tool = %s (%i)" % (tool.GetName(), toolID)
# parse the tooldata
toolbc = c4d.plugins.GetToolData(doc, toolID)
i=0
for elementID, value in toolbc:
elementType = toolbc.GetType(elementID)
print "%i ID: %i, Type: %i, Value: " % (i, elementID, elementType), value
i+=1
if __name__=='__main__':
main()
The output for the Live Selection tool was as expected. All attributes of the tool being visualized in the Attribute Manager can be found back in the printed output.
But then I selected the Rectangle Selection and executed the script once more. To my surprise very few attributes were printed out. Same for the Lasso Selection and Polygon Selection.
--- read ToolData BaseContainer ---
Active tool = Live Selection (200000083)
0 ID: 2108, Type: 15, Value: 1
1 ID: 2109, Type: 15, Value: 10
2 ID: 2200, Type: 15, Value: 0
3 ID: 2124, Type: 15, Value: 0
4 ID: 2125, Type: 19, Value: 1.0
5 ID: 2169, Type: 15, Value: 1
6 ID: 2163, Type: 15, Value: 0
7 ID: 2164, Type: 15, Value: 0
8 ID: 2201, Type: 15, Value: 0
9 ID: 2202, Type: 19, Value: 100.0
10 ID: 2203, Type: 19, Value: 1.0
11 ID: 2204, Type: 15, Value: 0
12 ID: 2205, Type: 15, Value: 0
13 ID: 2206, Type: 15, Value: 0
14 ID: 2207, Type: 19, Value: 0.5
15 ID: 2209, Type: 15, Value: 1
16 ID: 2208, Type: 1009060, Value: <c4d.SplineData object at 0x000000B81496D250>
17 ID: 2129, Type: 15, Value: 0
18 ID: 2130, Type: 19, Value: 1.0
19 ID: 2131, Type: 19, Value: 0.0
20 ID: 2132, Type: 19, Value: 1.0
21 ID: 20000, Type: 15, Value: 2
22 ID: 20001, Type: 15, Value: 0
23 ID: 20003, Type: 19, Value: 0.0
24 ID: 20004, Type: 19, Value: 0.0
25 ID: 20005, Type: 19, Value: 0.0
26 ID: 20006, Type: 15, Value: 0
27 ID: 705, Type: 15, Value: 1
28 ID: 20002, Type: 15, Value: 0
--- read ToolData BaseContainer ---
Active tool = Rectangle Selection (200000084)
0 ID: 2107, Type: 15, Value: 1
1 ID: 2106, Type: 15, Value: 0
2 ID: 705, Type: 15, Value: 1
--- read ToolData BaseContainer ---
Active tool = Lasso Selection (200000085)
0 ID: 705, Type: 15, Value: 1
--- read ToolData BaseContainer ---
Active tool = Polygon Selection (200000086)
0 ID: 705, Type: 15, Value: 1
So, I am rather confused about the content of the ToolData for the last 3 selection tools.
These printed output don't reflect the tool's attributes seen in the Attribute Manager. Are these attributes stored somewhere else perhaps?
Or is my script wrong in some way?