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.
- pyjallib/__init__.py +7 -7
- pyjallib/max/__init__.py +24 -25
- pyjallib/max/autoClavicle.py +39 -4
- pyjallib/max/bip.py +69 -2
- pyjallib/max/bone.py +37 -0
- pyjallib/max/boneChain.py +182 -0
- pyjallib/max/groinBone.py +65 -29
- pyjallib/max/hip.py +44 -7
- pyjallib/max/kneeBone.py +61 -26
- pyjallib/max/macro/jal_macro_bone.py +1 -1
- pyjallib/max/twistBone.py +59 -40
- pyjallib/max/volumeBone.py +77 -26
- pyjallib/naming.py +27 -2
- pyjallib/namingConfig.py +3 -2
- pyjallib/perforce.py +489 -9
- {pyjallib-0.1.10.dist-info → pyjallib-0.1.12.dist-info}/METADATA +1 -1
- {pyjallib-0.1.10.dist-info → pyjallib-0.1.12.dist-info}/RECORD +18 -21
- pyjallib/max/autoClavicleChain.py +0 -173
- pyjallib/max/groinBoneChain.py +0 -173
- pyjallib/max/twistBoneChain.py +0 -162
- pyjallib/max/volumeBoneChain.py +0 -363
- {pyjallib-0.1.10.dist-info → pyjallib-0.1.12.dist-info}/WHEEL +0 -0
pyjallib/max/volumeBone.py
CHANGED
@@ -18,6 +18,8 @@ from .helper import Helper
|
|
18
18
|
from .bone import Bone
|
19
19
|
from .constraint import Constraint
|
20
20
|
|
21
|
+
from .boneChain import BoneChain
|
22
|
+
|
21
23
|
|
22
24
|
class VolumeBone: # Updated class name to match the new file name
|
23
25
|
"""
|
@@ -69,8 +71,8 @@ class VolumeBone: # Updated class name to match the new file name
|
|
69
71
|
"\n"
|
70
72
|
"q = localDeltaTm.rotation\n"
|
71
73
|
"\n"
|
72
|
-
"eulerRot = (quatToEuler q order:
|
73
|
-
"swizzledRot = (eulerAngles eulerRot.
|
74
|
+
"eulerRot = (quatToEuler q order:5)\n"
|
75
|
+
"swizzledRot = (eulerAngles eulerRot.y eulerRot.z eulerRot.x)\n"
|
74
76
|
"saturatedTwist = abs ((swizzledRot.x*axis.x + swizzledRot.y*axis.y + swizzledRot.z*axis.z)/180.0)\n"
|
75
77
|
"\n"
|
76
78
|
"trAxis * saturatedTwist * volumeSize * transScale\n"
|
@@ -213,7 +215,7 @@ class VolumeBone: # Updated class name to match the new file name
|
|
213
215
|
inTransScales: 변환 비율 리스트
|
214
216
|
|
215
217
|
Returns:
|
216
|
-
|
218
|
+
BoneChain: 생성된 볼륨 본 체인 객체
|
217
219
|
"""
|
218
220
|
if rt.isValidNode(inObj) == False or rt.isValidNode(inParent) == False:
|
219
221
|
return None
|
@@ -242,32 +244,81 @@ class VolumeBone: # Updated class name to match the new file name
|
|
242
244
|
if rt.isValidNode(volBone):
|
243
245
|
bones.append(volBone)
|
244
246
|
|
245
|
-
#
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
self.rotAxises = inRotAxises.copy()
|
251
|
-
self.transAxises = inTransAxises.copy()
|
252
|
-
self.transScales = inTransScales.copy()
|
253
|
-
self.volumeSize = inVolumeSize
|
254
|
-
self.rotScale = inRotScale
|
255
|
-
|
256
|
-
# VolumeBoneChain이 필요로 하는 형태의 결과 딕셔너리 생성
|
247
|
+
# 모든 생성된 본들 모음
|
248
|
+
all_bones = [rootBone] + bones
|
249
|
+
rotHelper = self.rotHelper
|
250
|
+
|
251
|
+
# BoneChain에 필요한 형태의 결과 딕셔너리 생성
|
257
252
|
result = {
|
258
|
-
"
|
259
|
-
"
|
260
|
-
"
|
261
|
-
"
|
262
|
-
"LimbParent": inParent,
|
263
|
-
"Bones": bones,
|
264
|
-
"RotAxises": inRotAxises,
|
265
|
-
"TransAxises": inTransAxises,
|
266
|
-
"TransScales": inTransScales,
|
267
|
-
"VolumeSize": inVolumeSize
|
253
|
+
"Bones": all_bones,
|
254
|
+
"Helpers": [rotHelper],
|
255
|
+
"SourceBones": [inObj, inParent],
|
256
|
+
"Parameters": [inRotScale, inVolumeSize] + inRotAxises + inTransAxises + inTransScales
|
268
257
|
}
|
269
258
|
|
270
259
|
# 메소드 호출 후 데이터 초기화
|
271
260
|
self.reset()
|
272
261
|
|
273
|
-
return result
|
262
|
+
return BoneChain.from_result(result)
|
263
|
+
|
264
|
+
def create_bones_from_chain(self, inBoneChain: BoneChain):
|
265
|
+
"""
|
266
|
+
기존 BoneChain 객체에서 볼륨 본을 생성합니다.
|
267
|
+
기존 설정을 복원하거나 저장된 데이터에서 볼륨 본 셋업을 재생성할 때 사용합니다.
|
268
|
+
|
269
|
+
Args:
|
270
|
+
inBoneChain (BoneChain): 볼륨 본 정보를 포함한 BoneChain 객체
|
271
|
+
|
272
|
+
Returns:
|
273
|
+
BoneChain: 업데이트된 BoneChain 객체 또는 실패 시 None
|
274
|
+
"""
|
275
|
+
if not inBoneChain or inBoneChain.is_empty():
|
276
|
+
return None
|
277
|
+
|
278
|
+
# 기존 객체 삭제
|
279
|
+
inBoneChain.delete()
|
280
|
+
|
281
|
+
# BoneChain에서 필요한 정보 추출
|
282
|
+
sourceBones = inBoneChain.sourceBones
|
283
|
+
parameters = inBoneChain.parameters
|
284
|
+
|
285
|
+
# 필수 소스 본 확인
|
286
|
+
if len(sourceBones) < 2 or not rt.isValidNode(sourceBones[0]) or not rt.isValidNode(sourceBones[1]):
|
287
|
+
return None
|
288
|
+
|
289
|
+
# 최소 필요 파라미터 확인
|
290
|
+
if len(parameters) < 2:
|
291
|
+
return None
|
292
|
+
|
293
|
+
# 파라미터 가져오기
|
294
|
+
inRotScale = parameters[0]
|
295
|
+
inVolumeSize = parameters[1]
|
296
|
+
|
297
|
+
# 회전축, 변환축, 변환비율을 파라미터에서 추출
|
298
|
+
# 최소한 하나의 축 세트는 필요
|
299
|
+
param_count = len(parameters)
|
300
|
+
if param_count <= 2:
|
301
|
+
# 기본 값 사용
|
302
|
+
inRotAxises = ["Z"]
|
303
|
+
inTransAxises = ["PosY"]
|
304
|
+
inTransScales = [1.0]
|
305
|
+
else:
|
306
|
+
# 파라미터 중간을 3등분하여 각 목록 추출
|
307
|
+
axis_count = (param_count - 2) // 3
|
308
|
+
|
309
|
+
inRotAxises = parameters[2:2+axis_count]
|
310
|
+
inTransAxises = parameters[2+axis_count:2+axis_count*2]
|
311
|
+
inTransScales = parameters[2+axis_count*2:2+axis_count*3]
|
312
|
+
|
313
|
+
# 리스트 길이가 일치하지 않으면 기본값으로 보완
|
314
|
+
if len(inRotAxises) != len(inTransAxises) or len(inRotAxises) != len(inTransScales):
|
315
|
+
min_len = min(len(inRotAxises), len(inTransAxises), len(inTransScales))
|
316
|
+
inRotAxises = inRotAxises[:min_len] if min_len > 0 else ["Z"]
|
317
|
+
inTransAxises = inTransAxises[:min_len] if min_len > 0 else ["PosY"]
|
318
|
+
inTransScales = inTransScales[:min_len] if min_len > 0 else [1.0]
|
319
|
+
|
320
|
+
# 새로운 볼륨 본 생성
|
321
|
+
inObj = sourceBones[0]
|
322
|
+
inParent = sourceBones[1]
|
323
|
+
|
324
|
+
return self.create_bones(inObj, inParent, inRotScale, inVolumeSize, inRotAxises, inTransAxises, inTransScales)
|
pyjallib/naming.py
CHANGED
@@ -258,6 +258,18 @@ class Naming:
|
|
258
258
|
패딩 숫자
|
259
259
|
"""
|
260
260
|
return self._paddingNum
|
261
|
+
|
262
|
+
def get_filtering_char(self, inStr):
|
263
|
+
"""
|
264
|
+
문자열에서 구분자 문자 가져오기
|
265
|
+
|
266
|
+
Args:
|
267
|
+
inStr: 확인할 문자열
|
268
|
+
|
269
|
+
Returns:
|
270
|
+
구분자 문자 (' ' 또는 '_' 또는 '')
|
271
|
+
"""
|
272
|
+
return self._get_filtering_char(inStr)
|
261
273
|
|
262
274
|
def get_name_part(self, inNamePartName):
|
263
275
|
"""
|
@@ -273,6 +285,15 @@ class Naming:
|
|
273
285
|
if part.get_name() == inNamePartName:
|
274
286
|
return part
|
275
287
|
return None
|
288
|
+
|
289
|
+
def get_name_parts(self):
|
290
|
+
"""
|
291
|
+
모든 namePart 객체 가져오기
|
292
|
+
|
293
|
+
Returns:
|
294
|
+
namePart 객체 리스트
|
295
|
+
"""
|
296
|
+
return self._nameParts
|
276
297
|
|
277
298
|
def get_name_part_index(self, inNamePartName):
|
278
299
|
"""
|
@@ -473,7 +494,11 @@ class Naming:
|
|
473
494
|
|
474
495
|
# 배열을 문자열로 결합
|
475
496
|
newName = self._combine(combinedNameArray, inFilChar)
|
476
|
-
|
497
|
+
|
498
|
+
# "Index"키가 있을 때만 패딩 적용
|
499
|
+
if "Index" in inPartsDict:
|
500
|
+
newName = self.set_index_padding_num(newName)
|
501
|
+
|
477
502
|
return newName
|
478
503
|
|
479
504
|
def get_RealName(self, inStr):
|
@@ -494,7 +519,7 @@ class Naming:
|
|
494
519
|
for part in self._nameParts:
|
495
520
|
partName = part.get_name()
|
496
521
|
partType = part.get_type()
|
497
|
-
if partType != NamePartType.REALNAME:
|
522
|
+
if partType.value != NamePartType.REALNAME.value:
|
498
523
|
foundName = self.get_name(partName, inStr)
|
499
524
|
nonRealNameArray.append(foundName)
|
500
525
|
|
pyjallib/namingConfig.py
CHANGED
@@ -388,7 +388,7 @@ class NamingConfig:
|
|
388
388
|
|
389
389
|
return True
|
390
390
|
|
391
|
-
def set_part_value_by_csv(self, part_name: str, csv_file_path: str) -> bool:
|
391
|
+
def set_part_value_by_csv(self, part_name: str, csv_file_path: str, encoding: str = "utf-8") -> bool:
|
392
392
|
"""
|
393
393
|
특정 NamePart의 사전 정의 값을 CSV 파일로 설정
|
394
394
|
CSV 파일 형식: value,description,koreanDescription (각 줄당)
|
@@ -396,6 +396,7 @@ class NamingConfig:
|
|
396
396
|
Args:
|
397
397
|
part_name: NamePart 이름
|
398
398
|
csv_file_path: CSV 파일 경로
|
399
|
+
encoding: CSV 파일 인코딩 (기본값: "utf-8", "utf-8-sig" 등 사용 가능)
|
399
400
|
|
400
401
|
Returns:
|
401
402
|
설정 성공 여부 (True/False)
|
@@ -415,7 +416,7 @@ class NamingConfig:
|
|
415
416
|
descriptions = []
|
416
417
|
korean_descriptions = []
|
417
418
|
try:
|
418
|
-
with open(csv_file_path, 'r', encoding=
|
419
|
+
with open(csv_file_path, 'r', encoding=encoding, newline='') as f:
|
419
420
|
reader = csv.reader(f)
|
420
421
|
for row in reader:
|
421
422
|
if len(row) >= 3: # Ensure row has at least 3 columns
|