有没有办法在Blend中设置自定义着色器效果属性?

时间:2013-09-10 07:25:33

标签: wpf animation shader expression-blend

在Blend UI上无法看到自定义着色器属性,如下图所示:

enter image description here

通过查看DropShadowEffect(它是WPF的一部分)的来源,可动画属性的定义如下:

DropShadowEffect.ShadowDepthProperty = Animatable.RegisterProperty(...);

不幸的是, Animatable.RegisterProperty 方法内部禁止这样做,唯一可行的方法是手动编写故事板。

是否有方法或库可以让自定义着色器恢复此功能?

1 个答案:

答案 0 :(得分:0)

找到问题的根源:着色器的URI不完整!

应该是这样的:

var pixelShader = new PixelShader();
pixelShader.UriSource = new Uri(@"pack://application:,,,/YourAssembly;component/YourEffect.ps", UriKind.Absolute);

微妙:不要忘记@

参考:

https://stackoverflow.com/a/13112241/361899

属性现在又回来了:)

enter image description here

注意:不再需要所有以前的问题(动画)。

相关问题