Advertisement
nux95

C4D Pyrocluster Setup

Jun 1st, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. # Copyright (C) 2013, Niklas Rosenstein
  2. # All rights reserved.
  3. #
  4. # Free for private and commercial use. The copyright holder
  5. # does not give ANY WARRANTY in MERCHANTIBILITY of this software.
  6. # The copyright notice may not be removed nor modified.
  7. # Modifications of this software is allowed only with the
  8. # explicit notice of the origin of this software, naming the
  9. # original author.
  10.  
  11. import c4d
  12.  
  13. ID_PC_MATERIAL = 1001005
  14. ID_PC_VOLUMETRACER = 1001006
  15.  
  16. def create(type_id, parent=None, pred=None):
  17.     obj = c4d.BaseList2D(type_id)
  18.     if obj.CheckType(c4d.Obase):
  19.         doc.InsertObject(obj, parent, pred)
  20.     elif obj.CheckType(c4d.Mbase):
  21.         doc.InsertMaterial(obj, pred)
  22.         if not parent:
  23.             parent = ()
  24.         elif not isinstance(parent, (tuple, list)):
  25.             parent = (parent,)
  26.  
  27.         for p in parent:
  28.             tag = p.MakeTag(c4d.Ttexture)
  29.             tag[c4d.TEXTURETAG_MATERIAL] = obj
  30.             doc.AddUndo(c4d.UNDOTYPE_NEW, tag)
  31.  
  32.     elif obj.CheckType(c4d.Tbase):
  33.         parent.InsertTag(obj, pred)
  34.     else:
  35.         raise ValueError('incompatible base type for %d' % type_id)
  36.  
  37.     doc.AddUndo(c4d.UNDOTYPE_NEW, obj)
  38.     return obj
  39.  
  40. def main():
  41.     emitter = create(c4d.Oparticle)
  42.     p_geom  = create(c4d.ID_TP_PARTICLEGEOMETRY)
  43.     env     = create(c4d.Oenvironment)
  44.     null    = create(c4d.Onull)
  45.     xpresso = create(c4d.Texpresso, null)
  46.     mat     = create(ID_PC_MATERIAL, [emitter, p_geom])
  47.     vtracer = create(ID_PC_VOLUMETRACER, env)
  48.  
  49.     c4d.EventAdd()
  50.  
  51. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement