Animation_nodes: Allow more socket types for input based caching

Created on 2 Feb 2020  路  7Comments  路  Source: JacquesLucke/animation_nodes

Problem

Right now only a handful of socket types are marked as comparable, which hinders the caching mechanism for loops.
I'd suggest that instead of comparability, equality should be checked. (Which would require adding that property).

Unrelated, the Vector socket could become comparable (compare the length)

Why should this be changed

When using caching you can often have your node tree set to evaluate always and still have an interactive scene.

Workaround

Convert the data into something that is comparable (in case of vectors for example into 3 floats), and then convert them back inside the loop. Unfortunately that won't really work for lists

Most helpful comment

Implemented in 5e049b8.

All 7 comments

Can you provide a practical instance of the problem? As far as I know, this should be related to the storability of types as opposed to their comparability.

The vector socket for example doesn't work with caching.

Storability is always needed for caching, input based caching (which I was referring to) needs comparability aswell.
This is responsible snippet from invoke_subprogram.py

@property
    def canCache(self):
        if self.cacheType == "DISABLED": return True
        if self.cacheType in ("ONE_TIME", "FRAME_BASED") and self.isOutputStorable: return True
        if self.cacheType == "INPUT_BASED" and self.isInputComparable and self.isOutputStorable: return True
        return False

I see, I thought you were talking about the outputs. Let me take a look.

Implemented in 5e049b8.

Hmm, that doesn't seem to have solved the problem.

_Example:_
image

Seems to be working fine here. Did you install the daily build?

Oooops, I forgot to build after pulling. My bad!

Was this page helpful?
0 / 5 - 0 ratings