Closed fnio5 closed 1 year ago
Do you have any other feedback about what is missing for Linux compatibility? I’d love to see that be a thing.
Main problem with linux and mac is going to be the paths so I would suggest maybe using the FileInfo class more and Path.Combine() to avoid any pitfalls instead of doing any string manipulations. Other than that not sure if its a linux thing but there was a thing with the PreLegion custom function not being linked up in the shader by default I though it was broken but it just needed to to be linked up.
but there was a thing with the PreLegion custom function not being linked up in the shader by default I though it was broken but it just needed to to be linked up.
It was the same for me. I have no prior experience with Shader Graph so didn't dare assume it was wrong in this repo, but I guess it's fair to assume it is then. I can make a PR for this sooner or later, unless you beat me to it :)
Here is a example change that might work.
public static M2 ReadMetadataFor(string path)
{
string pathToMetadata = Path.GetDirectoryName(path) + "/" + Path.GetFileNameWithoutExtension(path) + ".json";
if (!File.Exists(pathToMetadata))
{
return null;
}
var sr = new StreamReader(Application.dataPath.Replace("Assets", "") + pathToMetadata);
var fileContents = sr.ReadToEnd();
sr.Close();
return JsonConvert.DeserializeObject<M2>(fileContents);
}
changed to
public static M2 ReadMetadataFor(FileInfo modelFile)
{
FileInfo jsonFile = new FileInfo(Path.ChangeExtension(modelFile.FullName, ".json"));
if (!jsonFile.Exists)
{
return null;
}
using (var sr = jsonFile.OpenText())
{
return JsonConvert.DeserializeObject<M2>(sr.ReadToEnd());
}
}
Changed some of the hard coded directory separator to Path.DirectorySeparatorChar, now it partially work on linux also.