jasongzy commited on
Commit
e9eca74
·
1 Parent(s): 9c04fbb

🦄 refactor: utils

Browse files
Files changed (5) hide show
  1. .gitignore +162 -0
  2. character_bones.txt +372 -83
  3. character_refine.py +27 -93
  4. try_import_blender.py +1 -17
  5. utils.py +196 -0
.gitignore CHANGED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
character_bones.txt CHANGED
@@ -3,113 +3,249 @@
3
  ./character/079f3ee7c8d748481707ca78c95750ac.fbx: 65
4
  ./character/08ed9e6576433de9fb72baae34d482b6.fbx: 65
5
  ./character/08f7e724f32af241e56a9244c2f37b43.fbx: 65
6
- ./character/098424150eb08fb107185646afaeee83.fbx: 64
7
  ./character/0a29fafad2ca23eba1787e20894ea8f6.fbx: 65
8
- ./character/0b69ca9d9cd64f4c061659f29956e297.fbx: 81
9
- ./character/0eb7402a9104734d873599c7f9f01c3d.fbx: 99
10
- ./character/0fa8427ca1b7b2f410e893daa42df16c.fbx: 67
11
- ./character/123d7c7f828741681ffed14eacaf606d.fbx: 69
12
- ./character/19b740666ef33a06abf265235d8281a0.fbx: 65
13
- ./character/1c679b4220a9b78133db6c49f59ca65c.fbx: 83
14
  ./character/1f6a7214d5f9eee30f4da837ad0db9a9.fbx: 65
15
  ./character/216f6676c0df33582682a270735a0bda.fbx: 65
16
- ./character/222261b7a837ccdf5db5ea086430d4c7.fbx: 112
17
  ./character/258580e0c4983768c0233dca33157732.fbx: 57
18
- ./character/27de3b0b89d27fa7e654955765e40d3b.fbx: 79
19
- ./character/28069e1e9f570cc90128fe1241343875.fbx: 47
20
- ./character/2d925ffeafc887cf96d22d272e6a87cd.fbx: 69
21
- ./character/32db57cc0f9c3ee01c22924512d56283.fbx: 73
22
- ./character/39967d464dd297954f89d06fb587045f.fbx: 99
23
  ./character/3c21546cb958a3daba75704b232b7e4b.fbx: 65
24
- ./character/3e911fa9c30c9a00a9de31409095cd57.fbx: 67
25
  ./character/3ec1224ed7c692d1e83a4cdfc2f5340b.fbx: 65
26
- ./character/4c989f8d4d0b9c1e6e096f21719fd09d.fbx: 66
27
- ./character/4cd9c2951759527d10bb7916baa80ca2.fbx: 99
28
- ./character/4fd247797b4f3653d5c2a8b335b03d29.fbx: 69
29
  ./character/51b67149e52d48e2442f1db223f59ba9.fbx: 65
30
  ./character/51d19d5e4cd1c8c8d75a97f078ff9476.fbx: 65
31
- ./character/51e1e51887023725371b27fd0cb3dca1.fbx: 65
32
  ./character/525795a33ca1026996b5ca009d61e263.fbx: 65
33
  ./character/57f74ab8c6de76c82d53e3257a6778e4.fbx: 65
34
  ./character/5bf474106308ccb071045e9579ca95e5.fbx: 65
35
- ./character/5cd6b5bf8b921a2cb0e4ce71d685ff90.fbx: 69
36
- ./character/6987df4026a93126ed745db3b5f2fbcf.fbx: 67
37
  ./character/69c3f460dcf1f1f97942d5dafaac572d.fbx: 65
38
  ./character/73cd22e7123f4c8e78ffc11ad5fbbc29.fbx: 65
39
  ./character/75a7bced986dc088580ecbe09e1c8590.fbx: 65
40
  ./character/761718127eb6d283b7bf7076bca62b78.fbx: 65
41
- ./character/761b5a0cf1945d0089f00686beb41f49.fbx: 65
42
  ./character/7dcd7c3eb5f2fb50caf6ae6896e9464c.fbx: 65
43
  ./character/7dd7bf41bda834a9500b2ff93705ad02.fbx: 65
44
  ./character/7faa53355e944ba38be5a4b7de179290.fbx: 65
45
  ./character/7fd6d88afe76663358a61901be3c6c15.fbx: 65
46
- ./character/8044e1503d3549a144741dc1878d414a.fbx: 43
47
  ./character/81f41f90717b8383b3d2fffb18f95d07.fbx: 65
48
  ./character/831a835d6cca7f50fee848116a1e0a6b.fbx: 88
49
  ./character/83828f0fe01d389df691a0b8f2e19b95.fbx: 72
50
- ./character/840c84726b0f55c9fa7235074394fd6a.fbx: 67
51
- ./character/85bc8db2b257cf836c186593aa8a1fce.fbx: 43
52
  ./character/893b3e8f4a0cea4255ccee36633756e7.fbx: 65
53
  ./character/8b6cd9d3a78bdf860d3d06b58715b310.fbx: 65
54
- ./character/8dfaf7ace7778cd25a6b181d98cd7e77.fbx: 67
55
  ./character/93025f9cd069b342a20217702a522b54.fbx: 65
56
  ./character/932216e3a518b0468f18bbb824ee6fa5.fbx: 65
57
  ./character/9882611aba55c935f071e41769da7b99.fbx: 65
58
  ./character/9a24bbb67c6dac80b1e83238982fc9bd.fbx: 65
59
  ./character/9a3c048709538dfbe0be943c9fae3d62.fbx: 65
60
- ./character/9e33cfb2c5443136600e393a4aa2e7f1.fbx: 43
61
- ./character/a0641e810f7d000c8ca59e7224c9d796.fbx: 72
62
- ./character/a3d6df0a1670bd02cc732c8137427dbe.fbx: 67
63
  ./character/a4ce3af02c103b2e9b78b9b14e7a01a3.fbx: 65
64
- ./character/a688cfa656103db0d2acb62c8d2d9144.fbx: 69
65
- ./character/aa03d7c7297f3864ce77600f5f940606.fbx: 69
66
- ./character/aed9922313c4b66e9b3ec1bc6dec06a8.fbx: 65
67
- ./character/b0ce097858de7591269ef24996ad0808.fbx: 67
68
- ./character/b1bf836b9d040760b79534e30a8cba76.fbx: 86
69
- ./character/b1ca6a6e9f48e9a7e4c2a92eb1837e37.fbx: 69
70
  ./character/b1eea1f10e0a85ad8f6b8c8cc5882cf8.fbx: 65
71
- ./character/b45062da94f349e53a67b0028539deac.fbx: 63
72
  ./character/b6e2f4dbb404550f7c05e5158c45f979.fbx: 65
73
  ./character/b78413c2dc7908bf952a609b24569807.fbx: 65
74
  ./character/b9ae94869ab838ee63cf92990211e525.fbx: 49
75
- ./character/bad88bdd65811e64a724b49cb0e505a5.fbx: 65
76
- ./character/bc9c26c1c3653c81d3d35261cd696839.fbx: 67
77
- ./character/bd0a2e2cc4da1a2e566e6dd98402edfb.fbx: 65
78
- ./character/bd5584dc8872126d57d969aa07ec09a6.fbx: 37
79
- ./character/c3b24f5c406ef4c09c2c07ae65dba0e0.fbx: 65
80
- ./character/c4d054e07d59a8b2224e07ab2fbf505b.fbx: 75
81
- ./character/c92d8db4a32b4606fb6258a385f5fcd1.fbx: 65
82
- ./character/cb8b934b054940623581dfaf5d9fd468.fbx: 68
83
  ./character/cdf89c5c4430cbc672e0f61c78797d39.fbx: 65
