Jump to content

Search the Community

Showing results for tags 'primattr'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
    • Marketplace
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering + Solaris!
    • 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

Product Groups

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Name


Location


Interests

Found 1 result

  1. 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?
×
×
  • Create New...