Hyunjun Cheong

Hyunjun Cheong

About Me

EXPERTISE
Student
INDUSTRY
Film/TV

Connect

LOCATION
Korea, Republic of

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Compiled Block cause Error July 28, 2017, 2:05 p.m.

jlait
This should be fixed in 16.0.681. Thank you for isolating it!
Thank you, Jlait.
I look forward Houdini 16.0.681.
I think only pcimport don't cause this problem.


1. Many Pieces in for loop sop
2. pciterate function as while iteration bool
3. pcimport function

like my file I attached before

Compiled Block cause Error July 24, 2017, 12:56 p.m.

I try to convert some not-Compilable SOP to Compilable SOP.
It's really fast than not using “Multithread When Compiled”.

For example, “connect adjacent pieces node” is not-Compileable.
In the adjacent piece node, “compute_point_normals” cause not-Compileable.
So I exchange this to “attribute_expression” like same function which do “compute_point_normals”.
It looks fine when I check “Single Pass” in ForEach Sop block one by one.
But it cause error when I disable “Single Pass” in Foreach Sop block.

So, I debug “connect adjacent pieces node”.
In “connect adjacent pieces node”, “connect_nearby_points” has some code like below.
I debug “connect_nearby_points”'s code. So, I find pcimport function causes error.

Is there anyway to fix this? or replace to attribute vop sop?

I think it's houdini 16.0's program error. It cause segmentation fault.
I test this Houdini 16.0.671 in Ubuntu 14.04, and Houdini 16.504.20 in Windows10.
Both of them cause Error and shut down Houdini program.

I attach file, too.

/// Creates a new line between the given point numbers.
void createline(int pt_a; int pt_b)
{
int prim = addprim(0, "polyline");
addvertex(0, prim, pt_a);
addvertex(0, prim, pt_b);
}

/// Returns true if the item is contained in the list.
int contains(string list[]; string item)
{
foreach(string str; list)
{
if (item == str)
return 1;
}

return 0;
}

int handle = pcopen(0, "P", @P, ch("../searchradius"),
chi("../maxsearchpoints"));
int max_connections = chi("../maxconnections");
string other_name;
string known_pieces[];
int num_connections = 0;
string my_name = s@name;

while (pciterate(handle) && num_connections < max_connections)
{
pcimport(handle, "name", other_name); // this line cause error

// Don't create connections to multiple points on the same piece, or
// to other points on our piece.
if ((my_name != other_name) &&
(num_connections == 0 || !contains(known_pieces, other_name)))
{
vector other_P;
pcimport(handle, "P", other_P); // this line cause error

// Only search in the direction of the point normal.
if (dot(other_P - @P, @N) >= 0)
{
int other_ptnum;
pcimport(handle, "point:number", other_ptnum);

createline(@ptnum, other_ptnum);
++num_connections;
if (num_connections < max_connections)
push(known_pieces, other_name);
}
}
}

pcclose(handle);

Write(Modify) Extra File in HDAs Jan. 2, 2017, 10:43 p.m.

edward
I assume you actually meant saveIndexDataToFile() here instead. In anycase, opdef: paths not not usually writable. Your best chance is probably to hack around the sections of the hou.HDADefinition [sidefx.com] itself and then save it.

Thanks, edward.

I look around all HDADefinition methods all yesterday.
For example,
...
...
------------------------------------------------------------------------
# HDA's Help Tab
node = hou.node("../HDANAME").type().definition().embeddedHelp()
------------------------------------------------------------------------
""" HDA's ExtraFileOptions -> Cursor of Extra Files, Extra Files's Name,
                      IsScipt, IsPython, Extra File's Source Path
"""
node = hou.node("../HDANAME").type().definition().extraFileOptions()
------------------------------------------------------------------------
""" HDA's sections -> return dict data type
{ 
'EXTRA_FILE_NAME' : 
<hou.HDASection EXTRA_FILE_NAME in definition of Sop HDA's Name in HDA's Installed Path>
}
"""
node = hou.node(".").type().definition().sections()
------------------------------------------------------------------------
# HDA's Name in HDA's Installed Path
node = hou.node(".").type().definition().libraryFilePath()
------------------------------------------------------------------------
# HDA's Name in HDA's User Info
node = hou.node(".").type().definition().userInfo()
------------------------------------------------------------------------
....
------------------------------------------------------------------------
....
------------------------------------------------------------------------
I look around HDASection [sidefx.com], too.

For example,
add SectionFromFile like other Extra Files File
class EXAMPLE():
    ....
    def addSectionFromFile(self, hda_definition, section_name, file_name):
        section_file = open(file_name, "r")
        hda_definition.addSection(section_name, section_file.read())
        section_file.close()
    
    def markSectionAsTxt(self, hda_definition, section_name):
        ....
        hda_definition.setExtraFileOption(section_name + "/IsPython", False)
        hda_definition.setExtraFileOption(section_name + "/IsScript", False)
        ....
    def ADD_MARK_SECTION(self):
        hda_definition = hou.node(".").type().definition()
        self.addSectionFromFile(hda_definition, "a.txt", hda_definition.libraryFilePath())
        self.markSectionAsTxt(hda_definition, "a.txt")
    ....

I run ADD_MARK_SECTION method.

The Section's Created like others. And, Extra File Option is added like others.
In Extra File's Tab “a.txt” is added!!

So, I can make Extra File's. I can see “a.txt” in Extra File's Tab.
But the content of “a.txt” said “Contains binary information”(Section Size always 487 bytes)
I don't know why.. (hou.readFile function cannot read “a.txt”)

And I think .hda file format is Oracle HyperData File [docs.oracle.com].(If not, let me know)
I open the .hda by Oracle's HDA. But HDA just contains definitions of shelves, toolbars, and tools. It should not be hand-edited when it is being used by the application. Note, that two definitions of the same element are not allowed in a single file. (<- This is message of HDA raw file) So, Editing .hda raw file is not good way.
And, .otl's raw file can be opened by Python's file open function. But .hda's raw file cannot.

Next I will try : modify or add the content of “a.txt”
I look around
$HFS/toolkit/include/HOM/HOM_hda.h
/HOM_HDADefinition.h
/HOM_HDASection.h
/...
/...