pyjallib 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyjallib/__init__.py CHANGED
@@ -6,7 +6,7 @@ pyjallib Package
6
6
  Python library for game character development pipeline.
7
7
  """
8
8
 
9
- __version__ = '0.1.7'
9
+ __version__ = '0.1.9'
10
10
 
11
11
  # reload_modules 함수를 패키지 레벨에서 사용 가능하게 함
12
12
  from .namePart import NamePart, NamePartType
@@ -34,8 +34,8 @@
34
34
  {
35
35
  "name": "Type",
36
36
  "predefinedValues": [
37
- "P",
38
37
  "Dum",
38
+ "P",
39
39
  "Exp",
40
40
  "IK",
41
41
  "T",
@@ -57,8 +57,8 @@
57
57
  ],
58
58
  "type": "PREFIX",
59
59
  "descriptions": [
60
- "Parent",
61
60
  "Dummy",
61
+ "Parent",
62
62
  "ExposeTM",
63
63
  "IK",
64
64
  "Target",
pyjallib/max/__init__.py CHANGED
@@ -24,10 +24,14 @@ from .link import Link
24
24
 
25
25
  from .bip import Bip
26
26
  from .skin import Skin
27
+ from .morph import Morph
27
28
 
28
29
  from .twistBone import TwistBone
29
30
  from .groinBone import GroinBone
30
31
  from .autoClavicle import AutoClavicle
32
+ from .volumePreserveBone import VolumePreserveBone
33
+
34
+ from .ui.Container import Container
31
35
 
32
36
  # 모듈 내보내기
33
37
  __all__ = [
@@ -44,7 +48,10 @@ __all__ = [
44
48
  'Link',
45
49
  'Bip',
46
50
  'Skin',
51
+ 'Morph',
47
52
  'TwistBone',
48
53
  'GroinBone',
49
- 'AutoClavicle'
54
+ 'AutoClavicle',
55
+ 'VolumePreserveBone',
56
+ 'Container'
50
57
  ]
@@ -8,13 +8,7 @@
8
8
 
9
9
  from pymxs import runtime as rt
10
10
 
11
- # Import necessary service classes for default initialization
12
- from .name import Name
13
- from .anim import Anim
14
- from .helper import Helper
15
- from .bone import Bone
16
- from .constraint import Constraint
17
- from .bip import Bip
11
+ from .header import jal
18
12
 
19
13
 
20
14
  class AutoClavicle:
@@ -24,7 +18,7 @@ class AutoClavicle:
24
18
  3ds Max의 기능들을 pymxs API를 통해 제어합니다.
25
19
  """
26
20
 
27
- def __init__(self, nameService=None, animService=None, helperService=None, boneService=None, constraintService=None, bipService=None):
21
+ def __init__(self):
28
22
  """
29
23
  클래스 초기화
30
24
 
@@ -36,14 +30,19 @@ class AutoClavicle:
36
30
  constraintService: 제약 서비스 (제공되지 않으면 새로 생성)
37
31
  bipService: Biped 서비스 (제공되지 않으면 새로 생성)
38
32
  """
39
- self.name = nameService if nameService else Name()
40
- self.anim = animService if animService else Anim()
41
- self.helper = helperService if helperService else Helper(nameService=self.name)
42
- self.bone = boneService if boneService else Bone(nameService=self.name, animService=self.anim, helperService=self.helper)
43
- self.const = constraintService if constraintService else Constraint(nameService=self.name, helperService=self.helper)
44
- self.bip = bipService if bipService else Bip(animService=self.anim, nameService=self.name, boneService=self.bone)
45
-
46
- self.bone_size = 2.0
33
+ self.name = jal.name
34
+ self.anim = jal.anim
35
+ self.helper = jal.helper
36
+ self.bone = jal.bone
37
+ self.const = jal.constraint
38
+ self.bip = jal.bip
39
+
40
+ self.boneSize = 2.0
41
+ self.clavicle = None
42
+ self.upperArm = None
43
+ self.liftScale = 0.8
44
+ self.genBones = []
45
+ self.genHelpers = []
47
46
 
