IndieStone NEXUS Fixes/Workarounds

lemmy101

Emperor
Joined
Apr 10, 2006
Messages
1,064
These will likely become redundant when the mod tools are updated, but in the meantime allow for full unit/building/wonder modding, including re-skinning and adding completely new units and wonders

For a tutorial on getting new units in the game using this tool, look here: http://forums.civfanatics.com/showthread.php?t=392985

Also check out the new version of this tool, rebranded the Nexus Buddy, which will no doubt replace this one soon: http://forums.civfanatics.com/showpost.php?p=9834949&postcount=21

Please note, all these tools tie into Nexus, and therefore most of the heavy lifting and all the granny file manipulation is done by Nexus. So credit where credit is due, I wouldn't want anyone to think I've managed to make a working alternative to the Nexus pipeline in a day or two, as that would be massively unfair to the awesome guys at Firaxis and all their hard work, without which this tool would pretty much be a user interface that didn't do anything.

IndieStone Material Maker!

Allows you to edit materials on your meshes pretty much as you would in Nexus, except it works... and doesn't have the preview sphere (which currently doesn't work anyway)



DOWNLOAD HERE: http://www.theindiestone.com/lemmyandbinky.com/civ2/IndieStoneMaterialMaker.zip

Place it in your Nexus/x86 directory and run it from there.

This tool provides a replacement for the currently non-functioning Nexus material editor.

With it you can do the following things to your gr2 models:

Add new materials - click 'add' to add a material, select it's type (Currently only UnitShader_Skinned, BuildingShader, LandmarkShader and LandmarkShader_Stencil supported) then you can set textures on them.

Edit materials - Select the material and edit the textures in the property grid to the right.

Delete materials - Select materials (hold shift/ctrl to multi-select) and click delete to delete materials from the file.

Easy skinning - Load up a firaxis gr2, save it to a new filename with Save As... then edit the materials how you like. NOTE: To reskin Firaxis buildings you will need to install the unofficial Nexus patch here or they won't work. Making your own new buildings or reskinning units should work without the patch, however.

Material reassigning just click on a mesh and you will get a drop down box in the mesh's material column, this will allow you to select the material that mesh uses.

And that's it, not sure what else to say!

Below is the material hacker which is now largely redundant but left here in case it comes in useful to anyone.

1. Granny Material Hacker - Allows for unit reskinning and works around the issues with Nexus' material editor

http://www.theindiestone.com/lemmyandbinky.com/civ2/GrannyMaterialHackerv2.zip

This tool can be used to copy the entire material set of a Firaxis model onto your own exported gr2 model. You can also reset the textures the materials point to to your own dds files. (See below for current limitations).

So to use it, place it in your Nexus directory and run it.

You select a firaxis gr2 in the top text box using the browse button.

Then you can browse the structure of it, to see what materials are in the gr2, and what textures are set on those materials.

You can, if you wish, replace any of the textures by double clicking the paths in the last column, to allow you to browse for a new texture. They should be in your Resources/DX9 directory.

Then select YOUR gr2 in the 'My GR2' section, this is the model that you exported in Nexus (the all black version. this file should be placed in the Resources/Common directory) or your duplicate of the first model if you're doing a unit re-skin .

If you only have one material, or just one mesh making up your model, then you can ignore the 'mesh -> material binding' section and just click HACKIFY!

This will transfer all the materials across to your GR2, with your new textures selected in each one. It will save the gr2 out as 'yourfilename_new.gr2' in the common directory. You will need to rename and remove the '_new' from the name of your main gr2 so it'll get picked up by the nexus viewer, I just did it like this so there would be no unsavoury overwriting going on.

It doesn't quite work for everything (the texture path for the wonders / buildings textures seems to also be stored in a place I can't easily get and it seems to be using that one instead of the material setting) but we've tested it with the unit shader and it seems to work a treat. This means we've technically got everything we need for doing units.

