Skip to content

Commit 9b0922f

Browse files
committed
Determine to add item as proxy or skel
1 parent 61b91dc commit 9b0922f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

exts/omni.makehuman/omni/makehuman/mhcaller.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def init_human(self):
7070
)
7171
# Add eyes
7272
self.add_proxy(data_path("eyes/high-poly/high-poly.mhpxy"), "eyes")
73-
base_skel = skeleton.load(
73+
self.base_skel = skeleton.load(
7474
mh.getSysDataPath("rigs/default.mhskel"),
7575
self.human.meshData,
7676
)
@@ -79,9 +79,9 @@ def init_human(self):
7979
)
8080
# Build joint weights on our chosen skeleton, derived from the base
8181
# skeleton
82-
cmu_skel.autoBuildWeightReferences(base_skel)
82+
cmu_skel.autoBuildWeightReferences(self.base_skel)
8383

84-
self.human.setBaseSkeleton(base_skel)
84+
self.human.setBaseSkeleton(self.base_skel)
8585
# Actually add the skeleton
8686
self.human.setSkeleton(cmu_skel)
8787
self.human.applyAllTargets()
@@ -186,6 +186,18 @@ def add_proxy(self, proxypath, proxy_type=None):
186186
# vertsMask[verts] = False
187187
# self.human.changeVertexMask(vertsMask)
188188

189+
def add_item(self, path):
190+
if "mhpxy" in path:
191+
self.add_proxy(path)
192+
elif "mhskel" in path:
193+
self.set_skel(path)
194+
195+
def set_skel(self, path):
196+
skel = skeleton.load(path, self.human.meshData)
197+
skel.autoBuildWeightReferences(self.base_skel)
198+
self.human.setSkeleton(skel)
199+
self.human.applyAllTargets()
200+
189201
def guess_proxy_type(self, path):
190202
proxy_types = ("eyes", "clothes", "eyebrows", "eyelashes", "hair")
191203
for type in proxy_types:

exts/omni.makehuman/omni/makehuman/ui_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def drop(self, item_tagget, source):
181181
self.add_child(source)
182182

183183
def add_child(self, item):
184-
self.mh_call.add_proxy(item)
184+
self.mh_call.add_item(item)
185185
self.update()
186186

187187
def get_item_children(self, item):

0 commit comments

Comments
 (0)