Houdini16 HDK

   1461   1   2
User Avatar
Member
11 posts
Joined: Aug. 2016
Offline
I just upgraded from Houdini15 to Houdini16. I have a custom C++ plugin that I'm trying to get to work with H'16, but am getting a weird compilation error. This bit of code used to work:

UT_Ramp XFALLOFFRAMP(fpreal t) {
    UT_Ramp myRamp;
    updateRampFromMultiParm(t, getParm("xFalloff"), myRamp);
    return myRamp;
}

But now gives me the following error:

In file included from SOP_DataReader.C:31:0:
SOP_DataReader.h: In member function ‘UT_Ramp AVL_DataReader::SOP_DataReader::XFALLOFFRAMP(fpreal)’:
SOP_DataReader.h:352:21: [b]error: no matching function for call to ‘UT_Ramp::UT_Ramp(UT_Ramp&)’[/b]
return myRamp;
^
SOP_DataReader.h:352:21: note: candidate is:
In file included from /opt/hfs16.0.504.20/toolkit/include/UT/UT_Performance.h:33:0,
from /opt/hfs16.0.504.20/toolkit/include/UT/UT_TaskScope.h:29,
from /opt/hfs16.0.504.20/toolkit/include/UT/UT_Task.h:23,
from /opt/hfs16.0.504.20/toolkit/include/UT/UT_TaskState.h:24,
from /opt/hfs16.0.504.20/toolkit/include/UT/UT_TaskExclusive.h:22,
from /opt/hfs16.0.504.20/toolkit/include/GA/GA_PrimitiveList.h:33,
from /opt/hfs16.0.504.20/toolkit/include/GA/GA_Detail.h:34,
from /opt/hfs16.0.504.20/toolkit/include/GA/GA_Primitive.h:26,
from /opt/hfs16.0.504.20/toolkit/include/GEO/GEO_Primitive.h:32,
from /opt/hfs16.0.504.20/toolkit/include/GEO/GEO_PrimVolume.h:26,
from /opt/hfs16.0.504.20/toolkit/include/GU/GU_PrimVolume.h:24,
from SOP_DataReader.h:33,
from SOP_DataReader.C:31:
/opt/hfs16.0.504.20/toolkit/include/UT/UT_Ramp.h:94:6: note: UT_Ramp::UT_Ramp()
UT_Ramp();
^
/opt/hfs16.0.504.20/toolkit/include/UT/UT_Ramp.h:94:6: [b]note: candidate expects 0 arguments, 1 provided[/b]

How should I fix this?
User Avatar
Member
1743 posts
Joined: March 2012
Offline
To avoid code accidentally copying a UT_Ramp, which can get quite expensive, the copy constructor was made explicit. You can avoid the copy by changing the function to take a reference to a UT_Ramp, e.g.:
void XFALLOFFRAMP(fpreal t, UT_Ramp &ramp) {
    updateRampFromMultiParm(t, getParm("xFalloff"), ramp);
}
Then, the calling code would change from something like:
UT_Ramp ramp = XFALLOFFRAMP(t);
to something like:
UT_Ramp ramp;
XFALLOFFRAMP(t, ramp);
A similar change was made to avoid accidentally copying UT_Array, though UT_Array has a move constructor, so if you need to return it by value, it can be done using std::move. It looks like there isn't currently a move constructor on UT_Ramp.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
  • Quick Links