2017-05-26 1 views
0

(Looping par la sélection et la fixation des enfants objets ensemble

on execute do 
(

    local AttachableObjectArray = #() 
    local SelectedNodes = getCurrentSelection() 
    local Idx = 1 





      for object in SelectedNodes[Idx].children do 
      (     
       append AttachableObjectArray object 
      )  

       for i = 1 to AttachableObjectArray.count do 
        (   
         polyop.attach attachableobjectarray[1] attachableobjectarray[i] 

         for j = 1 to AttachableObjectArray.count do 
         (
          if attachableobjectarray.count <= j do 
          (
           deselect SelectedNodes[Idx] 

          ) 
         ) 

        ) 
        SelectedNodes = getCurrentSelection() 
        print SelectedNodes.count 

)

This Is My Current Script il fonctionne mais ne fonctionne que sur une seule hiérarchie à la fois je en ai besoin en boucle à travers mes sélections jusqu'à ce que tous les parents les enfants sont attachés à l'autre

problème: Parent ---- Parent-enfant-enfant enfant ----- enfant-enfant-enfant script actuel: Parent ---- Chi ldren-joint Parent ----- Enfant-enfant-enfant

par le parent d'un mannequin avec ses boîtes liées au mannequin

Merci à l'avance

Répondre

0
for obj in $/selection/* do -- use just the top-level nodes 
(
    local children = join #() obj 
    local childrenToAttach = for i = 2 to children.count where canConvertTo children[i] Mesh collect children[i] 
    if childrenToAttach.count > 1 do convertToPoly childrenToAttach[1] 
    for i = 2 to childrenToAttach.count do polyop.attach childrenToAttach[1] childrenToAttach[i] 
) 
+0

merci swordslayer bonne regardant –