AiyaPK Posted Monday at 11:23 PM Share Posted Monday at 11:23 PM (edited) I have several custom HDAs of different types, each with their own sets of parameters, some are simple string fields, some are toggles, some are menus, etc. In these fields, the artists may opt to put in ints, floats, strings, or expressions. I'm trying to cycle through each parameter, save the values, then reapply them again. Expressions however are causing me some grief. By default, if I do parm.eval(), it will just resolve the value before saving it. However, I want to save and reapply the expression, not the resolved value. I can use parm.rawValue() so that it just grabs whatever value is in the field, so even if the parameter holds say a string or a number, it should still work (toggles have a raw value of 'on' or 'off' which is a tad annoying). Dynamically reapplying is what gets quite annoying.... parm.rawValue() gets the expression (lets say its something simple like opinputpath(".",0) )... but I need to use parm.setExpression() to properly set the parm as an expression and not just pasting the literal string of the expression, which won't behave like an expression should... But of course parm.setExpression() can't just work on any parm... I can't use it on a toggle parm..... so I have to know ahead of time what kind of value I saved before I decide whether I use parm.setExpression() vs just a simple parm.set(). I would use parm.isShowingExpression(), but turns out that's not without its faults, because during the saving step, the parm with the expression could either be showing the expression itself (isShowingExpression() resolve to True), or the resolved value (isShowingExpression() resolves to False).... Surely there has to be a simpler way to save and reapply parms that skips all this unnecessary logic? I read about recipes, which saves all the parms to a file? I have not tried this, but I'm also unsure I want to be creating a file for every unique combination of data an artist has typed into the various parameters.... Am I missing some magical hom method here?... Update: sorted. nvm... Edited Tuesday at 12:16 AM by AiyaPK no longer needed Quote Link to comment Share on other sites More sharing options...
AiyaPK Posted Tuesday at 12:16 AM Author Share Posted Tuesday at 12:16 AM nevermind, using parm.set() does work for Hscript... not sure why it wasn't working before.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.