Noesis tutorial Basic Model

Read or post any tutorial related to file format analysis for modding purposes.
User avatar
Demonsangel
mega-veteran
mega-veteran
Posts: 240
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: Noesis tutorial Basic Model

Post by Demonsangel » Sun Sep 02, 2012 1:40 pm

Try using something along the lines of:

Code: Select all

dirPath        = rapi.getDirForFilePath(rapi.getInputName())
with

Code: Select all

tex         = open(dirPath + '/texfolder/' +texName,'rb').read()
texture     = rapi.loadTexByHandler(tex,'.dds')
texture.name    = texName.split('.dds')[0] #//you can leave the .split() away if you want
texList.append(texture)



mdl.setModelMaterials(NoeModelMaterials(texList, matList))

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2387
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 296 times

Re: Noesis tutorial Basic Model

Post by finale00 » Sun Sep 02, 2012 2:00 pm

It should be enough to just specify the absolute path of the texture in the material and just set that as the texture.

I usually just tell people to create a "textures" folder and dump all the textures in there.

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Sun Sep 02, 2012 8:46 pm

Code: Select all

#Noesis Python model import+export test module, imports/exports some data from/to a made-up format
from inc_noesis import *
import noesis
#rapi methods should only be used during handler callbacks
import rapi
#registerNoesisTypes is called by Noesis to allow the script to register formats.
#Do not implement this function in script files unless you want them to be dedicated format modules!
def registerNoesisTypes():
	handle = noesis.register("Rinne no Lagrange Kamogawa Dream Match", ".gcm")
	noesis.setHandlerTypeCheck(handle, noepyCheckType)
	noesis.setHandlerLoadModel(handle, noepyLoadModel) #see also noepyLoadModelRPG
       #noesis.setHandlerWriteModel(handle, noepyWriteModel)
       #noesis.setHandlerWriteAnim(handle, noepyWriteAnim)
	noesis.logPopup()
       #print("The log can be useful for catching debug prints from preview loads.\nBut don't leave it on when you release your script, or it will probably annoy people.")
	return 1

NOEPY_HEADER = "PHYR"

#check if it's this type based on the data
def noepyCheckType(data):
	bs = NoeBitStream(data)
	if len(data) < 7:
		return 0
	if bs.readBytes(7).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
		return 0
  return 1       

#load the model
def noepyLoadModel(data, mdlList):
   ctx = rapi.rpgCreateContext()
   bs = NoeBitStream(data)
   rapi.rpgClearBufferBinds()   
   return 1
I'll wrote Noesis plugins.
I'm not sure whether I'm doing this right, so far.
Will you explain this part "if len(data) < 7:"?
Is this number right?
GCM.7z
You do not have the required permissions to view the files attached to this post.

User avatar
chrrox
Moderator
Posts: 2512
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1244 times

Re: Noesis tutorial Basic Model

Post by chrrox » Sun Sep 02, 2012 9:33 pm

NOEPY_HEADER = "PHYR"

#check if it's this type based on the data
def noepyCheckType(data):
bs = NoeBitStream(data)
if len(data) < 7:
return 0
if bs.readBytes(7).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
return 0
return 1

should be

NOEPY_HEADER = "PHYR"

#check if it's this type based on the data
def noepyCheckType(data):
bs = NoeBitStream(data)
if bs.readBytes(4).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
return 0
return 1

this just checks to make sure the first 4 characters of the file are PHYR

also your file is big endian keep that in mind

Vindis
advanced
Posts: 46
Joined: Fri Apr 08, 2011 9:31 pm
Has thanked: 16 times
Been thanked: 51 times

Re: Noesis tutorial Basic Model

Post by Vindis » Mon Sep 03, 2012 10:40 am

Hi,

this time i don't ask for help :D but it's somehow connected to file check. My plugin is ready, but every time i select the file format i only get an empty list in the viewer, but it occurs only under win7x64. The problem doesn't appear under xp.
Is there a workaround to solve this? I tried to run as admin but that didn't helped.
Should I run Noe in compatibility mode? (I'm currently at work so i can't try it out, and it's so long until i get home :D)

User avatar
Demonsangel
mega-veteran
mega-veteran
Posts: 240
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: Noesis tutorial Basic Model

Post by Demonsangel » Mon Sep 03, 2012 11:06 am

I run 7x64 and don't seem to have that problem, pm me the script and a model to test.

Does it occur if you just select "all known formats" ? Also, in the Noesis explorer try going to a parent fodler and back, see if that helps.

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Mon Sep 03, 2012 11:16 am

Thank you very much for your quick reply.
May I ask a few questions?
I've got a lot to learn.
Actually, I don’t know what to question, at first.

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2387
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 296 times

Re: Noesis tutorial Basic Model

Post by finale00 » Mon Sep 03, 2012 1:49 pm

You should start by reading the tutorial.

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Mon Sep 03, 2012 2:44 pm

finale00 wrote:You should start by reading the tutorial.
Sorry,
I'm a complete noob, please help.
Image
I can't understand "bs.seek(0x1C, NOESEEK_ABS)" part.

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2387
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 296 times

Re: Noesis tutorial Basic Model

Post by finale00 » Mon Sep 03, 2012 3:05 pm

There are several ways to go to different positions of a file (eg: seeking)

They are typically seeking from
-beginning of the file (absolute offset) eg: seek_abs
-current position (relative offset) eg: seek_curr
-end of file (seeking backwards)

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Mon Sep 03, 2012 3:43 pm

finale00 wrote:There are several ways to go to different positions of a file (eg: seeking)

They are typically seeking from
-beginning of the file (absolute offset) eg: seek_abs
-current position (relative offset) eg: seek_curr
-end of file (seeking backwards)
Thank you for your explanation.
But, i don't understand these code "0x1C".

User avatar
Demonsangel
mega-veteran
mega-veteran
Posts: 240
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: Noesis tutorial Basic Model

Post by Demonsangel » Mon Sep 03, 2012 4:12 pm

http://en.wikipedia.org/wiki/Hexadecimal

0x is the way to write hexadecimal

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Mon Sep 03, 2012 6:45 pm

Demonsangel wrote:http://en.wikipedia.org/wiki/Hexadecimal

0x is the way to write hexadecimal
That's not what I want to know.
Why it was "1C" what I'd like to know.

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2387
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 296 times

Re: Noesis tutorial Basic Model

Post by finale00 » Mon Sep 03, 2012 6:49 pm

This tutorial assumes you already know how to reverse models

You should read
viewtopic.php?f=29&t=3739

leyme
advanced
Posts: 51
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme » Mon Sep 03, 2012 6:53 pm

finale00 wrote:This tutorial assumes you already know how to reverse models

You should read
viewtopic.php?f=29&t=3739
Thanks, finale00

Post Reply