Jump to content
Official BF Editor Forums

Can't Import Object To Bf2 Editor...


simon.blom

Recommended Posts

Hi everybody!

First of all I'm using the already done "MyBunker" from the tutorials "Building the Bunker" from Lawrence Brown.

When I try to import the bunker (maya scene file) to bf2 editor I get this message:

bf2importerror.jpg

I've found out that it helps to klick "ok" and then direct the program to my Maya instrallation path.

But here's the problem:

When I've directed the program to my Maya path, then it starts to import my object but when finnishes I get this message in the bf2 editor Output Debug window:

******* Import Started *******

execute: maya/mparser60.exe   "C:/Program/Battlefield 2/bf2editor/rawdata/Objects/StaticObjects/_MyBase01/My_Bunker/My_Bunker.mb"

******* Import Started *******

execute: maya/mparser60.exe   "C:/Program/Battlefield 2/bf2editor/rawdata/Objects/StaticObjects/_MyBase01/My_Bunker/My_Bunker.mb"

******* Import Error *******

******* C:\Program\Battlefield 2\bf2editor/rawdata\Objects\StaticObjects\_MyBase01\My_Bunker\My_Bunker.log *******
A collision mesh has no vertices, aborting !
This geometry has no materials 
******* Import Completed *******

[Console] : Couldn't open console script "objects/staticobjects/_mybase01/my_bunker/my_bunker.con"

AND, it never shows up in the editor (or I cant find it?)

PLEASE help me!!!

Kindly regards - simon.blom

btw. If I've forgot to tell you something or if you need more info, please reply ;)

Link to comment
Share on other sites

What version of Maya are you using ?

If its version 6 or 6.0.1 it should work if you assign valid materials to the meshes and create collisionmeshes with a valid material. Other versions of Maya will not work with the *.mb importer in the editor.

Note that most of us have no experience with Maya - so we probably cannot help with more details except for the 'official' tutorials from Lawrence Brown.

Link to comment
Share on other sites

I'm using Maya 6.0.1

I checked Lewrence Brown:s profile on this site and it says that he was last seen 2006 :blink:

Do you know where I can find him?

I have the bunker in 3D Studio Max Version (Max Scene File), but this doesn't even show up in the editor...

Also, the bunker (both Maya and Max) is in a complete version. In the tutorials it says that I can import them to the editor. So in my thoughts there is no maya or max knowledge here, just bf2 editor knowledge :P

Thanks a lot for helping!

Link to comment
Share on other sites

Well, obviously its not only an editor job as its giving that error :P

I have the bunker in 3D Studio Max Version (Max Scene File), but this doesn't even show up in the editor...
Huh ? yeah, if its in Max it doesn't mean its in the editor :P You need to setup texture pathes ( they surely differ from LBrown's setup ) before attempting an export from Max.

Note that the workflow for Max is different from the one for Maya. Maya models ( in the *.mb format) need to be imported from within the editor to convert them to a BF2 model . Max models are ready for the editor as soon as you managed a successful export from Max.

Link to comment
Share on other sites

Trust me, I also started with maya and IMMEDIATELY stopped using it for battlefield editing and exporting. It just doesn't have good community support and it's crazy to think that you're gonna have to load the editor each time you create a new object to import the files and to maybe just test the object out.

----------------

Firstly select your main mesh or object (it should have no separate meshes) then go to the bf2 dropdown list and select "BF2 Utilities". In that window look for the "Wizard's" port and click "StaticMesh". That will create the necessary root nodes that your scene was missing.

If you want to look at these root nodes and its hierarchy do the following:

Try and find the "Select by Name" button. It's at the top center of 3ds max, next to an image of a default white cursor. That's where you can see and edit your Hierarchy of the object.

Now just go to the bf2 dropdown list again, and select BF2 Export. In the sub-folder path copy and paste this in there: objects/test

In "Object Name:" type any name you want. The press "Export Object".

----------------

You actually had to create 3 collision meshes and create 3 extra lods with a copy of the original object linked to them and link them in a certain way but I figured to leave that part out to make things a little simpler for you. You'll still be able to see this object with this method.

Also, if you got the object in the editor, you should try and apply any texture onto it and UVmap it, cause the editor might crash if it couldn't locate any textures.

This was a very basic explanation to export an object to the editor. You'll be able to see your object but if it doesn't have a texture and it didn't crash after you dragged it into the object editor you'll see that your object's shape is there but it is colored white, red and black all over (a man's face will be seen on the texture if UVmapped correctly). You'll also walk through your object as we did not create any collision meshes (which are meshes that acts like a barrier, which stops you to be able to move through objects).

