make python3.3 compatible, __class__ is no longer in the class methods namespace.
This commit is contained in:
parent
897cbe4b42
commit
dbc9e36f72
@ -29,7 +29,7 @@ op_as_string = ops_module.as_string
|
||||
op_get_rna = ops_module.get_rna
|
||||
|
||||
|
||||
class bpy_ops(object):
|
||||
class BPyOps(object):
|
||||
'''
|
||||
Fake module like class.
|
||||
|
||||
@ -42,7 +42,7 @@ class bpy_ops(object):
|
||||
'''
|
||||
if module.startswith('__'):
|
||||
raise AttributeError(module)
|
||||
return bpy_ops_submodule(module)
|
||||
return BPyOpsSubMod(module)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
@ -67,7 +67,7 @@ class bpy_ops(object):
|
||||
return "<module like class 'bpy.ops'>"
|
||||
|
||||
|
||||
class bpy_ops_submodule(object):
|
||||
class BPyOpsSubMod(object):
|
||||
'''
|
||||
Utility class to fake submodules.
|
||||
|
||||
@ -84,7 +84,7 @@ class bpy_ops_submodule(object):
|
||||
'''
|
||||
if func.startswith('__'):
|
||||
raise AttributeError(func)
|
||||
return bpy_ops_submodule_op(self.module, func)
|
||||
return BPyOpsSubModOp(self.module, func)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
@ -103,7 +103,7 @@ class bpy_ops_submodule(object):
|
||||
return "<module like class 'bpy.ops.%s'>" % self.module
|
||||
|
||||
|
||||
class bpy_ops_submodule_op(object):
|
||||
class BPyOpsSubModOp(object):
|
||||
'''
|
||||
Utility class to fake submodule operators.
|
||||
|
||||
@ -151,7 +151,7 @@ class bpy_ops_submodule_op(object):
|
||||
self.func = func
|
||||
|
||||
def poll(self, *args):
|
||||
C_dict, C_exec = __class__._parse_args(args)
|
||||
C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
|
||||
return op_poll(self.idname_py(), C_dict, C_exec)
|
||||
|
||||
def idname(self):
|
||||
@ -170,16 +170,16 @@ class bpy_ops_submodule_op(object):
|
||||
wm = context.window_manager
|
||||
|
||||
# run to account for any rna values the user changes.
|
||||
__class__._scene_update(context)
|
||||
BPyOpsSubModOp._scene_update(context)
|
||||
|
||||
if args:
|
||||
C_dict, C_exec = __class__._parse_args(args)
|
||||
C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
|
||||
ret = op_call(self.idname_py(), C_dict, kw, C_exec)
|
||||
else:
|
||||
ret = op_call(self.idname_py(), None, kw)
|
||||
|
||||
if 'FINISHED' in ret and context.window_manager == wm:
|
||||
__class__._scene_update(context)
|
||||
BPyOpsSubModOp._scene_update(context)
|
||||
|
||||
return ret
|
||||
|
||||
@ -208,4 +208,4 @@ class bpy_ops_submodule_op(object):
|
||||
return "<function bpy.ops.%s.%s at 0x%x'>" % \
|
||||
(self.module, self.func, id(self))
|
||||
|
||||
ops_fake_module = bpy_ops()
|
||||
ops_fake_module = BPyOps()
|
||||
|
@ -315,7 +315,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator):
|
||||
|
||||
@property
|
||||
def preset_subdir(self):
|
||||
return __class__.operator_path(self.operator)
|
||||
return AddPresetOperator.operator_path(self.operator)
|
||||
|
||||
@property
|
||||
def preset_values(self):
|
||||
|
@ -986,7 +986,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
split.label(text="Warning:")
|
||||
split.label(text=' ' + info["warning"], icon='ERROR')
|
||||
|
||||
user_addon = __class__.is_user_addon(mod, user_addon_paths)
|
||||
user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
|
||||
tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon)
|
||||
|
||||
if tot_row:
|
||||
@ -1136,7 +1136,7 @@ class WM_OT_addon_install(bpy.types.Operator):
|
||||
|
||||
if self.overwrite:
|
||||
for f in file_to_extract.namelist():
|
||||
__class__._module_remove(path_addons, f)
|
||||
WM_OT_addon_install._module_remove(path_addons, f)
|
||||
else:
|
||||
for f in file_to_extract.namelist():
|
||||
path_dest = os.path.join(path_addons, os.path.basename(f))
|
||||
@ -1160,7 +1160,7 @@ class WM_OT_addon_install(bpy.types.Operator):
|
||||
path_dest = os.path.join(path_addons, os.path.basename(pyfile))
|
||||
|
||||
if self.overwrite:
|
||||
__class__._module_remove(path_addons, os.path.basename(pyfile))
|
||||
WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile))
|
||||
elif os.path.exists(path_dest):
|
||||
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
|
||||
return {'CANCELLED'}
|
||||
@ -1225,7 +1225,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
|
||||
return None, False
|
||||
|
||||
def execute(self, context):
|
||||
path, isdir = __class__.path_from_addon(self.module)
|
||||
path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
|
||||
if path is None:
|
||||
self.report('WARNING', "Addon path %r could not be found" % path)
|
||||
return {'CANCELLED'}
|
||||
@ -1245,7 +1245,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
|
||||
# lame confirmation check
|
||||
def draw(self, context):
|
||||
self.layout.label(text="Remove Addon: %r?" % self.module)
|
||||
path, isdir = __class__.path_from_addon(self.module)
|
||||
path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
|
||||
self.layout.label(text="Path: %r" % path)
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
@ -234,7 +234,7 @@ class InputKeyMapPanel:
|
||||
for pname, value in properties.bl_rna.properties.items():
|
||||
if pname != "rna_type" and not properties.is_property_hidden(pname):
|
||||
if isinstance(value, bpy.types.OperatorProperties):
|
||||
__class__.draw_kmi_properties(box, value, title=pname)
|
||||
InputKeyMapPanel.draw_kmi_properties(box, value, title=pname)
|
||||
else:
|
||||
flow.prop(properties, pname)
|
||||
|
||||
@ -325,7 +325,7 @@ class InputKeyMapPanel:
|
||||
# Operator properties
|
||||
props = kmi.properties
|
||||
if props is not None:
|
||||
__class__.draw_kmi_properties(box, props)
|
||||
InputKeyMapPanel.draw_kmi_properties(box, props)
|
||||
|
||||
# Modal key maps attached to this operator
|
||||
if not km.is_modal:
|
||||
|
@ -2410,7 +2410,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
import rna_prop_ui
|
||||
member = __class__._active_context_member(context)
|
||||
member = VIEW3D_PT_context_properties._active_context_member(context)
|
||||
|
||||
if member:
|
||||
# Draw with no edit button
|
||||
|
@ -465,7 +465,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if not context.particle_edit_object:
|
||||
@ -686,7 +686,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
tex_slot = brush.texture_slot
|
||||
|
||||
@ -785,7 +785,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
col = layout.column(align=True)
|
||||
@ -820,7 +820,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
image_paint = context.image_paint_object
|
||||
|
||||
@ -1003,7 +1003,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if brush is None: # unlikely but can happen
|
||||
|
Loading…
x
Reference in New Issue
Block a user