Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright (C) 2013, Niklas Rosenstein
- # All rights reserved.
- #
- # Free for private and commercial use. The copyright holder
- # does not give ANY WARRANTY in MERCHANTIBILITY of this software.
- # The copyright notice may not be removed nor modified.
- # Modifications of this software is allowed only with the
- # explicit notice of the origin of this software, naming the
- # original author.
- import c4d
- ID_PC_MATERIAL = 1001005
- ID_PC_VOLUMETRACER = 1001006
- def create(type_id, parent=None, pred=None):
- obj = c4d.BaseList2D(type_id)
- if obj.CheckType(c4d.Obase):
- doc.InsertObject(obj, parent, pred)
- elif obj.CheckType(c4d.Mbase):
- doc.InsertMaterial(obj, pred)
- if not parent:
- parent = ()
- elif not isinstance(parent, (tuple, list)):
- parent = (parent,)
- for p in parent:
- tag = p.MakeTag(c4d.Ttexture)
- tag[c4d.TEXTURETAG_MATERIAL] = obj
- doc.AddUndo(c4d.UNDOTYPE_NEW, tag)
- elif obj.CheckType(c4d.Tbase):
- parent.InsertTag(obj, pred)
- else:
- raise ValueError('incompatible base type for %d' % type_id)
- doc.AddUndo(c4d.UNDOTYPE_NEW, obj)
- return obj
- def main():
- emitter = create(c4d.Oparticle)
- p_geom = create(c4d.ID_TP_PARTICLEGEOMETRY)
- env = create(c4d.Oenvironment)
- null = create(c4d.Onull)
- xpresso = create(c4d.Texpresso, null)
- mat = create(ID_PC_MATERIAL, [emitter, p_geom])
- vtracer = create(ID_PC_VOLUMETRACER, env)
- c4d.EventAdd()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement