Check style for effect use

Is it possible to check whether or not an effect is called for in a blade style?
For example, If style uses EFFECT_PREON, then do this, else just do this.
Maybe something with current_preset_.GetStyle....?

Currently no, but it would be relatively simple to add to the style->IsHandled() function. There isn’t enough bits to do this for all the different effects though, so for each effect that you need to check for, we would need to add the code that maps the effect number to one of the bits in the “handled” bitfield.

The definition of that bitfield lives here right now:

What is it you’re trying to do? Maybe there is another way?

Ha Most certainly probably a simpler way.
Working on that matching preon sound to blade effects thing…
Got it working, but seems clunky. Probably should be using a table or an array somehow, but…
The last issue with the way it is now is preon01, 02 and 03 always link to EFFECT_PREON1, 2 or 3, regardless if they exist in the blade style or not.
So if the style doesn’t have them, up to the first 3 preon sounds leave the blade black.
Well, not always. Only within #define PREONS_MATCH_BLADE_EFFECTS

To more directly answer, I’m trying to only do
hybrid_font.DoEffect(EFFECT_PREON1, 0); if it exists in the blade style.
That way preon01 just does normal EFFECT_PREON if the style doesn’t specify a numbered version.

Maybe it would be better to do hybrid_font.DoEffect(EFFECT_PREON, 1);? Then alter the style to react differently based on the “location” (which is really the effect number in this case.)

I was wondering about that argument! So it IS the effect number. Good lord that makes things better I think. Thanks.

Wait…alter the style?

I’ve never seen location be anything but zero. How does that work?

Well, location was originally intended to be calculated from sensor data, especially for clashes. However, I not found a way to do that yet, so it’s either zero or random. However, that doesn’t mean it has to be.

Currently there is no way to get the location inside a style, because there is not real use for it, but it could be added.

Just a note, this may not play nice with “Preon Options” for Edit Mode and in the OS6 library so please put any of these changes in a define. The “Preon Options” in the library will allow users to select from multiple preon effects within a single style via Edit Mode, including turning the effect off, so this doesn’t sound like it will work alongside this concept.

Stuff I’m playing with is only within an #ifdef PREONS_MATCH_BLADE_EFFECTS

That works, just note that will probably not work so well with the Edit Mode / library styles so you’ll probably want to put some comments with that define in your prop.

1 Like