84
- ./character/cf65a1c8be43a9c90570b99a0b702aff.fbx: 76
85
- ./character/cf7e9c498421b75e2df678adc5284783.fbx: 65
86
- ./character/d2f2e35da6c1fcca872fccf83fef9a5a.fbx: 72
87
  ./character/e000b51a0c9526a75f155bc925722db3.fbx: 65
88
- ./character/e426198d78eaf096bf1e38ffdaa9af17.fbx: 73
89
  ./character/e4280b007901ef1c87a68be75323ab39.fbx: 87
90
  ./character/e5e1eccee079207473fafb1c163e2272.fbx: 65
91
- ./character/eb5e61abbf1fd39f3e73212723d5f580.fbx: 66
92
- ./character/eceb1dd6a739c6523c4208394e95a659.fbx: 69
93
- ./character/ed5953ef8156aee8bbe329c3e6ff39a0.fbx: 68
94
- ./character/f24b568cf5d54dca7fbe5dd328e49632.fbx: 59
95
  ./character/fdad443d5251b547f75d6578a6447c7c.fbx: 65
96
- mixamorig:Hips: 95/95
97
- mixamorig:Spine: 95/95
98
- mixamorig:Spine1: 95/95
99
- mixamorig:Spine2: 95/95
100
- mixamorig:Neck: 95/95
101
- mixamorig:Head: 95/95
102
- mixamorig:HeadTop_End: 95/95
103
  LeftEye: 3/95
104
  RightEye: 3/95
105
- mixamorig:LeftShoulder: 95/95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  mixamorig:LeftArm: 95/95
 
 
107
  mixamorig:LeftForeArm: 95/95
 
 
 
 
108
  mixamorig:LeftHand: 95/95
109
- mixamorig:LeftHandThumb1: 94/95
110
- mixamorig:LeftHandThumb2: 94/95
111
- mixamorig:LeftHandThumb3: 94/95
112
- mixamorig:LeftHandThumb4: 94/95
113
  mixamorig:LeftHandIndex1: 94/95
114
  mixamorig:LeftHandIndex2: 94/95
115
  mixamorig:LeftHandIndex3: 94/95
@@ -118,22 +254,123 @@ mixamorig:LeftHandMiddle1: 91/95
118
  mixamorig:LeftHandMiddle2: 91/95
119
  mixamorig:LeftHandMiddle3: 91/95
120
  mixamorig:LeftHandMiddle4: 90/95
121
- mixamorig:LeftHandRing1: 90/95
122
- mixamorig:LeftHandRing2: 90/95
123
- mixamorig:LeftHandRing3: 90/95
124
- mixamorig:LeftHandRing4: 89/95
125
  mixamorig:LeftHandPinky1: 88/95
126
  mixamorig:LeftHandPinky2: 88/95
127
  mixamorig:LeftHandPinky3: 88/95
128
  mixamorig:LeftHandPinky4: 87/95
129
- mixamorig:RightShoulder: 95/95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  mixamorig:RightArm: 95/95
 
 
 
 
 
 
 
 
 
 
131
  mixamorig:RightForeArm: 95/95
 
 
 
 
 
 
132
  mixamorig:RightHand: 95/95
133
- mixamorig:RightHandThumb1: 94/95
134
- mixamorig:RightHandThumb2: 94/95
135
- mixamorig:RightHandThumb3: 94/95
136
- mixamorig:RightHandThumb4: 94/95
137
  mixamorig:RightHandIndex1: 94/95
138
  mixamorig:RightHandIndex2: 94/95
139
  mixamorig:RightHandIndex3: 94/95
@@ -142,21 +379,73 @@ mixamorig:RightHandMiddle1: 89/95
142
  mixamorig:RightHandMiddle2: 89/95
143
  mixamorig:RightHandMiddle3: 89/95
144
  mixamorig:RightHandMiddle4: 88/95
145
- mixamorig:RightHandRing1: 89/95
146
- mixamorig:RightHandRing2: 89/95
147
- mixamorig:RightHandRing3: 89/95
148
- mixamorig:RightHandRing4: 88/95
149
  mixamorig:RightHandPinky1: 88/95
150
  mixamorig:RightHandPinky2: 88/95
151
  mixamorig:RightHandPinky3: 88/95
152
  mixamorig:RightHandPinky4: 87/95
153
- mixamorig:LeftUpLeg: 95/95
154
- mixamorig:LeftLeg: 95/95
155
- mixamorig:LeftFoot: 95/95
156
- mixamorig:LeftToeBase: 95/95
157
- mixamorig:LeftToe_End: 95/95
158
- mixamorig:RightUpLeg: 95/95
 
 
159
  mixamorig:RightLeg: 95/95
160
- mixamorig:RightFoot: 95/95
 
 
 
 
 
161
  mixamorig:RightToeBase: 95/95
162
  mixamorig:RightToe_End: 95/95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ./character/079f3ee7c8d748481707ca78c95750ac.fbx: 65
4
  ./character/08ed9e6576433de9fb72baae34d482b6.fbx: 65
5
  ./character/08f7e724f32af241e56a9244c2f37b43.fbx: 65
6
+ ./character_fbx_upgraded/098424150eb08fb107185646afaeee83.fbx: 64
7
  ./character/0a29fafad2ca23eba1787e20894ea8f6.fbx: 65
8
+ ./character_fbx_upgraded/0b69ca9d9cd64f4c061659f29956e297.fbx: 81
9
+ ./character_fbx_upgraded/0eb7402a9104734d873599c7f9f01c3d.fbx: 99
10
+ ./character_fbx_upgraded/0fa8427ca1b7b2f410e893daa42df16c.fbx: 67
11
+ ./character_fbx_upgraded/123d7c7f828741681ffed14eacaf606d.fbx: 69
12
+ ./character_fbx_upgraded/19b740666ef33a06abf265235d8281a0.fbx: 65
13
+ ./character_fbx_upgraded/1c679b4220a9b78133db6c49f59ca65c.fbx: 83
14
  ./character/1f6a7214d5f9eee30f4da837ad0db9a9.fbx: 65
15
  ./character/216f6676c0df33582682a270735a0bda.fbx: 65
16
+ ./character_fbx_upgraded/222261b7a837ccdf5db5ea086430d4c7.fbx: 112
17
  ./character/258580e0c4983768c0233dca33157732.fbx: 57
18
+ ./character_fbx_upgraded/27de3b0b89d27fa7e654955765e40d3b.fbx: 79
19
+ ./character_fbx_upgraded/28069e1e9f570cc90128fe1241343875.fbx: 47
20
+ ./character_fbx_upgraded/2d925ffeafc887cf96d22d272e6a87cd.fbx: 69
21
+ ./character_fbx_upgraded/32db57cc0f9c3ee01c22924512d56283.fbx: 73
22
+ ./character_fbx_upgraded/39967d464dd297954f89d06fb587045f.fbx: 99
23
  ./character/3c21546cb958a3daba75704b232b7e4b.fbx: 65