48
47
  def create_bones(self, inClavicle, inUpperArm, liftScale=0.8):
49
48
  """
@@ -57,6 +56,15 @@ class AutoClavicle:
57
56
  Returns:
58
57
  생성된 자동 쇄골 뼈대 배열
59
58
  """
59
+ if not rt.isValidNode(inClavicle) or not rt.isValidNode(inUpperArm):
60
+ return False
61
+
62
+ self.clavicle = inClavicle
63
+ self.upperArm = inUpperArm
64
+ self.liftScale = liftScale
65
+ self.genBones = []
66
+ self.genHelpers = []
67
+
60
68
  # 쇄골과 상완 사이의 거리 계산
61
69
  clavicleLength = rt.distance(inClavicle, inUpperArm)
62
70
 
@@ -75,11 +83,12 @@ class AutoClavicle:
75
83
  end=True,
76
84
  delPoint=True,
77
85
  parent=False,
78
- size=self.bone_size
86
+ size=self.boneSize
79
87
  )
80
88
  autoClavicleBones[0].transform = inClavicle.transform
81
89
  self.anim.move_local(autoClavicleBones[0], clavicleLength/2.0, 0.0, 0.0)
82
90
  autoClavicleBones[0].parent = inClavicle
91
+ self.genBones.extend(autoClavicleBones)
83
92
 
84
93
  # LookAt 설정
85
94
  ikGoal = self.helper.create_point(autoClavicleName, boxToggle=False, crossToggle=True)
@@ -89,21 +98,25 @@ class AutoClavicle:
89
98
  autClavicleLookAtConst.upnode_world = False
90
99
  autClavicleLookAtConst.pickUpNode = inClavicle
91
100
  autClavicleLookAtConst.lookat_vector_length = 0.0
101
+ self.genHelpers.append(ikGoal)
92
102
 
93
103
  # 회전 헬퍼 포인트 생성
94
104
  autoClavicleRotHelper = self.helper.create_point(self.name.replace_name_part("Type", autoClavicleName, "Rot"))
95
105
  autoClavicleRotHelper.transform = autoClavicleBones[0].transform
96
106
  autoClavicleRotHelper.parent = inClavicle
107
+ self.genHelpers.append(autoClavicleRotHelper)
97
108
 
98
109
  # 타겟 헬퍼 포인트 생성 (쇄골과 상완용)
99
110
  rotTargetClavicle = self.helper.create_point(self.name.replace_name_part("Type", autoClavicleName, "T"))
100
111
  rotTargetClavicle.transform = inClavicle.transform
101
112
  self.anim.move_local(rotTargetClavicle, clavicleLength, 0.0, 0.0)
113
+ self.genHelpers.append(rotTargetClavicle)
102
114
 
103
115
  rotTargetUpperArm = self.helper.create_point(self.name.replace_name_part("Type", autoClavicleName, "T"))
104
116
  rotTargetUpperArm.name = self.name.add_suffix_to_real_name(rotTargetUpperArm.name, "UArm")
105
117
  rotTargetUpperArm.transform = inUpperArm.transform
106
118
  self.anim.move_local(rotTargetUpperArm, (clavicleLength/2.0)*liftScale, 0.0, 0.0)
119
+ self.genHelpers.append(rotTargetUpperArm)
107
120
 
108
121
  # 부모 설정
109
122
  rotTargetClavicle.parent = inClavicle
@@ -121,7 +134,7 @@ class AutoClavicle:
121
134
 
122
135
  return autoClavicleBones
123
136
 
124
- def get_bones(self, inClavicle, inUpperArm):
137
+ def get_bones(self):
125
138
  """
126
139
  자동 쇄골 뼈를 가져옵니다.
127
140
 
@@ -132,19 +145,18 @@ class AutoClavicle:
132
145
  Returns:
133
146
  자동 쇄골 뼈대 배열
134
147
  """