I hope you get your objects in the editor.

Dogbox

Link to comment
Share on other sites

I wonder why we write all these tutorials when everybody refuses to read them - the hieraachy thread contains an explanation about the 'Select by Name' window and about the point helpers and dummies necessary to create a hierachy. We even have tutorials for creating basic statics with Max or gmax:

http://bfeditor.org/forums/index.php?showtopic=12770

Or for creating an aircraft :

http://bfeditor.org/forums/index.php?showtopic=12461

Here's a detailed tutorial about the texturing system for statics in bf2/2142:

http://bfeditor.org/forums/index.php?showtopic=13381

Maybe you want to make a tank ? Ok but you need to make another model before starting with this one:

http://bfeditor.org/forums/index.php?showtopic=9656

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

Thanks a lot for all the tutorials mschoeldgen[Xww2] ;)

I tried with what you wrote dogbox, but I get an error when I press "export" in bf2 exporter:

----------------------------------------------------------

"MAXScript Rollout Handler Exception"

"-- Unknown property: "runDosBatch" in undefined"

----------------------------------------------------------

When I click "ok" a MaxScript window comes up with some code...

-- BF2 Scene
--


------------------------
-- INCLUDE FILES ------
-----------------------

g_bf2doInclude "general/strings.ms"
g_bf2doInclude "general/misc.ms"
g_bf2doInclude "general/nodes.ms"
g_bf2doInclude "materials.ms"
g_bf2doInclude "RMesh.ms"
g_bf2doInclude "settings.ms"
g_bf2doInclude "util/NamePrefixer.ms"
g_bf2doInclude "util/positionFloater.ms"








-----------------------
-- For weapon parts (relative to right hand or torus):
-- 1p == "torus" // this is the root bone of the 1p skeleton
-- 3p == "right_ullna"

-- We have to re-order our bones to match this order
-- .baf animation files identify bones by using an ID number, the order of which are listed in the file
-- the bf2 skeleton was exported with bones out of numerical order
-- we need to make sure that 10 comes after 9 and not ( 1,10,11,...,2,3,4,5)
global g_BF2skeMeshOrdering = #(1,2,3,4,5,6,7,8,16,14,15,10,9,11,12,13)



----------------------

fn BF2testEqualsClose t c=
(
if t < c + 0.0001 and t > c - 0.0001 then
(
	return true
)

return false
)

fn BF2checkScaleUniform pt3=
(
if BF2testEqualsClose pt3.y pt3.x then
(
	if BF2testEqualsClose pt3.z pt3.x then
	(
		return true
	)
)

return false
)

fn BF2checkScales objs=
(
local hadWarning = false
for o in objs do
(
	if not BF2checkScaleUniform o.scale then
	(
		format "WARNING! Scale must be uniform! %: %\n" o.name o.scale
		hadWarning = true
	)
)

return ( not hadWarning )
)

----------------------

g_bf2doInclude "skinnedMesh.ms"

----------------------




fn BF2ChangeOutputPaths objs val=
(
local rtNodes = #()
local numChanged = 0
for i=1 to objs.count do
(
	local rootObj = getParentWithSubStr objs[i] "root_"
	if isValidNode rootObj  then
	(
		local foundID = -1
		for j=1 to rtNodes.count do
		(
			if rootObj  == rtNodes[j] then
			(
				foundID = j
				exit;
			)
		)
		if (foundID == -1) then
		(
			append rtNodes rootObj

			setUserProp rootObj "bf2Path" val
			numChanged  += 1
		)
	)
)
return numChanged 
)

global rolbf2ChngOutPaths 
rollout rolbf2ChngOutPaths "BF2 - Change Output Paths To" width:267 height:122
(
editText edt3 "" pos:[16,40] width:232 height:20
groupBox grp3 "Change Output Paths To: " pos:[8,8] width:248 height:104
button btnOK "OK" pos:[88,72] width:88 height:24
on btnOK pressed do
(
	if edt3.text.count > 0 then
	(
		if selection.count > 0 then
		(
			local numChanged = BF2ChangeOutputPaths selection edt3.text
			MessageBox ("SUCCESS! Number of objects changed: " + (numChanged as string)) title:"SUCCESS!"
			DestroyDialog rolbf2ChngOutPaths
		)
		else MessageBox "Error! Please select objects!"
	)
	else MessageBox "Error! Please enter text!"
)
)







----------------------

g_bf2doInclude "rSceneDump.ms"

----------------------









global rolWorkingStatus 
rollout rolWorkingStatus "Working...." width:224 height:80
(
button btn1 "Please Wait ..." pos:[32,24] width:152 height:40 enabled:false

)
fn CreateRolWorkingStatus =
(	
createDialog rolWorkingStatus style:#(#style_sysmenu, #style_titlebar)
)


fn Bf2Export dbg:true objs:undefined fname:undefined pauseOutput:true anmRange:undefined anmObjs:undefined prefix:undefined s:undefined=
(
if dbg == true then format "Bf2Export()\n"

if objs == undefined then objs = objects as array

if fname == undefined then fname = getSaveFileName types:(rSceneDump.getFilenameExt())

if fname != undefined then
(
	local fnamePath = getFilenamePath fname
	makeDirPath fnamePath

	-- Get our scale value
	-- If the user has set to generic unit display then we just use 0.1 otherwise we calculate out what the scale should be
	if s == undefined then s = BF2_GetUnitMultiplier()

	-- Save out our .dat file
	local destDat = rSceneDump.save objs:objs fname:fname anmRange:anmRange anmObjs:anmObjs prefix:prefix dbg:dbg s:s

	local meshTYPE = undefined
	(
		local rootObjNode = rSceneDump.getRootNode objs
		local objectTypeName = rSceneDump.getRootNodeType rootObjNode
		if classof objectTypeName == string then
		(	
			meshType = "." + objectTypeName
		)
	)


	-- Convert the exported .dat file with sceneParse.exe

	-- destDat =1
	if classof destDat == string then
	(
		local fnamePath = getFilenamePath destDat
		local fnameWithoutExt = fnamePath + (getFilenameFile destDat)

		local buildMode
		if dbg == true then
		(
			buildMode = "debug/"
		)
		else
		(
			buildMode = "release/"
		)

		local strExeA = g_bf2ToolsLoc + "bin/" + buildMode + "SceneParse.exe"
		local convertStr = "\"" + strExeA + "\" \"" + destDat + "\""

		local convertStrB = undefined
		if classof meshTYPE == string then
		(
			local strExeB = g_bf2ToolsLoc + "bin\\release\\bf2Materials.exe"
			local convertStrB = "\"" + strExeB + "\" -applyTechniques \"" + fnamePath + "Meshes/" + (getFilenameFile destDat) + meshTYPE + "\""
			format "convertTechniques: %\n" convertStrB
		)

		if pauseOutput != true then
		(
			CreateRolWorkingStatus()
			bf2mdtops.runDosBatch convertStr
			destroyDialog rolWorkingStatus
		)
		else
		(	
			runDosCommand convertStr doPause:pauseOutput
		)	

		-- Applies custom technique names to materials after exporting the mesh file
		if convertStrB != undefined then
		(
			bf2mdtops.runDosBatch convertStrB 
		)			


		-- Deletes Debug files/logs
		if dbg != true then
		(
			local filesToDel = #()

			-- primary files
			append filesToDel destDat
			append filesToDel (fnameWithoutExt + ".material")

			-- Debug files
			append filesToDel (fnameWithoutExt + ".nfo")
			append filesToDel (fnamePath  + "samples.tga")
			append filesToDel (fnamePath  + "uvs.tga")
			append filesToDel "Log.txt"

			for f in filesToDel do
			( 
				deleteFile f
			)
		)
		else deleteFile "Log.txt" -- this one should always be removed, as it goes in the wrong spot!


		-- modify the .con file to prevent assert for .creator command
		-- "ObjectTemplate.creator REX-NFORCE2:Rex H" -> "ObjectTemplate.creator REX-NFORCE2:Rex_H"

		--format "postFix: %\n" (fnameWithoutExt + ".con")
		bf2_PostFixConFile_spacesInName (fnameWithoutExt + ".con")



		return true
	)

)

return false
)

When I close down the MaxScript a popup says:

----------------

"Working..."

"Please wait..."

----------------

But then it just freezes and nothing happens...

I waited for 1h with no result...

Help!

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

I've found out that it helps to klick "ok" and then direct the program to my Maya instrallation path.

simon,

Regarding your earlier post with importing the Maya .mb file:

Navigate to the Program Files/EA Games/BF2/bf2editor/settings/default/ open the "customize" file

In my file, the first line reads:

Environment.RawDataPath "bf2editor/rawdata"

I believe that is the path the editor needs to find your .mb files ready to be imported.

Are you going to try and learn both Max and Maya?

Link to comment
Share on other sites

First, if you don't want to navigate to your maya.exe every time set this environment variable:

maya_location.jpg

Okay, now for the importing. Your maya hierarchy should look like this:

maya_hier.jpg

If you have all this in your hierarchy, make sure to delete all construction history (select all objects and hit Edit > Delete all by type > History) and unhide all your meshes (hidden meshes/objects aren't recognized by the bfeditor .mb importer). The error you're getting (collision mesh had no vertices) usually means that a collision mesh is missing, hidden, not in the correct hierarchy, or has some wacky history attached to it. Hope this helps.

EDIT: If you need more help I'd be happy to have a look at your .mb file for you.

EDIT2: You say you have maya 6.0.1. You wouldn't happen to have the 6.0 > 6.0.1 update lying around would you? I haven't been able to locate it.

EDIT3: Okay I found the file from the tutorial and I just imported it successfully. The problem with it was that none of the meshes were triangulated, and the texture paths were wrong. So triangulate the meshes (select them and hit Polygons > Triangulate) and fix the texture paths (open the Hypershade and find CGFXShader01, or just select the main mesh, hit CTRL+A and hit the CGFXShader01 tab in the attribute editor. You'll see a list of texture paths. Set them to any textures you like). Then just to be safe, delete the history, and you should be set.

Edited by Chael
Link to comment
Share on other sites

Edited for codebox tags. Btw, there's no need to repost Rexmans scripts here

Ok, sorry. Just thought that it could be usefull :P

I did'nt know how to do so the codebox got scrollbars, how did you do that?

-------------------------------------------------------------------------------------------------------------------

What version of Max are you running ?

I'm using 3D Studio Max 9.

-------------------------------------------------------------------------------------------------------------------

Environment.RawDataPath "bf2editor/rawdata"

I checked in my file and it also says "bf2editor/rawdata".

btw. Thanks for coming over here and helping with maya ;)

-------------------------------------------------------------------------------------------------------------------

Are you going to try and learn both Max and Maya?

I think that I could learn the export/import for both maya and max, becouse this part looks like the hardest of the whole process.

Then when I know the export/import part, I go further and choose between which program I should use. Mayby one program is better for one thing and the other is better for another thing.

-------------------------------------------------------------------------------------------------------------------

First, if you don't want to navigate to your maya.exe every time set this environment variable:

Thanks for the tip :lol:

-------------------------------------------------------------------------------------------------------------------

EDIT: If you need more help I'd be happy to have a look at your .mb file for you.

EDIT2: You say you have maya 6.0.1. You wouldn't happen to have the 6.0 > 6.0.1 update lying around would you? I haven't been able to locate it.

1. I'm using the maya bunker from Lawrence Brown:s tutorials "BF2 Modding Tutorial Building the Bunker Maya". Think that you may find it on google ;)

2. No, it was pretty long time ago since I updated it and think that I deleted it becouse I can't find it. Sorry for the bad news :(

3. I will take a look at the collision mesh you mentioned.

btw. I was writing all this while you posted your reply, if you wonder why I didn't answer on you post - EDITED ;)

--------------------------------------------------------------------------------------------------------------------

Thanks very much for helping mschoeldgen[Xww2], [TLB]stickman, Dogbox and Chael. I really appreciate it ;)

I thought like this:

mschoeldgen[Xww2], if you want ;) , you take the Max part.

[TLB]stickman, if you want ;) , you take the Maya part.

Chael and Dogbox you can also help if you want ;)

Thanks again, it's really nice that you take you time and helping me

/// simon.blom

Edited by simon.blom
Link to comment
Share on other sites

I won't take any part - i only suggest that you first setup your Max tools.

For Max9 you should install the PoE2 tools for Max9 - those do work best .

http://bfeditor.org/forums/index.php?showtopic=10199

Setting up the tools:

http://bfeditor.org/forums/index.php?showtopic=9648

Then you follow my little static tutorial which comes with textures:

http://bfeditor.org/forums/index.php?showtopic=12770

Link to comment
Share on other sites

mschoeldgen[Xww2]

ok :P

I tried with the tools for 3ds max 9 and now I can export :lol::lol::lol:

Now I have a main folder called "box01" with 2 files init. 1 folder, "Meshes", and 1 .con file, "box01.con".

Inside the "Meshes" folder I have 2 files; "box01.samples" and "box01.staticmesh".

I tried to open up bf2 editor and click file > import. I can navigate to my "box01" folder but then the editor finds nothing init.

What should I do?

[TLB]stickman

Do you have any tips for maya?

Mayaby you can setup a very basic box for me that is ready for the editor, and then I can just try if I do something wrong or if it's my coputer thats insane ;)

