Jump to content

Search the Community

Showing results for tags 'pc2'.

  • 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 there I am building a pc2 writer sop to export point cache data from Houdini I have a working python solution but it can be a bit slow (code has been hacked from the various examples on odforce ect) see below: import sys, struct def doCache(): sf = hou.evalParm("startframe") ef = hou.evalParm("endframe") sr = 1 ns = (ef - sf) + 1 geo = hou.pwd().geometry() points = geo.points() np = len(points) pc2File = open(hou.evalParm("file"), "wb") geo = hou.pwd().geometry() # Write header headerFormat='<12siiffi' headerStr = struct.pack(headerFormat, "POINTCACHE2\0", 1, np, sf, sr, ns) pc2File.write(headerStr) # iterate points def writePP(p,f): hou.setFrame(f) curp = p.position() curps = pc2File.write( struct.pack('<fff', float(curp[0]), float(-curp[2]), float(curp[1]) ) ) a = [ writePP(p,f) for f in xrange(sf, sf+ns, sr) for p in geo.points() ] # close file pc2File.flush() pc2File.close() Due to slow speeds I am attempting to implement this using inlinecpp to speed up the execution time. My attempt can be found below, (non-functional at the mo). I am a HDK newb so there are probably lots of very simple mistakes in there. Would anyone with HDK experience be able to give me a few pointers in where I am going wrong? import sys import struct import inlinecpp writePts = inlinecpp.createLibrary( name="cpp_string_library", includes="#include <GU/GU_Detail.h>, #include <FS/FS_Writer.h>, #include <UT/UT_Vector3.h>, #include <HOM/HOM_Module.h>", function_sources=[ """void writePC2(GU_Detail *gdp, const char *filename, const char *pc2, int *numPoints, float *start, float *samplerate, int *numSamples ) { // open the file for writing FS_Writer fs(filename); ostream *file = fs.getStream(); // write header file << pc2; file << int(1); file << numPoints; file << start; file << samplerate; file << numSamples; // iterate through frames through points for ( float i=start; i<end; ++i) { HOM_Module::setFrame( double(i) ) //iterate through the points GA_Offset ptoff; GA_FOR_ALL_PTOFF(gdp, ptoff) { UT_Vector3 pos = gdp->getPos3(ptoff); file << pos.x << pos.y << pos.z; } } // close the file file.close() } """]) def doCache(): sf = hou.evalParm("startframe") ef = hou.evalParm("endframe") sr = 1 ns = (ef - sf) + 1 geo = hou.pwd().geometry() filename = hou.evalParm("file") pc2 = "POINTCACHE2\0" writePts.writePC2(geo, filename, pc2, len(geo.points), sf, sr, ns) Much obliged!!! Sam Swift-Glasman
×
×
  • Create New...