avd_Logo

avd_Logo
Welcome to the world of mystery.

Thinking Particles in c4d using python

Hey everyone!
I've been in the dungeon working on learning all the new python goodies. Now with r13 the entire mograph module is at your disposal, so there's that, but I wanted to take a step back and write about how to create some more basic stuff in python. Up until now, the only method by which to create thinking particles was through xpresso or the matrix object. Well, now the python generator can be added to your arsenal. Let's go through the basic process by which we can create some particles!

1) create a python object.(duh)

2) first, we need to retrieve the document that are particles are going to exist in. There are a couple ways to accomplish this in python c4d.
- you can import the documents module("from c4d import documents") and use
"documents.GetActiveDocument()"
- or you can get the document from the python object ("op.GetDocument()")

3) once the document has been retrieved, the Thinking Particle Master System(TPMS) can be retrieved from the document using the "GetParticleSystem()" command on your document.

4) once we have the TPMS we can do anything we want. Refer to the sdk for commands, but basically, we can create particle("TPMS.AllocParticle()"), remove particles ("TPMS.SetLife(particleID, -1)"), set velocities("TPMS.SetVelocity(pid, c4d.Vector())"), etc.

An example of some code is below:

import c4d

def Main():
Doc = op.GetDocument()
TPMS = Doc.GetParticleSystem()
NumParticles = 20
for i in xrange(NumParticles):
id = TPMS.AllocParticle()# this also returns the #particle ID
TPMS.SetLife(id, doc.GetMaxTime()) # set life to the doc length
TPMS.SetPosition(id, c4d.Vector(0, id*100, 0)

Hope that helps get u started. More to come!

New Developments

Hello Interwebs!
It's a wonderful Sunday night and i am proud to announce the upcoming release of two new plugins,( my first two!) so stay tuned for more information about Spline Gen and Keep Floored !

SplineGen Introduction from alex van dyne` on Vimeo.


SplineGen Introduction from alex van dyne` on Vimeo.

NOW AVAILABLE FOR DOWNLOAD UNDER THE PLUGINS PAGE!

working working working....

thanks for the input guys! working on Version .0000000000002:

things to look forward to:
1) I'm implementing an actual plugin this time. it will be callable from the plugins menu and will create a specialized building object. so much work to do this... :( but worth it.

2)fixing geometry output so normal's are facing the correct way. ( thanks to Mandrake for that one ;) )

3) adding the ability to control floor generation and concrete seperator generation using either basic c4d splines or customs splines.

4) adding a boundary spline control that sets the width and depth of the building based upon a floor spline.

5) adding Windows Gen!

6) adding Staircase Gen

7)changing material controls to support assignment switching within the plugin. for example, you can change the window's texture tag to assign whatever texture has been dragged into the corresponding link field. link fields will Include: glass,metal,wood,concrete,marble,plaster,custom#1,custom#2,custom#3. Also the automatic material mapping options will be fit the building's size instead of juts being cube mapped.

8) plugin will be composed of multiple object that construct buildings(kind of like xfrog). so you have the main building object and then you place special objects under it that will become the building. i was toying with the idea of creating some kind of node-based system, but I'm not sure people would be comfortable with that, plus i don't know that python supports this yet. I know there are python nodes in xpresso, but i don't know about creating them using the plugin module.

more to come! back to work! lol. thanks again everyone!

Complex Building Generator for c4d

hey All!
Ive been locked away in my dungeon creating python madness. i am proud to announce that i am almost 50% complete with my new building generator plugin for c4d. im not a really a developer so It's not as polished as i would like, but it is definitly working and a lot of fun to play with. If anyone is interesting in trying out these earlier versions hit me up and ill send you a copy!
check out some screen caps below.