Page 1 of 1

Noesis Encode Png file?

Posted: Thu Apr 04, 2019 3:55 am
by dgl
I'm writing an exporter for Noesis for a model format that uses internal png files to store textures.

Code: Select all

class NoeTexture:
	def __init__(self, name, width, height, pixelData, pixelType = noesis.NOESISTEX_RGBA32):
		self.name = name
		self.width = width
		self.height = height
		self.pixelData = pixelData
		self.pixelType = pixelType
		self.flags = 0
		self.mipCount = 0
I'm guessing the pixel data is the raw RGB or RGBA data. I've been looking through the rapi interface, but can't find what I'm looking for. Is there a way to encode png files through the python API?

Edit:

FML, found it right after posting:

Code: Select all

data = rapi.imageEncodeRaw(pixelData, width, height, ".png")
Another edit:

Found that textures are not included by default on export. This line is needed as well.

Code: Select all

texList = rapi.loadMdlTextures(mdl)
Edit:

I'm getting 0 bytes of output from "data = rapi.imageEncodeRaw(pixelData, width, height, ".png")", is there a code snippet for encoding png's?