135
- clavicleChildren = [item for item in self.bone.get_every_children(inClavicle) if rt.classOf(item) == rt.BoneGeometry]
136
- upperArmChildren = [item for item in self.bone.get_every_children(inUpperArm) if rt.classOf(item) == rt.BoneGeometry]
137
- returnVal = []
138
- for item in clavicleChildren:
139
- if item not in returnVal:
140
- returnVal.append(item)
141
- for item in upperArmChildren:
142
- if item not in returnVal:
143
- returnVal.append(item)
144
-
145
- return returnVal
148
+ if len(self.genBones) == 0:
149
+ return []
150
+
151
+ validResults = []
152
+ for item in self.genBones:
153
+ validResults.append(rt.isValidNode(item))
154
+ if not all(validResults):
155
+ return []
156
+
157
+ return self.genBones
146
158
 
147
- def get_helpers(self, inClavicle, inUpperArm):
159
+ def get_helpers(self):
148
160
  """
149
161
  자동 쇄골 헬퍼를 가져옵니다.
150
162
 
@@ -155,15 +167,46 @@ class AutoClavicle:
155
167
  Returns:
156
168
  자동 쇄골 헬퍼 배열
157
169
  """
158
- clavicleChildren = [item for item in self.bone.get_every_children(inClavicle) if rt.classOf(item) == rt.Point]
159
- upperArmChildren = [item for item in self.bone.get_every_children(inUpperArm) if rt.classOf(item) == rt.Point]
160
- returnVal = []
161
- for item in clavicleChildren:
162
- if item not in returnVal:
163
- returnVal.append(item)
164
- for item in upperArmChildren:
165
- if item not in returnVal:
166
- returnVal.append(item)
167
-
168
- return returnVal
169
-
170
+ if len(self.genHelpers) == 0:
171
+ return []
172
+
173
+ validResults = []
174
+ for item in self.genHelpers:
175
+ validResults.append(rt.isValidNode(item))
176
+ if not all(validResults):
177
+ return []
178
+
179
+ return self.genHelpers
180
+
181
+ def delete(self):
182
+ """
183
+ 자동 쇄골 뼈와 헬퍼를 삭제합니다.
184
+
185
+ Args:
186
+ None
187
+
188
+ Returns:
189
+ None
190
+ """
191
+ rt.delete(self.genBones)
192
+ rt.delete(self.genHelpers)
193
+
194
+ self.genBones = []
195
+ self.genHelpers = []
196
+
197
+ def update_liftScale(self, liftScale=0.8):
198
+ """
199
+ 자동 쇄골 뼈의 들어올림 스케일을 업데이트합니다.
200
+
201
+ Args:
202
+ liftScale: 들어올림 스케일 (기본값: 0.8)
203
+
204
+ Returns:
205
+ None
206
+ """
207
+ if len(self.genBones) == 0:
208
+ return False
209
+
210
+ self.delete()
211
+ self.create_bones(self.clavicle, self.upperArm, liftScale=liftScale)
212
+
pyjallib/max/bone.py CHANGED
@@ -712,7 +712,7 @@ class Bone:
712
712
 
713
713
  return True
714
714
 
