openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

Migrate VDB version check to SOP_NodeVDB

Open danrbailey opened this issue 5 years ago • 15 comments

SOP_OpenVDB_Scatter overrides the syncNodeVersion() with a check for the version of VDB the SOP was placed in:

https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb_houdini/SOP_OpenVDB_Scatter.cc#L256

We'd like to move the portion that does the version comparison up into SOP_NodeVDB, something like:

int SOP_NodeVDB::compareVersionString(const char* oldVersion, const char* nodeVersion);

and then change the SOP_OpenVDB_Scatter implementation to use this method so that other SOPs don't need to encode this version logic.

This needs to take account of the fact that the version string has only changed recently:

VDB 6.0.0 - "17.5.204" VDB 6.1.0 - "17.5.204" VDB 6.2.0 - "vdb6.2.0 houdini17.5.204" VDB 6.2.1 - "vdb6.2.1 houdini17.5.204" VDB 7.0.0 - "vdb7.0.0 houdini17.5.204"

Houdini version can be ignored for now, it's only the VDB version we care about.

danrbailey avatar Jan 23 '20 00:01 danrbailey

@danrbailey What I am understanding after reading the issue and code is that if we get the older version, we need to disable compression. So do we need to make this comparison only and move it up in the SOP_NodeVDB function so that we can directly use this function in SOP_OpenVDB_Scatter? I want to confirm if I am thinking in the right direction.

piyush0411 avatar Feb 20 '20 19:02 piyush0411

@danrbailey What I am understanding after reading the issue and code is that if we get the older version, we need to disable compression. So do we need to make this comparison only and move it up in the SOP_NodeVDB function so that we can directly use this function in SOP_OpenVDB_Scatter? I want to confirm if I am thinking in the right direction.

Yes, that's correct. The logic that deals with the version comparison should live in the base class (SOP_NodeVDB), the logic that deals with disabling compression should live in the derived class (SOP_OpenVDB_Scatter).

In theory there could be a number of derived classes enabling/disabling features (classA switches off featureA if version < 6.2.0, classB switches on featureB if version > 7.0.1, etc).

danrbailey avatar Feb 20 '20 20:02 danrbailey

Can I give this issue a try?

piyush0411 avatar Feb 20 '20 21:02 piyush0411

Can I give this issue a try?

Yes, by all means. :)

danrbailey avatar Feb 21 '20 01:02 danrbailey

@danrbailey I am a bit confused here. I am thinking of adding a function in SOP_NodeVDB.cc file in the repository. Am I doing it correct? Also I did not get clearly what you explained me about the derived classes in the previous comment. Can you please elaborate it a bit.

piyush0411 avatar Feb 21 '20 10:02 piyush0411

Also I am facing an error while running make -j4 command for openVDB.

openvdb/CMakeFiles/openvdb_static.dir/build.make:86: recipe for target 'openvdb/CMakeFiles/openvdb_static.dir/io/Archive.cc.o' failed
make[2]: *** [openvdb/CMakeFiles/openvdb_static.dir/io/Archive.cc.o] Error 1
In file included from /usr/include/c++/7/ext/string_conversions.h:41:0,
                 from /usr/include/c++/7/bits/basic_string.h:6361,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /usr/include/OpenEXR/half.h:89,
                 from /home/piyush/openvdb/openvdb/../openvdb/Types.h:9,
                 from /home/piyush/openvdb/openvdb/io/Compression.h:7,
                 from /home/piyush/openvdb/openvdb/io/Compression.cc:4:
/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.

I tried reinstalling gcc compiler but couldn't fix it. Can you please help me fix it?

piyush0411 avatar Feb 21 '20 17:02 piyush0411

@piyush0411 see this issue r.e. the stdlib.h problem https://github.com/AcademySoftwareFoundation/openvdb/issues/632

Idclip avatar Feb 21 '20 17:02 Idclip

Can you also confirm for me which version of CMake you're using? I need to fix this bug

Idclip avatar Feb 21 '20 17:02 Idclip

@Idclip Thanks for the help. I was able to successfully build it. Also cmake version I am using is 3.10.2

piyush0411 avatar Feb 21 '20 17:02 piyush0411

While commiting the changes, the build directory also gets committed every time. Wouldn't it be better to add a gitignore file to the repository?

piyush0411 avatar Feb 21 '20 18:02 piyush0411

While commiting the changes, the build directory also gets committed every time. Wouldn't it be better to add a gitignore file to the repository?

