Page 26 of 123

Re: Señor Casaroja's Noesis

Posted: Thu Sep 01, 2011 2:41 am
by Dinoguy1000
MrAdults wrote:That message is caused by not returning a 1 or 0 from your handler to indicate success or failure. I'd comment on more of this, but I'm on my phone and typing on this thing is like water torture.
And yet, clearly not so torturous as to prevent you from commenting on just how torturous it is. =D

Re: Señor Casaroja's Noesis

Posted: Thu Sep 01, 2011 2:50 am
by Satoh
MrAdults wrote:That message is caused by not returning a 1 or 0 from your handler to indicate success or failure. I'd comment on more of this, but I'm on my phone and typing on this thing is like water torture.
Brilliant! I completely forgot about that!

I'll have to fix that promptl-uhh... more like when I'm less exhausted from dealing with a language I don't even know using a bunch of proprietary functions that, while excellent, I have ne'er used before!

But all that aside, I can effin' export my sprites! and that was my goal, so I feel that, while I didn't do it with much elegance or fluency, I did it nonetheless. The errors I need to iron out now are simply loop or offset errors due to anomalous file data discrepancies between different versions of files.

I am thrilled! and totally wrecked from a week solid of programming!

thanks for your help Doctor Adults, as always.


@Dinoguy: Obviously he's in his TARDIS being all asynchronous to the time stream.

Re: Señor Casaroja's Noesis

Posted: Thu Sep 01, 2011 4:26 am
by MrAdults
Indeed. No matter how annoyed I am, I'm never too annoyed to bitch about how annoyed I am, even when bitching about being annoyed is annoying me.

So, some info on the functions I saw you using in your script there:

rapi.imageGetPalette - This does the opposite of what I think you thought it did. It doesn't actually convert a paletted image. It takes a 32-bit RGBA32 (r8g8b8a8) input, and gives you a byte array of palette entries based on the parameters. It uses a median cut algorithm to generate the palette. So you only want to use this function if you need to take a full-color image and export it to a format that uses a palette.

imgPix = rapi.imageDecodeRaw(imgPix, imgWidth, imgHeight, "a1b5g5r5") - This is saying "Ok, imgPix is an image with a1b5g5r5 pixels, so convert those to r8g8b8a8 and shove it back into imgPix"

texList.append(NoeTexture("soetex"+"."+h+"."+i, imgWidth, imgHeight, pix32, noesis.NOESISTEX_RGBA32)) #No idea how this works - You would want pix32 here to be imgPix instead. The parameters are image width, image height, image data, and image type. Because you just converted imgPix to rgba32 with the call above, that's the appropriate Noesis texture type. Those parameters are being used to construct a NoeTexture object, and that NoeTexture is getting shoved into the texture list. The texture list is what Noesis reads from once the handler exits - it allows the script to load more than one texture if it wants to. (when you have more than 1 image in a handler, they'll all be exported on export, or you can use the data viewer to preview them individually)

The Python libraries really need some real documentation. I gave general descriptions of what they all do and their input parameters in __NPReadMe.txt, but it's mostly pretty vague and doesn't provide example usage for most functions. Hopefully I can get to that sometime. There's a lot of very useful functionality in there that I suspect no one is actually aware of.

Re: Señor Casaroja's Noesis

Posted: Thu Sep 01, 2011 5:48 am
by Dinoguy1000
MrAdults wrote:Indeed. No matter how annoyed I am, I'm never too annoyed to bitch about how annoyed I am, even when bitching about being annoyed is annoying me.
I believe you've just achieved meta-bitchiness/annoyedness. =D

Re: Señor Casaroja's Noesis

Posted: Thu Sep 01, 2011 6:36 am
by Satoh
I think the biggest problems I had with the texList.append and imgDecodeRawPal were in this range:

I was misunderstanding the imgDecodeRawPal as imgDecodeRaw due to the fact that I had not seen the RAW version in the documentation (it's there, I just overlooked it) until the newest version which included the RAW PAL version of the function, and read them to be the same. Which was my error.

However, the constant references to 'must be RGBA32' confused me a little, as it seemed that there was no way to get non RGBA32 data into noesis without doing it manually byte by byte (which I did try doing for a short while, albeit failing miserably)

This again stems from me reading the documentation wrong.

I did however learn quite a bit about what noepy can do by reading the def 's in inc_noesis.py.
Anyone attempting to write a Noepy plugin with little Noesis experience (or in general) should skim through it to see what some of the base functions are and do, I wouldn't have even gotten through reading bytes if I hadn't had that to look through... I daresay I actually learned a bit more about reading raw bytearrays and programming in the process of writing this script.

For instance, filling an array with a [beginindex : endindex] call... true brilliance I didn't know was possible.

I must say I love the getOffset() function... C# doesn't have that as I recall... (it required you to create a ULong and set it to be equal to the PCline number or something)

but in the end I made my script work, despite even my own self-expectations. (It's still imperfect and doesn't output the proper palettes for a few files, but for the largest group of files I wrote it for, it works.)

tl;dr
The documentation is a bit lacking, but the code is more than capable and deserves praise, and I got my thingy doin the stuff I wanted.


ON A SEPARATE MATTER!:
Is there a way to have Noesis iterate through the texList, visually?
By this I mean either displaying a different texture every few seconds, or creating some sort of grid that shows multiple pictures at a time?

I admit I'm still a little fuzzy on what Noesis does with the files AFTER I read them... or how to create user interface options and such. (I assume that's possible, in order to get user input and such)

