Jump to content

pdeb

Regular Member
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

2 Noble Beginner

About pdeb

  • Rank
    C4D Cafe Junior

Profile Information

  • First Name
    Peter
  • Last Name
    Debay
  • Location
    Vancouver

Cinema 4D Information

  • C4D Version
    13 Broadcast

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. solved it with flipping the X axis rotation value for negative csv values: for u in range(0, nb): if myFloats[u] < 0: marr[u].v1 = c4d.Vector(-1,0,0) marr[u].v2 = c4d.Vector(0,myFloats[u]*100,0) count += 1 else: marr[u].v1 = c4d.Vector(1,0,0) marr[u].v2 = c4d.Vector(0,myFloats[u]*100,0) count += 1
  2. I've created a Python Effector which reads in csv values and scales clones in Y by index. My only issue is that the script doesn't respect negative values from the csv, and instead scales all clones in the positiveY. I thinkthis has something to do with matrices, and have read through matrix section the sdk, but can't seem to find a way have negative csv values translate to negativeY scales. Even when I negate the csv values, the effector still scales the clones in the positiveY. Maybe something simple I'm overlooking, but any help appreciated. import c4d from c4d.modules import mograph as mo import csv #Welcome to the world of Python def main(): csvFile = op[c4d.ID_USERDATA,1] csvColName = op[c4d.ID_USERDATA,2] count = 0 myValues = [] with open(csvFile) as csvfileIn: reader = csv.DictReader(csvfileIn) for row in reader: csvVals = (row[csvColName]) myValues.append(csvVals) count += 1 myRevList = myValues[::-1] #reverses the order of the list myFloats = [float(i) for i in myRevList] rangeLow = min(myFloats) rangeHigh = max(myFloats) md = mo.GeGetMoData(op) if md is None: return False marr = md.GetArray(c4d.MODATA_MATRIX) fall = md.GetFalloffs() nb = md.GetCount() for u in range(0, nb): marr[u].v2 = c4d.Vector(0,myFloats[u]*100,0) md.SetArray(c4d.MODATA_MATRIX, marr, True) return True if __name__=='__main__': main()
  3. Thanks Jed. Until I get my python chops I decided to go a different route, albeit hacky. I used a python script to export the runner's Y-position values to a CSV, then used Niklas Rosenstein's CSV effector to give each of my clones (as each appears on its own frame) the Y-value from the CSV. It works fine. it just means spitting out values to the CSV if I decide to change the path. But for now it will do the trick, thanks for your help, p
  4. Thanks for the reply Havealot, The attached will help describe what I'm trying to do. The clones would form the top of the elevation profile (reds/oranges/yellows). I hacked it by having 1 clone take the Y-value of the null traveling along the red path on the terrain, and moving it along x with a Time Effector. I tried embedding a conditional in the loop, telling Python to ignore any clone index which wasn't == current frame, but that didn't seem to do anything despite passing back no errors. It was more an exercise in going deeper into Python, so I'll read up on the BaseContainer and storing values, as it looks quite powerful.
  5. Hi all, Python novice trying to solve a mograph puzzle, thanks in advance for pointers. I'm trying to create an infographic similar to a runner's path elevation over time, where each cloner inherits the Y-value of the Null following a path over terrain, on that specific frame. The cloner has an Xpresso tag where Time generates clone count, so on each frame a new clone in the line appears, and a Tracer creates a growing elevation profile. I've tried the following code, and to no one's surprise, each cloner has the same value on each frame, so they all rise and fall in unison. import c4d from c4d.modules import mograph as mo #Welcome to the world of Python def main(): md = mo.GeGetMoData(op) if md is None: return False cnt = md.GetCount() marr = md.GetArray(c4d.MODATA_MATRIX) fall = md.GetFalloffs() Traveler = op[c4d.ID_USERDATA, 1] TravPos = Traveler.GetRelPos() TravPosY = TravPos[1] print TravPos for i in (xrange(0, cnt)): marr[i].off = c4d.Vector(marr[i].off.x,marr[i].off.y+TravPosY,marr[i].off.z) md.SetArray(c4d.MODATA_MATRIX, marr, True) return True Can someone point me to a way for each clone to take on the value on the frame it was generated, and then freeze in position? Is it a matter of a BaseContainer and storing values? I can't seem to find a way in the SDK to feed the Null's position a time or frame argument. thanks muchly, pdeb
  6. Worth noting that Niklas Rosenstein ported a couple of Jürgen Meier's COFFEE plugins to R20, one of which is a torus knot, but other nice procedurals as well. https://github.com/NiklasRosenstein/c4d-nr-toolbox/blob/master/docs/pr1mitive/README.md http://www.3d-meier.de/
  7. Give this a go...I'm still working on the math to range map the Spline Curve user data's start and end to the Spline Effector's start/end/offset, so for the time being I hacked it with a MoSpline as a source for the Effector, as annotated. Perhaps someone with greater Python skills can figure out the remap code so that when, for instance, if the Spline Effector's start/end is moved to 10%/90%, the Spline Curve compresses accordingly and bias shape is maintained in the smaller x range as opposed to clipping on either side. But for the purposes of having the bias work, a good first go. splineDistBiasc4dcafe_b0.1.c4d
  8. Eureka! I had failed to put the Python Effector into 'Full Control' mode - it works!
  9. Very novice python coder here, could I please ask for help getting this Python Effector into the barn. I’d like to use a Spline Curve User Data to redistribute clones on a spline (Spline Effector) for example, if I changed the UD spline to say Cubic, more clones would be bunched up against the start with larger and larger distances between clones towards the end. I have a (very very slow) python effector which properly remaps values along the spline, and when I manually place nulls to console positions on the spline as read out by a print marr.off line, they match up. When I add the md.SetArray line, the clones don’t seem to move to their affected positions. Code attached, thanks to anyone who can help me figure out why setArray isn’t working, or why I have a “TypeError: main expected float or c4d.Vector, not bool” error in the console Thanks, P import c4d from c4d.modules import mograph as mo def main(): sdo = doc.SearchObject('UserData') sd = sdo[c4d.ID_USERDATA,1] spl = sdo[c4d.ID_USERDATA,2] if spl.GetRealSpline() is None: return False sso = doc.SearchObject('SplineEff') se = sso[c4d.MGSPLINEEFFECTOR_END] sh=c4d.utils.SplineHelp() sh.InitSpline(spl) md = mo.GeGetMoData(op) if md==None: return False marr = md.GetArray(c4d.MODATA_MATRIX) cnt = md.GetCount() for i in (xrange(0, cnt)): itr = float(i) pospercent = (itr*1/(cnt))*se myRemap = sd.GetPoint(pospercent).y pos = sh.GetPosition(myRemap) marr[i].off = pos print marr[i].off md.SetArray(c4d.MODATA_MATRIX, marr, True) sh.FreeSpline() return True
  10. Hi Rad, If you need a robust CSV reader with lots of functionality, check out Niklas Rosenstein's github, which has both a CSV MoGraph effector and CSV Xpresso node https://github.com/NiklasRosenstein/c4d-nr-toolbox hth P
  11. There's also Point Projector from Frank Willeke: https://fwilleke80.github.io/PointProjector/ works on spline and geo, non-destructively. pdeb
  12. This seems to work. import c4d from c4d.modules import mograph as mo def main(): md = mo.GeGetMoData(op) if md is None : return False vtxu = op[c4d.ID_USERDATA,1] if vtxu is None : return False nb = md.GetCount() warr = md.GetArray(c4d.MODATA_WEIGHT) vtxs = vtxu.GetAllHighlevelData() if len(vtxs) != nb : return False for i in xrange(nb): vtxw = vtxs[i] warr[i] = vtxw md.SetArray(c4d.MODATA_WEIGHT, warr, True) return True
  13. Hi all, Python question from a complete and utter coding novice. I have a cloner set to object, and the reference object has an animating vertex map. I'm fumbling with the Python Effector to translate the individual point vertex map values to mograph weights for clones positioned at the corresponding vertices. The Python Effector would store the weights and subsequent effectors (like Inheritance) would use the weights as Falloff, so clones would animate as the vertex map animated. Here's my first go at the Python. I feel I'm close but somehow the array from the vertex map is not getting to the mograph weights (does it call for a RangeMap?). If anyone can help, would be greatly appreciated. import c4d from c4d.modules import mograph as mo from c4d import utils as u arr = [0.0] def main(): global arr sourceVmap = op[c4d.ID_USERDATA,1] sourceData = sourceVmap.GetAllHighlevelData() cnt = len(sourceData) if len(arr) != cnt: diff = cnt - len(arr) arr.extend([0.0]*diff) md = mo.GeGetMoData(op) if md is None: return False count = md.GetCount() index = md.GetCurrentIndex() marr = md.GetArray(c4d.MODATA_MATRIX) warr = md.GetArray(c4d.MODATA_WEIGHT) fall = md.GetFalloffs() for i in xrange(0, count): arr[i] = sourceData md.SetArray(c4d.MODATA_WEIGHT, arr, True) return True
  14. Hi all, A few years ago I bought a suite of xsyann's plugins, and now need to download the latest versions of what I purchased. I've tried to reset my account password on his website, but to no avail (I get an error), and messages to his website contact form go unanswered. Does anyone know if he's still actively administering his account? thanks in advance, Peter
×
×
  • Create New...

FORUMS INFO:

Dear members, we are aware of few more bugs that are still present withing the theme.We just wanted to let you know that we are working to fix them as soon as possible.
 

NEW MEMBERS:

Please be aware that we are manually approving all new registrations, due to spam prevention. Please be patient in case you cannot login right away, we will approve you within 12h or less if we decide you are not potential spammer. 

 

Thanks for understanding! :cowboypistol: