コード例 #1
0
ファイル: shapes.py プロジェクト: aaps/MCmotions
    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)
コード例 #2
0
ファイル: shapes.py プロジェクト: aaps/MCmotions
    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
コード例 #3
0
    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
コード例 #4
0
    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)