I think if I write another plugin I'd like it to be something along the lines of 'Open As' to basically tell Neosis to -try- parsing a file that doesn't meet all of the test criteria (IE a file that noesis doesn't recognize) as another type of file. Possibly with the option of having the user fill in some data like where to look for a header, in the case of files that are 'slightly modified' filetypes or files that have padding...

... or perhaps a plugin to export multiple textures tiled into to a single image file... but that sounds hard...

Anyway, I love the addition of Noepy, even if I'm still coming down from my headache =p

Re: Señor Casaroja's Noesis

Posted: Sat Sep 03, 2011 12:42 am
by philip92dk
Hey mr Adults,can you add support for 3ds and mtl files??

Re: Señor Casaroja's Noesis

Posted: Sun Sep 04, 2011 6:54 am
by Satoh
Aren't MTL just a component file that supplements an OBJ? Doesn't Noesis(hereafter Ns) write these automatically already??

Though 3DS support might be nice... but with the rate that autodesk and previously discreet update their software and formats, I don't see this one happening easily...

I'm half tempted to try my hand at the MTL issue, if there in fact is one... But I'm not sure I could tackle it... and I don't want to start something I know I might not finish... I've disappointed too many people that way already...

But seriously, I thought Ns already imported and exported those MTLs...

Re: Señor Casaroja's Noesis

Posted: Sun Sep 04, 2011 5:37 pm
by MrAdults
To view individual textures in the texList in Noesis, Tools->Data viewer->Model 1->Textures, then select the textures individually to see them in the preview pane.

There are a few ways to get info from the user. I try to avoid popups if possible, because if you want to batch process a set of files, you don't want the user being prompted for stuff for every single file in the batch if that can be avoided. That said, there is rapi.loadPairedFile (or rapi.loadPairedFileOptional if you don't want Noesis to raise an exception on failure) to prompt the user for a given file type and get back the raw data contents of the file they've selected. Typically when I use this, if possible, I'll try an automated solution for finding the data I need first. There's a good use of this in the Duke3D ART Python script. It tries to load the PALETTE.DAT on the same path as the input file, and if it can't find it there, it prompts the user for it with rapi.loadPairedFile.

The best way to allow the user to feed data in is via the noesis.addOption stuff. This allows you to add extra advanced/command line options, with arguments optional. If you want multiple arguments, you just have to parse them yourself out of the string it hands back. There's a good example of adding and checking command line options in fmt_sof1pc_m32.py. The reason this is a better idea than actually bringing up prompts to get optional data/parameters from the user is that it works out nicely with batch exports. They can set those options up in their batch generation if they want, so they can get that functionality without actually being bothered to manually enter data for each file.

Noesis has supported .3ds files since version 1. If you meant .max files, then no, probably not. That seems to be a continually-changing format, and it isn't worth supporting when there are already formats that are meant to be open and convey just as much data (that is, in terms of what Noesis would even care about), like COLLADA.

I've never supported .mtl files in Noesis. I just write obj files out with the diffuse texture name in the material entry, which most obj parsers (like the one in Max) handle fine. Probably wouldn't be a lot of work to handle .mtl files, but it's not a priority for me at the moment.

Edit: I just put 3.52 up, it has a good number of global Python refinements, but nothing that should break anything anyone might've already written. There's also a Quake 2 BSP script which is a good example of how to handle lightmaps or other multipass rendering needs in Python.

Re: Señor Casaroja's Noesis

Posted: Mon Sep 05, 2011 6:16 pm
by philip92dk
MrAdults wrote:To view individual textures in the texList in Noesis, Tools->Data viewer->Model 1->Textures, then select the textures individually to see them in the preview pane.

There are a few ways to get info from the user. I try to avoid popups if possible, because if you want to batch process a set of files, you don't want the user being prompted for stuff for every single file in the batch if that can be avoided. That said, there is rapi.loadPairedFile (or rapi.loadPairedFileOptional if you don't want Noesis to raise an exception on failure) to prompt the user for a given file type and get back the raw data contents of the file they've selected. Typically when I use this, if possible, I'll try an automated solution for finding the data I need first. There's a good use of this in the Duke3D ART Python script. It tries to load the PALETTE.DAT on the same path as the input file, and if it can't find it there, it prompts the user for it with rapi.loadPairedFile.

