ShaderContract IEditorService.GetShader(int id) { AssetDatabase.Load(id); var shader = AssetDatabase.GetAsset <Shader>(id); ShaderContract sc = new ShaderContract(); sc.Name = shader.Name; sc.uniforms = new List <Tuple <string, string> >(); foreach (var u in shader.uniforms) { sc.uniforms.Add(new Tuple <string, string>(u.type.Name, u.name)); } return(sc); }
void Select(object sender, MouseButtonEventArgs e) { notifyChanges = false; var source = e.Source as FrameworkElement; var data = source.DataContext as Tuple <string, string, int>; currentAssetID = data.Item3; CurrentTexture = null; CurrentShader = null; if (data.Item2 == "Texture2D") { CurrentTexture = MainWindow.service.GetTexture(data.Item3); } else if (data.Item2 == "Shader") { CurrentShader = MainWindow.service.GetShader(data.Item3); } notifyChanges = true; }