[ANSWERED] How to Set the Scale Min/Max of Inputs in Pythoner Actor?
-
Hi there,
I'm working with the Pythoner actor and I'm trying to figure out if there is a way of indicating that an input should have a particular range to start with inside the python code?
I'm able to get it to make different kinds of inputs but they always populate as "0". . . .
Any guidance would be great.
Thank you!
-=Alex=-
(edit: added extra words for more clarity)
-
Pythoner basically passes values from Isadora into your Python script as raw Python objects. There is:
❌ No built-in type system for inputs/outputs
❌ No way to declare types like “this input is always an int” at the actor level
✅ Only positional passing of valuesWith that said, you use the standard method of mutating your inputs/outputs to the expected types.
Additionally in your python code it is useful to test the type of inputs to ensure proper function. (I honestly don't do this often because I'm quite careful with my input connections. Using user actors to contain my pythoner scripts makes this even easier because you can set the type of the user inputs before attaching them).
You might look into using:
# Validate types
if not isinstance(my_input, expected_type):
# convert or handle error# Convert if needed
my_input = int(my_input) # or float, list, etc.This allows you to test incoming values in your python_init() function
-
-
@dusx said:
With that said, you use the standard method of mutating your inputs/outputs to the expected types.
These User Actors of mine can be quite useful for that: https://troikatronix.com/add-ons/mutator-user-actors/