V1 using your own resources

@Vortico what do you have to do to get your own resources on your plugins? if I do

namespace rack{
   namespace myfile{
    constructors here{};
}
}

↑ This gives nothing but errors. But if its like so:

namespace rack{
   //namespace myfile{
    constructors here{};
//}
}

Using a componentlibrary resource e.g. a port along side my own res it shows no issues or errors for my res but my own components do not show in rack or the module browser. The componentlibrary res shows in both.

I’m not sure i understand what you are trying to do.

This is a custom port i used to use. This code is the entire thing.

struct sub_port : SVGPort {
	sub_port() {
		setSVG(SVG::load(assetPlugin(plugin, "res/Components/sub_port.svg")));
	}
};

And this is code that put one of these ports on the module

addInput(Port::create<sub_port>(Vec(4,19 + offset), Port::INPUT, module, 2));

This is code for a version 0.6 module, but i don’t think its changed very much

I have them in the code already rack does not load them.

struct BarkOutPort350 : app::SvgPort {
			BarkOutPort350() {
				setSvg(APP->window->loadSvg(asset::system("res/components/BarkOutPort350.svg")));
			}
		};
this will work ↓ componentlibrary.hpp
addInput(createInput<PJ301MPort>(Vec(13.28f, rackY - 375.f), module, TrimLFO::FM1_INPUT));
this will not ↓ mycomponents.hpp
addOutput(createOutput<BarkOutPort350>(Vec(13.28f, rackY - 52.35f), module, TrimLFO::SIN_OUTPUT));

Are the ports working, but invisible?
What is the actusl path to your BarkOutPort350.svg?

solution!

using namespace myfile; in the .cpp

Although I changed a couple of other things so they might have effected also

@Vortico Just wondering what should be used:

a)

sw->setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/components/mycomponent.svg")));

b)

sw->setSvg(APP->window->loadSvg(asset::system(pluginInstance, "res/components/mycomponent.svg")));

c)

sw->setSvg(APP->window->loadSvg(asset::user(pluginInstance, "res/components/mycomponent.svg")));

or combo a,b or c with x)

sw->setSvg(APP->window->loadSvg(asset::[[[a,b,c above]]]("res/components/mycomponent.svg")));

From the documentation for asset::plugin

/** Returns the path of a resource in the plugin's folder. Should only read files from this location. */
std::string plugin(plugin::Plugin *plugin, std::string filename);

Your BarkOutPort350.svg file is in your plugin folder, not in the system or user folder. I also noticed that you’re adding things to the rack namespace above. There should be no reason to ever do that. For plugins, it’s perfectly fine just to define everything in the root namespace.

Got you, using plugin atm moment. Cheers!

Hi, sorry to Hijack and nub; where is the documentation for asset::plugin?

Rack/Include/asset.hpp

cheers