Renaming addon to fit convention of other addons
[blender-addons-contrib.git] / object_batch_rename_datablocks.py
index 1be2c948d3a7a52b02574df39508037f98e0e90f..7281b998456448bb6c2c4cfc6a3ff771813e0166 100644 (file)
 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ##### END GPL LICENSE BLOCK #####
-#######################################################################
-bl_addon_info = {
+
+bl_info = {
     "name": "Batch Rename Datablocks",
     "author": "tstscr",
     "version": (1, 0),
-    "blender": (2, 5, 5),
-    "api": 32013,
-    "location": "use the search :)",
+    "blender": (2, 5, 9),
+    "location": "Search > (rename)",
     "description": "Batch renaming of datablocks (e.g. rename materials after objectnames)",
     "warning": "",
-    "wiki_url": "",
-    "tracker_url": "",
-    "category": "USER"}
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts/Object/Batch_Rename_Datablocks",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=25242",
+    "category": "Object"}
+
 
-#######################################################################
 import bpy
 from bpy.props import *
 
@@ -56,7 +57,8 @@ def get_name(self, ob):
         return self.rename_custom
     
     
-def rename_datablocks_main(self, obs, context):
+def rename_datablocks_main(self, context):
+    obs = context.selected_editable_objects
     for ob in obs:
         name = get_name(self, ob)
         
@@ -88,7 +90,7 @@ def rename_datablocks_main(self, obs, context):
                                 m_slot.material.name = name
 
 class OBJECT_OT_batch_rename_datablocks(bpy.types.Operator):
-    '''Batch rename Datablocks'''
+    """Batch rename Datablocks"""
     bl_idname = "object.batch_rename_datablocks"
     bl_label = "Batch Rename Datablocks"
     bl_options = {'REGISTER', 'UNDO'}
@@ -100,7 +102,6 @@ class OBJECT_OT_batch_rename_datablocks(bpy.types.Operator):
                     ('Custom', 'Custom', 'Custom')
                     ]
     naming_base = EnumProperty(name='Name after:',
-                                default='',
                                 items=name_origins)
     rename_custom = StringProperty(name='Custom Name',
                                 default='New Name',
@@ -130,7 +131,7 @@ class OBJECT_OT_batch_rename_datablocks(bpy.types.Operator):
                                 default=True,
                                 description='Prefix Material Names')
 
-    dialog_width = 250
+    dialog_width = 260
 
     def draw(self, context):
         layout = self.layout
@@ -166,8 +167,7 @@ class OBJECT_OT_batch_rename_datablocks(bpy.types.Operator):
 
     def execute(self, context):
 
-        obs = context.selected_objects
-        rename_datablocks_main(self, obs, context)
+        rename_datablocks_main(self, context)
         
         return {'FINISHED'}
 
@@ -178,8 +178,10 @@ class OBJECT_OT_batch_rename_datablocks(bpy.types.Operator):
         
         
 def register():
+    bpy.utils.register_module(__name__)
     pass
 def unregister():
+    bpy.utils.unregister_module(__name__)
     pass
-if __name__ = '__main__':
+if __name__ == '__main__':
     register()