[Sidefx-houdini-list] Using HDK to get a constant parameter on a SOP
captainhammy at gmail.com
Fri Jul 5 10:36:04 EDT 2013
What exactly do you need the version for? I'm guessing that since you want
it as a parameter you're referencing it elsewhere? If you aren't really
using it you could always try putting the version information in as part of
the operator label. If you did need to use it somewhere , you could
probably create an expression that gets the substring from the label and
use it like that.
On Jul 5, 2013 6:30 AM, "Harry Biddle" <hb at dneg.com> wrote:
> Hi Frederic,
> Thanks for the code snippets. I gave this a go and it almost almost works:
> you now can't change the value off its default, which is great, but the
> only issue is when opening a saved scene: when Houdini sets the parameter
> value from the one saved in the file, it doesn't go through this callback
> function, and the parameter ends up with the value that was saved in the
> scene, rather than the value corresponding to the plugin you've just loaded.
> I'm wondering if there are any "post creation from saved file" callbacks
> that we can hook in to....I found OP_Node::onCreated which is called when
> nodes are created, but unfortunately it seems to be called before Houdini
> populates the node with the saved values.
> On 04/07/13 01:42, Frederic Servant wrote:
>> 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
>> 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_Template(PRM_STRING | PRM_Type(PRM_Type::PRM_**BEHAVIOR_NOREFRESH)
>> PRM_Type(PRM_Type::PRM_**BEHAVIOR_NOCOOK), 1,&versionName,&**
>> 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
>>> 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'?
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
More information about the Sidefx-houdini-list