Created
May 5, 2016 12:10
-
-
Save SEVEZ/124aac0297736601cc5bb9fce423de2b to your computer and use it in GitHub Desktop.
Apply scale expression to selected objects. They will scale up as locator1 approximates them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sel = `ls -sl`; | |
for ( $s in $sel ) | |
{ | |
$s = $s; | |
$loc = "locator1"; | |
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleX = 1; else " + $s + ".scaleX = ( cos( ( $vlen - 1 ) / 5 * 3.141592 ) + 1 ) / 2 * 0.35 + 1;"; | |
expression -s $constr -o $s -ae 1 -uc all ; | |
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleY = 1; else " + $s + ".scaleY = ( cos( ( $vlen - 1 ) / 5 * 3.141592 ) + 1 ) / 2 * 0.35 + 1;"; | |
expression -s $constr -o $s -ae 1 -uc all ; | |
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleZ = 1; else " + $s + ".scaleZ = ( cos( ( $vlen - 1 ) / 5 * 3.141592 ) + 1 ) / 2 * 0.35 + 1;"; | |
expression -s $constr -o $s -ae 1 -uc all ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also apply visibility expression. Objects will become visible only near the locator1