24
+ ./character_fbx_upgraded/3e911fa9c30c9a00a9de31409095cd57.fbx: 67
25
  ./character/3ec1224ed7c692d1e83a4cdfc2f5340b.fbx: 65
26
+ ./character_fbx_upgraded/4c989f8d4d0b9c1e6e096f21719fd09d.fbx: 66
27
+ ./character_fbx_upgraded/4cd9c2951759527d10bb7916baa80ca2.fbx: 99
28
+ ./character_fbx_upgraded/4fd247797b4f3653d5c2a8b335b03d29.fbx: 69
29
  ./character/51b67149e52d48e2442f1db223f59ba9.fbx: 65
30
  ./character/51d19d5e4cd1c8c8d75a97f078ff9476.fbx: 65
31
+ ./character_fbx_upgraded/51e1e51887023725371b27fd0cb3dca1.fbx: 65
32
  ./character/525795a33ca1026996b5ca009d61e263.fbx: 65
33
  ./character/57f74ab8c6de76c82d53e3257a6778e4.fbx: 65
34
  ./character/5bf474106308ccb071045e9579ca95e5.fbx: 65
35
+ ./character_fbx_upgraded/5cd6b5bf8b921a2cb0e4ce71d685ff90.fbx: 69
36
+ ./character_fbx_upgraded/6987df4026a93126ed745db3b5f2fbcf.fbx: 67
37
  ./character/69c3f460dcf1f1f97942d5dafaac572d.fbx: 65
38
  ./character/73cd22e7123f4c8e78ffc11ad5fbbc29.fbx: 65
39
  ./character/75a7bced986dc088580ecbe09e1c8590.fbx: 65
40
  ./character/761718127eb6d283b7bf7076bca62b78.fbx: 65
41
+ ./character_fbx_upgraded/761b5a0cf1945d0089f00686beb41f49.fbx: 65
42
  ./character/7dcd7c3eb5f2fb50caf6ae6896e9464c.fbx: 65
43
  ./character/7dd7bf41bda834a9500b2ff93705ad02.fbx: 65
44
  ./character/7faa53355e944ba38be5a4b7de179290.fbx: 65
45
  ./character/7fd6d88afe76663358a61901be3c6c15.fbx: 65
46
+ ./character_fbx_upgraded/8044e1503d3549a144741dc1878d414a.fbx: 43
47
  ./character/81f41f90717b8383b3d2fffb18f95d07.fbx: 65
48
  ./character/831a835d6cca7f50fee848116a1e0a6b.fbx: 88
49
  ./character/83828f0fe01d389df691a0b8f2e19b95.fbx: 72
50
+ ./character_fbx_upgraded/840c84726b0f55c9fa7235074394fd6a.fbx: 67
51
+ ./character_fbx_upgraded/85bc8db2b257cf836c186593aa8a1fce.fbx: 43
52
  ./character/893b3e8f4a0cea4255ccee36633756e7.fbx: 65
53
  ./character/8b6cd9d3a78bdf860d3d06b58715b310.fbx: 65
54
+ ./character_fbx_upgraded/8dfaf7ace7778cd25a6b181d98cd7e77.fbx: 67
55
  ./character/93025f9cd069b342a20217702a522b54.fbx: 65
56
  ./character/932216e3a518b0468f18bbb824ee6fa5.fbx: 65
57
  ./character/9882611aba55c935f071e41769da7b99.fbx: 65
58
  ./character/9a24bbb67c6dac80b1e83238982fc9bd.fbx: 65
59
  ./character/9a3c048709538dfbe0be943c9fae3d62.fbx: 65
60
+ ./character_fbx_upgraded/9e33cfb2c5443136600e393a4aa2e7f1.fbx: 43
61
+ ./character_fbx_upgraded/a0641e810f7d000c8ca59e7224c9d796.fbx: 72
62
+ ./character_fbx_upgraded/a3d6df0a1670bd02cc732c8137427dbe.fbx: 67
63
  ./character/a4ce3af02c103b2e9b78b9b14e7a01a3.fbx: 65
64
+ ./character_fbx_upgraded/a688cfa656103db0d2acb62c8d2d9144.fbx: 69
65
+ ./character_fbx_upgraded/aa03d7c7297f3864ce77600f5f940606.fbx: 69
66
+ ./character_fbx_upgraded/aed9922313c4b66e9b3ec1bc6dec06a8.fbx: 65
67
+ ./character_fbx_upgraded/b0ce097858de7591269ef24996ad0808.fbx: 67
68
+ ./character_fbx_upgraded/b1bf836b9d040760b79534e30a8cba76.fbx: 86
69
+ ./character_fbx_upgraded/b1ca6a6e9f48e9a7e4c2a92eb1837e37.fbx: 69
70
  ./character/b1eea1f10e0a85ad8f6b8c8cc5882cf8.fbx: 65
71
+ ./character_fbx_upgraded/b45062da94f349e53a67b0028539deac.fbx: 63
72
  ./character/b6e2f4dbb404550f7c05e5158c45f979.fbx: 65
73
  ./character/b78413c2dc7908bf952a609b24569807.fbx: 65
74
  ./character/b9ae94869ab838ee63cf92990211e525.fbx: 49
75
+ ./character_fbx_upgraded/bad88bdd65811e64a724b49cb0e505a5.fbx: 65
76
+ ./character_fbx_upgraded/bc9c26c1c3653c81d3d35261cd696839.fbx: 67
77
+ ./character_fbx_upgraded/bd0a2e2cc4da1a2e566e6dd98402edfb.fbx: 65
78
+ ./character_fbx_upgraded/bd5584dc8872126d57d969aa07ec09a6.fbx: 37
79
+ ./character_fbx_upgraded/c3b24f5c406ef4c09c2c07ae65dba0e0.fbx: 65
80
+ ./character_fbx_upgraded/c4d054e07d59a8b2224e07ab2fbf505b.fbx: 75
81
+ ./character_fbx_upgraded/c92d8db4a32b4606fb6258a385f5fcd1.fbx: 65
82
+ ./character_fbx_upgraded/cb8b934b054940623581dfaf5d9fd468.fbx: 68
83
  ./character/cdf89c5c4430cbc672e0f61c78797d39.fbx: 65
84
+ ./character_fbx_upgraded/cf65a1c8be43a9c90570b99a0b702aff.fbx: 76
85
+ ./character_fbx_upgraded/cf7e9c498421b75e2df678adc5284783.fbx: 65
86
+ ./character_fbx_upgraded/d2f2e35da6c1fcca872fccf83fef9a5a.fbx: 72
87
  ./character/e000b51a0c9526a75f155bc925722db3.fbx: 65
88
+ ./character_fbx_upgraded/e426198d78eaf096bf1e38ffdaa9af17.fbx: 73
89
  ./character/e4280b007901ef1c87a68be75323ab39.fbx: 87
90
  ./character/e5e1eccee079207473fafb1c163e2272.fbx: 65
91
+ ./character_fbx_upgraded/eb5e61abbf1fd39f3e73212723d5f580.fbx: 66
92
+ ./character_fbx_upgraded/eceb1dd6a739c6523c4208394e95a659.fbx: 69
93
+ ./character_fbx_upgraded/ed5953ef8156aee8bbe329c3e6ff39a0.fbx: 68
94
+ ./character_fbx_upgraded/f24b568cf5d54dca7fbe5dd328e49632.fbx: 59
95
  ./character/fdad443d5251b547f75d6578a6447c7c.fbx: 65