715
- def create_skin_bone(self, inBoneArray, skipNub=True, mesh=True, link=True, skinBoneBaseName="b"):
715
+ def create_skin_bone(self, inBoneArray, skipNub=True, mesh=True, link=True, skinBoneBaseName=""):
716
716
  """
717
717
  스킨 뼈대 생성.
718
718
 
@@ -731,11 +731,18 @@ class Bone:
731
731
  skinBonePushAmount = -0.02
732
732
  returnBones = []
733
733
 
734
+ definedSkinBoneBaseName = self.name.get_name_part_value_by_description("Base", "SkinBone")
735
+ if skinBoneBaseName == "":
736
+ if definedSkinBoneBaseName == "":
737
+ skinBoneBaseName = "b"
738
+ else:
739
+ skinBoneBaseName = definedSkinBoneBaseName
740
+
734
741
  for i in range(len(inBoneArray)):
735
- skinBoneName = self.name.replace_base(inBoneArray[i].name, skinBoneBaseName)
742
+ skinBoneName = self.name.replace_name_part("Base", inBoneArray[i].name, skinBoneBaseName)
736
743
  skinBoneName = self.name.replace_filtering_char(skinBoneName, skinBoneFilteringChar)
737
744
 
738
- skinBone = self.create_nub_bone("b_TempSkin", 2)
745
+ skinBone = self.create_nub_bone(f"{skinBoneBaseName}_TempSkin", 2)
739
746
  skinBone.name = skinBoneName
740
747
  skinBone.wireColor = rt.Color(255, 88, 199)
741
748
  skinBone.transform = inBoneArray[i].transform
@@ -753,7 +760,7 @@ class Bone:
753
760
 
754
761
  skinBone.boneEnable = True
755
762
  skinBone.renderable = False
756
- skinBone.boneScaleType = rt.Name("none")
763
+ skinBone.boneScaleType = rt.Name("None")
757
764
 
758
765
  bones.append(skinBone)
759
766
 
@@ -771,7 +778,7 @@ class Bone:
771
778
 
772
779
  if skipNub:
773
780
  for item in bones:
774
- if not rt.matchPattern(item.name, pattern=("*" + self.name.get_nub_str())):
781
+ if not rt.matchPattern(item.name, pattern=("*" + self.name.get_name_part_value_by_description("Nub", "Nub"))):
775
782
  returnBones.append(item)
776
783
  else:
777
784
  rt.delete(item)
@@ -782,7 +789,7 @@ class Bone:
782
789
 
783
790
  return returnBones
784
791
 
785
- def create_skin_bone_from_bip(self, inBoneArray, skipNub=True, mesh=False, link=True, skinBoneBaseName="b"):
792
+ def create_skin_bone_from_bip(self, inBoneArray, skipNub=True, mesh=False, link=True, skinBoneBaseName=""):
786
793
  """
787
794
  바이페드 객체에서 스킨 뼈대 생성.
788
795
 
@@ -806,7 +813,7 @@ class Bone:
806
813
 
807
814
  return returnSkinBones
808
815
 
809
- def create_skin_bone_from_bip_for_unreal(self, inBoneArray, skipNub=True, mesh=False, link=True, skinBoneBaseName="b"):
816
+ def create_skin_bone_from_bip_for_unreal(self, inBoneArray, skipNub=True, mesh=False, link=True, skinBoneBaseName=""):
810
817
  """
811
818
  언리얼 엔진용 바이페드 객체에서 스킨 뼈대 생성.
812
819
 
@@ -212,6 +212,8 @@ class Constraint:
212
212
  """
213
213
  for item in inTargetArray:
214
214
  self.assign_pos_const(inObj, item, keepInit=keepInit)
215
+
216
+ return self.get_pos_const(inObj)
215
217
 
216
218
  def add_target_to_pos_const(self, inObj, inTarget, inWeight):
217
219
  """
@@ -231,6 +233,8 @@ class Constraint:
231
233
  # 마지막 타겟에 특정 가중치 적용
232
234
  targetNum = targetPosConst.getNumTargets()
233
235
  targetPosConst.SetWeight(targetNum, inWeight)
236
+
237
+ return targetPosConst
234
238
 
235
239
  def assign_pos_xyz(self, inObj):
236
240
  """
@@ -251,8 +255,36 @@ class Constraint:
251
255
  posList = self.assign_pos_list(inObj)
252
256
 
253
257
  # Position_XYZ 컨트롤러 할당
254
- rt.setPropertyController(posList, "Available", rt.Position_XYZ())
258
+ posXYZ = rt.Position_XYZ()
259
+ rt.setPropertyController(posList, "Available", posXYZ)
255
260
  posList.setActive(posList.count)
261
+
262
+ return posXYZ
263
+
264
+ def assign_pos_script_controller(self, inObj):
265
+ """
266
+ 객체에 스크립트 기반 위치 컨트롤러를 할당.
267
+
268
+ Args:
269
+ inObj: 컨트롤러를 할당할 객체
270
+
271
+ Returns:
272
+ None
273
+ """
274
+ # 위치 컨트롤러가 리스트 형태가 아니면 변환
275
+ pos_controller = rt.getPropertyController(inObj.controller, "Position")
276
+ if rt.classOf(pos_controller) != rt.Position_list:
277
+ rt.setPropertyController(inObj.controller, "Position", rt.Position_list())
278
+
279
+ # 위치 리스트 컨트롤러 가져오기
280
+ posList = self.assign_pos_list(inObj)
281
+
282
+ # 스크립트 기반 위치 컨트롤러 할당
283
+ scriptPos = rt.Position_Script()
284
+ rt.setPropertyController(posList, "Available", scriptPos)
285
+ posList.setActive(posList.count)
286
+
287
+ return scriptPos
256
288
 
