Computed Properties/Dependable Expressions

Computed properties are similiar to pure dependebles, but are only read-only, as they implement an expression, that is dependeble on a dependeble object, also forcing a recook of parameters that refference them. Idealy they would implement a decorator, syntax:

class myExtension:
	def __init__(self, ownerComp):
		self.dependeble_value = tdu.Dependable( some_value )
	def Multiplied(self):
		return self.dependeble_value * 3

Changes to self.dependeble_value should force a trigger to ops refferencing the Multiplied member.

I suppose it is possible to implement this in the new experimental using the callbacks for the tdu.Dependeble object, where the decorator creates a proxy dependable object and implements a callback on self.dependable_object, setting the value of the proxy object.

1 Like

Much wanted feature from my side too!

This should just work. Does it not? If I understand correctly, works in the attached.
testdepend.toe (5.1 KB)

As longs as the function is refferencing a dependable value, yes, the properties are dependable.
Not sure if it always has been the case though but see this RFE as resolved.

This is exactly the magic of the Dependency object. Whenever the .val changes, any pars referencing it (or evalDAT etc) will update automatically.

Non-dependable values will never and can never have this effect. The dependency system is the part of TD that allows for smart cooking/updating of values.

Sorry, misunderstood the initial request a bit.
I was imagining ditching the need for an explicit dependable attribute, and instead having only a dependable property decorator.

You could make your own decorator for that I think