96
+ L_horn1: 1/95
97
+ L_horn_end: 1/95
 
 
 
 
 
98
  LeftEye: 3/95
99
  RightEye: 3/95
100
+ mixamorig:BackCloth1: 2/95
101
+ mixamorig:BackCloth2: 2/95
102
+ mixamorig:BackCloth3: 2/95
103
+ mixamorig:BackCloth4: 2/95
104
+ mixamorig:BackRope1: 1/95
105
+ mixamorig:BackRope2: 1/95
106
+ mixamorig:BackRope3: 1/95
107
+ mixamorig:Backpack: 1/95
108
+ mixamorig:Bag: 1/95
109
+ mixamorig:Belly: 2/95
110
+ mixamorig:Belly1: 1/95
111
+ mixamorig:BindLeftJacketString1: 1/95
112
+ mixamorig:BindLeftJacketString2: 1/95
113
+ mixamorig:BindRightJacketString1: 1/95
114
+ mixamorig:BindRightJacketString2: 1/95
115
+ mixamorig:Bow1: 1/95
116
+ mixamorig:Bow2: 1/95
117
+ mixamorig:Bow3: 1/95
118
+ mixamorig:Bow4: 1/95
119
+ mixamorig:Bow5: 1/95
120
+ mixamorig:Bow6: 1/95
121
+ mixamorig:Bow7: 1/95
122
+ mixamorig:Bow8: 1/95
123
+ mixamorig:Bow_Left: 1/95
124
+ mixamorig:Bow_Right: 1/95
125
+ mixamorig:Chin: 1/95
126
+ mixamorig:Cloak1: 2/95
127
+ mixamorig:Cloak2: 2/95
128
+ mixamorig:Cloak3: 2/95
129
+ mixamorig:Cloak4: 1/95
130
+ mixamorig:Cloak5: 1/95
131
+ mixamorig:Cloak6: 1/95
132
+ mixamorig:Cloak7: 1/95
133
+ mixamorig:Cloak_End: 1/95
134
+ mixamorig:Crotch1: 1/95
135
+ mixamorig:Crotch2: 1/95
136
+ mixamorig:Crotch3: 1/95
137
+ mixamorig:Crotch4: 1/95
138
+ mixamorig:F_skirt1: 3/95
139
+ mixamorig:F_skirt2: 3/95
140
+ mixamorig:F_skirt3: 3/95
141
+ mixamorig:F_skirt4: 2/95
142
+ mixamorig:F_skirt5: 1/95
143
+ mixamorig:F_skirt6: 1/95
144
+ mixamorig:F_skirt_end: 1/95
145
+ mixamorig:FrontCloth1: 2/95
146
+ mixamorig:FrontCloth2: 2/95
147
+ mixamorig:FrontCloth3: 2/95
148
+ mixamorig:FrontCloth4: 2/95
149
+ mixamorig:FrontRope1: 1/95
150
+ mixamorig:FrontRope2: 1/95
151
+ mixamorig:Hair1: 2/95
152
+ mixamorig:Hair2: 2/95
153
+ mixamorig:Hair3: 2/95
154
+ mixamorig:Hair4: 2/95
155
+ mixamorig:Hair5: 1/95
156
+ mixamorig:Hair6: 1/95
157
+ mixamorig:HairA: 2/95
158
+ mixamorig:HairB: 2/95
159
+ mixamorig:HairC: 1/95
160
+ mixamorig:HairC1: 1/95
161
+ mixamorig:HairE1: 1/95
162
+ mixamorig:HairE2: 1/95
163
+ mixamorig:HairF1: 1/95
164
+ mixamorig:HairF2: 1/95
165
+ mixamorig:HairG1: 1/95
166
+ mixamorig:HairG2: 1/95
167
+ mixamorig:HairLeftA1: 1/95
168
+ mixamorig:HairLeftB1: 1/95
169
+ mixamorig:HairLeftC1: 1/95
170
+ mixamorig:HairLeftD1: 1/95
171
+ mixamorig:HairLeftE1: 1/95
172
+ mixamorig:HairLeftF1: 1/95
173
+ mixamorig:HairMidA1: 1/95
174
+ mixamorig:HairMidB1: 1/95
175
+ mixamorig:HairMidC1: 1/95
176
+ mixamorig:HairMidD1: 1/95
177
+ mixamorig:HairMidE1: 1/95
178
+ mixamorig:HairMidF1: 1/95
179
+ mixamorig:HairRightA1: 1/95
180
+ mixamorig:HairRightB1: 1/95
181
+ mixamorig:HairRightC1: 1/95
182
+ mixamorig:HairRightD1: 1/95
183
+ mixamorig:HairRightE1: 1/95
184
+ mixamorig:HairRightF1: 1/95
185
+ mixamorig:Hair_Back: 1/95
186
+ mixamorig:Hair_End: 1/95
187
+ mixamorig:Hat: 2/95
188
+ mixamorig:Head: 95/95
189
+ mixamorig:HeadTop_End: 95/95
190
+ mixamorig:HeadTop_End1: 1/95
191
+ mixamorig:Hips: 95/95
192
+ mixamorig:Hood: 1/95
193
+ mixamorig:Hood0: 1/95
194
+ mixamorig:Hood1: 2/95
195
+ mixamorig:Hood2: 1/95
196
+ mixamorig:Jaw: 3/95
197
+ mixamorig:JawDowm: 1/95
198
+ mixamorig:JawUp: 1/95
199
+ mixamorig:LBackpack_Strap: 1/95
200
+ mixamorig:LFootTongue: 1/95
201
+ mixamorig:LHoodieString: 1/95
202
+ mixamorig:LHoodieString1: 1/95
203
+ mixamorig:LHoodieString2: 1/95
204
+ mixamorig:LSleeve: 1/95
205
+ mixamorig:L_A_skirt1: 2/95
206
+ mixamorig:L_A_skirt2: 2/95
207
+ mixamorig:L_A_skirt3: 2/95
208
+ mixamorig:L_A_skirt4: 1/95
209
+ mixamorig:L_A_skirt_end: 1/95
210
+ mixamorig:L_B_skirt1: 2/95
211
+ mixamorig:L_B_skirt2: 2/95
212
+ mixamorig:L_B_skirt3: 2/95
213
+ mixamorig:L_B_skirt4: 1/95
214
+ mixamorig:L_B_skirt_end: 1/95
215
+ mixamorig:L_C_skirt1: 2/95
216
+ mixamorig:L_C_skirt2: 2/95
217
+ mixamorig:L_C_skirt3: 2/95
218
+ mixamorig:L_C_skirt4: 1/95
219
+ mixamorig:L_C_skirt_end: 1/95
220
+ mixamorig:L_CheekFold: 1/95
221
+ mixamorig:L_Ear: 1/95
222
+ mixamorig:L_Eye: 1/95
223
+ mixamorig:L_EyelidLower: 1/95
224
+ mixamorig:L_EyelidUpper: 1/95
225
+ mixamorig:L_IOuterBrow: 1/95
226
+ mixamorig:L_InnerBrow: 1/95
227
+ mixamorig:L_InnerCheek: 1/95
228
+ mixamorig:L_LipCorner: 1/95
229
+ mixamorig:L_LipCornerLowTweak: 1/95
230
+ mixamorig:L_LipCornerUpTweak: 1/95
231
+ mixamorig:L_LipLower: 1/95
232
+ mixamorig:L_LipUpper: 1/95
233
+ mixamorig:L_LowerCheek: 1/95
234
+ mixamorig:L_MidBrow: 1/95
235
+ mixamorig:L_Nostril: 1/95
236
+ mixamorig:L_OuterCheek: 1/95
237
+ mixamorig:L_Temple: 1/95
238
+ mixamorig:L_horn1: 1/95
239
+ mixamorig:L_horn2: 1/95
240
  mixamorig:LeftArm: 95/95
