Jump to content

Trancor

Members
  • Content count

    10
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

2 Neutral

About Trancor

  • Rank
    Peon

Personal Information

  • Name
    Kevin
  • Interests
    Artificial Intelligence and Dynamic Sims
    DIY anything; Web, Arduino, Metal, Wood, 3D/2D.
  1. Hey, old thread but figured I'd chime in, if you are looking for something to read only a random nearby point, try this in a wrangle node--- Its smart enough to detect second input geometry. (Pic 1) Just make sure to hit the `Create Spare Parameters` button on the right of the wrangle node vexpression parameter. Then set `maxLineLength` and `maxFindCount` up to find near by points using `pcfind`. int read=0; if(npoints(1)>0){ read=1; } int pts[]=pcfind(read,"P",v@P,chf("maxLineLength"),chi("maxFindCount")); int l=len(pts); float fl=float(l); int randomConnect=chi("randomConnect"); int rander=pts[int(random(@ptnum*fl+randomConnect)*fl*fl) % l]; vector curPos=attrib(read,"point", "P", rander); int to=addpoint(0,curPos); addprim(0,"polyline",@ptnum,to); Since I'm not sure the end goal, I'll share this line generator I wrote. Connects any found points; supports second input detection. (Pic 2) Same as above, `Create Spare Parameters` Use `Keep Point Count` to not create needless amounts of duplicate points. int drawLine(vector f; vector t){ int base=addpoint(0,f); int to=addpoint(0,t); int line=addprim(0,"polyline",base,to); return line; } //----------------------------- int read=0; if(npoints(1)>0){ read=1; } int maxLines=chi("maxLineCount"); float minLen=chf("minLineLength"); int pts[]=pcfind(read,"P",v@P,chf("maxLineLength"),chi("maxFindCount")); int randomConnect=chi("randomConnect"); int keepPointCount=min(1, max(0,chi("keepPointCount"))); int runner=0; vector curPos; int pt; if(randomConnect == 0){ for(int x=0; x<len(pts);++x){ pt=pts[x]; if(runner > maxLines){ break; } curPos=attrib(read,"point", "P", pt); if(length(curPos-v@P)>minLen && (@ptnum<pt || read)){ if(keepPointCount){ int to=pt; if(read){ to=addpoint(0,curPos); } addprim(0,"polyline",@ptnum,to); }else{ drawLine(v@P,curPos); } runner++; } } }else{ int l=len(pts); float fl=float(l); int rander=pts[int(random(@ptnum*fl+randomConnect)*fl*fl) % l]; curPos=attrib(read,"point", "P", rander); if(keepPointCount){ int to=rander; if(read){ to=addpoint(0,curPos); } addprim(0,"polyline",@ptnum,to); }else{ drawLine(v@P,curPos); } }
  2. EDIT : This may be something different. When parent bones have non matching scales to the current edited bone, this issue arises. Going to poke around, issue remains tho, on uniform scaled bones too. I'm not sure if this should be in the scripting forum or not... But I'm running into some issues with non-uniform scaled bone's becoming uniformly scaled when using the agent edit node. I'm specifically trying to edit the bones through vex at this point now. It seems to change a non uniform scale to a uniform scale after using the maketransform vex function. I'm noticing this issue when polar decomposition and transposing of 4x4 matricies being scaled by one of the scale's values when only modifying a position or rotation of the matrix. As tho, instead of scaling by {1.2, .8, 1.3} it scales by {1.2, 1.2, 1.2} or maybe its just the vector's length of the found eigenvalues. Like when using the agent edit node, it will change any edited bone's non-uniform scale to a uniform scale. Has anyone found a simple way to get around this, other than manually editing the matrix position W row and using dihedral math to rotate the bones?
  3. Eval in VEX?

    Thanks everyone. Captain, I think that might be the solution here. Not a fan though, hahah. Since its all VEX, parsing out the string in python and applying any particle numbers seems futile to me. I got around it with just opening up a VEXpression input on my otl, changes workflow a little, but at least it works. I just figured, every languages I've ever used had an eval command, was sort of hoping VEX had
  4. Eval in VEX?

    Not in this case, I sort of gave up and just added a VEXpression parameter, I guess similar to snippets, but to set point attributes for the code I'm writing to read from. Annoying, but works.
  5. Eval in VEX?

    User input basically. It'll find a string like "40*5+@ptnum" and I'm just looking to get the value of that math in VEX. To mimic eval( ) from any number of other scripting and programming langues.
  6. Eval in VEX?

    Hey guys, thanks for the replies. The problem is, I can't remove the + Its goin to be "90+" or "sin($F)+" or some variant with the operators built into the string being passed. Thats why I was hoping for an eval command to process the string like a math problem. eval("91+5*"+@ptnum); Type of thing. atof( ) only grabs the first number in the string it finds, as it appears.
  7. Eval in VEX?

    Hey guys, I searched around for this and can't seem to find a solution, maybe you guys know. To simplify what I'm doing (its quite more complicated than this, but, ya know), lets just say I have this set up- string A = "91+"; string B = @ptnum; string C = A+B; C == "91+1", "91+2", "91+3" . . . Is there an eval I can do in VEX to get a result like this per point? 91 92 93 94 95 I've tried doing things like - float( C ) == errors out or atof( C ) == "91" But it doesn't seem to work for me. Is there any sort of - eval( C ) Or another way to evaluate the string variables as an expression/math? I'm considering just adding new parameters to evalutate the math through python and to read the parameters into the vex, but is there an easier way to do this?
  8. Recursive VEX functions

    I'll look into shader calls some, but yeah, dunno if this will help much. VEX might or might not be Turing Complete, but who knows, might need some special syntax, ha. I've written up my script through VEX since it runs VEX commands native to houdini. To jump between python nodes and back would be cumber some and slow things down. I'd need a ton more nodes to pass the data around or use python nodes just to generate attributes and process data to pass back to vex. Not exactly what I'm looking for when it would take a simple 5-6 line void to do the process. I've gone a different route now anyway, whiles loops and maintaining variables. I'm not a fan, but it works. Thanks for the info Mantragora, I'll have to look into Outer Code more in the future.
  9. Recursive VEX functions

    Interesting, I never knew what this Outer Code option was meant for. But I'm unsure how to use this vex code without it being on snippet. Which its throwing an error, probably the same one you are talking about. Unexpected "[" on line 22. Course, I'm just putting "printer" into the Outer Code parm. I tried putting it into a header file and loading the header file from the file, but it also throws that same error. So I'm probably trying to use this Outer Code option wrong. Can you help any further? Are you using this Outer Code method on a VEX node itself? Writing out a VCC compiler command? Because when ever I try to load up VEX that have nested headers, it can't find the header. Which is also what was happening when I tried using the Outer Code option on the snippet with any additional headers I'm trying to include. Sorry for my ignorance on this topic.
  10. Recursive VEX functions

    Hey guys, I've been trying to find a way of making a recursive function in VEX. I'm trying to aggregate infromation from points and build an return array, but can't get any recursive funtions to work. For example, when ever I try running something like- void printer(int count){ count+=1; printf("\n %c", count); if(count < 10){ printer(count); } } printer(1); It throws the error- "Call to undifiend function 'printer'" I know I can go the messy route with while loops and maintaining variables by adding and subtracting elements and having a result variable... but this is needlessly insane to try to do a basic recursive function. I've tried giving pointer variables, and it seems like vex doesn't want to accept standard C pointer code. Or at least doesn't like * in the input variables of a void definition. Has anyone had success with this and might be able to point me in a useful direction for vex code? (No, this can't be done with nodes or a python node for the real node I'm working on) Thanks in advance! -Kevin
×