Jump to content

MDB to FBX, FBX to MDB converter


FreshLook

Recommended Posts

I don't remember if this has been clarified already, but here are a few things to keep in mind when animating placeables:

  • Naming convention: usually, all placeables' names look like PLC_XY_nameZZ
    • PLC stands for PLaCeable
    • X is a general model type: B = Building, M = Manmade, N = Natural, D = Door
    • Y gives the location type: C = City, R = Rural, N = Nature, T = Tileset, S = Swamp, F = Forest
    • ZZ is a number to differentiate several similar placeables.
    • Ex: PLC_BR_WindML1 --> the windmill is a Building, normally found in Rural areas.
  • All moving parts are attached to the main part, and use the same name as the main part followed by an underscore and a two-digit number: the blades for the windmill above will then be named PLC_BR_WindML1_01
  • The GR2 skeleton has the same name as the main part: in our example, it must be PLC_BR_WindML1.gr2
  • The animations must include the main part and all the moving parts, and be named as follows:
    • name of the main part + "_Idle" (ex: PLC_BR_WindML1_Idle.gr2) for the default animation. Of course it can be a static one!
    • name of the main part + "_PLC_OpenIdle" for the open position
    • name of the main part + "_PLC_Open" for the opening animation
    • name of the main part + "_PLC_Close" for the closing animation
    • name of the main part + "_PLC_TurnOn" for the activating animation
    • the OnUse script to run these animations should look like
