0

2 つのリストをループして結合しようとしています。しかし、ループ コードの構造化に問題があります。

これは Softimage (アニメーション 3D プログラム) のコードですが、意味があるといいのですが。

これは私が持っているものです:

import os
import glob
app = Application
storeSelect=[]
mypath = app.ActiveProject.ActiveScene.filename.value
folder=[]
storeAll=[]
listObj=[]
path=[]
storeSelecte=[]
folderAll=[]
#Seleccion
app.SelectObj("*.geometry_cache_grp*")
mySelection = app.Selection


# GETS PATHS FOr each Character Folder

userPath=Application.XSIInputBox ("Direccion de Cache", "Cache")+ "/" 
os.chdir(userPath)


#/loops

for lis in mySelection:
    storeSelect.append(lis)
    members = app.SelectMembers(lis)
    app.SelectObj("*.geometry_cache_grp*")
    mySelection = app.Selection

    for files in sorted(glob.glob("*.scn_c*")):
        folder=files
        for lise in members:
            print lise,folder

しかし、次のように結果を 2 回取得しています。

# DI_CACHE.lengua Anim_2p.scn_c_DI_rig
# DI_CACHE.vidrios Anim_2p.scn_c_DI_rig
# DI_CACHE.dientes_abajo Anim_2p.scn_c_DI_rig
# DI_CACHE.lengua Anim_2p.scn_c_TOTO_GALLO_rig
# DI_CACHE.vidrios Anim_2p.scn_c_TOTO_GALLO_rig
# DI_CACHE.dientes_abajo Anim_2p.scn_c_TOTO_GALLO_rig
# TOTO_GALLO_cache.lengua Anim_2p.scn_c_DI_rig
# TOTO_GALLO_cache.dientes_01 Anim_2p.scn_c_DI_rig
# TOTO_GALLO_cache.plumas_guantes Anim_2p.scn_c_DI_rig
# TOTO_GALLO_cache.lengua Anim_2p.scn_c_TOTO_GALLO_rig
# TOTO_GALLO_cache.dientes_01 Anim_2p.scn_c_TOTO_GALLO_rig
# TOTO_GALLO_cache.plumas_guantes Anim_2p.scn_c_TOTO_GALLO_rig

私のループを修正する方法を知っている人はいますか? 結果は次のようになります。

# DI_CACHE.lengua Anim_2p.scn_c_DI_rig
# DI_CACHE.vidrios Anim_2p.scn_c_DI_rig
# DI_CACHE.dientes_abajo Anim_2p.scn_c_DI_rig 
# TOTO_GALLO_cache.lengua Anim_2p.scn_c_TOTO_GALLO_rig
# TOTO_GALLO_cache.dientes_01 Anim_2p.scn_c_TOTO_GALLO_rig
# TOTO_GALLO_cache.plumas_guantes Anim_2p.scn_c_TOTO_GALLO_rig
4

1 に答える 1

0

それがあなたを助けるかどうかはわかりませんが、次のようなことができます:

members=[["DI_CACHE.lengua","DI_CACHE.vidrios","DI_CACHE.dientes_abajo"],["TOTO_GALLO_cache.lengua","TOTO_GALLO_cache.dientes_01","TOTO_GALLO_cache.plumas_guantes"]]'

folders=[["Anim_2p.scn_c_DI_rig"],["Anim_2p.scn_c_TOTO_GALLO_rig"]]

それから

for i in xrange(len(a)):
    for n,m in itertools.product(a[i],b[i]):
        print n,m

結果:

DI_CACHE.lengua Anim_2p.scn_c_DI_rig
DI_CACHE.vidrios Anim_2p.scn_c_DI_rig
DI_CACHE.dientes_abajo Anim_2p.scn_c_DI_rig
TOTO_GALLO_cache.lengua Anim_2p.scn_c_TOTO_GALLO_rig
TOTO_GALLO_cache.dientes_01 Anim_2p.scn_c_TOTO_GALLO_rig
TOTO_GALLO_cache.plumas_guantes Anim_2p.scn_c_TOTO_GALLO_rig
于 2013-04-10T07:51:53.610 に答える