[Sidefx-houdini-list] Using HDK to get a constant parameter on a SOP

Frederic Servant frederic.servant at gmail.com
Wed Jul 3 20:42:19 EDT 2013

Hi Harry,

I had the same issue, I used a PRM_STRING, I did not disable it since it
makes it less legible and more difficult to copy and paste.

You are right to set your version in the default value, this ensures the
version displayed is the current SOP dso's version and not the version the
SOP instance was created with initially.

Now all you need to do is to prevent any changes to the parameter, I used a
callback for that:

// restore defaults callback
static int restoreDefaults(void *data, int index, float time, const
PRM_Template *tplate)
    UT_String token;
    SOP_MySop* sop = reinterpret_cast<SOP_MySop*>(data);
    return 1;

// parameter definitions
static PRM_Name versionName("version", "Version");
static PRM_Default versionDefault(0, MY_VERSION);
static PRM_Template parameterTemplates[] =
    // some parameters here...
PRM_Type(PRM_Type::PRM_BEHAVIOR_NOCOOK), 1, &versionName, &versionDefault,
0, 0, restoreDefaults),
    // more parameters...

Hope this helps,

On Wed, Jul 3, 2013 at 10:31 AM, Harry Biddle <hb at dneg.com> wrote:

> Hi guys,
> I've been trying to build a SOP in C++ land that has a constant string
> parameter on it---I'm using this to display the version number of the SOP.
> I can do this with a PRM_STRING or PRM_LABEL, setting a default on
> compile-time. But it ends up as a node parameter, that gets saved along
> with the scene, and can be overwritten by the user!
> Does anybody know if there some kind of a flag that says 'this label is
> constant; its value can never be changed from the default value'?
> Thanks,
> Harry
> ______________________________**_________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>

More information about the Sidefx-houdini-list mailing list