Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bake operators are not currently properly enabled/disabled based on the target objects state.
STRs:
Actual Result: The bake buttons are enabled
Expected Result: The bake buttons shouldn't be enabled as the baking is not possible
This PR splits the current Bake operator in three different operators that have a different poll implementations.
This PRs splits the
BakeOperator
implementation in a base implementation and a concrete implementation for each bake type so we can poll properly. Although functional I'm not really happy with this implementation, I think there should be an easier way of making poll conditional but I couldn't find a better way based on my attempts below but I'm more than happy to know what should be (if any) the best way of doing this.Other approaches considered:
The first intent was to store the bake mode in the context via
context_pointer_set
. This require a pointer type so storing a string/enum/int is not allowed:Ideally we could store the operator properties reference but that would require the
context_pointer_set
to be called after the operator is created but in that case the context reference has already being bound and the context won't reflect the later context update:Another alternative would have been to add a property to the
UILayout
type to store the bake mode but doesn't seem reasonable to pollute the whole type with a narrow scoped property.: