Jump to content

Search the Community

Showing results for tags 'array'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 14 results

  1. It looks like it's possible to set point attributes all at once instead of looping through them one at a time. I was trying to do it with NumPy, but can't quite get it right. Seems to be problem with the custom attribute being an array. Given an array with the same shape,i.e., number of points x array size it looks like it should work, but doesn't. Incidentally, the NumPy array will contain data from a file. I can't tell there's a better way to pull file data straight into something like VEX, hence the NumPy array. Here's my test code: node = hou.pwd() g = node.geometry() pt0 = [1.0, 0.0, 0.0] point = g.createPoint() point.setPosition(pt0) pt_1 = [0.5, 0.5, -1.0] point_2 = g.createPoint() point_2.setPosition(pt_1) pt_2 = [1.5, -2.5, 0.0] point_3 = g.createPoint() point_3.setPosition(pt_2) g.addArrayAttrib(hou.attribType.Point, "MyFloats", hou.attribData.Float, 8) gp = g.points() # This works fine ''' gb0 = (0.5, 0.3, 0.1, 0.1, 0.6, 0.2, 0.3, 0.8) gp[0].setAttribValue("MyFloats", gb0) gb1 = (0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1) gp[1].setAttribValue("MyFloats", gb1) gb2 = (0.7, 0.6, 0.1, 0.5, 0.1, 0.2, 0.8, 0.9) gp[2].setAttribValue("MyFloats", gb2) ''' import numpy as np y = np.arange(24, dtype=np.float32).reshape(3,8) g.setPointFloatAttribValues("MyFloats", y) # error print g.pointFloatAttribValues("MyFloats") # error
  2. Hi all, I have an arrays-in-loops puzzle. I thought of a shortcut to do a thing, it doesn't seem to work, and I should move on -- except I would like to understand why it doesn't work. Minimal background: I've got some point data, I've polywired it together using Connect Adjacent Pieces, and gotten a restlength on the primitives from that. I need to set a pscale on the points before moving on to my next step. Half the distance to the nearest neighbor is good enough for now. I could use nearpoints() to figure that out (and it seems to work!), but I thought, "hey, I already have restlengths; why not just look up the shortest restlength and use that?" That turns out not to work, or at least not as I think it should. Where have I gone wrong? After my connect step, each point ends up connected to 4-20 other points by primitives with restlengths between .9 and 3.9. My first stab at this was: use pointprims() to get an array of primitives associate with each point; create an empty float array to hold the restlengths; foreach loop over the primitives, read the restlength with primattrib(), and push the result onto the lengths array; sort() the lengths array into a new array; read out the shortest length and use that to calculate a pscale. Here's the actual code: int myprims[] = pointprims(0, @ptnum); float mylens[] = {}; foreach (int myndx; myprims) { float mytmp = primattrib(0, "restlength", myprims[myndx], 0); // f@checktmp = mytemp; push(mylens, mytmp); // f@checkrslt = mylens[myndx]; } float lensort[] = sort(mylens); float shortest = lensort[0]; f@pscale = shortest/2; I think it's failing at the push statement. If I write out mytmp as a point attribute just before I push it, I get a reasonable number (commented code). If I check the stored value right after the push, I get either zero or the restlength of prim zero. If I check after the foreach loop completes, I get restlength of prim zero. So the push doesn't work. Looks like example code in the docs, but I'm missing something. Any thoughts?
  3. Creating a force array in vex

    Hi all, I am struggling to write a force array per particle, i have an float array per particle named "upforce" and i want to use this array as my "y" force. Any tips? Thanks
  4. Read point array attribute from detail wrangle

    I am in a detail wrangle and want to read the first component of a point array attribute. Unfortunately neither point() nor attrib() seem to offer this. I couldnt find suitable array functions, either. int npts = npoints(0); i[]@prim_list[npts]; for(int i = 0; i < npts; i++){ @prim_list[i] = point(0, "sourceprim", i).[0]; // try to access first component }
  5. VEX array of structs

    Hello, I'm a newbie with vex and I'm trying to create an array of structs. In my wrangle node I defined the struct in the outer code section as suggested here my struct looks like this: struct node { int pt; int nbrs[ ]; } In my code I later declare node nd; node array[ ]; I manage to initialise the nd variable normally. Then I tried the following int pt = nd.pt; //works fine int nbrs[] = nd.nbrs; //works fine array[0] = nd; //seems to work fine pt = array[0].pt; //nope nd = array[0]; //nope By doesn't work I mean that the node turns red saying the following Error The sub-network output operator failed to cook: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Warning: Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Error: Vex error: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1) Failed to resolve VEX code op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1'. Warning Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Warning Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Warning Vex error: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1) Failed to resolve VEX code op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1' Any ideas? Thank you Marta
  6. Hello! First time poster (also posted on sidefx forums) ~ I have a wrangle set after an assemble sop and am currently having success with: string shatter_points = chs('Pieces_to_Break'); if(@name != shatter_points) removepoint(0,@ptnum); Where Pieces_to_Break can contain one name. Effectively this deletes all but the named packed primitive. I'd like to amend this so that I can enter an array of pieces to “keep”. Any thoughts? Thanks in advance!!
  7. Hello! First time poster (also posted on sidefx forums) ~ I have a wrangle set after an assemble sop and am currently having success with: string shatter_points = chs('Pieces_to_Break'); if(@name != shatter_points) removepoint(0,@ptnum); Where Pieces_to_Break can contain one name. Effectively this deletes all but the named packed primitive. I'd like to amend this so that I can enter an array of pieces to “keep”. Any thoughts? Thanks in advance!!
  8. Hello, Trying to read a vector array from another point at a certain index. From my understanding of Houdini something like this should work. vector tempArray[] = point(0,"vectorArrayAttrib",pointToReadFrom); vector v = tempArray[index]; Unfortunately this method is returning an empty array from the point() function. If this is not the right way to go about doing this please let me know. Any help welcomed. Thanks.
  9. Hello,I'm attempting to create the slitscan/timeshift effect. I'm creating a vector array in a for loop, each loop has an attrib from map and a wrangle that appends Cd to a vector array. It works when the attrib from map is always reading from the same file. When I change the attrib from map file read expression to anything that has to do with $F or the meta nodes iteration Houdini crashes. I have a test scene that has documentation and even nodes setup to create test frames to work with.If it is a matter of the way that multiple files cannot be read at once please let me know. If someone knows of a better way to read from multiple files at once and/or achieve this effect please let me know. I'm aware that after effects has this effect and uses gradients to determine which frame to look up color from. While that method is great, I'd like to be able to write the gradients/lookups in vex to achieve results. Any help greatly appreciated. -T concept_025_slitScan_v001.hiplc
  10. Hi I need an array wich stores a range of numbers, starting at zero and ending at @numpt (total amount of points in a geometry). Is there a fast way to do this apart from filling the array in a for loop? Thanks
  11. Ok, I have many objects separated into point groups by unique suffixes. I'd like to split the suffix integer value from the array of group names. Then assign that integer to a custom attribute. I'm terrible at VEX so any suggestions would be greatly appreciated.
  12. Access array attribute wrangle

    Hey, I have a bunch of points with 3 float attributes, b[0] b[1], b[2] If I want to access only the second attribute, specifically through a wrangle (for learning), how would I do this? I've tried @foo = point(@p,"b",1) but that only returns the first attribute value. Presumably because I'm not asking for an array? Thanks!
  13. VEX supports array function?

    Hi, this is my first post here. I've been trying to call a vector array function in VEX, but it either returned "Internal Compiler Error" or "Syntax error, unexpected identifier, expecting ';'". I also checked Array help file and the example as below didn't work at all: To specify a literal array, use curly braces, with the array members separated by commas: vector[] rgb_array() { return { {1, , }, {, 1, }, {, , 1} }; } Here is the simple code I tried to compile, but it returned an error message "Syntax error, unexpected identifier, expecting ';'." vector an_array[] = {{1,1,1}, {2,2,2}}; vector a[]; vector[] testFunction(vector[] a){ return a; } a=testFunction[an_array]; Does anyone know if VEX supports array function? Thank you very much!
  14. A VOP performs a pointcloud lookup and uses while loop in oder to take advandage of the pcimport node to get distance,ptnum ,P etc. How can I store the result of each loop in a while node in vops? Each loop gives me a point but I only get the last point out of the node( although I have set max number of points to a number higher than one.. ) Maybe somehow push/append them into an array so I can call the later on? If that is the way, arrays in vops need inline code (afaik..) and I haven't managed to figure i out... One of my goals is to draw multiple lines that connect the look up point with a number of points on the pointcloud(= max number of points) without puting the VOP and the Foreach node into another ForEach node out side the vop (because it is not fast). I hope all this makes sense ......thanks ps. play a bit with the slider of "max number of points". Slide it from 1 to 4 and you'll see the line jumbing to the next point. I want to be able to store these points without movin the slider.. Push in array.hip
×