Icons: only write icons from group 'Export'

Allows reference objects not to get mixed up with finished icons.
This commit is contained in:
Campbell Barton 2018-04-24 17:44:13 +02:00
parent 00d4e99955
commit bd40b2c402
2 changed files with 22 additions and 1 deletions

View File

@ -190,6 +190,16 @@ def create_argparse():
type=str,
metavar="DIR",
required=False,
help="Directory to write icons to.",
)
parser.add_argument(
"--group",
dest="group",
default="",
type=str,
metavar="GROUP",
required=False,
help="Group name to export from (otherwise export all objects).",
)
return parser
@ -206,7 +216,17 @@ def main():
objects = []
for ob in bpy.data.objects:
if args.group:
group = bpy.data.groups.get(args.group)
if group is None:
print(f"Group {group!r} not found!")
return
objects_source = group.objects
del group
else:
objects_source = bpy.data.objects
for ob in objects_source:
# Skip non-mesh objects
if ob.type != 'MESH':

View File

@ -26,6 +26,7 @@ for blend in icons_blend:
blend,
"--python", os.path.join(BASEDIR, "blender_icons_geom.py"),
"--",
"--group", "Export",
"--output-dir", os.path.join(BASEDIR, "icons"),
)
run(cmd)