The Forum is up for sale: XeNTaX Forum looking for new owner

Noesis Plugin MascotCapsule (MBAC)?

Post questions about game models here, or help out others!
Post Reply
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

(.MBAC) 3d model in J2ME
Hello everyone [roll]
I wanted to make a plugin for Noesis (adapt a ready-made solution).
But I am not familiar with python. (I working with C#) So nothing came out :(
So, can someone help?

I attach an archive with scripts and a file
here's another description of the format
You do not have the required permissions to view the files attached to this post.
Last edited by Durik256 on Sat Dec 18, 2021 9:00 pm, edited 1 time in total.
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

more models
You do not have the required permissions to view the files attached to this post.
Last edited by Durik256 on Sun Jan 09, 2022 5:59 pm, edited 4 times in total.
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

models are already loaded but only with triangular faces, square faces give an error...
Last edited by Durik256 on Sat Jan 08, 2022 7:33 pm, edited 3 times in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4231
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1139 times
Been thanked: 2222 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by shakotay2 »

Durik256 wrote: Sat Mar 06, 2021 3:18 am models are already loaded but only with triangular faces, square faces give an error...
You could use
rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_UINT, numIdx, noesis.RPGEO_QUAD, 1)

But as you can see it's the "latest Noesis style" (rapi interface) while you seem to use the old one.

Read here (answer from MrAdults):
viewtopic.php?f=16&t=15997&p=128710&hil ... ns#p128710
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

Thanks for your answer, I will certainly study what you provided and try to redo everything with rapi.
But I decided for the time being in my own way) :D

Code: Select all

if len(face) == 4:
            a, b, c, d = face
            indices +=[c, b, a, d, b, c]
2.png
You do not have the required permissions to view the files attached to this post.
Last edited by Durik256 on Sat Jan 08, 2022 7:34 pm, edited 7 times in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4231
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1139 times
Been thanked: 2222 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by shakotay2 »

Durik256 wrote: Sat Mar 06, 2021 11:21 pm Oh, thanks for your answer, I will certainly study what you provided and try to redo everything with rapi.
But I decided for the time being in my own way)
MrAdults wrote: Fri Mar 17, 2017 3:13 am mariokart64n's tutorial uses the more manual means of constructing a mesh, which probably does seem more familiar to someone coming from Max.
So you need to choose the way which fits best for you. :)

I can't help you with "old style", though. Also rapi is not my preferred way and, to be honest, I hate python generally. :D

Usually I do I with 'C', view my Make_obj project (with C source), if interested:
shakotay2 wrote: Mon Mar 06, 2017 11:01 am
btw: feel free to convert that project to C#. (If you will do so I'd please you to make it available for others.)
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

support for bones and weights:

Code: Select all

from inc_noesis import *
import noesis
import rapi
from mascotcapsule import Figure

def registerNoesisTypes():
   handle = noesis.register("MascotCapsule contains geometry data", ".mbac")
   noesis.setHandlerTypeCheck(handle, mbacCheckType)
   noesis.setHandlerLoadModel(handle, mbacLoadModel)
   noesis.logPopup()
   return 1

NOEPY_HEADER = "MB"

def mbacCheckType(data):
   bs = NoeBitStream(data)
   if len(data) < 2:
      return 0
   if bs.readBytes(2).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
      return 0
   return 1       

def mbacLoadModel(data, mdlList):
   dirPath = rapi.getDirForFilePath(rapi.getInputName())
   filename = rapi.getLocalFileName(rapi.getInputName())
   f = open(dirPath + filename, 'rb')
   figure = Figure.fromfile(f, False)
   g = geometry(figure)
   b = Bones(figure.bones,len(g.positions))
   msh = NoeMesh([],[],"mesh0", "mat0")
   msh.setIndices(g.indices)
   msh.setPositions(g.positions)
   msh.setUVs(g.texcoord)
   msh.setNormals(g.normals)
   msh.setWeights(b.bWeList)
   mdl = NoeModel([msh],[],[])
   mdl.setBones(b.bones)
   mdlList.append(mdl)
   return 1
   
def mdl_create(g,figure):
    print('figure.vertices: %d' % len(figure.vertices))
    for x, y, z in figure.vertices:
        g.positions.append(NoeVec3((x,y,z)))
        g.texcoord.append(NoeVec3((0,0,0)))
    for face in figure.faces:
        if len(face) == 3:
            a, b, c = face
            for i in (c, b, a):
                g.indices.append(i)
                
        elif len(face) == 4:
            a, b, c, d = face
            for i in (c, b, a):
                g.indices.append(i)
            for i in (d, b, c):
                g.indices.append(i)               
                
        elif len(face) == 9:
            a, b, c, u1, v1, u2, v2, u3, v3 = face

            g.texcoord[a]=(NoeVec3([u1, v1, 0]))
            g.texcoord[b]=(NoeVec3([u2, v2, 0]))
            g.texcoord[c]=(NoeVec3([u3, v3, 0]))
                
            for i in (c, b, a):
                g.indices.append(i)
        else:
            a, b, c, d, u1, v1, u2, v2, u3, v3, u4, v4 = face
            g.texcoord[a]=(NoeVec3([u1, v1, 0]))
            g.texcoord[b]=(NoeVec3([u2, v2, 0]))
            g.texcoord[c]=(NoeVec3([u3, v3, 0]))
            g.texcoord[d]=(NoeVec3([u4, v4, 0]))
            
            for i in (c, b, a):
                g.indices.append(i)
            for i in (d, b, c):
                g.indices.append(i)
    
class geometry:
    def __init__(self,f):
        self.positions = []
        self.indices = []
        self.texcoord = []
        self.normals = []
        mdl_create(self,f)

class Bones:
    def __init__(self,b,v):
        self.bones = []
        self.boneMap = []
        #weight
        self.boWe = [1.0, 0.0, 0.0, 0.0]
        self.boId = [0, 0, 0, 0]
        self.bWeList = [NoeVertWeight(self.boId, self.boWe)]*v
        for i in range (0,len(b)):
            boneName = "bone"+str(i)
            bonePIndex = b[i][0]
            boneMat = NoeMat43(( 
            NoeVec3((b[i][1][0], b[i][1][4], b[i][1][8])), 
            NoeVec3((b[i][1][1], b[i][1][5], b[i][1][9])), 
            NoeVec3((b[i][1][2], b[i][1][6], b[i][1][10])), 
            NoeVec3((b[i][1][3], b[i][1][7], b[i][1][11])) ))
            #translate = NoeVec3((b[i][1][3],b[i][1][7],b[i][1][11]))
            #rotate = NoeQuat((0.0, 0.0, 0.0, 1.0))
            #boneMat = rotate.toMat43(transposed = 1)
            #boneMat[3] = translate
            self.bones.append(NoeBone(i,boneName,boneMat,None,bonePIndex))
            if b[i][3] - b[i][2] > 0:
                for x in range(b[i][2], b[i][3]):
                    self.bWeList[x] = NoeVertWeight([i, 0, 0, 0], self.boWe)
You do not have the required permissions to view the files attached to this post.
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Noesis Plugin MascotCapsule (MBAC)?

Post by Durik256 »

new plugin without "mascotcapsule .py"
(meshes, normals, uvs ,bones)
'uv need manual sczle in 3d editor'
You do not have the required permissions to view the files attached to this post.
Post Reply