It will allow you to transfer the material from an existing building / wonder onto your new one (we managed to get the pyramids materials and textures displaying on a test object in nexus, we just couldn't alter what texture it was pointing to), so if you want to test your wonder in-game in the meantime you can replace the unpacked dds files for the wonder you're ripping the materials from in the DX9 directory and it should work properly for your wonder that shares them (but will display the wonder you used to transfer from incorrectly using your texture, obv, but who cares if you're just testing).

ALSO assuming you can open the source dds's for reference, this tool will allow for proper unit reskinning! it will allow you to duplicate, say, the rifleman.gr2 to superrifleman.gr2, run the tool to point him at a new dds file, and therefore reskin units! All without ever going into Nexus! WEEE!

Mesh -> Material Mapping

For cases where you have multiple meshes and/or materials, and you only want certain materials adding to specific meshes, you can use this section to 'unbind' materials from your meshes. The program by default binds every material to every mesh, to ease in use of the tool when doing simple material hacks.

For cases where you have multiple materials (builders / leaders for example, when support is in for them) you may for example want one material assigning to each mesh part of the model. To do this you can select each of your meshes in the box on the left, to show all the bound or unbound materials in the boxes to the right. By default they will all be in the bottom 'bound' section. Select each material you don't want to be bound to this mesh and click 'unbind' to take that material off that mesh.

Then click HACKIFY! when you're happy.

(Note version 1, before the mesh binding feature went in is linked here, in case there's any problems or bugs with the new version: http://www.theindiestone.com/lemmyandbinky.com/civ2/GrannyMaterialHacker.zip)
 
2. Nexus '5k empty animation bug' fix patch. Allows for animations to be exported in Nexus properly.

I've been struggling about what to do with the animation fix I have here in this DLL, especially now it is the only thing getting in the way of full unit modding. Distributing it was out the question, but I think I've found a nice compromise:

http://www.theindiestone.com/lemmyandbinky.com/civ2/Civ5NexusAnimBugFix.zip

Here is a patch that does not contain any Firaxis owned materials, that will simply tweak the DLL file on your end. Back up your Civ5NexusModes.dll in steam/common/civ 5 sdk/nexus/x86/plugins if you wish (though it's easy to re get it off steam should anything go amiss)

Please note this is not in any way affiliated with Firaxis or 2K Games, use entirely at your own risk!

This completely solves the 5k empty animation bug, and with this fix we have managed to get perfectly functioning animations exported through nexus. Enjoy!

With this, and the material transfering program, you are able to add completely new units in mods now.

(Note, when the official tools update, it should just overwrite this automatically with their own fixed version. If for some reason this doesn't happen, you can just delete the plugin directory and in the SDK options on Steam 'Verify Integrity of Local Cache' and it will redownload the latest version. This can be used to revert this change, too)
 
Awesumniss!!!

This is exactly one of those big user ambitions that break the borders of possibilities for the whole community.

Can't wait till I got enough spare time to try this out....
 
Still no luck getting the units to stand in formation normally.

I have tried a couple of models and all have the same result. Looking at the pictures I noticed the units are almost exactly half-way into the ground. Assigning a blank animation did not help either. Adding a state manager did not either. So I then started looking at the file through granny viewer and I noticed this:



heres a screen to compare to:


This makes me believe the problem is somewhere in the code where it places the units using the Z center grid instead of the Z origin grid. This would explain why they are sunk into the ground. There has to be somewhere where these variables are stored along with the variables for the rotation. Or how else would we make helicopters hover above ground?

Its also possible to view names of each bone in grannyviewer, so if we can get it to import the vanilla unit models, we may be able to reuse existing animations.

Ill try to keep poking around and see what I can come up with.:crazyeye:
 
I 've imported Civ IV graphics in blender
I exported in FBX then i imported through nexus (it appears in 3D viewer)
then i simply replaced the fxsxml file with the paratrooper one,changing model and texture paths to my files,but leaving the animation related stuff like that
And guess what ? I get the same result as Deliverator : My units are invisible
Any thoughts?
 
try doing it like i did. Add another member to the group which already came with the game. I think this is what solved my problem when they wouldnt appear.
 
try doing it like i did. Add another member to the group which already came with the game. I think this is what solved my problem when they wouldnt appear.

I tried using the Babylonian archer as a member of a group with other vanilla units and it was still invisible. I'm not sure how your unit is even showing up. I'm thinking that until we try a unit with at least it's own proper idle animation it's not going to work.
 
I 've imported Civ IV graphics in blender
I exported in FBX then i imported through nexus (it appears in 3D viewer)
then i simply replaced the fxsxml file with the paratrooper one,changing model and texture paths to my files,but leaving the animation related stuff like that
And guess what ? I get the same result as Deliverator : My units are invisible
Any thoughts?

My only thoughts are that it could be to do with the FBX export options from Blender.

@Ekmek: Did you use the default FBX export setting for the file you gave to Firaxis?
 
@Ekmek: Did you use the default FBX export setting for the file you gave to Firaxis?

yeah, what ever as part of 2.49b. The only thing different in my blender is the nifscripts of course.

Has anyone actually imported a wonder from civ4? I think we should try that first because they have no bones and no animation. I added a vertex which shouldcount as a bone but mine didnt show. Since civ5 wonders have no animation I wonder why their's shows and mine didnt. I'm going to try again tonight though.
 
Lemmy,

any chance you found out why nexus "remembers" your previous imports. I just created a new fbx and tried to import - 3d preview was greyed out - and when I created the gr2 it was my old yert.

EDIT: I've even deleted nexus and reinstalled through steam and it STILL REMEMBERS. I can tell because granny viewer keeps pointing to a previous fbx. I cant find whereit is storing this or why its taking it from there.

i removed the fbx it kept taking from and then it found my gr2 and left it blank. its odd because in the nexus viewer it shows my old model but when it exports it brings up my old model.

Any one else getting this? anyone else try more than one model?
 
NEW TOOL!

ANNOUNCING:

IndieStone Nexus Buddy!

DOWNLOAD HERE: http://www.theindiestone.com/lemmyandbinky.com/civ2/IndieStoneNexusBuddy.zip

New experimental version of the Material Maker. It's now called the 'Nexus Buddy' as it's much more than a material maker! You can now make new units without EVER LOADING NEXUS. Weee! (well not strictly true as it's interacting with Nexus on a code level)

New features:

* You can now import directly from an FBX file! When you open a file, click the drop down to select FBX as the file type, and select an FBX and it will import automatically!



You want your FBX file and ALL dds textures you plan to use on your materials all together in a work directory. This is all you need.

* You can define the animation definitions inside Nexus Buddy! Set them up in the same way as you would in Nexus. The first anim you define will automatically gain every event code used to create units,so you can take them off this anim in the property window as you add new anims. It will save these anim definition and load them whenever you load up your source gr2 file or reimport the FBX file, so you don't have to keep typing them whenever you make changes.



* The biggie. Assuming you have your FBX and associated dds textures in one place... Once you've imported it, set up your materials and added the anims. Click the 'Smart Exporter' tab to find....



BAM!

Just click 'Export' and you'll get a subdirectory where your FBX file is called 'export'

In it...



All the files you need for your model, all prepared with animations, the texture, and a fully made fxsxml file set up for all the anims, state machines, anim graphs and anim triggers.

Just drop these into your Art folder of your mod and add your own civ5artdefines_unitmembers.xml and that's ALL you have to do. New unit, in there!

Furthermore you can always reload your source gr2 (the one in same directory as your FBX) and change the animations / materials, or reimport the FBX. Although currently you'll have to recreate your materials if you reimport from FBX, all your anim definitions will still be there, so you can reexport to your heart's content and tweak the anim definitions to suit.

Have fun!

Will update the tutorial with the 'fast way' which cuts out a lot of the steps sometime soon. Tomorrow I may try and do some kind of automatic new unit XML generation, perhaps even have it make a ModBuddy project if you want it to. See how many of those steps we can get rid of :) also we're going to look into getting a leader in the game soon, so will be adding Leader support to this then.
 
NEW VERSION:

http://www.theindiestone.com/lemmyandbinky.com/civ2/IndieStoneNexusBuddy.zip

So I added this:




Which allows you to edit most of the unit details, both the art details and the actual unit's stats and such. It all generates sensible values based on the model filename and such, and the parameters of the unit are mostly equivelent to a warrior.

Click export with all default settings, not typing in a single value, and it generates this in the export directory:



Drag the tree into ModBuddy and add the UpdateDatabase reference, tick the Reload Unit tickbox in the properties. Literally that's the only thing you have to do, run the game and:



Hurrah! That's a unit from FBX to in the game without touching a line of XML. :)
 
Hey,

When I first ran your mod buddy I guess I pointed it to the wrong folder (it's looking for Assets/Assets not just /Assets). Now it crashes when I try to run it, when running Nexus it gives the same error, but allows me to at least get into the program.

How do I change this now?

Thanks. Can't wait to get to grips with this tool, looks amazing.

EDIT: Never mind, found this thread...
http://forums.civfanatics.com/showthread.php?t=385031
 
Hi lemmy,

First thanks a lot for your great work .

One question ... Is it possible at the moment to just import a unit gr2 file from resources and export it through the smart exporter after having changed the materials ?
I've tried to do this with multiple units but I always get the error "No animations data is found in the loaded file . Cannot export unit" .
Could this be due to the different gr2 files that seem to exist for each animation ? ( see attached images )
 

Attachments

  • bab_bowman_export_01.jpg
    bab_bowman_export_01.jpg
    127.1 KB · Views: 343
  • bab_bowman_export_02.jpg
    bab_bowman_export_02.jpg
    142.1 KB · Views: 350
  • bab_bowman_export_03.jpg
    bab_bowman_export_03.jpg
    223.2 KB · Views: 310
Top Bottom