# Loosing ValueTree Entries

**URL:** <https://forum.juce.com/t/loosing-valuetree-entries/42484>\
**Category:** General JUCE discussion\
**Created:** [October 29, 2020, 7:44pm UTC](https://forum.juce.com/t/loosing-valuetree-entries/42484 "2020-10-29T19:44:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tobante/32/9644_2.png) [@tobante](https://forum.juce.com/u/tobante)\
**Post date:** [October 29, 2020, 7:44pm UTC](https://forum.juce.com/t/loosing-valuetree-entries/42484/1 "2020-10-29T19:44:16Z")

</div>

Hi,

I’m playing around with the examples from [David Rowland - Using JUCE value trees and modern C++ to build large scale applications (ADC’17)](https://youtu.be/3IaMjH5lBEY). I’ve create a `ModulatorList` class which inherits from Davids `ValueTreeObjectList`. The code example below shows the constructor of the Plug-In, where I’m adding two new modulators to the tree. The ` DBG(apvts_.state.toXmlString());` statement correctly prints a XML document with 2 modulators added.

If I do the same statement inside my editor constructor: ` DBG(processor.GetState().state.toXmlString());` it only prints the main identifier & the plug-in parameters added via the `ParameterLayout`. The added modulators are no longer visible.

Any ideas how this could happen?

**Processor**

```cpp
class AudioPlugin
{
public:
    AudioPlugin()
        : state_(*this, &undoManager_, "AudioPlugin",
                 {std::make_unique<juce::AudioParameterFloat>("gain", "Gain", 0.0f, 2.0f, 1.0f)})
        , modList_(apvts_.state)
    {
        ValueTreeUtils::CreateUuidProperty(apvts_.state);
        apvts_.state.addChild(juce::ValueTree {ids::CONST_MODULATOR}, -1, nullptr);
        apvts_.state.addChild(juce::ValueTree {ids::LFO_MODULATOR}, -1, nullptr);

        jassert(modList_.objects.size() == 2);
        DBG(apvts_.state.toXmlString());
    }

    auto GetState() -> juce::AudioProcessorValueTreeState& { return apvts_; }
    auto GetState() const -> juce::AudioProcessorValueTreeState const& { return apvts_; }

    // ...

private:
    juce::AudioProcessorValueTreeState apvts_;
    mc::ModulatorList modList_;

};

```

**Editor**

```cpp
// ...
DBG(processor.GetState().state.toXmlString());
// ...

```

---

<div class="post-metadata">

**Author:** ![tobante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tobante/32/9644_2.png) [@tobante](https://forum.juce.com/u/tobante)\
**Post date:** [October 29, 2020, 9:11pm UTC](https://forum.juce.com/t/loosing-valuetree-entries/42484/2 "2020-10-29T21:11:20Z")

</div>

Ok I was just being really stupid. The state was reloaded from disk via `getStateInformation` & `setStateInformation`. It overwrote the dummy data I created in the constructor.

Problems solved for now.
