Script controller expression does not "persist" after evaluation

Script controller expression does not "persist" after evaluation

truckexpert
Advocate Advocate
628 Views
2 Replies
Message 1 of 3

Script controller expression does not "persist" after evaluation

truckexpert
Advocate
Advocate

Hello friends,

 

When I'm rigging a script controller, the actual expression is replaced by the evaluated numerical results. The expression appears to continue to control the object correctly, but when I look at the “Assigned To” field in the script controller dialog box, it shows the results, not the expression (equation).

 

In the example below,  I define the array “Arr” as:   Arr = getSegLengths $myPath 1. After clicking EVALUATE, the desired results are shown. Clicking OK to close the dialog box, then clicking ASSIGN CONSTANT (again) to check the expression, the expression is gone, and the resulting array values appear in the expression field, where the expression once was. I want to see (and be able to double-check and edit) the actual expression in the future. How do I achieve this? Video shown below to explain further.

 

The objective is to assign a given speed to a container that is controlled with a path constraint. I wish to control the percentage using the queried (getSegLengths) values for the spline's overall length, and the "current" time.

 

Distance = Velocity * Time, and I want to calculate/control the PERCENT (along the path) using the script controller's output: Percent = Distance/Length. 

 

Maybe there's an easier way, but my main question is about how to make the equation stay put where I can examine it later?

 

I'm using 3DS Max 2022.

 

Thank you in advance. Happy animating, and happy holidays!

 

Dave

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes
Accepted solutions (1)
629 Views
2 Replies
Replies (2)
Message 2 of 3

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

constant assignment can be done with a "persistent" expression (unfortunately). The expression only helps to create a value that will be stored as a constant.
The only solution I can see is to make this constant (an array in your case) in the body of the script on every call. This means using a local variable within the script instead of a constant array. Some memory leak may occur, but if the array is not too large, the leak should not be bad.

0 Likes
Message 3 of 3

truckexpert
Advocate
Advocate
Thanks, Denis. That helps. My mistake was not recognizing that the equations I was wanting to define must be defined in the top-right window, along with the expression that cranks out the result value for the controller.

Thanks for the reply!
Cheers
Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes