Page 1 of 1

[Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 02:41
by Gracler
I can't figure out why I can't get the exporter tool to work with my static object in 3dsmax9

I'm thinking I've made rookie mistake somewhere, but after several tryes I can't really figure out what it is.

Here is a part of the exporter message where it comes up with several warnings that it cannot create file, and the final red line is the one that makes it "stop"

Image

Code: Select all

		-- EXPORT MESH DATA
		writeLong f validMeshIDs.count
		
		
		local matFname = (getFilenamePath fname) + (getFilenameFile fname) + ".material"
		deleteFile matFname 
		
		local fMat = fopen matFname "w"
		if fmat != undefined then
		(
			fclose fMat 
		)
		else
		(
			format "WARNING! Unable to create file: %\n" matFname 
		)
		
		
		for i=1 to validMeshIDs.count do
		(
			local meshObj = objs[validMeshIDs[i]]	
			local matInfo = BF2MatInfo.getMulti meshObj.material type :o bjectTypeName
			
			local meshObj_OriginalTransform = meshObj.transform
			
			local isNonVis = false
			if isValidNode meshObj.parent then
			(
				if (lowercase meshObj.parent.name == "nonvis_") then
					isNonVis = true;
			)
			
			
			
			local crdSpace = matrix3 1
			if isStaticObject then
			(				
				crdSpace = meshObj.transform * (inverse rootObjNode.transform)
			)
			else
			(
			
				local p = meshObj.parent
				if isValidNode p then
				(

					if lowercase p.name == "nonvis_" then
					(
						if isValidNode p.parent then
						(	
							-- A collision mesh's pivot is the visible mesh that it is parented to
							crdSpace = meshObj.transform * (inverse p.parent.transform)
						)
					)

					-- scale the mesh
					crdSpace = crdSpace * scaleMatrix meshObj.scale
					
				)
	
				
			)


			local dontWarnSkinWeights = false
			
			local bnObjs = #()
			-- TODO: Get the skeleton bones in the correct order as they will be in the export
			if objectTypeName == "skinnedmesh" then
			(
				format "SkinnedMesh ... Getting skeleton bones for mesh: %\n" meshObj.name
				bnObjs = bf2GetSkinMeshBones meshObj objs jointNodeTypes
			)
			if objectTypeName == "bundledmesh" then
			(
				dontWarnSkinWeights = true
				for o in objs do
				(
					if findItem jointNodeTypes (classof o) > 0 then 
						append bnObjs o
				)
			)
			local minUvSetCnt = 0
			if isStaticObject and not isNonVis then
			(
				minUvSetCnt = 4
			)
		
			
			rSceneDump.writeMesh f meshObj matInfo coordSpace:crdSpace s:s isNonVis:isNonVis bnObjs:bnObjs dontWarnSkinWeights :d ontWarnSkinWeights minUvSetCnt:minUvSetCnt 

			meshObj.transform = meshObj_OriginalTransform
		
			local a = ""
			for i=1 to matInfo.count do
			(
				local fxMat = matInfo[i]
				
				if fxMat.fxFilename == undefined then
				(
				 	format "WARNING: % has undefined .fxFilename\n" meshObj.name
					--format "    % \n" fxMat
					--format "    % \n" meshObj.material
				)
				local b = fxMat.materialID as string
				b = b + ";" + (fxMat.materialName as string)
				b = b + ";" + (fxMat.fxFilename as string)
				b = b + ";" + (fxMat.technique as string) + ";"
				
				for j=1 to fxMat.textures.count do
				(
					local tmpTexture = fxMat.textures[j]
					if tmpTexture.count == 0 then tmpTexture = "default.dds"
					
					b = b + "|" + tmpTexture 
				)
					
				a = a + "?" + b
			)
			
			local saveMatSuccess = bf2mdtOps.saveMaterial matFname ("mesh" + ((i-1) as string)) a
			if saveMatSuccess != 0 then
			(
[color=Red]				format "WARNING! Unable to save file: %\n" matFname 
			)
		)[/color]
In this example I just added a "base" layer and not the rest and it makes the same error.
Image
Image

If anyone have some suggestions....maybe some simple tests I could make to see if there is something wrong with the Exporter tool or if its my model ....or my folder structure.... i'm running out of ideas myself but i'm pretty sure It's a stupid mistake somewhere :D

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 03:40
by CTRifle
I'm not an exporter but you need more than just lod 0 (going off of your picture there) Like the collision meshes ect

Image

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 04:08
by Gracler
I know im missing some lod's... but I thought I could still "test" export by using the wizard Utilities -> StaticMesh button, which only creates Lod0 it seems.

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 05:32
by Rhino
Ye you don't need lods or cols for a simple static test like your doing

Hard to say what the problem is here but try renaming your material to something like concrete? # might be screwing it up.

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 11:35
by lucky.BOY
I never renamed staticmesh materials, i only rename colision mesh materials to tell them apart in editor. And i dont have problems with that.

You might want to try to export in a different path, esp. not in /objects/. Try /staticobjects/pr/bunker/ww2_bunkers/

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 11:49
by Rhino
lucky.BOY wrote:You might want to try to export in a different path, esp. not in /objects/. Try /staticobjects/pr/bunker/ww2_bunkers/
Ye, at the moment your exporting to "pr_edit/objects/objects/"...

Shouldn't crate this issue but you should be exporting into a folder within staticobjects as lucky said.

Also I would not generate any samples for a test static.

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 15:07
by Gracler
I tried both things but still the same error. I'm starting to think that it is a problem with the plugin permissions or something.

a .dat file is created
and an empty .material file


After installing 3dsmax I installed service pack 2 for 3dsmax (I presumed service pack 1 was included in it)
then I installed the plugin files.


Maybe I should retry to install everything or try the 32bit version of it.

Re: [Help!] exporting from 3dsmax "saveMaterial" problem

Posted: 2013-02-04 15:33
by Rhino
64bit version of max9 afaik is screwed up... should be using the 32bit version. Only real advantage of the 64bit version is rendering which if I'm doing any of, I use the latest version of max for since that is one of the main advantages they have from max9 and you can easily open a max9 scene up in one to render it, but only do that for massive rendering tasks.

Problem solved!

Posted: 2013-02-05 19:12
by Gracler
I installed 32 bit version of 3dsmax9 and while installing the plugin again i noticed that i coud'nt extract into it without admin permission (and its my personal pc so I am the admin of it :p ) so I changed the security permissions at the folder for 3dsmax9 from SYSTEM to Admin.

Now the export works :) I guess it was stopped because I didn't have write permission by default in the 3dsmax9 folder.

Thanks for the help guys. I also learned from you that it exports by default into /objects/ so I only have to add whatever is after that so I dont end up with Objects/objects :D