The rules have been updated, read them now: Rules!

Noesis Encode Png file?

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
Posts: 4
Joined: Thu Mar 28, 2019 6:32 am
Has thanked: 3 times

Noesis Encode Png file?

Post by dgl » Thu Apr 04, 2019 3:55 am

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): = 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?


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)

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

Post Reply