257
289
  def get_rot_list_controller(self, inObj):
258
290
  """
@@ -392,6 +424,8 @@ class Constraint:
392
424
  """
393
425
  for item in inTargetArray:
394
426
  self.assign_rot_const(inObj, item, keepInit=keepInit)
427
+
428
+ return self.get_rot_const(inObj)
395
429
 
396
430
  def add_target_to_rot_const(self, inObj, inTarget, inWeight):
397
431
  """
@@ -411,6 +445,8 @@ class Constraint:
411
445
  # 마지막 타겟에 특정 가중치 적용
412
446
  targetNum = targetRotConstraint.getNumTargets()
413
447
  targetRotConstraint.SetWeight(targetNum, inWeight)
448
+
449
+ return targetRotConstraint
414
450
 
415
451
  def assign_euler_xyz(self, inObj):
416
452
  """
@@ -431,8 +467,11 @@ class Constraint:
431
467
  rotList = self.assign_rot_list(inObj)
432
468
 
433
469
  # Euler_XYZ 컨트롤러 할당
434
- rt.setPropertyController(rotList, "Available", rt.Euler_XYZ())
470
+ eulerXYZ = rt.Euler_XYZ()
471
+ rt.setPropertyController(rotList, "Available", eulerXYZ)
435
472
  rotList.setActive(rotList.count)
473
+
474
+ return eulerXYZ
436
475
 
437
476
  def get_lookat(self, inObj):
438
477
  """
@@ -528,6 +567,8 @@ class Constraint:
528
567
  """
529
568
  for item in inTargetArray:
530
569
  self.assign_lookat(inObj, item, keepInit=keepInit)
570
+
571
+ return self.get_lookat(inObj)
531
572
 
532
573
  def assign_lookat_flipless(self, inObj, inTarget):
533
574
  """
@@ -572,6 +613,8 @@ class Constraint:
572
613
  rot_list = self.get_rot_list_controller(inObj)
573
614
  rt.setPropertyController(rot_list, "Available", targetRotConstraint)
574
615
  rot_list.setActive(rot_list.count)
616
+
617
+ return targetRotConstraint
575
618
 
576
619
  def assign_rot_const_scripted(self, inObj, inTarget):
577
620
  """
@@ -598,32 +641,19 @@ class Constraint:
598
641
  rot_list.setActive(rot_list.count)
599
642
 
600
643
  # 헬퍼 객체 이름 생성
601
- if self.name:
602
- rotPointName = self.name.replace_Type(inObj.name, self.name.get_dummy_value())
603
- rotMeasurePointName = self.name.increase_index(rotPointName, 1)
604
- rotExpName = self.name.replace_Type(inObj.name, self.name.get_exposeTm_value())
605
- rotExpName = self.name.replace_Index(rotExpName, "0")
606
-
607
- print(f"dumStr: {self.name.get_dummy_value()}")
608
- print(f"exposeTmStr: {self.name.get_exposeTm_value()}")
609
- print(f"rotPointName: {rotPointName}, rotMeasurePointName: {rotMeasurePointName}, rotExpName: {rotExpName}")
610
- else:
611
- # name 서비스가 없는 경우 기본 이름 사용
612
- base_name = rt.getProperty(inObj, "name")
613
- rotPointName = f"dum_{base_name}"
614
- rotMeasurePointName = f"dum_{base_name}_01"
615
- rotExpName = f"exp_{base_name}_0"
644
+ rotPointName = self.name.replace_Type(inObj.name, self.name.get_dummy_value())
645
+ rotMeasurePointName = self.name.increase_index(rotPointName, 1)
646
+ rotExpName = self.name.replace_Type(inObj.name, self.name.get_exposeTm_value())
647
+ rotExpName = self.name.replace_Index(rotExpName, "0")
648
+
649
+ print(f"dumStr: {self.name.get_dummy_value()}")
650
+ print(f"exposeTmStr: {self.name.get_exposeTm_value()}")
651
+ print(f"rotPointName: {rotPointName}, rotMeasurePointName: {rotMeasurePointName}, rotExpName: {rotExpName}")
616
652
 
