pyjallib 0.1.10__py3-none-any.whl → 0.1.12__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.
@@ -1,173 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- 자동 쇄골 체인(AutoClavicle Chain) 관련 기능을 제공하는 클래스.
6
- AutoClavicle 클래스가 생성한 자동 쇄골 뼈대들을 관리하고 접근하는 인터페이스를 제공합니다.
7
-
8
- Examples:
9
- # 자동 쇄골 체인 생성 예시
10
- from pyjallib.max import AutoClavicle, AutoClavicleChain
11
- from pymxs import runtime as rt
12
-
13
- # 선택된 쇄골과 상완 객체
14
- clavicle = rt.selection[0]
15
- upperArm = rt.selection[1]
16
-
17
- # AutoClavicle 클래스 인스턴스 생성
18
- auto_clavicle = AutoClavicle()
19
-
20
- # 자동 쇄골 뼈대 생성
21
- clavicle_bones = auto_clavicle.create_bones(clavicle, upperArm, liftScale=0.8)
22
-
23
- # 생성된 뼈대로 AutoClavicleChain 인스턴스 생성
24
- chain = AutoClavicleChain.from_auto_clavicle_result(
25
- {
26
- "Bones": clavicle_bones,
27
- "Helpers": auto_clavicle.helpers,
28
- "Clavicle": clavicle,
29
- "UpperArm": upperArm,
30
- "LiftScale": 0.8
31
- }
32
- )
33
-
34
- # 체인 관리 기능 사용
35
- bone = chain.get_bone()
36
-
37
- # 체인의 모든 뼈대 이름 변경
38
- chain.rename_bones(prefix="character_", suffix="_autoClavicle")
39
-
40
- # 체인의 LiftScale 수정
41
- chain.update_lift_scale(0.9)
42
-
43
- # 필요 없어지면 체인의 모든 뼈대와 헬퍼 삭제
44
- # chain.delete_all()
45
- """
46
-
47
- from pymxs import runtime as rt
48
- from pyjallib.max.header import get_pyjallibmaxheader
49
- jal = get_pyjallibmaxheader()
50
-
51
-
52
- class AutoClavicleChain:
53
- def __init__(self, inResult):
54
- """
55
- 클래스 초기화.
56
-
57
- Args:
58
- inResult: AutoClavicle 클래스의 생성 결과 (딕셔너리)
59
- """
60
- self.bones = inResult.get("Bones", [])
61
- self.helpers = inResult.get("Helpers", [])
62
- self.clavicle = inResult.get("Clavicle", None)
63
- self.upperArm = inResult.get("UpperArm", None)
64
- self.liftScale = inResult.get("LiftScale", 0.8)
65
-
66
- def get_bones(self):
67
- """
68
- 체인의 모든 뼈대 가져오기
69
-
70
- Returns:
71
- 모든 뼈대 객체의 배열
72
- """
73
- if self.is_empty():
74
- return []
75
-
76
- return self.bones
77
-
78
- def get_helpers(self):
79
- """
80
- 체인의 모든 헬퍼 가져오기
81
-
82
- Returns:
83
- 모든 헬퍼 객체의 배열
84
- """
85
- if self.is_empty():
86
- return []
87
-
88
- return self.helpers
89
-
90
- def is_empty(self):
91
- """
92
- 체인이 비어있는지 확인
93
-
94
- Returns:
95
- 체인이 비어있으면 True, 아니면 False
96
- """
97
- return len(self.bones) == 0
98
-
99
- def clear(self):
100
- """체인의 모든 뼈대와 헬퍼 참조 제거"""
101
- self.bones = []
102
- self.helpers = []
103
- self.clavicle = None
104
- self.upperArm = None
105
-
106
- def delete_all(self):
107
- """
108
- 체인의 모든 뼈대와 헬퍼를 3ds Max 씬에서 삭제
109
-
110
- Returns:
111
- 삭제 성공 여부 (boolean)
112
- """
113
- if self.is_empty():
114
- return False
115
-
116
- try:
117
- for bone in self.bones:
118
- if rt.isValidNode(bone):
119
- rt.delete(bone)
120
-
121
- for helper in self.helpers:
122
- if rt.isValidNode(helper):
123
- rt.delete(helper)
124
-
125
- self.clear()
126
- return True
127
- except:
128
- return False
129
-
130
- def update_lift_scale(self, newLiftScale=0.8):
131
- """
132
- 자동 쇄골의 들어올림 스케일 업데이트
133
-
134
- Args:
135
- newLiftScale: 새로운 들어올림 스케일 (기본값: 0.8)
136
-
137
- Returns:
138
- 업데이트 성공 여부 (boolean)
139
- """
140
- if self.is_empty() or not rt.isValidNode(self.clavicle) or not rt.isValidNode(self.upperArm):
141
- return False
142
-
143
- clavicle = self.clavicle
144
- upperArm = self.upperArm
145
-
146
- # 기존 본과 헬퍼 삭제
147
- self.delete_all()
148
-
149
- # 새로운 LiftScale 값 설정
150
- self.liftScale = newLiftScale
151
- self.clavicle = clavicle
152
- self.upperArm = upperArm
153
-
154
- # 재생성
155
- result = jal.autoClavicle.create_bones(self.clavicle, self.upperArm, self.liftScale)
156
- if result:
157
- return True
158
-
159
- return False
160
-
161
- @classmethod
162
- def from_auto_clavicle_result(cls, inResult):
163
- """
164
- AutoClavicle 클래스의 결과로부터 AutoClavicleChain 인스턴스 생성
165
-
166
- Args:
167
- inResult: AutoClavicle 클래스의 메서드가 반환한 결과값 딕셔너리
168
-
169
- Returns:
170
- AutoClavicleChain 인스턴스
171
- """
172
- chain = cls(inResult)
173
- return chain
@@ -1,173 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- 고간 부 본 체인(Groin Bone Chain) 관련 기능을 제공하는 클래스.
6
- GroinBone 클래스가 생성한 고간 부 본들과 헬퍼들을 관리하고 접근하는 인터페이스를 제공합니다.
7
-
8
- Examples:
9
- # GroinBone 클래스로 고간 본 생성 후 체인으로 관리하기
10
- groin_bone = GroinBone()
11
- biped_obj = rt.selection[0] # 선택된 바이패드 객체
12
-
13
- # 고간 본 생성
14
- success = groin_bone.create_bone(biped_obj, 40.0, 60.0)
15
- if success:
16
- # 생성된 본과 헬퍼로 체인 생성
17
- chain = GroinBoneChain.from_groin_bone_result(
18
- groin_bone.genBones,
19
- groin_bone.genHelpers,
20
- biped_obj,
21
- 40.0,
22
- 60.0
23
- )
24
-
25
- # 체인 가중치 업데이트
26
- chain.update_weights(35.0, 65.0)
27
-
28
- # 본과 헬퍼 이름 변경
29
- chain.rename_bones(prefix="Character_", suffix="_Groin")
30
- chain.rename_helpers(prefix="Character_", suffix="_Helper")
31
-
32
- # 현재 가중치 값 확인
33
- pelvis_w, thigh_w = chain.get_weights()
34
- print(f"Current weights: Pelvis={pelvis_w}, Thigh={thigh_w}")
35
-
36
- # 체인 삭제
37
- # chain.delete_all()
38
- """
39
-
40
- from pymxs import runtime as rt
41
- from pyjallib.max.header import get_pyjallibmaxheader
42
- jal = get_pyjallibmaxheader()
43
-
44
- class GroinBoneChain:
45
- def __init__(self, inResult):
46
- """
47
- 클래스 초기화.
48
-
49
- Args:
50
- bones: 고간 부 본 체인을 구성하는 뼈대 배열 (기본값: None)
51
- helpers: 고간 부 본과 연관된 헬퍼 객체 배열 (기본값: None)
52
- biped_obj: 연관된 Biped 객체 (기본값: None)
53
- """
54
- self.pelvis =inResult["Pelvis"]
55
- self.lThighTwist = inResult["LThighTwist"]
56
- self.rThighTwist = inResult["RThighTwist"]
57
- self.bones = inResult["Bones"]
58
- self.helpers = inResult["Helpers"]
59
- self.pelvisWeight = inResult["PelvisWeight"]
60
- self.thighWeight = inResult["ThighWeight"]
61
-
62
- def is_empty(self):
63
- """
64
- 체인이 비어있는지 확인
65
-
66
- Returns:
67
- 본과 헬퍼가 모두 비어있으면 True, 아니면 False
68
- """
69
- return len(self.bones) == 0 and len(self.helpers) == 0
70
-
71
- def clear(self):
72
- """체인의 모든 본과 헬퍼 참조 제거"""
73
- self.bones = []
74
- self.helpers = []
75
- self.pelvis = None
76
- self.lThighTwist = None
77
- self.rThighTwist = None
78
- self.pelvisWeight = 40.0 # 기본 골반 가중치
79
- self.thighWeight = 60.0 # 기본 허벅지 가중치
80
-
81
- def delete(self):
82
- """
83
- 체인의 모든 본과 헬퍼를 3ds Max 씬에서 삭제
84
-
85
- Returns:
86
- 삭제 성공 여부 (boolean)
87
- """
88
- if self.is_empty():
89
- return False
90
-
91
- try:
92
- rt.delete(self.bones)
93
- rt.delete(self.helpers)
94
- return True
95
- except:
96
- return False
97
-
98
- def delete_all(self):
99
- """
100
- 체인의 모든 본과 헬퍼를 3ds Max 씬에서 삭제
101
-
102
- Returns:
103
- 삭제 성공 여부 (boolean)
104
- """
105
- if self.is_empty():
106
- return False
107
-
108
- try:
109
- rt.delete(self.bones)
110
- rt.delete(self.helpers)
111
- self.clear()
112
- return True
113
- except:
114
- return False
115
-
116
- def update_weights(self, pelvisWeight=None, thighWeight=None):
117
- """
118
- 고간 부 본의 가중치 업데이트
119
-
120
- Args:
121
- pelvisWeight: 골반 가중치 (None인 경우 현재 값 유지)
122
- thighWeight: 허벅지 가중치 (None인 경우 현재 값 유지)
123
-
124
- Returns:
125
- 업데이트 성공 여부 (boolean)
126
- """
127
- if self.is_empty():
128
- return False
129
-
130
- # 새 가중치 설정
131
- if pelvisWeight is not None:
132
- self.pelvisWeight = pelvisWeight
133
- if thighWeight is not None:
134
- self.thighWeight = thighWeight
135
-
136
- self.delete()
137
- result = jal.groinBone.create_bone(
138
- self.pelvis,
139
- self.lThighTwist,
140
- self.rThighTwist,
141
- self.pelvisWeight,
142
- self.thighWeight
143
- )
144
- self.bones = result["Bones"]
145
- self.helpers = result["Helpers"]
146
-
147
- def get_weights(self):
148
- """
149
- 현재 설정된 가중치 값 가져오기
150
-
151
- Returns:
152
- (pelvis_weight, thigh_weight) 형태의 튜플
153
- """
154
- return (self.pelvis_weight, self.thigh_weight)
155
-
156
- @classmethod
157
- def from_groin_bone_result(cls, inResult):
158
- """
159
- GroinBone 클래스의 결과로부터 GroinBoneChain 인스턴스 생성
160
-
161
- Args:
162
- bones: GroinBone 클래스가 생성한 뼈대 배열
163
- helpers: GroinBone 클래스가 생성한 헬퍼 배열
164
- biped_obj: 연관된 Biped 객체 (기본값: None)
165
- pelvisWeight: 골반 가중치 (기본값: 40.0)
166
- thighWeight: 허벅지 가중치 (기본값: 60.0)
167
-
168
- Returns:
169
- GroinBoneChain 인스턴스
170
- """
171
- chain = cls(inResult)
172
-
173
- return chain
@@ -1,162 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- 트위스트 뼈대 체인(Twist Bone Chain) 모듈 - 트위스트 뼈대 그룹 관리 기능 제공
6
-
7
- 이 모듈은 TwistBone 클래스가 생성한 트위스트 뼈대들을 하나의 체인으로 관리하고
8
- 간편하게 접근할 수 있는 인터페이스를 제공합니다. 일반적으로 캐릭터 리깅에서
9
- 팔, 다리 등의 관절 부위에 자연스러운 회전 움직임을 구현하기 위해 사용됩니다.
10
-
11
- TwistBoneChain 클래스는 다음과 같은 주요 기능을 제공합니다:
12
- - 트위스트 뼈대 체인의 개별 뼈대 접근
13
- - 체인의 첫 번째/마지막 뼈대 쉽게 가져오기
14
- - 체인의 모든 뼈대를 한 번에 삭제하기
15
- - 체인의 타입 정보 관리 (상체/하체)
16
-
17
- Examples:
18
- # 트위스트 체인 생성 및 관리 예시
19
- from pyjallib.max import TwistBone, TwistBoneChain
20
- from pymxs import runtime as rt
21
-
22
- # 트위스트 뼈대를 생성할 뼈대 객체와 그 자식 객체 가져오기
23
- parent_bone = rt.selection[0] # 예: 상완 뼈대
24
- child_bone = parent_bone.children[0] # 예: 전완 뼈대
25
-
26
- # TwistBone 클래스 인스턴스 생성
27
- twist_bone = TwistBone()
28
-
29
- # 상완(Upper) 타입의 트위스트 뼈대 체인 생성 (4개의 뼈대)
30
- twist_result = twist_bone.create_upper_limb_bones(parent_bone, child_bone, 4)
31
-
32
- # 생성된 결과로 TwistBoneChain 인스턴스 생성
33
- chain = TwistBoneChain.from_twist_bone_result(twist_result)
34
-
35
- # 체인 관리 기능 사용
36
- first_bone = chain.get_first_bone() # 첫 번째 트위스트 뼈대
37
- last_bone = chain.get_last_bone() # 마지막 트위스트 뼈대
38
- middle_bone = chain.get_bone_at_index(2) # 특정 인덱스의 뼈대
39
-
40
- # 체인 정보 확인
41
- bone_count = chain.get_count() # 체인의 뼈대 개수
42
- chain_type = chain.get_type() # 체인의 타입 (Upper 또는 Lower)
43
-
44
- # 필요 없어지면 체인의 모든 뼈대 삭제
45
- # chain.delete_all()
46
- """
47
-
48
- from pymxs import runtime as rt
49
- from pyjallib.max.header import get_pyjallibmaxheader
50
- jal = get_pyjallibmaxheader()
51
-
52
- class TwistBoneChain:
53
- def __init__(self, inResult):
54
- """
55
- 클래스 초기화.
56
-
57
- Args:
58
- bones: 트위스트 뼈대 체인을 구성하는 뼈대 배열 (기본값: None)
59
- """
60
- self.bones = inResult["Bones"]
61
- self.type = inResult["Type"]
62
- self.limb = inResult["Limb"]
63
- self.child = inResult["Child"]
64
- self.twistNum = inResult["TwistNum"]
65
-
66
- def get_bone_at_index(self, index):
67
- """
68
- 지정된 인덱스의 트위스트 뼈대 가져오기
69
-
70
- Args:
71
- index: 가져올 뼈대의 인덱스
72
-
73
- Returns:
74
- 해당 인덱스의 뼈대 객체 또는 None (인덱스가 범위를 벗어난 경우)
75
- """
76
- if 0 <= index < len(self.bones):
77
- return self.bones[index]
78
- return None
79
-
80
- def get_first_bone(self):
81
- """
82
- 체인의 첫 번째 트위스트 뼈대 가져오기
83
-
84
- Returns:
85
- 첫 번째 뼈대 객체 또는 None (체인이 비어있는 경우)
86
- """
87
- return self.bones[0] if self.bones else None
88
-
89
- def get_last_bone(self):
90
- """
91
- 체인의 마지막 트위스트 뼈대 가져오기
92
-
93
- Returns:
94
- 마지막 뼈대 객체 또는 None (체인이 비어있는 경우)
95
- """
96
- return self.bones[-1] if self.bones else None
97
-
98
- def get_count(self):
99
- """
100
- 체인의 트위스트 뼈대 개수 가져오기
101
-
102
- Returns:
103
- 뼈대 개수
104
- """
105
- return self.twistNum
106
-
107
- def is_empty(self):
108
- """
109
- 체인이 비어있는지 확인
110
-
111
- Returns:
112
- 체인이 비어있으면 True, 아니면 False
113
- """
114
- return len(self.bones) == 0
115
-
116
- def clear(self):
117
- """체인의 모든 뼈대 제거"""
118
- self.bones = []
119
-
120
- def delete_all(self):
121
- """
122
- 체인의 모든 뼈대를 3ds Max 씬에서 삭제
123
-
124
- Returns:
125
- 삭제 성공 여부 (boolean)
126
- """
127
- if not self.bones:
128
- return False
129
-
130
- try:
131
- for bone in self.bones:
132
- rt.delete(bone)
133
- self.clear()
134
- return True
135
- except:
136
- return False
137
-
138
- def get_type(self):
139
- """
140
- 트위스트 뼈대 체인의 타입을 반환합니다.
141
-
142
- Returns:
143
- 트위스트 뼈대 체인의 타입 ('upperArm', 'foreArm', 'thigh', 'calf', 'bend' 중 하나) 또는 None
144
- """
145
- return self.type
146
-
147
- @classmethod
148
- def from_twist_bone_result(cls, inResult):
149
- """
150
- TwistBone 클래스의 결과로부터 TwistBoneChain 인스턴스 생성
151
-
152
- Args:
153
- twist_bone_result: TwistBone 클래스의 메서드가 반환한 뼈대 배열
154
- source_bone: 원본 뼈대 객체 (기본값: None)
155
- type_name: 트위스트 뼈대 타입 (기본값: None)
156
-
157
- Returns:
158
- TwistBoneChain 인스턴스
159
- """
160
- chain = cls(inResult)
161
-
162
- return chain