everyone! I've run into an issue with controlling world shader with properties. Thus far I've been using a method where I check when I update a property and then overwrite the default value for a value node in the world node tree. This is because Attribute node with "Object" type doesn't work with world shaders. This, however, leads to several limitations. Firstly, it appears that my method has significant performance issues on larger node trees compared to how attribute node would work. This isn't the main problem and is not what I need solution for, just thought it's worth mentioning. The other big problem is handling animations, which is what I need a solution for here. The method that I'm currently using in the addon is quite hacky. I am using frame change handlers to check when frame changes and I need to update an animated property's value in the shader. This, however, comes with a few drawbacks.
- Animation performance is abysmally low. Since the node tree happens to be quite big, animating just a few values can sometimes drop the playback speed down to sub 10 FPS.
- This method is not very robust and can simply not work in some cases, namely when offloading the rendering task to a renderfarm. Since the animation requires addon to work (as otherwise there is no relation between the property values and the node tree), if the renderfarm does not have given addon present and enabled, the animated values will simply stay static on renderfarm side.
So what kind of solution I am looking for? Well, ideally I'd love to see Attribute node with "Object" type working in world shader nodes. However, since it's not a thing, I am wondering if it's somehow possible to copy all of the animation data from a property into a node's field through Python. This would mean that whenever you change a property's value or animate it, the nodes within the shader that contain the same value would get the same treatment. As such, I wouldn't need to use a frame change handler to update their value, significantly reducing performance issues and allowing the animations to work independently of the addon once they've been created.