There are two optional arguments - to 'copy' the entities rather than move them and to make the specific instance 'unique' or globally change the definition.
- Code: Select all
The two arguments default to 'false' if not given: to set them make them 'true'.
Read the notes at the start of the script. Call it from other scripts. Trying to add an instance into itself or adding an instance's definition recursively could BugSplat - this is trapped by making copies and/or making_unique any instances so added... For Windows users an additional toggleWindows.zip file contains the two files needed in the Plugins folder to give a utility to rollup an open Outliner window during this operation - this will avoid BugSplats [it's based on Jim's code]. If you don't want to install this addition or if you have a Mac then the 'add_entities' method will still work BUT please ensure that the Outliner is not open when using it - it is a known problem in the API itself...
[EDIT: v1.1 new files added 20090401]
[EDIT: v1.2 unneeded file removed, 'defn.delete' now built-in 20090402]
[EDIT: v1.3 unneeded 'require ...' removed 20090408]
[EDIT: v1.4 needed 'group.definition' added direct into file 20090410]
[EDIT: v1.5 'group.definition' empty group error fixed 20090515]
[EDIT: v1.6 definition.behavior(s) fully copied across 20090702]
[EDIT: v1.7 definition attribute dictionaries copied across 20090819]
[EDIT: v1.8 error will attrdicts==nil fixed 20090821]
[EDIT: v1.9 Attribute Dictionaries copied for Instance 20090825]