Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Noesis tutorial Basic Model

Read or post any tutorial related to file format analysis for modding purposes.
Demonsangel
mega-veteran
mega-veteran
Posts: 241
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 »

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: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Noesis tutorial Basic Model

Post by finale00 »

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: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Noesis tutorial Basic Model

Post by chrrox »

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: 44
Joined: Fri Apr 08, 2011 9:31 pm
Has thanked: 16 times
Been thanked: 41 times

Re: Noesis tutorial Basic Model

Post by Vindis »

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)
Demonsangel
mega-veteran
mega-veteran
Posts: 241
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 »

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: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Noesis tutorial Basic Model

Post by finale00 »

You should start by reading the tutorial.
leyme
advanced
Posts: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Noesis tutorial Basic Model

Post by finale00 »

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: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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".
Demonsangel
mega-veteran
mega-veteran
Posts: 241
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 »

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

0x is the way to write hexadecimal
leyme
advanced
Posts: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Noesis tutorial Basic Model

Post by finale00 »

This tutorial assumes you already know how to reverse models

You should read
viewtopic.php?f=29&t=3739
leyme
advanced
Posts: 50
Joined: Wed Apr 04, 2012 10:17 am
Has thanked: 10 times
Been thanked: 3 times

Re: Noesis tutorial Basic Model

Post by leyme »

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