Jump to content

Blender 3D Scripts


Jab

Recommended Posts

Blender 3D Model Import / Export Scripts are a WIP (Work in Progress). 

 

 

Right now the scripts can do the following:

  • Import:
    • Import all models
    • Import rigs
  • Export:
    • Export non-weighted models (Weapons)
    • Export weighted models (Clothes, hair, etc)
    • Export Animations

 

These features are planned on being added:

  • Export Skeletons

 

To use these scripts, you will need to open the 'Text Editor' in Blender, and paste the scripts in the editor and hit the 'Run Script' button on the window bar.

 

Scripts:

 

 

[Tutorial by WolfeArt]

 

 

Link to comment
Share on other sites

If you want to go ahead and just load models right now, this script will work for all models in the game. 

 

https://github.com/JabJabJab/BlenderZomboidIO/blob/master/ZomboidImport.py

 

raw file:

https://raw.githubusercontent.com/JabJabJab/BlenderZomboidIO/master/ZomboidImport.py

 

just paste this into your script editor, and load a model from one of the txt files located in your zomboid install directory/media/models.

 

The textures are not loaded because they are hard-code-loaded in the actual game. the textures are located in media/textures. The Texture UV map is loaded.

 

iOejKBpM5ywh7.png

 

Happy Blending! :)

Link to comment
Share on other sites

Wow! Nice man! So can you actually import stuff, and see them ingame, or you haven't made any progress on that? If you have, then you've just helped a lot of modders, I guess.

 

Right now this is just a import script. The next finishing step would be to also import the animation data (rig, keyframes, etc.). The next step after that would be to export to the same format used to import, which is where things like modding would be a thing.

Link to comment
Share on other sites

this is awesome! <3 would love to see this complete. We'll get to official support at some point but there are considerations first :)

 

Glad to know this kind of utility is welcomed. 

 

I would strongly suggest the Quake MD5 model format, due to its use of vertex weights, quaternions, and everything your format uses, however, separating the animations into separate files. This would be a plus for modding & adding animation support, plus it's a well known format.

Link to comment
Share on other sites

Been having so much trouble loading the rig for the male / female models. The model data uses 4x4 matrices with a bind_pose, a inverse_bind_pose, and a bone_offset matrix, and the only thing I can get out of this data is an akward rig that barely resembles a bind pose. 

 

ijtoCI4vPGikV.png

 

I've been scratching my head at this for the past few days. I'm not sure what to do really. 

Link to comment
Share on other sites

It's interesting to see the clothes pointing to an armature that is not defined in the file. Kind of odd, and will complicate the way imports will work (This is not an issue. I want to have Blender detect the armature before making one, as well as making one if one does not exist. I might have to do some hard-coded stuff, and no-one likes that. :( ).

 

Anyways, I went ahead and pushed the code that loads the armature to the repository (the links update), however, the mesh is not bound to the rig yet. That will be the next step forward.

Link to comment
Share on other sites

Pushing code that allows objects worn "Auto-attach" to the rig if the rig is loaded (with male or kate) before the object is loaded. (Weapons don't auto-attach (maybe later)).

 

Animations right now are still a headache, and I'll look into getting this up and ready when i find out what I need to do to properly load them in.

 

Here's a picture. 

 

 

ibHRwIe5hGH1w.png

Link to comment
Share on other sites

So Right now I'm looking at building a export script for the most basic things like weapons, shirts, etc, until I can get this animation thing nailed down properly. What a headache. Oh well. 

Link to comment
Share on other sites

I shall break the chain of Developer posts to stay true to my member title!
Also, great work man I bet many modders will appreciate this. Personally, I was unable to load anything as it all just kept being a cube but then again, I'm a noob in blender and don't know anything about it lol.

Link to comment
Share on other sites

I shall break the chain of Developer posts to stay true to my member title!

Also, great work man I bet many modders will appreciate this. Personally, I was unable to load anything as it all just kept being a cube but then again, I'm a noob in blender and don't know anything about it lol.

Delete the cube. Most of the imported stuff is so small that they appear inside the cube.

 

 

 

This is so cool! I succesfully made an import and used it as a template, but I'm still having difficulties getting the game to read my exported model.

 

I'm guessing that the modding and scripting system doesn't yet cover models? Or does anyone know a way to create a new item with a newly exported model?

 

Here's my quick code if anyone has time to take a look.

I've added the model under mods/stick/media/models/weapons_stick.txt and I've changed the model name to weapons_stick. I have the recipe as follows:

stick.txt

module Base{    item TreeBranch    {        MaxRange    =    1,        WeaponSprite    =    weapons_stick,  /************Also tried 'Stick' as with other weapons...**********/        MinAngle    =    0,        Type    =    Weapon,        MinimumSwingTime    =    2,        KnockBackOnNoDeath    =    FALSE,        SwingAmountBeforeImpact    =    0.02,        Categories    =    Blade,        ConditionLowerChanceOneIn    =    5,        Weight    =    0.3,        SplatNumber    =    0,        PushBackMod    =    0.1,        MaxDamage    =    0.1,        SubCategory    =    Stab,        AimingMod    =    0.8,        CloseKillMove = Jaw_Stab,        ConditionMax    =    5,        MaxHitCount    =    1,        IsAimedHandWeapon    =    TRUE,        DoorDamage    =    1,        SwingAnim    =    Stab,        WeaponWeight    =    0.3,        DisplayName    =    testbranch,        MinRange    =    0.61,        SwingTime    =    2,        MinDamage    =    0.1,        KnockdownMod    =    0,        SplatBloodOnNoDeath    =    FALSE,        Icon    =    KnifeButter,        RunAnim    =    Run_Weapon2,        IdleAnim    =    Idle_Weapon2,        BreakSound  =   PZ_MetalSnap,        TreeDamage  =   0,        EnduranceMod = 0.5,    }}

and here's the model:

https://www.dropbox.com/s/up1en7r65bcuvl7/weapons_stick.txt?dl=0

The item loads just fine, but the model doesn't appear/is invisible. Also the model is using the existing plank texture so it shouldn't be a problem with that...?

Would I need to write lua to load the model into game? I did try to search the javadocs with no avail...

 

Another newb trying to learn with too steep of a learning curve. :P

Link to comment
Share on other sites

This is great!

 

(Just don't load the golf club - it's by far the worst 3D model I have ever made in my life :D )

 

What program did you use to export your models? I'd like to take a look at it for research purposes. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...