241
+ mixamorig:LeftEye: 23/95
242
+ mixamorig:LeftFoot: 95/95
243
  mixamorig:LeftForeArm: 95/95
244
+ mixamorig:LeftHairA1: 1/95
245
+ mixamorig:LeftHairA2: 1/95
246
+ mixamorig:LeftHairC1: 1/95
247
+ mixamorig:LeftHairC2: 1/95
248
  mixamorig:LeftHand: 95/95
 
 
 
 
249
  mixamorig:LeftHandIndex1: 94/95
250
  mixamorig:LeftHandIndex2: 94/95
251
  mixamorig:LeftHandIndex3: 94/95
 
254
  mixamorig:LeftHandMiddle2: 91/95
255
  mixamorig:LeftHandMiddle3: 91/95
256
  mixamorig:LeftHandMiddle4: 90/95
 
 
 
 
257
  mixamorig:LeftHandPinky1: 88/95
258
  mixamorig:LeftHandPinky2: 88/95
259
  mixamorig:LeftHandPinky3: 88/95
260
  mixamorig:LeftHandPinky4: 87/95
261
+ mixamorig:LeftHandRing1: 90/95
262
+ mixamorig:LeftHandRing2: 90/95
263
+ mixamorig:LeftHandRing3: 90/95
264
+ mixamorig:LeftHandRing4: 89/95
265
+ mixamorig:LeftHandThumb1: 94/95
266
+ mixamorig:LeftHandThumb2: 94/95
267
+ mixamorig:LeftHandThumb3: 94/95
268
+ mixamorig:LeftHandThumb4: 94/95
269
+ mixamorig:LeftLeg: 95/95
270
+ mixamorig:LeftRibbon1: 1/95
271
+ mixamorig:LeftRibbon2: 1/95
272
+ mixamorig:LeftShoulder: 95/95
273
+ mixamorig:LeftToeBase: 95/95
274
+ mixamorig:LeftToe_End: 95/95
275
+ mixamorig:LeftUpArmTwist: 1/95
276
+ mixamorig:LeftUpLeg: 95/95
277
+ mixamorig:LeftWristTwist: 1/95
278
+ mixamorig:Left_Breast: 1/95
279
+ mixamorig:Left_Breast1: 1/95
280
+ mixamorig:Left_Butt1: 1/95
281
+ mixamorig:Left_CapeA: 1/95
282
+ mixamorig:Left_CapeA1: 1/95
283
+ mixamorig:Left_CapeB: 1/95
284
+ mixamorig:Left_CapeB1: 1/95
285
+ mixamorig:Left_CapeC: 1/95
286
+ mixamorig:Left_CapeC1: 1/95
287
+ mixamorig:Left_Collar: 1/95
288
+ mixamorig:Left_Collar1: 1/95
289
+ mixamorig:Left_Peck: 1/95
290
+ mixamorig:Left_ShortSleeve: 1/95
291
+ mixamorig:Left_Sleeve: 2/95
292
+ mixamorig:Leye: 3/95
293
+ mixamorig:LipMidLower: 1/95
294
+ mixamorig:LipMidUpper: 1/95
295
+ mixamorig:LowerChin: 1/95
296
+ mixamorig:M_skirt1: 1/95
297
+ mixamorig:M_skirt2: 1/95
298
+ mixamorig:M_skirt3: 1/95
299
+ mixamorig:M_skirt4: 1/95
300
+ mixamorig:M_skirt5: 1/95
301
+ mixamorig:M_skirt6: 1/95
302
+ mixamorig:MidBrows: 1/95
303
+ mixamorig:Neck: 95/95
304
+ mixamorig:Neck1: 3/95
305
+ mixamorig:Ponytail: 1/95
306
+ mixamorig:Ponytail1: 1/95
307
+ mixamorig:Ponytail2: 1/95
308
+ mixamorig:Pouch: 1/95
309
+ mixamorig:RBackpack_Strap: 1/95
310
+ mixamorig:RFootTongue: 1/95
311
+ mixamorig:RHoodieString: 1/95
312
+ mixamorig:RHoodieString1: 1/95
313
+ mixamorig:RHoodieString2: 1/95
314
+ mixamorig:RSleeve: 1/95
315
+ mixamorig:R_A_skirt1: 2/95
316
+ mixamorig:R_A_skirt2: 2/95
317
+ mixamorig:R_A_skirt3: 2/95
318
+ mixamorig:R_A_skirt4: 1/95
319
+ mixamorig:R_A_skirt_end: 1/95
320
+ mixamorig:R_B_skirt1: 2/95
321
+ mixamorig:R_B_skirt2: 2/95
322
+ mixamorig:R_B_skirt3: 2/95
323
+ mixamorig:R_B_skirt4: 1/95
324
+ mixamorig:R_B_skirt_end: 1/95
325
+ mixamorig:R_C_skirt1: 2/95
326
+ mixamorig:R_C_skirt2: 2/95
327
+ mixamorig:R_C_skirt3: 2/95
328
+ mixamorig:R_C_skirt4: 1/95
329
+ mixamorig:R_C_skirt_end: 1/95
330
+ mixamorig:R_CheekFold: 1/95
331
+ mixamorig:R_Ear: 1/95
332
+ mixamorig:R_Eye: 1/95
333
+ mixamorig:R_EyelidLower: 1/95
334
+ mixamorig:R_EyelidUpper: 1/95
335
+ mixamorig:R_IOuterBrow: 1/95
336
+ mixamorig:R_InnerBrow: 1/95
337
+ mixamorig:R_InnerCheek: 1/95
338
+ mixamorig:R_LipLower: 1/95
339
+ mixamorig:R_LipUpper: 1/95
340
+ mixamorig:R_LowerCheek: 1/95
341
+ mixamorig:R_MidBrow: 1/95
342
+ mixamorig:R_OuterCheek: 1/95
343
+ mixamorig:R_Temple: 1/95
344
+ mixamorig:R_bag1: 1/95
345
+ mixamorig:R_bag_end: 1/95
346
+ mixamorig:R_gLipCorner: 1/95
347
+ mixamorig:R_gLipCornerLowTweak: 1/95
348
+ mixamorig:R_gLipCornerUpTweak: 1/95
349
+ mixamorig:R_horn1: 1/95
350
+ mixamorig:R_horn2: 1/95
351
+ mixamorig:Reye: 3/95
352
+ mixamorig:Ribbon1: 1/95
353
+ mixamorig:Ribbon2: 1/95
354
+ mixamorig:Ribbon3: 1/95
355
  mixamorig:RightArm: 95/95
