code-google-com / autofill

Automatically exported from code.google.com/p/autofill
0 stars 0 forks source link

Select, automate, and/or describe the best customization approach to mimic C4D instancing in 3ds and Maya #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The one reason Maya and 3ds are 2 points behind C4D for autoPack is that the 
instancing that I demonstrated in C4D here:
 http://www.autopack.org/documentation/tutorials/customize-cellpack-models
is critical for users to be able to customize their models for the contest (to 
truly use the software to its potential), but may not be easily duplicated in 
Max or Maya...

Kelly posted this solution and then later suggested the code below.

From Kelly>>>>
The video you posted with C4D and instances is different in 3ds Max.  It can 
easily be done via max script though.
http://screencast.com/t/zzizqOUWC

I spoke with a dev on this info (Larry) and he sent this, the function handles 
weird cases if needed:

fn replaceNodeAndReferencesBaseObject theMasterNode theNewBaseObject =
(
  local origBaseObject = theMasterNode.baseobject
  local theNodes = refs.dependentNodes origBaseObject baseObjectOnly:true
  for n in theNodes where n.baseobject == origBaseObject do 
  (
    local owner = n
    local refIndex = 2
    local theRef
    while (theRef = refs.getReference owner refIndex) != origBaseObject do 
    ( 
      owner = theRef; 
      refIndex = 1
-- for i = 1 to (refs.getNumRefs theRef) do (format "% : %\n" i 
(refs.getReference theRef i))
    )
-- format "% : % : % : %\n" n owner refIndex theRef
    refs.replaceReference owner refIndex theNewBaseObject
  )
  notifyDependents $.baseobject partId:#all
)

replaceNodeAndReferencesBaseObject $ (createInstance box)

Original issue reported on code.google.com by gra...@fivth.com on 15 Nov 2012 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by gra...@fivth.com on 15 Nov 2012 at 12:26