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