356
+ mixamorig:RightArmour1: 1/95
357
+ mixamorig:RightArmour2: 1/95
358
+ mixamorig:RightArmour3: 1/95
359
+ mixamorig:RightArmour4: 1/95
360
+ mixamorig:RightArmour5: 1/95
361
+ mixamorig:RightChain1: 1/95
362
+ mixamorig:RightChain2: 1/95
363
+ mixamorig:RightChain3: 1/95
364
+ mixamorig:RightEye: 25/95
365
+ mixamorig:RightFoot: 95/95
366
  mixamorig:RightForeArm: 95/95
367
+ mixamorig:RightHair1: 1/95
368
+ mixamorig:RightHair2: 1/95
369
+ mixamorig:RightHairA1: 1/95
370
+ mixamorig:RightHairA2: 1/95
371
+ mixamorig:RightHairC1: 1/95
372
+ mixamorig:RightHairC2: 1/95
373
  mixamorig:RightHand: 95/95
 
 
 
 
374
  mixamorig:RightHandIndex1: 94/95
375
  mixamorig:RightHandIndex2: 94/95
376
  mixamorig:RightHandIndex3: 94/95
 
379
  mixamorig:RightHandMiddle2: 89/95
380
  mixamorig:RightHandMiddle3: 89/95
381
  mixamorig:RightHandMiddle4: 88/95
 
 
 
 
382
  mixamorig:RightHandPinky1: 88/95
383
  mixamorig:RightHandPinky2: 88/95
384
  mixamorig:RightHandPinky3: 88/95
385
  mixamorig:RightHandPinky4: 87/95
386
+ mixamorig:RightHandRing1: 89/95
387
+ mixamorig:RightHandRing2: 89/95
388
+ mixamorig:RightHandRing3: 89/95
389
+ mixamorig:RightHandRing4: 88/95
390
+ mixamorig:RightHandThumb1: 94/95
391
+ mixamorig:RightHandThumb2: 94/95
392
+ mixamorig:RightHandThumb3: 94/95
393
+ mixamorig:RightHandThumb4: 94/95
394
  mixamorig:RightLeg: 95/95
395
+ mixamorig:RightNostril: 1/95
396
+ mixamorig:RightRope1: 1/95
397
+ mixamorig:RightRope2: 1/95
398
+ mixamorig:RightRope3: 1/95
399
+ mixamorig:RightRope4: 1/95
400
+ mixamorig:RightShoulder: 95/95
401
  mixamorig:RightToeBase: 95/95
402
  mixamorig:RightToe_End: 95/95
403
+ mixamorig:RightUpArmTwist: 1/95
404
+ mixamorig:RightUpLeg: 95/95
405
+ mixamorig:RightWristTwist: 1/95
406
+ mixamorig:Right_Breast: 1/95
407
+ mixamorig:Right_Breast1: 1/95
408
+ mixamorig:Right_Butt1: 1/95
409
+ mixamorig:Right_CapeA: 1/95
410
+ mixamorig:Right_CapeA1: 1/95
411
+ mixamorig:Right_CapeB: 1/95
412
+ mixamorig:Right_CapeB1: 1/95
413
+ mixamorig:Right_CapeC: 1/95
414
+ mixamorig:Right_CapeC1: 1/95
415
+ mixamorig:Right_Collar: 1/95
416
+ mixamorig:Right_Collar1: 1/95
417
+ mixamorig:Right_Peck: 1/95
418
+ mixamorig:Right_ShortSleeve: 1/95
419
+ mixamorig:Right_Sleeve: 2/95
420
+ mixamorig:Scalp: 1/95
421
+ mixamorig:Scart1: 1/95
422
+ mixamorig:Scart2: 1/95
423
+ mixamorig:Scart3: 1/95
424
+ mixamorig:Scart4: 1/95
425
+ mixamorig:Shield_joint: 1/95
426
+ mixamorig:Skirt1: 1/95
427
+ mixamorig:Skirt2: 1/95
428
+ mixamorig:Skirt3: 1/95
429
+ mixamorig:Skirt4: 1/95
430
+ mixamorig:Skirt5: 1/95
431
+ mixamorig:SkirtA: 1/95
432
+ mixamorig:SkirtA1: 1/95
433
+ mixamorig:SkirtB: 1/95
434
+ mixamorig:SkirtB1: 1/95
435
+ mixamorig:SkirtC: 1/95
436
+ mixamorig:SkirtC1: 1/95
437
+ mixamorig:Sleeve1: 1/95
438
+ mixamorig:Sleeve2: 1/95
439
+ mixamorig:Spine: 95/95
440
+ mixamorig:Spine1: 95/95
441
+ mixamorig:Spine2: 95/95
442
+ mixamorig:Sword_joint: 1/95
443
+ mixamorig:Throat: 1/95
444
+ mixamorig:TongueBack: 1/95
445
+ mixamorig:TongueMid: 1/95
446
+ mixamorig:TongueTip: 1/95
447
+ mixamorig:Visor1: 1/95
448
+ mixamorig:Weapon: 1/95
449
+ mixamorig:Whistle0: 1/95
450
+ mixamorig:Whistle1: 1/95
451
+ mixamorig:Whistle2: 1/95
character_refine.py CHANGED
@@ -1,81 +1,18 @@
1
  import os
2
- import sys
3
  from glob import glob
4
 
5
  import bpy
6
- import numpy as np
7
  from tqdm import tqdm
8
 
9
-
10
- class HiddenPrints:
11
- def __init__(self, disable=False):
12
- self.disable = disable
13
-
14
- def __enter__(self):
15
- if self.disable:
16
- return
17
- self._original_stdout = sys.stdout
18
- sys.stdout = open(os.devnull, "w")
19
-
20
- def __exit__(self, exc_type, exc_val, exc_tb):
21
- if self.disable:
22
- return
23
- sys.stdout.close()
24
- sys.stdout = self._original_stdout
25
-
26
-
27
- def remove_all(delete_actions=True):
28
- for obj in bpy.data.objects.values():
29
- bpy.data.objects.remove(obj, do_unlink=True)
30
- bpy.ops.outliner.orphans_purge(do_recursive=True)
31
- if delete_actions:
32
- for action in bpy.data.actions:
33
- bpy.data.actions.remove(action, do_unlink=True)
34
-
35
-
36
- def load_file(filepath: str):
37
- old_objs = set(bpy.context.scene.objects)
38
- if filepath.endswith(".glb"):
39
- bpy.ops.import_scene.gltf(filepath=filepath)
40
- elif filepath.endswith(".fbx"):
41
- bpy.ops.import_scene.fbx(filepath=filepath)
42
- else:
43
- raise RuntimeError(f"Invalid input file: {filepath}")
44
- imported_objs = set(bpy.context.scene.objects) - old_objs
45
- print("Imported:", imported_objs)
46
- return imported_objs
47
-
48
-
49
- def get_type_objs(obj_list=None, type="MESH"):
50
- if not obj_list:
51
- obj_list = bpy.context.scene.objects
52
- type_obj_list = []
53
- for obj in obj_list:
54
- if obj.type == type:
55
- type_obj_list.append(obj)
56
- return type_obj_list
57
-
58
-
59
- def get_all_mesh_obj(obj_list=None):
60
- return get_type_objs(obj_list, "MESH")
61
-
62
-
63
- def get_all_armature_obj(obj_list=None):
64
- return get_type_objs(obj_list, "ARMATURE")
65
-
66
-
67
- def get_rest_bones(armature_obj):
68
- if armature_obj is None:
69
- return None, None
70
- else:
71
- rest_bones = []
72
- bones_idx_dict: "dict[str,int]" = {}
73
- for i, bone in enumerate(armature_obj.data.bones):
74
- rest_bones.append(armature_obj.matrix_world @ bone.head_local)
75
- bones_idx_dict[bone.name] = i
76
- rest_bones = np.stack(rest_bones, axis=0)
77
- # print(bones_idx_dict)
78
- return rest_bones, bones_idx_dict
79
 
