Today I would like to share with you a greatly useful Python Effector Script written by Iain Greenhalgh…
Couple of days ago I was searching for a way to create random appearing clones with time control. I had found some way using Xpresso but it was not enough because they had no time control and it was a heavy scene on CPU. I asked a question on cgsociety forum and thankfully Iain Greenhalgh answered me with this wonderful Python Effector Script. ( I guess he had written it on 2013 ).
So I would like to share it with you;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import c4d import random from c4d.modules import mograph as mo from c4d import documents as docs, utils #weights clone by time - (c) Iain Greenhalgh 2013 def main(): md = mo.GeGetMoData(op) if md==None: return False time = doc.GetTime() reverse = op[c4d.ID_USERDATA,5] currentTime = time.Get() cnt = md.GetCount() cloneDuration = op[c4d.ID_USERDATA,3].Get() offset = op[c4d.ID_USERDATA,2].Get() fOffset = op[c4d.ID_USERDATA,1].Get() ease = op[c4d.ID_USERDATA,4] totalDuration = cnt * cloneDuration randomise = op[c4d.ID_USERDATA,6] ranSeed = op[c4d.ID_USERDATA,8] warr = [] if reverse: for i in xrange(0, cnt): startTime = cloneDuration * i + (i * fOffset) + offset finishTime = startTime + cloneDuration warr.append(utils.RangeMap(currentTime, startTime, finishTime, 0.0, 1.0, True, ease)) else: for i in reversed(xrange(0, cnt)): startTime = cloneDuration * i + (i * fOffset) + offset finishTime = startTime + cloneDuration warr.append(utils.RangeMap(currentTime, startTime, finishTime, 0.0, 1.0, True, ease)) if randomise: random.seed(ranSeed) random.shuffle(warr) md.SetArray(c4d.MODATA_WEIGHT, warr, True) return True |
[youtube url=”http://youtu.be/-NXKzv45gLg” width=”548″ height=”411″ rel=”0″ showsearch=”0″]
[wpdm_package id=1172 template=”link-template-default.php”]
Leave a Reply
Want to join the discussion?Feel free to contribute!