VCV-Rack-Plugins icon indicating copy to clipboard operation
VCV-Rack-Plugins copied to clipboard

Graphics Problems

Open lnikj opened this issue 8 years ago • 18 comments

OS X 10.11.6 Rack 0.4.0

Many thanks for this. There is a problem in the mac build though with the graphics. Wrong SVG path?

screenshot_14

Other than that, just a couple of warnings:

src/CLog.cpp:114:14: warning: format string is not a string literal (potentially insecure) [-Wformat-security] fprintf( fp,(char*)buffer.c_str() ); ^ ~~~~~~~~~~~~~~ src/CLog.cpp:114:14: note: treat the string as an argument to avoid this fprintf( fp,(char*)buffer.c_str() ); ^ "%s", src/CLog.cpp:142:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] fprintf( fp, (char*)buffer.c_str() ); ^ ~~~~~~~~~~~~~~ src/CLog.cpp:142:15: note: treat the string as an argument to avoid this fprintf( fp, (char*)buffer.c_str() ); ^ "%s", 2 warnings generated.

lnikj avatar Oct 31 '17 08:10 lnikj

Here is a build for mac with the correct paths:

VCV-Rack-Plugins.zip

lnikj avatar Oct 31 '17 12:10 lnikj

This fixes the SVG links:

sed -i - 's//mschack///VCV-Rack-Plugins//g' src/mscHack_Controls.hpp

The Makefile needs to be:

SOURCES = $(wildcard src/*.cpp)

include ../../plugin.mk

dist: all mkdir -p dist/VCV-Rack-Plugins cp LICENSE* dist/VCV-Rack-Plugins/ cp plugin.* dist/VCV-Rack-Pluginsk/ cp -R res dist/VCV-Rack-Plugins/

lnikj avatar Oct 31 '17 12:10 lnikj

Thank you very much. I am not as familiar with the MAC stuff. Will the make files be different on MAC / Windows? As for the log stuff I should just remove it.

mschack avatar Oct 31 '17 13:10 mschack

The only problem bar the links in the Makefile is this:

mkdir -p dist/mscHack cp LICENSE* dist/mscHack/

The mac shell wants those commands on a separate line.

I'm sure that will be fine in Windows?

lnikj avatar Oct 31 '17 14:10 lnikj

Also a question I have, is it possible to build for MAC in Windows?

mschack avatar Oct 31 '17 14:10 mschack

Sorry, but that binary IS NOT WORKING. I don't understand why but I have everything working fine in my source compiled 0.4.0, but it does not work when compiled into a binary distribution.

I will look again later.

lnikj avatar Oct 31 '17 14:10 lnikj

Ok thanks.

mschack avatar Oct 31 '17 14:10 mschack

The problem is that in the windows version resources go in Rack/plugin/this.plugin/res/ but on a Mac they go into ~/Documents/Rack/plugin/this.plugin/res/.

That changed in 0.4.0 iirc. I don't know how to fix it.

lnikj avatar Oct 31 '17 14:10 lnikj

So the problem is the plugin is searching the wrong folder? This would require a code change for the MAC plugin?
Autodaf also posted a link to the MAC build. I will ask him if he had any issues.

mschack avatar Oct 31 '17 16:10 mschack

Now that I look at your screenshot it is loading the square buttons.

mschack avatar Oct 31 '17 16:10 mschack

I should say I am not a dev, just somebody with a bit of Unix sysadmin experience a decade ago.

I have looked through your source and compared it to that of others and can't see anything obvious.

What I don't understand is where the code is that moves the plugin and resource files to the correct location on a Mac.

I presume is it something handled in the call to ../../plugin.mk from Rack itself. If it is then I don't understand why it should be handling your files differently.

A bit stuck at the moment.

lnikj avatar Oct 31 '17 17:10 lnikj

The only obvious difference I can find is that in other people's modules when loading SVG assets their call would be to 'res/mschack_screw.svg', whereas yours is to 'plugins/mschack/res/mschack_screw.svg'.

I was able to get your module up and running on my Mac with my sed command to replace 'mschack' with 'VCV-Rack-Plugins' but, as noted, this works in a source build but not when copied across to a binary distro.

If i remove the path 'plugins/mschack/' to give you the same format as other people then the resulting build loses the graphics both locally and in the binary.

I don't know if these observations are helping at all?

lnikj avatar Oct 31 '17 18:10 lnikj

I think I have a working Mac version compatible with 0.4.0 if anyone wants to cross-check? mschack.zip

metaphorz avatar Nov 13 '17 18:11 metaphorz

mscHack_Controls.hpp needed to be changed, but to where the code looks like this (notice the AssetPlugin argument structure):

//----------------------------------------------------- // Procedure: MySquareButton // //----------------------------------------------------- struct MySquareButtonSmall : SVGSwitch, MomentarySwitch { MySquareButtonSmall() { addFrame(SVG::load(assetPlugin(plugin,"res/mschack_square_button.svg"))); sw->wrap(); box.size = Vec(9, 9); } };

I am attaching the new one

mscHack_Controls.hpp.zip

metaphorz avatar Nov 13 '17 18:11 metaphorz

Yes. Working here. Nice one!

lnikj avatar Nov 13 '17 19:11 lnikj

@mschack have you fixed your source code as above? In theory this fix should work for windows or no?

metaphorz avatar Nov 16 '17 02:11 metaphorz

If I change it on Windows it can't find the resources. Right now this seems to be a MAC issue only. I will at least put a define for the location at the top of the file so it is easy to change.

mschack avatar Nov 16 '17 13:11 mschack

Ok. I don’t know enough about how other devs manage multiple platform comparability. I’d like to believe that there is one uniform way of specifying SVG file assets that is platform independent.

metaphorz avatar Nov 16 '17 20:11 metaphorz