nojanath / SublimeKSP

Fork of Nils Liberg's SublimeKSP plugin. See README for details.
GNU General Public License v3.0
87 stars 18 forks source link

Fix get/set_event_par() by generating functions_with_constant_return #351

Closed JackWilliams-FractureSounds closed 1 year ago

JackWilliams-FractureSounds commented 1 year ago

Close #350

This was being caused by certain functions not being considered to return a constant. Reworked the set functions_with_constant_return to be generated when creating builtins. It adds any function from the set functions which can return a 'real' or 'integer'. I believe this is how Kontakt is able to determine if the expression is valid within get/set_event_par or get/set_engine_par.

As a side effect, optimize_code would no longer evaluate expressions (abs, in_range, sh_left, sh_right, by_marks, int_to_real, real, real_to_int, int), so added a new builtins set, functions_evaluated_with_optimize_code that bypasses these builtins to allow for evaluation.