Support pattern matching in ModelToggle mod#169
Open
copygirl wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
If we wanted to go further, we could also allow specifying a list of model names easily, either via a comma-separated list or similar, or via supporting multi-line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
My model has some parts that are separate, but should be shown/hidden as a unit, so I would have to create multiple
ModelTogglemods for each part, all using the same redeem as a trigger. In some cases, the parts of the model share part of their name. So I figured it'd be nice to "fuzzily" match node names and apply to multiple at the same time, which thankfully,find_childrenalready supports.I decided to filter for only
Node3Dnodes, as those have thevisibleproperty we care about. And I enabled recursive search, since objects attached to bones may appear as children of those bones in the skeleton, apparently.There is the possibility to create a helper method (such as
models_set_visibility(bool)or so) to deduplicate code, but I decided to keep the changes straight-forward. If desired, I could include this suggestion.Example
Model has "Belt", "Belt_Buckle", "Belt_Pouch" parts.
Specify
Belt*for Model Name to be able to toggle visibility of all three at once.