-
-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: button local variables #3314
base: develop
Are you sure you want to change the base?
Conversation
Well, as I see it we want 3 types of these local variables.
Once I started thinking about the data piping and backend structure to be able to do this (primarily needing to be able to host feedbacks), I realised that it would avoid a lot of complexity and risk of future bugs to make them part of the 'entity' system. Really the driving factor for this approach is 3; 1 & 2 are bonus side effects of this architecture. I am not set on the ui being this way, but it keeps the implementation simple. 2 isnt explicitly necessary, but I think it will be a nice thing to have to avoid having to repeat expressions in style elements. I don't know why I started with this one instead of the 'constant' value one |
OK, I'm fine if the UI looking different between the global and the local variables although I'd prefer some uniformity. If this proves to be superior maybe we carry it over to the global variables then. How will the expression type local variable behave if you set up two of them with cross references? E.g. local:var1 with the expression So, the constant type will have the options How about the feedback driven type? What is your UI suggestion for making the connection between the feedback and the variable? I'm not strongly against that implementation, but im not convinced yet. Local variables could be just like global variables with the same or similar UI and the only difference that they have is the scope of a control. A local variable that always reflects the result of an expression would not be possible that way, but tbh I fear more problems with that than the value is. We still have the unresolved challenge of circular references. The whole system of expressions that automatically subscribe to the needed values and automatically reevaluate in case of change has some appeal but also a lot of challenges and I think we will be better off when we try to avoid possible circular references and make the workflows more procedural. I think that will be much easier to understand for the users. Of course now we have established self reevaluating expressions and they are quite useful and we should keep them but maybe we can try to use them only for "terminal points". I have not a final solution for that problem and am very open for suggestions. When we solve the problem of circular references we also can introduce the functionality of the entity based expression type local variable with a internal feedback. Today we have internal: Variable: Check boolean expression for boolean values. That can be generic and then you just add that feedback, enter your expression and the feedback will always fill its local variable with the result of the expression. Technically it is the same as the expression type variable but we could avoid introducing many new and different entities. |
To explain some other decisions I made, I put these under the
To mitigate the risk of this, I have gone with an approach of lazily evaluating the expressions, so they will be evaluated when they are used rather than how we are doing feedbacks where we precalculate and cache the values. Of course the feedback based ones will need a different strategy, and will need some guard to prevent excessive recalculation which I havent begun thinking about
Yes, this would look the same as an action-group or the other composite action/feedbacks we have (logic and, logic or, logic if). In fact, unless we put the effort in to limit it, it will support all the recently added feedback logic operators
The reason I want this expression type is to avoid having to repeat myself in the style elements.
This branch is based off develop without any of the drawing work, to try and keep PRs small. But I am writing this for #3299 and what I think will be wanted for the new drawing, so some bits may be a bit weird and confusing when combined with the old buttons. I will answer the rest tomorrow, when I have some time to think about it more. |
If your expression produces a boolean then yes it is the same, but for any other value it isn't the same. So it would solve some use cases (with less technical complexity, and more user clicks), but not all of the use cases. It seems like the rest is based around the concern of circular references and trying to mitigate that, so with the lazy execution allowing circular references to be safe, maybe this is fine? |
2c1dc67
to
f157a05
Compare
I am not sure about this. Largely because I don't yet have a plan I am happy with for advanced feedbacks in the graphics overhaul. So I am very tempted to limit this to just booleans for now, with the intention of reconsidering that limitation once the graphics overhaul has a plan on how advanced feedbacks should interact.
OK, so this will require us to add a new 'value' feedback type to support these non-boolean values. I am not opposed to doing that internally as part of this, to be exposed to modules later.
So ignore everything from above?
Tbh, I don't know if we should or shouldn't change the name. Because of the big shift in how they operate I think there is value in also changing the name of the feature.
Should every feedback have a name, or just the root level ones? Other than naming/terminology, this is sounding pretty close to what I have done? Ah, but I suppose these are a specialisation of feedbacks (a new 'value' sub-type, with boolean also being a valid 'value' type) rather than their own entity type. |
Correct
Correct
Logic 'and' has the same effect as the stack for booleans, correct. If we do not ignore advanced or any other type, than we need some way to replicate today's workflow. A stack could be that missing link. Advanced feedbacks return a JSON with optional style properties. A stack would basically be a spread of the JSONs like We could introduce an entity that consumes one or more boolean feedbacks and outputs the style like it is done today with the advanced feedbacks. It would look like this:
This would give exactly the same results as the current workflow.
I'd say every feedback. 1. this would make it more uniform 2. you can access whatever you like from element's expressions 3. it makes it easier/possible to move feedbacks between different levels without messing up everything |
ok, this is now restructured to be like you proposed. Recursive expressions appears to be fine (I am not 100% sure why), and a loop of two feedbacks/expressions does run as fast as it can, but is recoverable. I will look into adding some rate limit to reduce the impact |
WIP
Trying to build this as a new type of entity, in the hope that keeps things a bit simpler as these will need to support containing other entities (feedbacks)TODO: