From df73d26896858f2b8987eb4c6321ad652173b074 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 26 Jan 2019 20:59:14 -0500 Subject: [PATCH] Fix if-in-dict antipattern in material code --- korman/exporter/material.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 5d652d4..fa976d8 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -255,10 +255,8 @@ class MaterialConverter: hsgmat.addLayer(layer.key) # Cache this material for later - if bo in self._obj2mat: - self._obj2mat[bo].append(hsgmat.key) - else: - self._obj2mat[bo] = [hsgmat.key] + mat_list = self._obj2mat.setdefault(bo, []) + mat_list.append(hsgmat.key) # Looks like we're done... return hsgmat.key