617
653
  # 헬퍼 객체 생성
618
- if self.helper:
619
- rotPoint = self.helper.create_point(rotPointName, size=2, boxToggle=True, crossToggle=False)
620
- rotMeasuerPoint = self.helper.create_point(rotMeasurePointName, size=3, boxToggle=True, crossToggle=False)
621
- rotExpPoint = rt.ExposeTm(name=rotExpName, size=3, box=False, cross=True, wirecolor=rt.Color(14, 255, 2))
622
- else:
623
- # 직접 헬퍼 객체 생성
624
- rotPoint = rt.Point(name=rotPointName, size=2, box=True, cross=False)
625
- rotMeasuerPoint = rt.Point(name=rotMeasurePointName, size=3, box=True, cross=False)
626
- rotExpPoint = rt.ExposeTm(name=rotExpName, size=3, box=False, cross=True, wirecolor=rt.Color(14, 255, 2))
654
+ rotPoint = self.helper.create_point(rotPointName, size=2, boxToggle=True, crossToggle=False)
655
+ rotMeasuerPoint = self.helper.create_point(rotMeasurePointName, size=3, boxToggle=True, crossToggle=False)
656
+ rotExpPoint = rt.ExposeTm(name=rotExpName, size=3, box=False, cross=True, wirecolor=rt.Color(14, 255, 2))
627
657
 
628
658
  # 초기 변환 설정
629
659
  rt.setProperty(rotPoint, "transform", rt.getProperty(inObj, "transform"))
@@ -673,22 +703,20 @@ class Constraint:
673
703
  targetObjArray = inTarget
674
704
 
675
705
  # 객체 이름 생성
676
- if self.name:
677
- objName = self.name.get_string(oriObj.name)
678
- indexVal = self.name.get_index_as_digit(oriObj.name)
679
- indexNum = 0 if indexVal is False else indexVal
680
- dummyName = self.name.add_prefix_to_real_name(objName, self.name.get_dummy_value())
681
-
682
- lookAtPointName = self.name.replace_Index(dummyName, str(indexNum))
683
- lookAtMeasurePointName = self.name.replace_Index(dummyName, str(indexNum+1))
684
- lookAtExpPointName = dummyName + self.name.get_exposeTm_value()
685
- lookAtExpPointName = self.name.replace_Index(lookAtExpPointName, "0")
706
+ objName = self.name.get_string(oriObj.name)
707
+ indexVal = self.name.get_index_as_digit(oriObj.name)
708
+ indexNum = 0 if indexVal is False else indexVal
709
+ dummyName = self.name.add_prefix_to_real_name(objName, self.name.get_dummy_value())
710
+
711
+ lookAtPointName = self.name.replace_Index(dummyName, str(indexNum))
712
+ lookAtMeasurePointName = self.name.replace_Index(dummyName, str(indexNum+1))
713
+ lookAtExpPointName = dummyName + self.name.get_exposeTm_value()
714
+ lookAtExpPointName = self.name.replace_Index(lookAtExpPointName, "0")
686
715
 
687
716
  # 헬퍼 객체 생성
688
- if self.helper:
689
- lookAtPoint = self.helper.create_point(lookAtPointName, size=2, boxToggle=True, crossToggle=False)
690
- lookAtMeasurePoint = self.helper.create_point(lookAtMeasurePointName, size=3, boxToggle=True, crossToggle=False)
691
- lookAtExpPoint = rt.ExposeTm(name=lookAtExpPointName, size=3, box=False, cross=True, wirecolor=rt.Color(14, 255, 2))
717
+ lookAtPoint = self.helper.create_point(lookAtPointName, size=2, boxToggle=True, crossToggle=False)
718
+ lookAtMeasurePoint = self.helper.create_point(lookAtMeasurePointName, size=3, boxToggle=True, crossToggle=False)
719
+ lookAtExpPoint = rt.ExposeTm(name=lookAtExpPointName, size=3, box=False, cross=True, wirecolor=rt.Color(14, 255, 2))
692
720
 
