MrAdults wrote:That's completely wrong, again. And on export, too, you can use globally-indexed mesh data. I think you have the problem of miscomprehending most of what I try to tell you and moving on under your poor assumptions instead of taking the time to reprocess.
ok. then fix for me, to see what i'm doing wrong, this example script to load both materials in one mesh:
Code: Select all
#Noesis test script, pretends to open *.txt files to run itself
from inc_noesis import *
import noesis
import rapi #rapi methods should only be used during handler callbacks
import struct
def registerNoesisTypes():
handle = noesis.register("test script", ".txt")
noesis.setHandlerTypeCheck(handle, noepyCheckType)
noesis.setHandlerLoadModel(handle, noepyLoadModel) #see also noepyLoadModelRPG
noesis.logPopup()
return 1
def noepyCheckType(data):
return 1
def noepyLoadModel(data, mdlList):
vtxdata = struct.pack("<20f", 1,1,0, 1,1, 1,-1,0, 1,-1, -1,-1,0, -1,-1, -1,1,0, -1,1)#four vertices with location and uv
mat1idxdata = struct.pack("<3H", 2,1,0)#first triangle uses the material mat1
mat2idxdata = struct.pack("<3H", 0,3,2)#second triangle uses the material mat2
matList = []
material = NoeMaterial("mat1", "")
material.setDiffuseColor(NoeVec4([0.0, 0.0, 1.0, 0.0]))
material.setDefaultBlend(0)
matList.append(material)
material = NoeMaterial("mat2", "")
material.setDiffuseColor(NoeVec4([1.0, 0.0, 0.0, 0.0]))
matList.append(material)
ctx = rapi.rpgCreateContext()
meshname = "meshwithtwomats"
rapi.rpgSetName(meshname)
rapi.rpgSetMaterial("mat1")
rapi.rpgBindPositionBufferOfs(vtxdata, noesis.RPGEODATA_FLOAT, 20, 0)
rapi.rpgBindUV1BufferOfs(vtxdata, noesis.RPGEODATA_FLOAT, 20, 12)
rapi.rpgCommitTriangles(mat1idxdata, noesis.RPGEODATA_USHORT, 3, noesis.RPGEO_TRIANGLE, 1)
## rapi.rpgSetName(meshname)
rapi.rpgSetMaterial("mat2")
rapi.rpgCommitTriangles(mat2idxdata, noesis.RPGEODATA_USHORT, 3, noesis.RPGEO_TRIANGLE, 1)#not allowing to add this data to the same mesh
rapi.rpgClearBufferBinds()
mdl = rapi.rpgConstructModel()
mdl.setModelMaterials(NoeModelMaterials([], matList))
mdlList.append(mdl)
return 1