pyjallib 0.1.9__py3-none-any.whl → 0.1.11__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 +7 -7
- pyjallib/max/ConfigFiles/Default_3DSMaxNamingConfig.json +161 -0
- pyjallib/max/__init__.py +31 -20
- pyjallib/max/anim.py +60 -36
- pyjallib/max/autoClavicle.py +122 -122
- pyjallib/max/bip.py +213 -14
- pyjallib/max/bone.py +378 -16
- pyjallib/max/boneChain.py +182 -0
- pyjallib/max/groinBone.py +148 -73
- pyjallib/max/header.py +42 -6
- pyjallib/max/helper.py +3 -21
- pyjallib/max/hip.py +276 -366
- pyjallib/max/kneeBone.py +552 -0
- pyjallib/max/macro/jal_macro_align.py +11 -10
- pyjallib/max/macro/jal_macro_bone.py +3 -2
- pyjallib/max/macro/jal_macro_constraint.py +2 -1
- pyjallib/max/macro/jal_macro_helper.py +2 -1
- pyjallib/max/macro/jal_macro_link.py +2 -1
- pyjallib/max/macro/jal_macro_select.py +2 -1
- pyjallib/max/mirror.py +1 -1
- pyjallib/max/twistBone.py +264 -462
- pyjallib/max/volumeBone.py +324 -0
- pyjallib/namePart.py +16 -16
- pyjallib/nameToPath.py +1 -1
- pyjallib/naming.py +16 -17
- pyjallib/namingConfig.py +3 -3
- pyjallib/perforce.py +127 -9
- {pyjallib-0.1.9.dist-info → pyjallib-0.1.11.dist-info}/METADATA +1 -1
- pyjallib-0.1.11.dist-info/RECORD +43 -0
- pyjallib/max/volumePreserveBone.py +0 -209
- pyjallib/p4module.py +0 -488
- pyjallib-0.1.9.dist-info/RECORD +0 -41
- {pyjallib-0.1.9.dist-info → pyjallib-0.1.11.dist-info}/WHEEL +0 -0
pyjallib/max/groinBone.py
CHANGED
@@ -7,7 +7,14 @@
|
|
7
7
|
|
8
8
|
from pymxs import runtime as rt
|
9
9
|
|
10
|
-
|
10
|
+
# Import necessary service classes for default initialization
|
11
|
+
from .name import Name
|
12
|
+
from .anim import Anim
|
13
|
+
from .helper import Helper
|
14
|
+
from .bone import Bone
|
15
|
+
from .constraint import Constraint
|
16
|
+
|
17
|
+
from .boneChain import BoneChain
|
11
18
|
|
12
19
|
class GroinBone:
|
13
20
|
"""
|
@@ -15,107 +22,175 @@ class GroinBone:
|
|
15
22
|
3DS Max에서 고간 부 본을 생성하고 관리하는 기능을 제공합니다.
|
16
23
|
"""
|
17
24
|
|
18
|
-
def __init__(self):
|
25
|
+
def __init__(self, nameService=None, animService=None, constraintService=None, boneService=None, helperService=None):
|
19
26
|
"""
|
20
27
|
클래스 초기화.
|
21
28
|
|
22
29
|
Args:
|
23
30
|
nameService: 이름 처리 서비스 (제공되지 않으면 새로 생성)
|
24
31
|
animService: 애니메이션 서비스 (제공되지 않으면 새로 생성)
|
25
|
-
|
26
|
-
bipService:
|
32
|
+
constraintService: 제약 서비스 (제공되지 않으면 새로 생성)
|
33
|
+
bipService: Biped 서비스 (제공되지 않으면 새로 생성)
|
34
|
+
boneService: 뼈대 서비스 (제공되지 않으면 새로 생성)
|
35
|
+
twistBoneService: 트위스트 본 서비스 (제공되지 않으면 새로 생성)
|
36
|
+
helperService: 헬퍼 객체 서비스 (제공되지 않으면 새로 생성)
|
37
|
+
"""
|
38
|
+
# 서비스 인스턴스 설정 또는 생성
|
39
|
+
self.name = nameService if nameService else Name()
|
40
|
+
self.anim = animService if animService else Anim()
|
41
|
+
|
42
|
+
# 종속성이 있는 서비스들은 이미 생성된 서비스들을 전달
|
43
|
+
self.const = constraintService if constraintService else Constraint(nameService=self.name)
|
44
|
+
self.bone = boneService if boneService else Bone(nameService=self.name, animService=self.anim)
|
45
|
+
self.helper = helperService if helperService else Helper(nameService=self.name)
|
46
|
+
|
47
|
+
# 초기화된 결과를 저장할 변수들
|
48
|
+
self.pelvis = None
|
49
|
+
self.lThighTwist = None
|
50
|
+
self.rThighTwist = None
|
51
|
+
self.bones = []
|
52
|
+
self.helpers = []
|
53
|
+
self.pelvisWeight = 40.0
|
54
|
+
self.thighWeight = 60.0
|
55
|
+
|
56
|
+
def reset(self):
|
57
|
+
"""
|
58
|
+
클래스의 주요 컴포넌트들을 초기화합니다.
|
59
|
+
서비스가 아닌 클래스 자체의 작업 데이터를 초기화하는 함수입니다.
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
self: 메소드 체이닝을 위한 자기 자신 반환
|
27
63
|
"""
|
28
|
-
self.
|
29
|
-
self.
|
30
|
-
|
31
|
-
self.
|
32
|
-
self.
|
33
|
-
self.
|
34
|
-
self.
|
35
|
-
|
36
|
-
|
37
|
-
self.bipObj = None
|
38
|
-
self.genBones = []
|
39
|
-
self.genHelpers = []
|
64
|
+
self.pelvis = None
|
65
|
+
self.lThighTwist = None
|
66
|
+
self.rThighTwist = None
|
67
|
+
self.bones = []
|
68
|
+
self.helpers = []
|
69
|
+
self.pelvisWeight = 40.0
|
70
|
+
self.thighWeight = 60.0
|
71
|
+
|
72
|
+
return self
|
40
73
|
|
41
|
-
def create_bone(self,
|
74
|
+
def create_bone(self, inPelvis, inLThighTwist, inRThighTwist, inPelvisWeight=40.0, inThighWeight=60.0):
|
42
75
|
"""
|
43
76
|
고간 부 본을 생성하는 메소드.
|
44
77
|
|
45
78
|
Args:
|
46
|
-
|
47
|
-
|
79
|
+
inPelvis: Biped 객체
|
80
|
+
inLThighTwist: 왼쪽 허벅지 트위스트 본
|
81
|
+
inRThighTwist: 오른쪽 허벅지 트위스트 본
|
82
|
+
inPelvisWeight: 골반 가중치 (기본값: 40.0)
|
83
|
+
inThighWeight: 허벅지 가중치 (기본값: 60.0)
|
48
84
|
|
49
85
|
Returns:
|
50
|
-
생성된 본 객체
|
86
|
+
BoneChain: 생성된 고간 부 본 체인 객체 또는 실패 시 False
|
51
87
|
"""
|
52
|
-
if self.bip.is_biped_object(inObj) == False:
|
53
|
-
rt.messageBox("This is not a biped object.")
|
54
|
-
return False
|
55
|
-
|
56
|
-
bipObj = self.bip.get_com(inObj)
|
57
|
-
self.bipObj = bipObj
|
58
88
|
|
59
|
-
|
60
|
-
|
61
|
-
|
89
|
+
if rt.isValidNode(inPelvis) == False or rt.isValidNode(inLThighTwist) == False or rt.isValidNode(inRThighTwist) == False:
|
90
|
+
rt.messageBox("There is no valid node.")
|
91
|
+
return False
|
62
92
|
|
63
|
-
|
64
|
-
|
93
|
+
groinName = "Groin"
|
94
|
+
if inPelvis.name[0].islower():
|
95
|
+
groinName = groinName.lower()
|
65
96
|
|
66
|
-
|
67
|
-
rt.messageBox("There is no twist bone.")
|
68
|
-
return False
|
97
|
+
groinBaseName = self.name.replace_name_part("RealName", inLThighTwist.name, groinName)
|
69
98
|
|
70
|
-
|
71
|
-
|
72
|
-
self.
|
73
|
-
self.
|
74
|
-
pelvisHelper.
|
99
|
+
pelvisHelperName = self.name.replace_name_part("Type", groinBaseName, self.name.get_name_part_value_by_description("Type", "Dummy"))
|
100
|
+
pelvisHelperName = self.name.replace_name_part("Index", pelvisHelperName, "0")
|
101
|
+
pelvisHelperName = self.name.remove_name_part("Side", pelvisHelperName)
|
102
|
+
pelvisHelper = self.helper.create_point(pelvisHelperName)
|
103
|
+
pelvisHelper.transform = inPelvis.transform
|
104
|
+
self.anim.rotate_local(pelvisHelper, 0.0, 0.0, -180.0)
|
105
|
+
pelvisHelper.parent = inPelvis
|
75
106
|
self.helper.set_shape_to_box(pelvisHelper)
|
76
|
-
self.genHelpers.append(pelvisHelper)
|
77
107
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
108
|
+
lThighTwistHelperName = self.name.replace_name_part("Type", groinBaseName, self.name.get_name_part_value_by_description("Type", "Dummy"))
|
109
|
+
lThighTwistHelperName = self.name.replace_name_part("Side", lThighTwistHelperName, self.name.get_name_part_value_by_description("Side", "Left"))
|
110
|
+
lThighTwistHelperName = self.name.replace_name_part("Index", lThighTwistHelperName, "0")
|
111
|
+
lThighTwistHelper = self.helper.create_point(lThighTwistHelperName)
|
112
|
+
lThighTwistHelper.transform = pelvisHelper.transform
|
113
|
+
lThighTwistHelper.position = inLThighTwist.position
|
114
|
+
lThighTwistHelper.parent = inLThighTwist
|
115
|
+
self.helper.set_shape_to_box(lThighTwistHelper)
|
116
|
+
|
117
|
+
rThighTwistHelperName = self.name.replace_name_part("Type", groinBaseName, self.name.get_name_part_value_by_description("Type", "Dummy"))
|
118
|
+
rThighTwistHelperName = self.name.replace_name_part("Side", rThighTwistHelperName, self.name.get_name_part_value_by_description("Side", "Right"))
|
119
|
+
rThighTwistHelperName = self.name.replace_name_part("Index", rThighTwistHelperName, "0")
|
120
|
+
rThighTwistHelper = self.helper.create_point(rThighTwistHelperName)
|
121
|
+
rThighTwistHelper.transform = pelvisHelper.transform
|
122
|
+
rThighTwistHelper.position = inRThighTwist.position
|
123
|
+
rThighTwistHelper.parent = inRThighTwist
|
124
|
+
self.helper.set_shape_to_box(rThighTwistHelper)
|
125
|
+
|
126
|
+
groinBoneName = self.name.replace_name_part("Index", groinBaseName, "0")
|
127
|
+
groinBoneName = self.name.remove_name_part("Side", groinBoneName)
|
128
|
+
groinBone = self.bone.create_nub_bone(groinBoneName, 2)
|
129
|
+
groinBone.name = groinBoneName
|
130
|
+
groinBone.transform = pelvisHelper.transform
|
131
|
+
groinBone.parent = inPelvis
|
132
|
+
|
133
|
+
self.const.assign_rot_const_multi(groinBone, [pelvisHelper, lThighTwistHelper, rThighTwistHelper])
|
134
|
+
rotConst = self.const.get_rot_list_controller(groinBone)[1]
|
86
135
|
rotConst.setWeight(1, inPelvisWeight)
|
87
136
|
rotConst.setWeight(2, inThighWeight/2.0)
|
88
137
|
rotConst.setWeight(3, inThighWeight/2.0)
|
89
138
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
139
|
+
# 결과를 멤버 변수에 저장
|
140
|
+
self.pelvis = inPelvis
|
141
|
+
self.lThighTwist = inLThighTwist
|
142
|
+
self.rThighTwist = inRThighTwist
|
143
|
+
self.bones = [groinBone]
|
144
|
+
self.helpers = [pelvisHelper, lThighTwistHelper, rThighTwistHelper]
|
145
|
+
self.pelvisWeight = inPelvisWeight
|
146
|
+
self.thighWeight = inThighWeight
|
147
|
+
|
148
|
+
# BoneChain 구조에 맞는 결과 딕셔너리 생성
|
149
|
+
result = {
|
150
|
+
"Bones": [groinBone],
|
151
|
+
"Helpers": [pelvisHelper, lThighTwistHelper, rThighTwistHelper],
|
152
|
+
"SourceBones": [inPelvis, inLThighTwist, inRThighTwist],
|
153
|
+
"Parameters": [inPelvisWeight, inThighWeight]
|
154
|
+
}
|
155
|
+
|
156
|
+
# 메소드 호출 후 데이터 초기화
|
157
|
+
self.reset()
|
158
|
+
|
159
|
+
# BoneChain 객체 반환
|
160
|
+
return BoneChain.from_result(result)
|
102
161
|
|
103
|
-
def
|
162
|
+
def create_bones_from_chain(self, inBoneChain: BoneChain):
|
104
163
|
"""
|
105
|
-
고간 부
|
164
|
+
기존 BoneChain 객체에서 고간 부 본을 생성합니다.
|
165
|
+
기존 설정을 복원하거나 저장된 데이터에서 고간 부 본 셋업을 재생성할 때 사용합니다.
|
106
166
|
|
107
167
|
Args:
|
108
|
-
|
109
|
-
inThighWeight: 허벅지 가중치
|
168
|
+
inBoneChain (BoneChain): 고간 부 본 정보를 포함한 BoneChain 객체
|
110
169
|
|
111
170
|
Returns:
|
112
|
-
None
|
171
|
+
BoneChain: 업데이트된 BoneChain 객체 또는 실패 시 None
|
113
172
|
"""
|
114
|
-
if
|
115
|
-
return
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
173
|
+
if not inBoneChain or inBoneChain.is_empty():
|
174
|
+
return None
|
175
|
+
|
176
|
+
# 기존 객체 삭제
|
177
|
+
inBoneChain.delete()
|
178
|
+
|
179
|
+
# BoneChain에서 필요한 정보 추출
|
180
|
+
sourceBones = inBoneChain.sourceBones
|
181
|
+
parameters = inBoneChain.parameters
|
182
|
+
|
183
|
+
# 필수 소스 본 확인 (최소 3개: 골반, 좌허벅지트위스트, 우허벅지트위스트)
|
184
|
+
if len(sourceBones) < 3 or not rt.isValidNode(sourceBones[0]) or not rt.isValidNode(sourceBones[1]) or not rt.isValidNode(sourceBones[2]):
|
185
|
+
return None
|
186
|
+
|
187
|
+
# 파라미터 가져오기 (또는 기본값 사용)
|
188
|
+
pelvisWeight = parameters[0] if len(parameters) > 0 else 40.0
|
189
|
+
thighWeight = parameters[1] if len(parameters) > 1 else 60.0
|
190
|
+
|
191
|
+
# 새로운 고간 부 본 생성
|
192
|
+
inPelvis = sourceBones[0]
|
193
|
+
inLThighTwist = sourceBones[1]
|
194
|
+
inRThighTwist = sourceBones[2]
|
195
|
+
|
196
|
+
return self.create_bone(inPelvis, inLThighTwist, inRThighTwist, pelvisWeight, thighWeight)
|
pyjallib/max/header.py
CHANGED
@@ -25,8 +25,11 @@ from .bip import Bip
|
|
25
25
|
from .skin import Skin
|
26
26
|
|
27
27
|
from .twistBone import TwistBone
|
28
|
-
|
29
|
-
|
28
|
+
from .autoClavicle import AutoClavicle
|
29
|
+
from .groinBone import GroinBone
|
30
|
+
from .volumeBone import VolumeBone
|
31
|
+
from .kneeBone import KneeBone
|
32
|
+
from .hip import Hip
|
30
33
|
|
31
34
|
from .morph import Morph
|
32
35
|
|
@@ -67,13 +70,46 @@ class Header:
|
|
67
70
|
self.bip = Bip(animService=self.anim, nameService=self.name, boneService=self.bone)
|
68
71
|
self.skin = Skin()
|
69
72
|
|
70
|
-
self.twistBone = TwistBone(nameService=self.name, animService=self.anim,
|
71
|
-
|
72
|
-
|
73
|
+
self.twistBone = TwistBone(nameService=self.name, animService=self.anim, constraintService=self.constraint, bipService=self.bip, boneService=self.bone)
|
74
|
+
self.groinBone = GroinBone(nameService=self.name, animService=self.anim, constraintService=self.constraint, boneService=self.bone, helperService=self.helper)
|
75
|
+
self.autoClavicle = AutoClavicle(nameService=self.name, animService=self.anim, helperService=self.helper, boneService=self.bone, constraintService=self.constraint, bipService=self.bip)
|
76
|
+
self.volumeBone = VolumeBone(nameService=self.name, animService=self.anim, constraintService=self.constraint, boneService=self.bone, helperService=self.helper)
|
77
|
+
self.kneeBone = KneeBone(nameService=self.name, animService=self.anim, constraintService=self.constraint, boneService=self.bone, helperService=self.helper, volumeBoneService=self.volumeBone)
|
78
|
+
self.hip = Hip(nameService=self.name, animService=self.anim, helperService=self.helper, boneService=self.bone, constraintService=self.constraint)
|
73
79
|
|
74
80
|
self.morph = Morph()
|
75
81
|
|
76
82
|
self.tools = []
|
83
|
+
|
84
|
+
def update_nameConifg(self, configPath):
|
85
|
+
"""
|
86
|
+
이름 설정을 업데이트합니다.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
configPath: ConfigPath 인스턴스
|
90
|
+
"""
|
91
|
+
self.name.load_from_config_file(configPath)
|
92
|
+
|
93
|
+
def add_tool(self, tool):
|
94
|
+
"""
|
95
|
+
도구를 추가합니다.
|
96
|
+
|
97
|
+
Args:
|
98
|
+
tool: 추가할 도구
|
99
|
+
"""
|
100
|
+
if tool in self.tools:
|
101
|
+
self.tools.remove(tool)
|
102
|
+
|
103
|
+
self.tools.append(tool)
|
77
104
|
|
78
105
|
# 모듈 레벨에서 전역 인스턴스 생성
|
79
|
-
|
106
|
+
_pyjallibmaxheader = Header.get_instance()
|
107
|
+
|
108
|
+
def get_pyjallibmaxheader():
|
109
|
+
"""
|
110
|
+
jal 인스턴스를 반환합니다.
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
Header 인스턴스
|
114
|
+
"""
|
115
|
+
return _pyjallibmaxheader
|
pyjallib/max/helper.py
CHANGED
@@ -93,30 +93,12 @@ class Helper:
|
|
93
93
|
찾은 Type namePart 값
|
94
94
|
"""
|
95
95
|
typePart = self.name.get_name_part("Type")
|
96
|
-
predefinedValues = typePart.get_predefined_values()
|
97
96
|
firstTypeValue = typePart.get_value_by_min_weight()
|
98
97
|
|
98
|
+
helperTypeName = self.name.get_name_part_value_by_description("Type", helperType)
|
99
|
+
if helperTypeName != "":
|
100
|
+
return helperTypeName
|
99
101
|
|
100
|
-
# 헬퍼 타입 패턴 정의
|
101
|
-
helperNamePatterns = {
|
102
|
-
"Dummy": ["dum", "Dum", "Dummy", "Helper", "Hpr", "Dmy"],
|
103
|
-
"IK": ["ik", "IK", "Ik"],
|
104
|
-
"Target": ["Tgt", "Target", "TG", "Tg", "T"],
|
105
|
-
"Parent": ["Prn", "PRN", "Parent", "P"],
|
106
|
-
"ExposeTm": ["Exp", "Etm", "EXP", "ETM"]
|
107
|
-
}
|
108
|
-
|
109
|
-
# 타입 패턴 가져오기
|
110
|
-
patterns = helperNamePatterns.get(helperType, [])
|
111
|
-
if not patterns:
|
112
|
-
return firstTypeValue
|
113
|
-
|
114
|
-
# 패턴과 일치하는 값 찾기
|
115
|
-
for value in predefinedValues:
|
116
|
-
if value in patterns:
|
117
|
-
return value
|
118
|
-
|
119
|
-
# 일치하는 값이 없으면 기본값 반환
|
120
102
|
return firstTypeValue
|
121
103
|
|
122
104
|
def gen_helper_name_from_obj(self, inObj, make_two=False, is_exp=False):
|