From fd0e8dafa7bea3a059d23bd385d842a3da4b9754 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sun, 19 Mar 2017 13:54:30 -1000 Subject: [PATCH] Fix broken multipart models --- src/mcedit2/rendering/blockmodels.pyx | 13 ++++++++----- src/mcedit2/rendering/modelmesh.pyx | 10 +++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mcedit2/rendering/blockmodels.pyx b/src/mcedit2/rendering/blockmodels.pyx index 84b19f1..13a334e 100644 --- a/src/mcedit2/rendering/blockmodels.pyx +++ b/src/mcedit2/rendering/blockmodels.pyx @@ -473,7 +473,7 @@ cdef class BlockModels(object): if varVal is None: ok = False - if str(varVal) != val: + if str(varVal).lower() != str(val).lower(): # Gross, values in multipart may be raw values but values in resourceVariant are strings... ok = False @@ -509,8 +509,11 @@ cdef class BlockModels(object): if ok: apply = part.get('apply') if apply is not None: + if not isinstance(apply, list): + apply = [apply] + for model in apply: - modelName = apply.get('model') + modelName = model.get('model') if modelName is None: continue try: @@ -522,10 +525,10 @@ cdef class BlockModels(object): log.exception("Error parsing json for block/%s: %s", modelName, e) continue - variantXrot = apply.get('x', 0) - variantYrot = apply.get('y', 0) + variantXrot = model.get('x', 0) + variantYrot = model.get('y', 0) ret.append((modelDict, variantXrot, variantYrot)) - + return ret def buildBoxQuads(self, dict element, unicode nameAndState, dict textureVars, diff --git a/src/mcedit2/rendering/modelmesh.pyx b/src/mcedit2/rendering/modelmesh.pyx index 686be73..661c79c 100644 --- a/src/mcedit2/rendering/modelmesh.pyx +++ b/src/mcedit2/rendering/modelmesh.pyx @@ -301,11 +301,11 @@ class BlockModelMesh(object): nID = areaBlocks[y, z+dz, x+dx] props[direction] = ("true" if opaqueCube[nID] - or paneID and nID == paneID - or barsID and nID == barsID - or stainedGlassPaneID and nID == stainedGlassPaneID - or glassID and nID == glassID - or stainedGlassID and nID == stainedGlassID + or (paneID and nID == paneID) + or (barsID and nID == barsID) + or (stainedGlassPaneID and nID == stainedGlassPaneID) + or (glassID and nID == glassID) + or (stainedGlassID and nID == stainedGlassID) else "false") actualState = blocktypes.namesByID[ID], combineProps(props)