Joske
(Joske)
September 10, 2010, 8:29am
1
Hallo,
I try to acces external objects in the draw() function of a selfmade panel.
However when I do so all those objects except Operators are set to ‘None’.
The following code will thus give an error:
import bpy
class a():
@classmethod
def methodA():
print("a")
class b(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = 'test'
def draw(self,context):
a.methodA()
that ‘NoneType’ does not have the methodA
Does anyone have the same problem and solved it?
My Blender version is: 2.53.1 r318127
many thanks
import bpy
class a():
def methodA(self):
print("a")
class b(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = 'test'
@classmethod
def poll(self,context):
return True
def draw(self, context):
a().methodA()
PKHG
(PKHG)
September 10, 2010, 11:18pm
3
Vista, SVN 31853
If you add the decorator: @classmethod
change your code to:
class a():
@classmethod
def methodA(<b>self</b>):
print("a")
class b(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = 'test'
def draw(self,context):
a.methodA()
gibberish
(gibberish)
September 11, 2010, 7:24am
4
I had the same problem with r31827, but I just updated to r31880 and the issue seems fixed there.
Joske
(Joske)
September 13, 2010, 1:30am
5
@Uncle Entity & PKHG
Both solutions still give the same problem:
AttributeError: ‘NoneType’ object has no attribute ‘methodA’
@gibberisch
I recently updated blender to 2.54.0 r31896
The problem is solved on the laptop of a friend of mine who runs ubuntu.
But on my own laptop, a macbook with leopard, the problem persists.
PKHG
(PKHG)
September 13, 2010, 3:31am
6
import bpy #should be added in front of my example
Vista W32 SVN31894, no problem, prints a lot of ‘a’ …
Joske
(Joske)
September 13, 2010, 3:51am
7
yh I did test it with the import.
It seems that the error is only on OS X. I think I will work on a virtual machine until they fixe it.