693
721
  # 초기 변환 설정
694
722
  rt.setProperty(lookAtPoint, "transform", rt.getProperty(oriObj, "transform"))
pyjallib/max/groinBone.py CHANGED
@@ -7,14 +7,7 @@
7
7
 
8
8
  from pymxs import runtime as rt
9
9
 
10
- # Import necessary service classes for default initialization
11
- from .name import Name
12
- from .anim import Anim
13
- from .constraint import Constraint
14
- from .bip import Bip
15
- from .bone import Bone
16
- from .helper import Helper
17
- from .twistBone import TwistBone
10
+ from .header import jal
18
11
 
19
12
  class GroinBone:
20
13
  """
@@ -22,7 +15,7 @@ class GroinBone:
22
15
  3DS Max에서 고간 부 본을 생성하고 관리하는 기능을 제공합니다.
23
16
  """
24
17
 
25
- def __init__(self, nameService=None, animService=None, helperService=None, constService=None, bipService=None, boneService=None, twistBoneService=None):
18
+ def __init__(self):
26
19
  """
27
20
  클래스 초기화.
28
21
 
@@ -32,16 +25,20 @@ class GroinBone:
32
25
  constService: 제약 서비스 (제공되지 않으면 새로 생성)
33
26
  bipService: 바이페드 서비스 (제공되지 않으면 새로 생성)
34
27
  """
35
- self.name = nameService if nameService else Name()
36
- self.anim = animService if animService else Anim()
28
+ self.name = jal.name
29
+ self.anim = jal.anim
37
30
  # Ensure dependent services use the potentially newly created instances
38
- self.const = constService if constService else Constraint(nameService=self.name)
39
- self.bip = bipService if bipService else Bip(animService=self.anim, nameService=self.name)
40
- self.bone = boneService if boneService else Bone(nameService=self.name, animService=self.anim)
41
- self.twistBone = twistBoneService if twistBoneService else TwistBone(nameService=self.name, animService=self.anim, constService=self.const, bipService=self.bip, boneService=self.bone)
42
- self.helper = helperService if helperService else Helper(nameService=self.name)
31
+ self.const = jal.constraint
32
+ self.bip = jal.bip
33
+ self.bone = jal.bone
34
+ self.twistBone = jal.twistBone
35
+ self.helper = jal.helper
36
+
37
+ self.bipObj = None
38
+ self.genBones = []
39
+ self.genHelpers = []
43
40
 
