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",
26 "blender": (2, 80, 0),
27 "location": "Info -> File Menu -> Project Folder",
28 "description": "Open the project folder in a file browser",
30 "doc_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/System/Project_Folder",
31 "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
37 from platform
import system
as currentOS
40 class ProjectFolder(bpy
.types
.Operator
):
41 """Open the Project Folder in a file Browser"""
42 bl_idname
= "file.project_folder"
43 bl_label
= "Project Folder"
46 def execute(self
, context
):
50 self
.report({'INFO'}, "No project folder yet")
53 bpy
.ops
.wm
.path_open(filepath
=path
)
59 filepath
= bpy
.data
.filepath
60 relpath
= bpy
.path
.relpath(filepath
)
61 path
= filepath
[0: -1 * (relpath
.__len
__() - 2)]
67 def menu_func(self
, context
):
69 ProjectFolder
.bl_idname
,
70 text
="Project Folder",
74 bpy
.utils
.register_class(ProjectFolder
)
75 bpy
.types
.TOPBAR_MT_file
.prepend(menu_func
)
78 bpy
.utils
.unregister_class(ProjectFolder
)
79 bpy
.types
.TOPBAR_MT_file
.remove(menu_func
)
81 if __name__
== "__main__":