From d20a7d2198060c28c53f80477443a74578b1368d Mon Sep 17 00:00:00 2001 From: Aurelien Vaillant Date: Fri, 31 May 2024 10:36:28 +0200 Subject: [PATCH] Return an error if the placeholder export are empty or no children collection. Update the docstring operator to be more clear. --- Fange_Pipeline/operators/exports.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Fange_Pipeline/operators/exports.py b/Fange_Pipeline/operators/exports.py index 147fa17..90068bd 100644 --- a/Fange_Pipeline/operators/exports.py +++ b/Fange_Pipeline/operators/exports.py @@ -5,7 +5,8 @@ from pathlib import Path class ExportForFange(bpy.types.Operator): - """Export a building for fange""" + """Export a building for fange. +Requiert your blend file are write on your hard-drive.""" bl_idname = 'graou.building_export' bl_label = 'Easily export a building asset' @@ -37,7 +38,12 @@ class ExportForFange(bpy.types.Operator): self.report({'ERROR'}, 'Can\'t find the asset category.') return {'CANCELLED'} - if len(self.coll_layout.collection_children): + if not len(self.coll_layout.children): + self.report({'WARNING'}, 'No children collection, nothing can be exported.') + return {'CANCELLED'} + + if not len(self.coll_layout.collection_children): + for coll in self.coll_layout.children: print(f'[Pipeline] Update "{coll.name}" mesh') child = bpy.data.collections.get(coll.name)