Announcement

Collapse
No announcement yet.

collapse all linked geometry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • collapse all linked geometry

    i have a model made from thousands of elements, each one is a base object with multiple smaller objects linked to it.

    i would like to convert each collection of linked objects into a single mesh.

    anyone know of a script/plugin? didnt find anything obvious online.

  • #2
    You can try with something like this, if you don't have anything selected will attach all the scene linked children, otherwise the ones hanging from your selection:

    Code:
    try (destroyDialog attachLinkedDialog) catch()
    
    rollout attachLinkedDialog "Attach Linked" (
    
        button btnAttach "ATTACH!"
    
        fn getAllChildren n children: = (
            if children == unsupplied then children = #(n)
            for c in n.children do (
                children = append children c
                getAllChildren c children:children
            )
            children
        )
    
        fn attachNodes nodes = (
            if nodes.count == 1 do return true
            base = convertToMesh nodes[1]
            for i = 2 to nodes.count do (
                meshop.attach base (convertToMesh nodes[i]) attachMat:#IDToMat condenseMat:true
            )
        )
    
        on btnAttach pressed do (
            target = if selection.count == 0 then (
                for o in objects where o.parent == undefined collect o
            )
            else (
                for o in selection where findItem (selection as array) o.parent == 0 collect o
            )
            for parent in target do (
                for c in parent.children do (
                    children = getAllChildren c
                    attachNodes children
                )
            )
        )
    
    )
    
    createDialog attachLinkedDialog
    Last edited by Codi; 16-04-2020, 07:26 AM.

    Comment

    Working...
    X