1 # system_project_folder.py (c) 2010 Dany Lebel (Axon_D)
3 # ***** BEGIN GPL LICENSE BLOCK *****
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # ***** END GPL LICENCE BLOCK *****
23 "name": "Project Folder",
24 "author": "Dany Lebel (Axon_D), Spirou4D",
28 "location": "Info -> File Menu -> Project Folder",
29 "description": "Open the project folder in a file browser",
31 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/System/Project_Folder",
32 "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=25910",
38 from platform import system as currentOS
41 class ProjectFolder(bpy.types.Operator):
42 """Open the Project Folder in a file Browser"""
43 bl_idname = "file.project_folder"
44 bl_label = "Project Folder"
47 def execute(self, context):
51 self.report({'INFO'}, "No project folder yet")
54 bpy.ops.wm.path_open(filepath=path)
60 filepath = bpy.data.filepath
61 relpath = bpy.path.relpath(filepath)
62 path = filepath[0: -1 * (relpath.__len__() - 2)]
68 def menu_func(self, context):
70 ProjectFolder.bl_idname,
71 text="Project Folder",
75 bpy.utils.register_class(ProjectFolder)
76 bpy.types.INFO_MT_file.prepend(menu_func)
79 bpy.utils.unregister_class(ProjectFolder)
80 bpy.types.INFO_MT_file.remove(menu_func)
82 if __name__ == "__main__":