80
 
81
  def rename_maxiamo_bone(armature_obj):
@@ -88,23 +25,20 @@ def rename_maxiamo_bone(armature_obj):
88
  return armature_obj
89
 
90
 
91
- def mesh_quads2tris(obj_list=None):
92
- if not obj_list:
93
- obj_list = bpy.context.scene.objects
94
- for obj in obj_list:
95
- if obj.type == "MESH":
96
- # obj.select_set(True)
97
- bpy.context.view_layer.objects.active = obj
98
- bpy.ops.object.mode_set(mode="EDIT")
99
- bpy.ops.mesh.quads_convert_to_tris(quad_method="BEAUTY", ngon_method="BEAUTY")
100
- bpy.ops.object.mode_set(mode="OBJECT")
101
-
102
-
103
  if __name__ == "__main__":
104
  input_dir = "."
 
105
  output_dir = os.path.join(input_dir, "character_refined")
 
 
106
  os.makedirs(output_dir, exist_ok=True)
107
  character_list = sorted(glob(os.path.join(input_dir, "character", "*.fbx")))
 
 
 
 
 
 
108
  animation_list = sorted(glob(os.path.join(input_dir, "animation", "*.fbx")))
109
  unposed_list_file = "character_unposed.txt"
110
  if os.path.isfile(unposed_list_file):
@@ -129,17 +63,16 @@ if __name__ == "__main__":
129
  rest_bones, bones_idx_dict = get_rest_bones(armature_obj)
130
 
131
  # mesh_quads2tris(get_all_mesh_obj(obj_list))
132
- bpy.ops.object.select_all(action="DESELECT")
133
- for obj in obj_list:
134
- obj.select_set(True)
135
  bpy.ops.export_scene.fbx(
136
  filepath=os.path.join(output_dir, os.path.basename(file)),
137
  check_existing=False,
138
  use_selection=True,
139
- use_triangles=True, #!
140
  add_leaf_bones=False,
141
  bake_anim=False,
142
- embed_textures=False,
 
143
  )
144
  bones_name_list += list(bones_idx_dict.keys())
145
  with open(logfile, "a") as f:
@@ -152,9 +85,10 @@ if __name__ == "__main__":
152
 
153
  # Calculate the coverage of each bone among all characters
154
  print(sorted(set(bones_name_list)))
155
- with HiddenPrints():
156
- remove_all()
157
- rest_bones, bones_idx_dict = get_rest_bones(get_all_armature_obj(load_file(animation_list[0]))[0])
158
  with open(logfile, "a") as f:
159
- for v in bones_idx_dict.keys():
 
160
  f.write(f"{v}: {bones_name_list.count(v)}/{len(character_list)}\n")
 
1
  import os
 
2
  from glob import glob
3
 
4
  import bpy
 
5
  from tqdm import tqdm
6
 