The best way to allow the user to feed data in is via the noesis.addOption stuff. This allows you to add extra advanced/command line options, with arguments optional. If you want multiple arguments, you just have to parse them yourself out of the string it hands back. There's a good example of adding and checking command line options in fmt_sof1pc_m32.py. The reason this is a better idea than actually bringing up prompts to get optional data/parameters from the user is that it works out nicely with batch exports. They can set those options up in their batch generation if they want, so they can get that functionality without actually being bothered to manually enter data for each file.

Noesis has supported .3ds files since version 1. If you meant .max files, then no, probably not. That seems to be a continually-changing format, and it isn't worth supporting when there are already formats that are meant to be open and convey just as much data (that is, in terms of what Noesis would even care about), like COLLADA.

I've never supported .mtl files in Noesis. I just write obj files out with the diffuse texture name in the material entry, which most obj parsers (like the one in Max) handle fine. Probably wouldn't be a lot of work to handle .mtl files, but it's not a priority for me at the moment.

Edit: I just put 3.52 up, it has a good number of global Python refinements, but nothing that should break anything anyone might've already written. There's also a Quake 2 BSP script which is a good example of how to handle lightmaps or other multipass rendering needs in Python.
what I meant was if you could add support for export 3ds. is there is a way to import 3d models with texture from Noesis to Google SketchUp :oops:

Re: Señor Casaroja's Noesis

Posted: Mon Sep 05, 2011 6:46 pm
by MrAdults
philip92dk wrote:what I meant was if you could add support for export 3ds. is there is a way to import 3d models with texture from Noesis to Google SketchUp :oops:
http://sketchup.google.com/support/bin/ ... wer=140408

For chrrox:

Code: Select all

from inc_noesis import *

def registerNoesisTypes():
	handle = noesis.register("ALO Archive", ".alo")
	noesis.setHandlerExtractArc(handle, aloExtractArc)
	return 1

def aloExtractArc(fileName, fileLen, justChecking):
	if fileLen < 37:
		return 0
	with open(fileName, "rb") as f:
		hdrBytes = f.read(37)
		srcSize = noeUnpackFrom("<i", hdrBytes, 16)[0]
		if srcSize+36 != fileLen or hdrBytes[36] != 0x78:
			return 0
		if justChecking: #it's valid
			return 1
		f.seek(36, 0)
		srcBytes = f.read(srcSize)
		decompSize = rapi.getInflatedSize(srcBytes)
		decompData = rapi.decompInflate(srcBytes, decompSize)
		dstName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName())) + "_decomp.bin"
		print("Writing", dstName)
		rapi.exportArchiveFile(dstName, decompData)
	return 1

Re: Señor Casaroja's Noesis

Posted: Mon Sep 05, 2011 8:31 pm
by philip92dk
missing textures-
E:\3d\Noesis\texture000
E:\3d\Noesis\texture001
E:\3d\Noesis\texture002
E:\3d\Noesis\texture003
E:\3d\Noesis\texture004

Re: Señor Casaroja's Noesis

Posted: Fri Sep 09, 2011 6:40 pm
by xinyingho
Can any upload the tool in a mirror site? I cannot download it from http://oasis.xentax.com/ as I always get a corrupt file...
Thanks!

Re: Señor Casaroja's Noesis

Posted: Mon Sep 12, 2011 9:30 pm
by BakameExcalibur
Am I the only one so far to note how it's a bit odd how there's a plugin for Ninja Gaiden 2/DOAX2, yet nothing for stuff like Dead or Alive Ultimate? If I could write code, I'd do it myself (I can barely even write HTML >_>;), but yeah.

Re: Señor Casaroja's Noesis

Posted: Tue Sep 13, 2011 8:06 am
by m4tias
is posible extract models from "KOF Maximum IMPACT Regulation A" with noesis????
the players got extension .pak

Re: Señor Casaroja's Noesis

Posted: Tue Sep 13, 2011 8:14 pm
by Satoh
m4tias wrote:is posible extract models from "KOF Maximum IMPACT Regulation A" with noesis????
the players got extension .pak
Noesis opens multiple types of files labeled .pak . You should look through the list and try each, if they don't load or export properly then the answer is no.

I see a lot of people asking questions like this, and honestly I don't know how they expect to get a simple answer. MrAdults programmed Noesis, with the exception of a few of the plugins, but he doesn't know what format a file is simply by hearing the name of the game or the extension on the file.

Just as the man who creates a wrench doesn't know which size you need for your washing machine simply because you told him where you bought it...

Noesis is a tool, and a good one, one that takes away most of the user's need to be involved, but there is still a small amount of common sense that says a user must be there to start it up and test it out on things.

EDIT: Said xentax, meant noesis.