User properties on the fly

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Sling
Posts: 5242
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

User properties on the fly

#1 Post by Sling »

I need a little help understanding how user properties are meant to function.

Initially I couldn't get any user properties to show in Create/Edit or Panels but after an AM restart they appeared in Panels. I've asked in another post about having the user properties also in Create/Edit but I'd also like to see them update without having to restart AM. Other script changes and the result of user property selection changes are implemented by simply hiding and re showing the given panel but scripting changes affecting the appearance of the actual user property controls in the settings window require AM to be restarted as far as I can tell.

If this is indeed the case can this be changed so they update in a better way.

I was hoping to display the user properties in a conditional way but if i implement this as I had it becomes un-intuitive for the user. Basically you have to select the first user property, restart AM and then the 2nd property becomes visible or vice versa when de-selecting. I know I could show them all and still have the conditional code work but I was hoping not to clutter the settings window with user properties that have no effect. i.e. only show them when they become active.

What i mean by this is something like this.

Code: Select all

user_id = user_prop_add_boolean("Sim or User", false, "Select for User selectable value.")
setting = user_prop_get(user_id)

if setting == false then
	--get value from sim or use a default
	value = 100
else
	--display a new user property for the user to enter their value.
	val_id = user_prop_add_integer("value", 80, 120, 100, "Enter value".")
	value = user_prop_get(val_id)
end
Last edited by Sling on Sun Oct 08, 2017 11:37 am, edited 1 time in total.

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: User properties on the fly

#2 Post by Corjan »

Hi Sling,


The idea behind the user properties is that non-developers can still configure the instruments without having to edit the lua code.
For that reason the instrument is being scanned for user properties only once during AM boot.

I can understand that it is annoying that changes made to the lua are not reflected directly in the first Panels tab though, I'll see if I can make it work somehow. Maybe syncing the user properties when you start an instrument in the Create/Edit tab.

As for the conditional user properties. I like the idea, but it is not something we are able to squeeze into the AM 3.0 version. I have added it to our internal TODO list, maybe something for AM 3.1 or later...


Thanks for your input!

Corjan

User avatar
Sling
Posts: 5242
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: User properties on the fly

#3 Post by Sling »

Thanks Corjan,

I get the user properties idea it was just the implementation that I was struggling with. After your response I realise I had it right and with my suggested improvements at some point I think it will make it easier for both developers and users alike.

Keep up the great work and I'll keep looking for new ways to improve AM.

SimPassion
Posts: 5346
Joined: Thu Jul 27, 2017 12:22 am

Re: User properties on the fly

#4 Post by SimPassion »

Hi Sling

I've found a way by creating AM3 variable subscriptions that are available to all instruments
and then using persistence to retrieve value on start

it's not strictly on your need, just another way to made customizable on user side

you will able to analyze the code inside our instruments once soon published, if needed

Best Regards
Gilles

Post Reply