From a6f13f9d7bfef7020d43cb0a8058753e6d7a128d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 9 Aug 2010 01:37:09 +0000 Subject: poll() as a python '@staticmethod' was too limiting and didnt allow useful base class poll functions in many cases. now rna functions that dont have a 'self' are automatically assumed '@classmethods'. de-duplicated poll functions and made some minor tweaks too. --- release/scripts/templates/operator.py | 4 ++-- release/scripts/templates/operator_simple.py | 4 ++-- release/scripts/templates/operator_uv.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'release/scripts/templates') diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py index 9a875c6899e..5a525784b51 100644 --- a/release/scripts/templates/operator.py +++ b/release/scripts/templates/operator.py @@ -23,8 +23,8 @@ class ExportSomeData(bpy.types.Operator): description="Choose between two items", default='OPT_A') - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): return context.active_object != None def execute(self, context): diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index 55afe586a1e..853bfa666eb 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -9,8 +9,8 @@ class SimpleOperator(bpy.types.Operator): bl_idname = "object.simple_operator" bl_label = "Simple Object Operator" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): return context.active_object != None def execute(self, context): diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py index f27f5300857..46ce15f090d 100644 --- a/release/scripts/templates/operator_uv.py +++ b/release/scripts/templates/operator_uv.py @@ -30,8 +30,8 @@ class UvOperator(bpy.types.Operator): bl_idname = "uv.simple_operator" bl_label = "Simple UV Operator" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj and obj.type == 'MESH') -- cgit v1.2.3