2021-10-18 17:05:56 +02:00
import bpy
from bpy . props import ( FloatProperty ,
BoolProperty ,
EnumProperty ,
StringProperty ,
IntProperty ,
PointerProperty )
def get_addon_prefs ( ) :
prefs = bpy . context . preferences
return prefs . addons [ __package__ ] . preferences
class myaddonPrefs ( bpy . types . AddonPreferences ) :
bl_idname = __name__ . split ( ' . ' ) [ 0 ]
root_default : bpy . props . StringProperty (
name = ' Default Root ' ,
description = " Default root folder path when using export to Zip " ,
subtype = ' DIR_PATH ' ,
default = ' ' )
2022-01-07 00:08:18 +01:00
use_env_root : BoolProperty (
name = " Use Environement Root " ,
description = " Use root path specified by environnement keys at startup \n Using key ' ZIP_ROOT ' or ' PROJECT_ROOT ' if exists (priority to key ZIP_ROOT if both are set) \n Else always use prefs. " ,
default = True ,
)
2021-10-18 17:05:56 +02:00
def draw ( self , context ) :
layout = self . layout
col = layout . column ( )
col . label ( text = ' Export to Zip preferences: ' )
col . prop ( self , ' root_default ' )
col = layout . column ( )
col . label ( text = ' If specified, will be the default root folder path when using export to Zip ' )
col . label ( text = ' Typically the root folder of the current project ' )
2022-01-07 00:08:18 +01:00
col . prop ( self , ' use_env_root ' )
2021-10-18 17:05:56 +02:00
### --- REGISTER ---
classes = (
myaddonPrefs ,
)
def register ( ) :
for cls in classes :
bpy . utils . register_class ( cls )
def unregister ( ) :
for cls in reversed ( classes ) :
bpy . utils . unregister_class ( cls )