-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from sharkmob/main
Merge all updates
- Loading branch information
Showing
22 changed files
with
320 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "3DsMax", | ||
"type": "python", | ||
"request": "attach", | ||
"connect": { | ||
"host": "localhost", | ||
"port": 6000 | ||
}, | ||
"justMyCode": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
PYProjects/skin_plus_plus/dccs/max/skin_plus_plus_pymxs_2023/skin_plus_plus_pymxs.exp
Binary file not shown.
Binary file modified
BIN
+610 KB
(470%)
PYProjects/skin_plus_plus/dccs/max/skin_plus_plus_pymxs_2023/skin_plus_plus_pymxs.pyd
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
PYProjects/skin_plus_plus/dccs/maya/skin_plus_plus_pymaya_2023/skin_plus_plus_pymaya.exp
Binary file not shown.
Binary file modified
BIN
+539 KB
(320%)
PYProjects/skin_plus_plus/dccs/maya/skin_plus_plus_pymaya_2023/skin_plus_plus_pymaya.pyd
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
PYProjects/skin_plus_plus/py/debug_39/skin_plus_plus_py.exp
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from __future__ import annotations | ||
|
||
|
||
def get_flat_weights(bone_ids: list[list[int]], weights: list[list[float]], max_influence_count: int = 3): | ||
vertex_count = len(bone_ids) | ||
m_weights = [0.0] * vertex_count * max_influence_count | ||
for vertex_index in range(vertex_count): | ||
vertex_bone_ids = bone_ids[vertex_index] | ||
array_index = vertex_index * max_influence_count | ||
for influence_index in range(len(vertex_bone_ids)): | ||
bone_id = vertex_bone_ids[influence_index] | ||
if bone_id == -1: | ||
continue | ||
index = array_index + bone_id | ||
m_weights[index] = weights[vertex_index][influence_index] | ||
|
||
return m_weights | ||
|
||
names = ["one", "two", "three"] | ||
new_names = ["FART", "three", "one", "two", "RANDOM"] | ||
bone_ids = [[0, 1, -1], [-1, 1, 2], [0, 1, 2]] | ||
weights = [[0.25, 0.75, None], [None, 0.5, 0.5], [0.25, 0.25, 0.5]] | ||
|
||
m_weights = get_flat_weights(bone_ids, weights) | ||
|
||
print(m_weights) | ||
print(m_weights == [0.25, 0.75, 0.0, 0.0, 0.5, 0.5, 0.25, 0.25, 0.5]) | ||
|
||
|
||
name_map = {} | ||
for index, name in enumerate(new_names): | ||
name_map[name] = index | ||
|
||
new_bone_ids = [] | ||
for name in names: | ||
new_index = name_map[name] | ||
new_bone_ids.append(new_index) | ||
|
||
def get_sorted_bone_ids(bone_ids: list[list[int]], new_bone_id_order: list[int]): | ||
for vertex in bone_ids: | ||
for i, bone_id in enumerate(vertex): | ||
if bone_id == -1: | ||
continue | ||
|
||
new_index = new_bone_id_order[bone_id] | ||
vertex[i] = new_index | ||
|
||
return bone_ids | ||
|
||
|
||
sorted_bone_ids = get_sorted_bone_ids(bone_ids, new_bone_ids) | ||
print(bone_ids) | ||
print(bone_ids == [[1, 2, -1], [-1, 2, 0], [1, 2, 0]]) | ||
|
||
m_weights = get_flat_weights(sorted_bone_ids, weights) | ||
|
||
print(m_weights) | ||
print(m_weights == [0.0, 0.25, 0.75, 0.5, 0.0, 0.5, 0.5, 0.25, 0.25]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.