def makeverticalblock(self, loneneighbors, mat): temporigin = [] tempfaces = [] for block in loneneighbors[mat]: listoffaces = loneneighbors[mat][block]['faces'] left = block[0]-1, block[1], block[2] right = block[0]+1, block[1], block[2] front = block[0], block[1]-1, block[2] back = block[0], block[1]+1, block[2] if mat in self.colormaterials and 'models' in self.colormaterials[mat]: pointlist = PointList() pointlist.from_tuple_list(self.colormaterials[mat]['models'][0]) pointops = pointlist else: pointops = self.defshapes.make_default_flat_blocks() if front in loneneighbors[mat] or back in loneneighbors[mat]: pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock) pointops.rotate_points_z(90) elif left in loneneighbors[mat] or right in loneneighbors[mat]: pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock) elif left in loneneighbors[mat] and right in loneneighbors[mat] and front in loneneighbors[mat] and back in loneneighbors[mat]: pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock) else: pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock) self.defshapes.remove_neibors(pointops, listoffaces) self.appendto3dlist(pointops, block) temporigin.append(pointops.get_avg_point().as_tuple()) tempfaces += pointops return tempfaces, self.getavgorigins(temporigin)
def fromfileordefault(self, mat, index, defaultfunction): if mat in self.colormaterials and 'models' in self.colormaterials[mat] and index + 1 <= len(self.colormaterials[mat]['models']): pointlist = PointList() pointlist.from_tuple_list(self.colormaterials[mat]['models'][index]) pointops = pointlist else: pointops = defaultfunction() return pointops
def fromfileordefault(self, mat, index, defaultfunction): if mat in self.colormaterials and 'models' in self.colormaterials[ mat] and index + 1 <= len(self.colormaterials[mat]['models']): pointlist = PointList() pointlist.from_tuple_list( self.colormaterials[mat]['models'][index]) pointops = pointlist else: pointops = defaultfunction() return pointops
def makeverticalblock(self, loneneighbors, mat): temporigin = [] tempfaces = [] for block in loneneighbors[mat]: listoffaces = loneneighbors[mat][block]['faces'] left = block[0] - 1, block[1], block[2] right = block[0] + 1, block[1], block[2] front = block[0], block[1] - 1, block[2] back = block[0], block[1] + 1, block[2] if mat in self.colormaterials and 'models' in self.colormaterials[ mat]: pointlist = PointList() pointlist.from_tuple_list( self.colormaterials[mat]['models'][0]) pointops = pointlist else: pointops = self.defshapes.make_default_flat_blocks() if front in loneneighbors[mat] or back in loneneighbors[mat]: pointops = self.fromfileordefault( mat, 0, self.defshapes.make_default_vertical_plusblock) pointops.rotate_points_z(90) elif left in loneneighbors[mat] or right in loneneighbors[mat]: pointops = self.fromfileordefault( mat, 0, self.defshapes.make_default_vertical_plusblock) elif left in loneneighbors[mat] and right in loneneighbors[ mat] and front in loneneighbors[ mat] and back in loneneighbors[mat]: pointops = self.fromfileordefault( mat, 0, self.defshapes.make_default_vertical_plusblock) else: pointops = self.fromfileordefault( mat, 0, self.defshapes.make_default_vertical_plusblock) self.defshapes.remove_neibors(pointops, listoffaces) self.appendto3dlist(pointops, block) temporigin.append(pointops.get_avg_point().as_tuple()) tempfaces += pointops return tempfaces, self.getavgorigins(temporigin)