Thanks for helping [TLB]stickman :)

Edited by simon.blom
Link to comment
Share on other sites

I quickly created a simple box object that has already been linked correctly and everything. Download this *.max file which also includes the *.dds texture file:

http://uploading.com/files/b49d7327/Test_Object.zip/

After downloading it, take that *.dds file and place it in mods/bf2/objects/staticobjects/textures. Load the *.max file and just press export (give it a name if it doesn't have one specified). Then load up the editor and look if the file is in there. If not, then go to the tab called "Mod" in the editor somewhere at the top then click "Editor Content" and then check "Objects" so that the little white square turns green. Then press ok and look for it again.

Use that *.max file as a reference to what you have to do to get other objects such as your own custom made buildings into the editor.

Link to comment
Share on other sites

I tried to open up bf2 editor and click file > import. I can navigate to my "box01" folder but then the editor finds nothing init.

Say, did you read any of my responses or tutorials ? You don't need to 'import' any objects created with Max , its all ready for tweaking. Find your object in the resource window in the editor. If you'd read my tutorial about exporting a box you should know that you now need to map materials in the 'default' section of the tweaker.

Link to comment
Share on other sites

mschoeldgen[Xww2]

Sorry, I mayby missed that about no import, I'm a newbie to all this about moddeling and tweaking... :(

I tried to place my "box01" folder inside: /Battlefield 2/mods/mymod/objects/staticobjects/

But I can't find it in the resource window either. I checked under "mymod" and "bf2editor" but just the usually files where there :(

Tips?

Dogbox

I will try it thanks ;)

Link to comment
Share on other sites

yay :lol: I soloved it!

I placed the "box01" inside my "objects_clint.rar" and then started the editor. Then in the resource i clicked on the "+" and found the "box01".

Thanks for the help mschoeldgen[Xww2] ;)

Does a staticobject needs any tweaking or can I place it on a map?

Becouse of no texture there was a picture of a man with a hat and a text "I want you!" on my box. Is this becouse I didn't place the texture .dds in the folder or becouse I did something wrong in the texturing part in max?

Can I create my own textures and use, like create wood texture in photoshop? In which format does the texture-file has to bi in then?

Again, thanks a lot mschoeldgen[Xww2] for helping me out, you are a nice friend ;)

--------------------------------------------------------------------------------------------------------------

[TLB]stickman or Chael, have you any help for me about export/import, that would bee wonderfull ;)

THANKS EVERYBODY :)

Edited by simon.blom
Link to comment
Share on other sites

I quote from my 'Create your first static in Max/gmax' tutorial and start after the successful export:

Its now ready to be examined in the BF2 Editor. Your first task should be to map materials to it. Open the box in object editor by browsing the resource window and doubleclicking the box. Now find the 'Default' tweaker where you find an entry called 'Map Materials' . Open it and assign a wood material to your box. Save the object.
Link to comment
Share on other sites

Do you know how many times you have helped me out?
I've stopped counting :P

If the tweaker is completely greyed out chances are that you're not editing your box but some other ( write-protected ) object. If the object doesn't have the 'hasCollisionPhysics' box checked there went something wrong with the export of your collisionmeshes. Post the *.con file of your box and addtionally check if you assigned material ID1 to all the faces of all collisionmeshes. Do you have a 'box.collisionmesh' file in the /meshes folder ?

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

And I have stopped counting how many times you helped me :P

My tweaker bar isn't grey, I can click on the the different options (defaults, physics, animation) but when I click on "defaults" there is just "..." in the MapMaterials field and I can't click on it to change it.

I tried to put the box on a map and started bf2 but when the map loads bf2 crashes, probably becouse of the box?

I found the "hasCollisionPhysics" field (physics > hasCollisionPhysics) and it wasn't checked, but I could check it, it wasn't "locked" as the MapMaterial.

About the "materialID1", I didn't assign it. I followed everything in you tutorial but I had some problems with the "materialID1", I couldn't find it...

But I thought that it shoudn't matter :(

Can you explain the "materialID1" thing for me? ;)

In the meshes folder there is a samples and staticmesh file, no colisionmesh.

Strange becouse I think that I did a collisionmesh in max...

Heres the content of my "box01.con" file:

GeometryTemplate.create StaticMesh box01

ObjectTemplate.create SimpleObject box01
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator CNU9303RQQ:vxo9siblom
ObjectTemplate.geometry box01

include box01.tweak

Thanks for helping, mschoeldgen[Xww2] ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...