Asset Pipeline v2 #145
@ -15,7 +15,16 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
|||||||
_name = None
|
_name = None
|
||||||
_dir = None
|
_dir = None
|
||||||
|
|
||||||
# TODO add poll method to check if name and directory are valid before running
|
@classmethod
|
||||||
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
|
new_asset = context.scene.asset_new
|
||||||
|
if new_asset.name == "" or new_asset.dir == "":
|
||||||
|
cls.poll_message_set("Asset Name and Directory must be valid")
|
||||||
|
return False
|
||||||
|
if os.path.exists(os.path.join(new_asset.dir, new_asset.name)):
|
||||||
|
cls.poll_message_set("Asset Folder already exists")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context):
|
def execute(self, context: bpy.types.Context):
|
||||||
# New File is Createed so Props need to be saved
|
# New File is Createed so Props need to be saved
|
||||||
|
Loading…
Reference in New Issue
Block a user