void main()
{
    // note that nActive = 1 does not necessarily mean the placeable is active, that depends on the initial state of the placeable
    object oSELF = OBJECT_SELF;
    int nActive = GetLocalInt(oSELF, "X2_L_PLC_OPEN_STATE");
    // play the appropriate animation
    if (!nActive)
    {
        ActionPlayAnimation(ANIMATION_PLACEABLE_OPEN);
    }
    else
    {
        ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE);
    }
    // store new state
    SetLocalInt(oSELF, "X2_L_PLC_OPEN_STATE", !nActive)
}
  • for doors, there are two opened positions (pushed/pulled):
    • name of the main part + "_DR_Open1"
    • name of the main part + "_DR_Open2"
  • The main part .mdb includes everything except the moving parts (in other words, in the .mdb there will be the model of the main part along with the door hookpoint [if any], the walkmesh [if there's one], the collision boxes, etc...)
  • The moving parts will all have their own .mdb (so, for the windmill, there should be PLC_BR_WindML1.mdb and PLC_BR_WindML1_01.mdb)

 

The "Open", "Close", "Idle", "OpenIdle" and "TurnOn" animations can be used to animate placeables that don't close or open. For example, I used the "Open" and "Close" animations for a hoist lifting / lowering a cage in a mine pit, and the "TurnOn" animation to show how it looked like once destroyed.

Edited by 4760
Link to comment
Share on other sites

  • Replies 353
  • Created
  • Last Reply

Top Posters In This Topic

plc_md_cabinet05 should be the main part and the only child of plc_md_cabinet05.PIVOT. plc_md_cabinet05_01 and plc_md_cabinet05_02should be the attached parts and children of plc_md_cabinet05.

Okay, thank you. Well I tried that, but, alas, it did no better.

 

https://www.dropbox.com/s/m5fdn0zotgv9nal/plc_md_cabinet05_r2.7z?dl=0

 

I also tried it with the model that fbx2nw.exe spits out, but it had a messed up texture map assignment. After correcting that, the texture still ends up flickering in the game and the animation didn't work, so I went back to the original model.

Edited by rjshae
Link to comment
Share on other sites

 

  • The moving parts will all have their own .mdb (so, for the windmill, there should be PLC_BR_WindML1.mdb and PLC_BR_WindML1_01.mdb)

 

I tried my cabinet with the moving parts as separate models, but the resulting animated placeable was then missing the moving parts. Perhaps that's the problem then? The skeleton isn't attaching the extra parts. I tried building the baseline .fbx file by running all three parts through nw2fbs.exe then making the doors children of the frame, but had no luck with the resulting skeleton. Running the three parts and the skeleton through nw2fbx.exe didn't show the doors as children of the frame.

Edited by rjshae
Link to comment
Share on other sites

You must have three separate model parts on your hard drive:

  1. plc_md_cabinet05.mdb as the main part, including the plc_md_cabinet05_C2 and plc_md_cabinet05_C3 collision boxes if needed (I suppose there isn't any plc_md_cabinet05_w [no walking area for this placeable probably]), and for the two moving parts you need
  2. plc_md_cabinet05_01.mdb and
  3. plc_md_cabinet05_02.mdb.

 

As previously indicated, both plc_md_cabinet05_01 and plc_md_cabinet05_02 are linked to plc_md_cabinet05 (so in Blender/3ds max, all parts are in the same .blend/.max file)

 

The skeleton is built from the three parts, namely plc_md_cabinet05, plc_md_cabinet05_01 and plc_md_cabinet05_02 (note: it's not only the .mdb, but also the parts in Blender / 3ds max / Gmax, which must be named thus).

 

The animations must also be saved with all the parts plc_md_cabinet05, plc_md_cabinet05_01 and plc_md_cabinet05_02.

Link to comment
Share on other sites

By trial&error I got it working. I think I found the problem. It seems that the blending between IDLE and OPENIDLE only works if IDLE has only one keyframe. Before exporting IDLE to FBX, in the Timeline area, set Start: 1 and End: 1. It works if OPENIDLE has more than one keyframe, but since it's an idle animation, why having more than one keyframe?

 

I have tried having all attached parts in the same MDB as the main part as well as having each attached part in its own MDB and it has worked both ways. However, it seems all vanilla placeables have each attached part in its own MDB. I wonder if there is any reason for this.

 

If each attached part is in its own MDB, you must set column AttachedModelName of placeables.2da to plc_md_cabinet05_??.

 

I think the texture flickering is because you aren't exporting binormal and tangent vectors. In the FBX export options, you must check Tangent Space in the Geometries Tab. Next version of my tool will validate that there is tangent space info in the FBX and give an error if it's missing.

Edited by FreshLook
Link to comment
Share on other sites

Ah, okay. Well it's working now, after a fashion. The opening motion is odd though. I guess I'll have to use a rig to get it working properly. Thank you for taking a look.

 

The opening motion is odd because the geometry origin of the attached parts should be the hinge. Look at the armoire attached parts for an example. With the proper geometry origin, you should achieve exactly the same animation than the armoire. For animating placeables you don't need a rig at all. And anyway, if the blending between animations doesn't result in the desired animation, you can always create X_PLC_OPEN.GR2 and X_PLC_CLOSE.GR2 animations.

Edited by FreshLook
Link to comment
Share on other sites

I'll give that a shot. Thank you!

 

Ed.: I set the door placeables so that the hinge line is at the origin. When I run it in game though, the doors end up backwards with the hinges on the outside. Hmm, I guess that little dotted line to the door part is the location of what it thinks of as its geometric origin, and of course it's on the wrong end. I'll have to figure out how to change that.

Edited by rjshae
Link to comment
Share on other sites

I'll give that a shot. Thank you!

 

Ed.: I set the door placeables so that the hinge line is at the origin. When I run it in game though, the doors end up backwards with the hinges on the outside. Hmm, I guess that little dotted line to the door part is the location of what it thinks of as its geometric origin, and of course it's on the wrong end. I'll have to figure out how to change that.

 

Select the door and where the manipulator (three colored arrows) is located, there is the geometry origin.

 

After having changed the geometry origin, are you reconverting the animations?

Edited by FreshLook
Link to comment
Share on other sites

Select the door and where the manipulator (three colored arrows) is located, there is the geometry origin.

 

 

 

After having changed the geometry origin, are you reconverting the animations?

 

Well then the geometry origin is in the right location. Hmm. Yes I started over, importing the three parts into an FBX file, joining them under a .PIVOT as before with the doors as children. I tried the same thing using the 'Object (keep transform)' option to join the doors, but that made no difference. It's curious though that when I'm shifting the doors into position, the geometric origin stays at the same x-axis location (0.0) rather than moving with the doors while the y and z coordinates move.

 

https://www.dropbox.com/s/27jsb8uezipo934/plc_md_cabinet05_r4.7z?dl=0

Edited by rjshae
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...