Yes, it would, I didn't realize that we didn't have one. I created a new issue here:

https://github.com/AcademySoftwareFoundation/openvdb/issues/639

danrbailey avatar Feb 21 '20 18:02 danrbailey

@danrbailey I am a bit confused here. I am thinking of adding a function in SOP_NodeVDB.cc file in the repository. Am I doing it correct? Also I did not get clearly what you explained me about the derived classes in the previous comment. Can you please elaborate it a bit.

Can you help me with this?

piyush0411 avatar Feb 21 '20 19:02 piyush0411

@danrbailey I am a bit confused here. I am thinking of adding a function in SOP_NodeVDB.cc file in the repository. Am I doing it correct? Also I did not get clearly what you explained me about the derived classes in the previous comment. Can you please elaborate it a bit.

Can you help me with this?

Sure, we'd like to introduce a new function (modeled after the UT_String::compareVersionString method in SideFX's HDK), such as:

int SOP_NodeVDB::compareVersionString(const char* oldVersion, const char* nodeVersion);

then move the version comparison logic out of SOP_OpenVDB_Scatter::syncNodeVersion into this new function and then call this new method from the syncNodeVersion method.

If you haven't already, I would recommend starting out by downloading Houdini Apprentice (https://www.sidefx.com/download/), building the OpenVDB Houdini plugin, launching Houdini and putting down one of these SOPs.

danrbailey avatar Feb 21 '20 19:02 danrbailey

@danrbailey I am a bit confused here. I am thinking of adding a function in SOP_NodeVDB.cc file in the repository. Am I doing it correct? Also I did not get clearly what you explained me about the derived classes in the previous comment. Can you please elaborate it a bit.

Can you help me with this?

Sure, we'd like to introduce a new function (modeled after the UT_String::compareVersionString method in SideFX's HDK), such as:

int SOP_NodeVDB::compareVersionString(const char* oldVersion, const char* nodeVersion);

then move the version comparison logic out of SOP_OpenVDB_Scatter::syncNodeVersion into this new function and then call this new method from the syncNodeVersion method.

If you haven't already, I would recommend starting out by downloading Houdini Apprentice (https://www.sidefx.com/download/), building the OpenVDB Houdini plugin, launching Houdini and putting down one of these SOPs.

I have made the necessary changes in the files as told by you. I have added the function compareVersionString in the SOP_NodeVDB.cc file and made the necessary changes in the syncNodeVersion function so that comparison function is called in synNodeVersion.

But I am not able to understand how to check if the changes made by me do not give an error. I want to know how to build the project. Do I need to run the commands given in the readme file in this repository everytime to check the correctness of my changes?

Also I am not able to understand how to build the OpenVDB Houdini plugin you told me about. Can you please tell me about some tutorial or elaborate the concept that can help me?

piyush0411 avatar Feb 22 '20 11:02 piyush0411

@danrbailey I am a bit confused here. I am thinking of adding a function in SOP_NodeVDB.cc file in the repository. Am I doing it correct? Also I did not get clearly what you explained me about the derived classes in the previous comment. Can you please elaborate it a bit.

Can you help me with this?

Sure, we'd like to introduce a new function (modeled after the UT_String::compareVersionString method in SideFX's HDK), such as: int SOP_NodeVDB::compareVersionString(const char* oldVersion, const char* nodeVersion); then move the version comparison logic out of SOP_OpenVDB_Scatter::syncNodeVersion into this new function and then call this new method from the syncNodeVersion method. If you haven't already, I would recommend starting out by downloading Houdini Apprentice (https://www.sidefx.com/download/), building the OpenVDB Houdini plugin, launching Houdini and putting down one of these SOPs.

I have made the necessary changes in the files as told by you. I have added the function compareVersionString in the SOP_NodeVDB.cc file and made the necessary changes in the syncNodeVersion function so that comparison function is called in synNodeVersion.

But I am not able to understand how to check if the changes made by me do not give an error. I want to know how to build the project. Do I need to run the commands given in the readme file in this repository everytime to check the correctness of my changes?

Also I am not able to understand how to build the OpenVDB Houdini plugin you told me about. Can you please tell me about some tutorial or elaborate the concept that can help me?

Here is our build documentation:

https://www.openvdb.org/documentation/doxygen/build.html

It sounds like you would benefit from more generally reading and understanding how to use CMake too, there are lots of tutorials available online.

danrbailey avatar Feb 25 '20 18:02 danrbailey