Here is a pre-coffee mockup via tcl. Put the below in a file called fit.tcl inside your NUKE_PATH to be able to do something like this in a knob:

[fit inMin inMax outMin outMax]
e.g.:
[fit 1 2 3 4]


proc fit {inMin inMax outMin outMax} {
return [expression "(curve-$inMin) / ($inMax-$inMin) * ($outMax-$outMin) + $outMin"]
}

It should be easy enough to extend this to automatically find inMin and inMax. And of course you could do the same with python, but tcl feels more efficient for this.


Point is, it'd be great to have a default match expression to do this :)


On 26/01/16 10:41 am, Frank Rueter|OHUfx wrote:
Sorry, I forgot the second step. The below only normalises, after that yo'd want to remap it to a new min/max, e.g.:
(curve-inMin) / (inMax-inMmin) * (outMax-outMin) + outMin

That combined into a fit function would indeed be nice to have as a default math expression (so no tcl/python scripting is required).

Speaking of: is it actually possible to user define new math expressions? That would be very cool!




On 26/01/16 10:34 am, Frank Rueter|OHUfx wrote:
I think Chris isn't referring to the knob layout but to an expression function that kinda does the opposite to lerp, something like normal(frame)
Something liek this:
(curve-_min) / (_max-_min)


Is that what you are after Chris?


set cut_paste_input [stack 0]
version 9.0 v8
push $cut_paste_input
Blur {
size {{"(curve-_min) / (_max-_min)" x42 -421.2707519 x43.06526184 4.625946045 x43.25991821 15.09881592 x43.3896904 30.80813599 x43.64923096 55.24484253 x43.71411896 65.71769714 x43.77900314 74.44509888 83.17250061 x43.97365952 97.13631439 x44.0385437 102.3727493 x44.16831589 109.35466 116.3365784 x44.36297226 119.8275299 x44.49274063 123.3184967 x44.55762863 126.8094482 x44.62251282 130.300415 x44.75228119 130.300415 x44.81716919 130.300415 x45.07670975 116.3365784 x45.40113831 83.17250061 x45.59579468 62.22674561 x45.85533524 41.28100586 x46.43930435 -5.846908569 x47.34770203 -77.41156006 x48.06143951 -117.5575562 x48.51564026 -136.7578125 x48.96983719 -155.9580688 -175.1583252 x49.81334686 -196.1040649 x50.59197235 -236.250061 x51.24082565 -271.1596375 x51.88968277 -304.3237305 x52.60342407 -335.7423096 x53.57670593 -375.8883667 x53.83624268 -386.3612061 x54.16067123 -393.3431396 x54.42021561 -396.8341064 x54.61487198 -398.5795898 x55.13395309 -396.8341064 x55.97746277 -370.6519165 x56.30189133 -354.942627 x56.75608826 -333.9968872 x57.275177 -307.8146973 x58.44311142 -243.2319946 x60.45455933 -115.8120728 x61.10341263 -66.93865967 x61.88204193 -14.5743103 x64.1530304 135.5368347 x65.77516174 210.5924225 x69.1492157 327.5394897 x69.66828918 339.7578125 x70.51180267 358.9580688 x71.22554016 367.6854858 x72.13394165 374.6674194 x72.39347839 374.6674194 371.1764526 x72.84768677 365.9400024 x73.10722351 355.4671326 x73.626297 325.7940063 x74.21026611 280.4115601 x74.72935486 228.0471954 170.4464111 x75.70263672 104.1182327 x75.96217346 70.95413208 x76.22172546 32.55361938 x76.87057495 -44.24743652 x77.58432007 -126.2849426 x78.36294556 -201.3405151 x79.07667542 -271.1596375 x79.79042053 -349.7061768 x80.04995728 -386.3612061 x80.24461365 -412.543396 x80.50416565 -421.270752 x80.82858276 -416.0343628 x81.08813477 -389.8522339 x81.34767151 -346.21521 -292.1053772 x82.45072937 -211.813385 x82.77514648 -189.1221619 x83.42401123 -157.7035522 x83.87820435 -145.485199 x84.07286072 -148.9761353 x84.33239746 -161.1944885 x84.52705383 -178.649292 x84.78660583 -201.3405151 x85.11102295 -224.0317383 x85.43545532 -244.977478 x85.75987244 -265.9231873 x86.14920044 -285.1234741 x86.47361755 -302.5782471 x86.8629303 -316.5421143 x87.70643616 -340.9787598 x88.16064453 -340.9787598 x88.48506165 -328.760437 x89.00415039 -309.5601196 x89.65299988 -290.3599243 x89.91255188 -283.3779907 x90.17208862 -278.141571 x90.69117737 -272.9051208 x91.46980286 -262.432251 x93.0919342 -225.7771912 x93.93544006 -185.6311951 x94.71406555 -129.7758789 x95.03849792 -101.8482361 x95.42781067 -77.41156006 x95.75222778 -59.95675659 x96.01177979 -45.99291992 x96.66062927 -28.53813171 x96.85528564 -23.30169678 x96.98506165 -143.7397461 x97.50415039 -190.8676147 x98.02322388 -215.3043213 x98.47743225 -236.250061 x98.67207336 -244.977478 x98.866745 -253.7048645 x99.12628174 -260.6867676 x99.32093811 -265.9231873 x99.90490723 -276.3960571 x100.5537567 -285.1234741 x100.7484131 -288.6144104 x101.0079651 -293.8508301 x101.2026062 -297.3418274 x101.3323822 -300.8328247}}
 name Blur1
 selected true
 xpos 117
 ypos -151
 addUserKnob {20 User}
 addUserKnob {7 _min}
 _min -421.2707519
 addUserKnob {7 _max}
 _max 374.6674194
}


On 26/01/16 4:32 am, Frank Harrison wrote:
Not that I'm aware of. Do you have a link, so I can learn more about how Houdini does it?

I ask because, as a user myself, I'm also a bit frustrated with how Nuke lays out it's knobs.

F.

On Friday, 22 January 2016, Chris Noellert <cnoell...@gmail.com> wrote:

    Does a fit function exist for knobs?  Something akin to
    Houdini’s fit or fit01 for remapping values to a normalized or
    user defined range?

    I looked through the knob expression doc and found just about
    everything else I might want and perhaps I missed it so I
    thought I might ask.

    Best,
    Chris


    _______________________________________________
    Nuke-users mailing list
    Nuke-users@support.thefoundry.co.uk <javascript:;>,
    http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users



--
Frank Harrison
Senior Nuke Software Engineer
The Foundry
Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
Web: www.thefoundry.co.uk <http://www.thefoundry.co.uk>
Email: frank.harri...@thefoundry.co.uk <mailto:frank.harri...@thefoundry.co.uk>



_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk,http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation and consulting <http://ohufx.com/index.php/vfx-customising>* *



_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk,http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation and consulting <http://ohufx.com/index.php/vfx-customising>* *



_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation and consulting <http://ohufx.com/index.php/vfx-customising>* *

_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to