Question Load Plugin Presets via own Plugin

Nickster

New member
Messages
11
Reactions
11
Points
3
Hello,
Im writting my first plugin now and i have the following question:
Is it possible to load plugin presets via my own plugin?

On the plugin UI i select an atom. Then i would like to load a Plugin Preset for that selected atom.
I tried it over the MVRPluginManager but i cant find a method which allows me to load it.
The only thing i found was some PresetAction methods but i dont know if that are the right ones.
I also found the "CreatePlugin" method which creates an empty plugin in the atom. But i think thats the wrong way.

I hope somebody can help me.

Thank you.
 
you mean "Loading own jsoned pref file"?

You can Load and Save em from "/Saves/PluginData/yourname/something.json" with SuperController.singleton.LoadJSON(path) and SaveJSON(path)
json will be loaded as SimpleJSON.JSONNode

and Perhaps in your case you'd better make Person node in single file JSONNode.

you can check my plugin "CUAAutoFollow" source code.
(note Folder Creation Trick is given from Blazedust, not Mine :))
 
Last edited:
Upvote 0
Thanks for your reply.
But i mean loading a standard plugin preset.
Im now able to load it by MeshVR.PresetManager and with the the following methods:

LoadDefaultsPre();
customPath = "myPath";
LoadPreset();

This works fine if no preset was loaded before.
But if there is already a preset loaded manually, this methods dont load my preset. Instead the manually selected Preset is loaded.

@meshedvr Maybe you can tell me how it works?? Maybe its a bug?

@zgock I will check your code. It's really helpful to check as many plugins as possible.
I'm about to make a plugin for a simple UI which i will upload as soon as its finished and tested. This community is really amazing. And thanks to @meshedvr for this stunning application. I can only express my respect for this masterpiece???

And sorry for my bad english I'm a Unity developer from Germany. We have many words that are capitalized ?

Btw: I know this application less than 2 month and its the best thing I've ever had on my PC. And the best thing is, that the girlfriend knows it and is really interested in it. Thats the jackpot?

@meshedvr If you can spare your precious time, it would be nice if you could tell me if I can put a canvas behind the objects. I have already tried the different render modes and sorting layers. Unfortunately without success.
See the attached image.
 

Attachments

  • IMG_20220630_221720.jpg
    IMG_20220630_221720.jpg
    4.6 MB · Views: 0
Last edited:
Upvote 0
@SPQR I tried it again. But there is the same issue. It loads the correct plugins from the presets but not with its settings.
If i load the same preset manually it works fine.

Here is my code i used:
C#:
private void SetupPluginPreset(Atom atom, string presetName)
{
  PresetManager prem = atom.GetComponentsInChildren<MeshVR.PresetManager>().Where(pm => pm.storeFolderName == "Plugins").First();
  prem.presetName = presetName;
  prem.LoadPreset();
}

I dont know what im doing wrong.
 
Upvote 0
Back
Top Bottom