44
- def create_bone(self, inObj):
41
+ def create_bone(self, inObj, inPelvisWeight=40.0, inThighWeight=60.0):
45
42
  """
46
43
  고간 부 본을 생성하는 메소드.
47
44
 
@@ -57,6 +54,7 @@ class GroinBone:
57
54
  return False
58
55
 
59
56
  bipObj = self.bip.get_com(inObj)
57
+ self.bipObj = bipObj
60
58
 
61
59
  lThigh = self.bip.get_grouped_nodes(inObj, "lLeg")[0]
62
60
  rThigh = self.bip.get_grouped_nodes(inObj, "rLeg")[0]
@@ -75,16 +73,49 @@ class GroinBone:
75
73
  self.anim.rotate_local(pelvisHelper, 0, 0, -90)
76
74
  pelvisHelper.parent = pelvis
77
75
  self.helper.set_shape_to_box(pelvisHelper)
76
+ self.genHelpers.append(pelvisHelper)
78
77
 
79
78
  groinBones = self.bone.create_simple_bone(3.0, bipObj.name +" Groin 00", size=2)
80
79
  groinBones[0].transform = pelvisHelper.transform
81
80
  groinBones[0].parent = pelvis
81
+ for groinBone in groinBones:
82
+ self.genBones.append(groinBone)
82
83
 
83
84
  self.const.assign_rot_const_multi(groinBones[0], [pelvisHelper, lThigh, rThigh])
84
85
  rotConst = self.const.get_rot_list_controller(groinBones[0])[1]
85
- rotConst.setWeight(1, 40.0)
86
- rotConst.setWeight(2, 30.0)
87
- rotConst.setWeight(3, 30.0)
86
+ rotConst.setWeight(1, inPelvisWeight)
87
+ rotConst.setWeight(2, inThighWeight/2.0)
88
+ rotConst.setWeight(3, inThighWeight/2.0)
89
+
90
+ def delete(self):
91
+ """
92
+ 생성된 고간 부 본과 헬퍼를 삭제하는 메소드.
93
+
94
+ Returns:
95
+ None
96
+ """
97
+ rt.delete(self.genBones)
98
+ rt.delete(self.genHelpers)
99
+
100
+ self.genBones = []
101
+ self.genHelpers = []
102
+
103
+ def update_weight(self, inPelvisWeight=40.0, inThighWeight=60.0):
104
+ """
105
+ 고간 부 본의 가중치를 업데이트하는 메소드.
106
+
107
+ Args:
108
+ inPelvisWeight: 골반 가중치
109
+ inThighWeight: 허벅지 가중치
110
+
111
+ Returns:
112
+ None
113
+ """
114
+ if len(self.genBones) == 0:
115
+ return False
116
+
117
+ self.delete()
118
+ self.create_bone(self.bipObj, inPelvisWeight, inThighWeight)
88
119
 
89
120
 
90
121
 
pyjallib/max/header.py CHANGED
@@ -25,8 +25,10 @@ from .bip import Bip
25
25
  from .skin import Skin
26
26
 
27
27
  from .twistBone import TwistBone
28
- from .groinBone import GroinBone
29
- from .autoClavicle import AutoClavicle
28
+ # from .autoClavicle import AutoClavicle
29
+ # from .volumePreserveBone import VolumePreserveBone
30
+
31
+ from .morph import Morph
30
32
 
31
33
  class Header:
32
34
  """
@@ -66,8 +68,10 @@ class Header:
66
68
  self.skin = Skin()
67
69
 
68
70
  self.twistBone = TwistBone(nameService=self.name, animService=self.anim, constService=self.constraint, bipService=self.bip, boneService=self.bone)
69
- self.groinBone = GroinBone(nameService=self.name, animService=self.anim, helperService=self.helper, constService=self.constraint, bipService=self.bip, boneService=self.bone, twistBoneService=self.twistBone)
70
- self.autoClavicle = AutoClavicle(nameService=self.name, animService=self.anim, helperService=self.helper, boneService=self.bone, constraintService=self.constraint, bipService=self.bip)
71
+ # self.autoClavicle = AutoClavicle(nameService=self.name, animService=self.anim, helperService=self.helper, boneService=self.bone, constraintService=self.constraint, bipService=self.bip)
72
+ # self.volumePreserveBone = VolumePreserveBone(nameService=self.name, animService=self.anim, constService=self.constraint, boneService=self.bone, helperService=self.helper)
73
+
74
+ self.morph = Morph()
71
75
 
72
76
  self.tools = []
73
77
 
pyjallib/max/helper.py CHANGED
@@ -264,6 +264,7 @@ class Helper:
264
264
  부모 헬퍼 생성
265
265
  """
266
266
  # 선택된 객체가 있는 경우에만 처리
267
+ returnHelpers = []
267
268
  if rt.selection.count > 0:
268
269
  selArray = rt.getCurrentSelection()
269
270
 
@@ -297,6 +298,11 @@ class Helper:
297
298
  # 부모 헬퍼로 이름 변경
298
299
  finalName = self.name.replace_name_part("Type", genPoint.name, self.get_name_by_type("Parent"))
299
300
  rt.setProperty(genPoint, "name", finalName)
301
+
302
+ returnHelpers.append(genPoint)
303
+
304
+ return returnHelpers
305
+
300
306
 
301
307
  def create_exp_tm(self):
302
308
  """