Thanks for the correction.
You can wrap RNA instances in your own classes and pass them around.
>>> class MyDecorObject(bpy.types.Object):
... def my_prop(self):
... return "Foo"
>>> o = MyDecorObject(bpy.context.object)
But this isn't done anywhere in Blender AFAIK
On Mon, Mar 12, 2018 at 10:31 PM, Toni Alatalo <t...@playsign.net> wrote:
> Python decorators do not implement the Decorator Pattern, they are
> different things. Wikipedia explains it like this:
> """ https://en.wikipedia.org/wiki/Decorator_pattern#Python
> Please do not confuse the Decorator Pattern (or an implementation of
> this design pattern in Python - as the above example) with Python
> Decorators, a Python language feature. They are different things.
> Second to the Python Wiki:
> The Decorator Pattern is a pattern described in the Design Patterns
> Book. It is a way of apparently modifying an object's behavior, by
> enclosing it inside a decorating object with a similar interface. This
> is not to be confused with Python Decorators, which is a language
> feature for dynamically modifying a function or class."""
> I'm not surprised if that pattern, nor other from the OO patterns
> movement, is not used in Blender at all. Curious to hear if it is,
> though :)
> On Mon, Mar 12, 2018 at 7:25 AM, Campbell Barton <ideasma...@gmail.com> wrote:
>> Hi, Blender's built in scripts don't make much use of decorators
>> they are used here though:
>> On Mon, Mar 12, 2018 at 11:33 AM, Brad Eric hollister
>> <behol...@soe.ucsc.edu> wrote:
>>> I’m preparing a short talk on the decorator pattern for classroom
>>> I’d like to use an example from Blender. Are there any such examples in the
>>> Bf-committers mailing list
>> - Campbell
>> Bf-committers mailing list
> Bf-committers mailing list
Bf-committers mailing list