を動作していませんTEST_1_GRP、TEST_2_GRP、TEST_3_GRPなどの名前を持つグループを表示するのではなく、TEST_1_GRP、TEST_1_GRP1、TEST_1_GRP2を自分の結果として取得しています...カウンター私のタイトルはとにかく間違った印象はなく...</p> <p>を与える場合、私は2を持っているとき、私は、謝罪..私はそれに応じてインクリメントするようなカウンターの使用、でグループ化するいくつかを実行しようとしてい
(文の中/前のように)周りのカウンタ部分の行は、私はどこにもいません。
以下は私のコードです:
def fix_shapes():
all_geos = cmds.ls(sl = True)
for geo in all_geos:
shapes = cmds.listRelatives(geo, fullPath=True, shapes=True)
if len(shapes) == 1:
continue
new_listing = []
listing.append(shapes[:1])
# pop out the first shape, since we don't have to fix it
multi_shapes = shapes[1:]
for multi_shape in multi_shapes:
new_transform = cmds.duplicate(multi_shape, parentOnly=True)
new_geos = cmds.parent(multi_shape, new_transform, addObject=True, shape=True)
listing.append(new_geos)
# remove the shape from its original transform
cmds.parent(multi_shape, removeObject=True, shape=True)
# counter to 'version' up new_geos group naming
counter = 0
new_group_name = cmds.group(em=True, name = 'TEST_' + str(counter + 1) + '_GRP')
for item in new_listing:
counter = counter + 1
new_geos_parent_name = cmds.listRelatives(item, parent = True)
cmds.parent(new_geos_parent_name, new_group_name)
直後に 'counter = 0'と' str(counter + 1) 'があります。あなたが期待していることは分かりませんが、変数を0に設定して値をチェックすると、常に0になります。 'str(counter + 1)'は ' 1 "がそこにある。 – melpomene