Register VariantConverters to juce

is there a way to let juce see that I have a variantConverter defined for a type.
write now I have to use my custom VariantConverters like this

v.setProperty(IDs::nodeID,VariantConverter<juce::AudioProcessorGraph::NodeID>::toVar(this->pluginID), nullptr);

I have this defined in a file in my program like so

namespace juce {
    template<>
    struct VariantConverter<juce::AudioProcessorGraph::NodeID> final
    {
        using Type = String;

        static juce::AudioProcessorGraph::NodeID fromVar(const var& v)
        {
            if(v.isString())
            {
                return juce::AudioProcessorGraph::NodeID(static_cast<uint32_t>(int64(v)));
            }
            return {};
        }

        static var toVar(const AudioProcessorGraph::NodeID& id)
        {
            return String(id.uid);
        }
    };
}

but this obviously doesn’t allow the setProperty function to see it…

You need to declare your custom overload before including the bit of JUCE that needs to make use of it. I.e.

#include "MyCustomVariantConverters.h"
#include <juce_data_structures/juce_data_structures.h>

that makes sense. I guess I’ll have to actually stop using the JuceHeader and update my program to only include the necessary headers

It should work the same with <JuceHeader.h> - just make sure your overloads are declared before including that.

That’s what I tried but it didn’t seem to work. Would it have to be included before the first use of the <JuceHeader.h>? When I threw the "VariantConverters.h" before the <JuceHeader.h>in the file where I used the that converter it still didn’t seem to find it.

I may have to change the way I include the JuceHeader throughout the whole program to get that to register? Would it have to go before the first include of the JuceHeader?

I’ll get around to find a solution soon! I have another version of my project template for another project where I did remove use of the JuceHeader which I was planning to merge with my current project soon so maybe this is reason enough to get on with that

still can’t seem to get this to work. Wonder what I’m doing wrong here