JJ FX Posted March 21, 2022 Share Posted March 21, 2022 Hi, So I cannot figure out how with python create a relative referenced ramp. The closest I got is to this: # pseudocode controller = 'my_controller_node' target = 'polyextrude_node' path = target.relativePathTo(controller) # or the other way around controllerRamp = controller.parm('thicknessramp') targetRamp = target.parm('thicknessramp') # store the current ramp: keys = targetRamp.evalAsRamp().keys() values = targetRamp.evalAsRamp().values() # set the expression on the thicknessramp parameter expression = 'ch("' + path + '/' + controllerRamp.name() + '")' targetRamp.setExpression(expression) # now the ramp is all broken, so I'm restoring the control points and give them expressions too for i in range(len(keys)): key = targetRamp.name() + str(i+1) + 'pos' value = targetRamp.name() + str(i+1) + 'value' interp = targetRamp.name() + str(i+1) + 'interp' # set the keys, values and interpolations controller.parm(key).set(keys[i]) controller.parm(value).set(values[i]) controller.parm(interp).set(2) # and finally expressions expression = 'ch("' + path + '/' + key + '")' target.parm(key).setExpression(expression) expression = 'ch("' + path + '/' + value + '")' target.parm(value).setExpression(expression) expression = 'ch("' + path + '/' + interp + '")' target.parm(interp).setExpression(expression) So this works fine as long I don't add new points to the controller node. Then ofcourse ramp creates new parameter names 'parmname15pos' etc... So the whole thing is not working properly. This seams to be quite overengineered already... What am I missing that I have to use to do the copy / paste relative references for a ramp parameter? Quote Link to comment Share on other sites More sharing options...
flcc Posted March 22, 2022 Share Posted March 22, 2022 May be you can find some clue in this asset, as it generate control point diynamically. https://richardcthomas.com/image-to-ramp And by the way it's a nice usefull asset. Quote Link to comment Share on other sites More sharing options...
Librarian Posted March 28, 2022 Share Posted March 28, 2022 @JJ FX can you post working file.. Thank you Quote Link to comment Share on other sites More sharing options...
JJ FX Posted March 29, 2022 Author Share Posted March 29, 2022 On 22.03.2022 at 8:24 PM, flcc said: May be you can find some clue in this asset, as it generate control point diynamically. https://richardcthomas.com/image-to-ramp And by the way it's a nice usefull asset. Thanks, will look into that Quote Link to comment Share on other sites More sharing options...
JJ FX Posted March 29, 2022 Author Share Posted March 29, 2022 On 28.03.2022 at 9:58 AM, Librarian said: @JJ FX can you post working file.. Thank you Will do when I find some time! 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.