-
Notifications
You must be signed in to change notification settings - Fork 0
/
json_tree.py
124 lines (120 loc) · 3.28 KB
/
json_tree.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# -*-coding: utf-8 -*-
# from maya import cmds
# import json
# import types
from anytree import RenderTree, Node
from anytree.importer import DictImporter
importer = DictImporter()
face_rig_dict = {
"root": "face_rig",
"children": [
{ "face_constraint": "face_constraint" },
{
"face_ctrl": [
{
"ctrl_grp": [
{
"jaw_ctrl_locator": [
{
"lowerlip": [
{
"lowerlip2": "lowerlip_2_sufaceJoint"
}
]
}
]
},
{
"lowerEyelid_left_ctrl_locator": [
{
"lowerEyelid_left": [
"lowerEyelid_left_1_bn_ctrl",
"lowerEyelid_left_2_bn_ctrl",
"lowerEyelid_left_3_bn_ctrl"
]
}
]
},
{
"upperEyelid_left_ctrl_locator": [
{
"upperEyelid_left": [
"upperEyelid_left_1_bn_ctrl",
"upperEyelid_left_2_bn_ctrl",
"upperEyelid_left_3_bn_ctrl"
]
}
]
}
]
},
{
"brows_left": [
"brows_left_1_locator",
"brows_left_2_locator",
"brows_left_3_locator"
]
},
{
"brows_right": [
"brows_right_1_locator",
"brows_right_2_locator",
"brows_right_3_locator"
]
},
{
"mouth_conner": [
{
"upperlip": "upperlip_2_surfaceJoint"
},
{
"mouthCorner_left": [
{
"mouthCorner_left": [
{
"mouthCorner_left_jaw": [
{
"mouthCorner_left_ctrl": [
{ "mouthCorner_left_locater_grp": "mouthCorner_left_locater" },
"upperlip_1_sufaceJoint",
"lowerlip_1_sufaceJoint"
]
}
]
}
]
}
]
},
{
"mouthCorner_right": [
{
"mouthCorner_right": [
{
"mouthCorner_right_jaw": [
{
"mouthCorner_right_ctrl": [
{ "mouthCorner_right_locater_grp": "mouthCorner_right_locater" },
"upperlip_3_sufaceJoint",
"lowerlip_3_sufaceJoint"
]
}
]
}
]
}
]
}
]
}
]
}
]
}
data = {"a":"root", 'children': [{'a': 'sub0','children': [{'a': 'sub0A', 'b': 'foo'}, {'a': 'sub0B'}]},{'a': 'sub1'}]}
root = importer.import_(data)
rootB = importer.import_(face_rig_dict)
print(RenderTree(root))
print(RenderTree(rootB))
dict = {"a":"b", "c":"d"}
print (len(dict))