7
+ from utils import (
8
+ HiddenPrints,
9
+ get_all_armature_obj,
10
+ get_rest_bones,
11
+ load_file,
12
+ mesh_quads2tris,
13
+ remove_all,
14
+ select_objs,
15
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
 
18
  def rename_maxiamo_bone(armature_obj):
 
25
  return armature_obj
26
 
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  if __name__ == "__main__":
29
  input_dir = "."
30
+ keep_texture = False
31
  output_dir = os.path.join(input_dir, "character_refined")
32
+ if keep_texture:
33
+ output_dir += "_textured"
34
  os.makedirs(output_dir, exist_ok=True)
35
  character_list = sorted(glob(os.path.join(input_dir, "character", "*.fbx")))
36
+ character_list_upgraded = sorted(glob(os.path.join(input_dir, "character_fbx_upgraded", "*.fbx")))
37
+ character_list_upgraded = {os.path.basename(x): x for x in character_list_upgraded}
38
+ for i, path in enumerate(character_list):
39
+ path_upgraded = character_list_upgraded.get(os.path.basename(path))
40
+ if path_upgraded is not None:
41
+ character_list[i] = path_upgraded
42
  animation_list = sorted(glob(os.path.join(input_dir, "animation", "*.fbx")))
43
  unposed_list_file = "character_unposed.txt"
44
  if os.path.isfile(unposed_list_file):
 
63
  rest_bones, bones_idx_dict = get_rest_bones(armature_obj)
64
 
65
  # mesh_quads2tris(get_all_mesh_obj(obj_list))
66
+ select_objs(obj_list, deselect_first=True)
 
 
67
  bpy.ops.export_scene.fbx(
68
  filepath=os.path.join(output_dir, os.path.basename(file)),
69
  check_existing=False,
70
  use_selection=True,
71
+ use_triangles=True, # !
72
  add_leaf_bones=False,
73
  bake_anim=False,
74
+ path_mode="COPY",
75
+ embed_textures=keep_texture,
76
  )
77
  bones_name_list += list(bones_idx_dict.keys())
78
  with open(logfile, "a") as f:
 
85
 
86
  # Calculate the coverage of each bone among all characters
87
  print(sorted(set(bones_name_list)))
88
+ # with HiddenPrints():
89
+ # remove_all()
90
+ # rest_bones, bones_idx_dict = get_rest_bones(get_all_armature_obj(load_file(animation_list[0]))[0])
91
  with open(logfile, "a") as f:
92
+ # for v in bones_idx_dict.keys():
93
+ for v in sorted(set(bones_name_list)):
94
  f.write(f"{v}: {bones_name_list.count(v)}/{len(character_list)}\n")
try_import_blender.py CHANGED
@@ -5,23 +5,7 @@ from glob import glob
5
  import bpy
6
  from tqdm import tqdm
7
 
8
-
9
- class HiddenPrints:
10
- def __init__(self, disable=False):
11
- self.disable = disable
12
-
13
- def __enter__(self):
14
- if self.disable:
15
- return
16
- self._original_stdout = sys.stdout
17
- sys.stdout = open(os.devnull, "w")
18
-
19
- def __exit__(self, exc_type, exc_val, exc_tb):
20
- if self.disable:
21
- return
22
- sys.stdout.close()
23
- sys.stdout = self._original_stdout
24
-
25
 
26
  if __name__ == "__main__":
27
  input_dir = "."
 
5
  import bpy
6
  from tqdm import tqdm
7
 
8
+ from utils import HiddenPrints
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  if __name__ == "__main__":
11
  input_dir = "."
utils.py ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import os
3
+ import sys
4
+
5
+ import bpy
6
+ import numpy as np
7
+ from bpy.types import Action, Armature, Mesh, Object
8
+
9
+ # isort: split
10
+ import bmesh
11
+ import mathutils
12
+
13
+
14
+ class HiddenPrints:
15
+ def __init__(self, enable=True, suppress_err=False):
16
+ self.enable = enable
17
+ self.suppress_err = suppress_err
18
+
19
+ def __enter__(self):
20
+ if not self.enable:
21
+ return
22
+ self._original_stdout = sys.stdout
23
+ sys.stdout = open(os.devnull, "w")
24
+ if self.suppress_err:
25
+ self._original_stderr = sys.stderr
26
+ sys.stderr = open(os.devnull, "w")
27
+
28
+ def __exit__(self, exc_type, exc_val, exc_tb):
29
+ if not self.enable:
30
+ return
31
+ sys.stdout.close()
32
+ sys.stdout = self._original_stdout
33
+ if self.suppress_err:
34
+ sys.stderr.close()
35
+ sys.stderr = self._original_stderr
36
+
37
+
38
+ USE_WORLD_COORDINATES = False
39
+
40
+
41
+ class Mode:
42
+ def __init__(self, mode_name="EDIT", active_obj: Object = None):
43
+ self.mode = mode_name
44
+ self.active = active_obj
45
+ self.pre_active = None
46
+ self.pre_mode = "OBJECT"
47
+
48
+ def __enter__(self):
49
+ self.pre_active = bpy.context.view_layer.objects.active
50
+ if self.pre_active is not None:
51
+ self.pre_mode = bpy.context.object.mode
52
+ bpy.context.view_layer.objects.active = self.active
53
+ bpy.ops.object.mode_set(mode=self.mode)
54
+ return self.active
55
+
56
+ def __exit__(self, exc_type, exc_val, exc_tb):
57
+ bpy.ops.object.mode_set(mode=self.pre_mode)
58
+ bpy.context.view_layer.objects.active = self.pre_active
59
+
60
+
61
+ def reset():
62
+ bpy.ops.wm.read_factory_settings(use_empty=True)
63
+
64
+
65
+ def remove_all(delete_actions=True):
66
+ for obj in bpy.data.objects.values():
67
+ bpy.data.objects.remove(obj, do_unlink=True)
68
+ bpy.ops.outliner.orphans_purge(do_recursive=True)
69
+ if delete_actions:
70
+ for action in bpy.data.actions:
71
+ bpy.data.actions.remove(action, do_unlink=True)
72
+
73
+
74
+ def remove_empty():
75
+ childless_empties = [e for e in bpy.data.objects if e.type.startswith("EMPTY") and not e.children]
76
+ bpy.data.batch_remove(childless_empties)
77
+
78
+
79
+ def load_file(filepath: str, *args, **kwargs) -> "list[Object]":
80
+ old_objs = set(bpy.context.scene.objects)
81
+ if filepath.endswith(".glb"):
82
+ bpy.ops.import_scene.gltf(filepath=filepath, *args, **kwargs)
83
+ elif filepath.endswith(".fbx"):
84
+ bpy.ops.import_scene.fbx(filepath=filepath, *args, **kwargs)
85
+ elif filepath.endswith(".obj"):
86
+ bpy.ops.wm.obj_import(filepath=filepath, *args, **kwargs)
87
+ elif filepath.endswith(".ply"):
88
+ bpy.ops.wm.ply_import(filepath=filepath, *args, **kwargs)
89
+ else:
90
+ raise RuntimeError(f"Invalid input file: {filepath}")
91
+ imported_objs = set(bpy.context.scene.objects) - old_objs
92
+ imported_objs = sorted(imported_objs, key=lambda x: x.name)
93
+ print("Imported:", imported_objs)
94
+ return imported_objs
95
+
96
+
97
+ def select_all():
98
+ bpy.ops.object.select_all(action="SELECT")
99
+
100
+
101
+ def deselect():
102
+ bpy.ops.object.select_all(action="DESELECT")
103
+
104
+
105
+ def select_objs(obj_list: "list[Object]" = None, deselect_first=False):
106
+ if not obj_list:
107
+ obj_list = bpy.context.scene.objects
108
+ if deselect_first:
109
+ deselect()
110
+ for obj in obj_list:
111
+ obj.select_set(True)
112
+
113
+
114
+ def select_mesh(obj_list: "list[Object]" = None, all=True, deselect_first=False):
115
+ if not obj_list:
116
+ obj_list = bpy.context.scene.objects
117
+ if deselect_first:
118
+ deselect()
119
+ for obj in obj_list:
120
+ if obj.type == "MESH":
121
+ if all:
122
+ obj.select_set(True)
123
+ else:
124
+ break
125
+
126
+
127
+ class Select:
128
+ """
129
+ Deselecting before and after selecting the specified objects.
130
+ """
131
+
132
+ def __init__(self, objs: "Object | list[Object]" = None):
133
+ self.objs = (objs,) if isinstance(objs, Object) else objs
134
+ self.objs: "tuple[Object]" = tuple(self.objs)
135
+
136
+ def __enter__(self):
137
+ select_objs(self.objs, deselect_first=True)
138
+ return self.objs
139
+
140
+ def __exit__(self, exc_type, exc_val, exc_tb):
141
+ deselect()
142
+
143
+
144
+ def get_type_objs(obj_list: "list[Object]" = None, type="MESH", sort=True) -> "list[Object]":
145
+ if not obj_list:
146
+ obj_list = bpy.context.scene.objects
147
+ type_obj_list = [obj for obj in obj_list if obj.type == type]
148
+ if sort:
149
+ type_obj_list = sorted(type_obj_list, key=lambda x: x.name)
150
+ return type_obj_list
151
+
152
+
153
+ def get_all_mesh_obj(obj_list: "list[Object]" = None):
154
+ return get_type_objs(obj_list, "MESH")
155
+
156
+
157
+ def get_all_armature_obj(obj_list: "list[Object]" = None):
158
+ return get_type_objs(obj_list, "ARMATURE")
159
+
160
+
161
+ def get_armature_obj(obj_list: "list[Object]" = None) -> Object:
162
+ if not obj_list:
163
+ obj_list = bpy.context.scene.objects
164
+ for obj in obj_list:
165
+ if obj.type == "ARMATURE":
166
+ return obj
167
+
168
+
169
+ def get_rest_bones(armature_obj: Object):
170
+ if armature_obj is None:
171
+ return None, None, None
172
+ rest_bones = []
173
+ rest_bones_tail = []
174
+ bones_idx_dict: "dict[str, int]" = {}
175
+ armature_data: Armature = armature_obj.data
176
+ for i, bone in enumerate(armature_data.bones):
177
+ pos = bone.head_local
178
+ pos_tail = bone.tail_local
179
+ if USE_WORLD_COORDINATES:
180
+ pos = armature_obj.matrix_world @ pos
181
+ pos_tail = armature_obj.matrix_world @ pos_tail
182
+ rest_bones.append(pos)
183
+ rest_bones_tail.append(pos_tail)
184
+ bones_idx_dict[bone.name] = i
185
+ rest_bones = np.stack(rest_bones, axis=0)
186
+ rest_bones_tail = np.stack(rest_bones_tail, axis=0)
187
+ return rest_bones, rest_bones_tail, bones_idx_dict
188
+
189
+
190
+ def mesh_quads2tris(obj_list: "list[Object]" = None):
191
+ if not obj_list:
192
+ obj_list = bpy.context.scene.objects
193
+ for obj in obj_list:
194
+ if obj.type == "MESH":
195
+ with Mode("EDIT", obj):
196
+ bpy.ops.mesh.quads_convert_to_tris(quad_method="BEAUTY", ngon_method="BEAUTY")