rabidpraxis

rabidpraxis

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Getting and setting detail (global) variables in VEX code May 25, 2010, 4:05 p.m.

Actually, let me show an example, cause I am noticing some weirdness.

Here is an example sop vex node:


#pragma opname pc_save
#pragma oplabel “Point Cloud Export Example”
#pragma opmininputs 1
#pragma opmaxinputs 2
#pragma label file “Point Cloud Texture”
#pragma hint file file

sop
pc_save(string file = “op:`opinputpath('.', 1)`”)
{
int handle = pcopen(file, “P”, P, 10000, 1);

int success = pciterate(handle);
if(ptnum == 0) {
float myNum = (random(Frame) * 55);
int e_success = pcexport(handle, “testAttr2”, myNum);
}

float iVal;
pcimport(handle, “testAttr2”, iVal);

addattribute(“import_val”, iVal, “type”, “float”);
}


This looks like it will work, but it won't. It looks as though the pciterate will not execute the iteration if its return value is not referenced somewhere. So to fix it, I just replaced:


if(ptnum == 0) {


with:


if(ptnum == 0 && success == 1) {


and that ensures that it iterates to the single point that is piped into slot 1

If anyone who knows more about point clouds wants to add more context about what is happening in the background, I would appreciate it.

Getting and setting detail (global) variables in VEX code May 25, 2010, 3:01 p.m.

Alright, so I figured out the export problem.

The key to exporting to an attribute is to make sure that the attribute is not already defined. If it has already been added to the geometry, then I'm assuming its considered locked in a point cloud context. Therefore export will not work.

So just set the export/import texture parameter to something unique and all will be fine.

Getting and setting detail (global) variables in VEX code May 21, 2010, 1:54 p.m.

Ok, so I have moved away from using POP's and instead have started using just points in SOPs with a SOP solver for my dynamics.

Thanks for the tutorial suggestion Jeff, that cleared up a few issues I had. But it did not solve my main issue. So here is the problem. I set everything up so it is iterating to the one point, and I can get it to import the “channel” values, but I cannot figure out how to export. Both in Vex and Vops, pcexport is not saving the data that I am posting to it. I have tried to use a referenced SOP and an exported .pc file and both have the same result of not allowing me to export a value. The documentation states that you can only export to a read-write channel. Could that be the problem?

What about pcwrite? is that the function that I should be using? Would that be as efficient since I would be writing to files for every frame?

Thanks,
Kevin