Code Monkey home page Code Monkey logo

blender2lus's Introduction

blender2lus

Springrts Lua Unit Script (LUS) Export addon for Blender

Description

This is a simple Blender addon that allows one to export animations created in Blender (provided they obey a long list of caveats and requirements) as SpringRTS Lua Unit Scripts in a fairly modular way.

Installing

1) Paste the io_anim_lus folder into your blender's scripts/addons directory

2) Enable the addon in blender

3) ???

4) PROFIT

Using

1) Assemble a model suitable for import by Spring's Assimp. This means, in particular:

  • Each animatable piece of the model is a separate object

  • You will have to apply all scale and rotation transformations before exporting the model and starting your animation work. Whatever model you use ingame has to perfectly match to what you will be animating on.

  • Preferred export format for Spring import is .dae - others might work, but there's little guarantee.

2) Obsessively change each object's Rotation Mode in the hidden right pannel (or in object transform properties) to "Euler ZXY".

  • It's possible to do this reasonably fast by posting the following snippet into Blender's Python console:
	for i in bpy.data.objects:
	    i.rotation_mode = 'ZXY'
  • If you skip this step, your animations will not be usable. Switching rotation mode on already existing keyframe data does not convert the keyframes automatically, thus ruining the animation.

3) Create your animation. Mind the limitations.

4) Hit the export button! While doing so you can choose between two export modes:

  • Save as an animation include. This will only output the animation data, without any additional stuff, ready to be imported into an animation script. This is the default option.

  • Save as a main script file. This will create all the framework needed to import and run animations for your unit, as well as the animation itself. Useful only once per unit.

5) Plug and play the exported stuff into your greater script's logic. Sadly, exporter won't do all the work for you - it only allows you to separate artwork and programming.

Limitations and bugs

  • You absolutely have to change every object in your scene into Euler ZXY rotation mode before starting your animation work, or the animation will be irrecoverably incorrect.

  • Your object names have to be valid Lua variable names, because object names are not validated in any way. Generally, avoid anything containting spaces and punctuation marks.

  • You cannot have multiple animations per blender file. Blender's Actions system doesn't really accomodate for a horror soup of a dozen objects trying to dance in concert.

  • You can only use Linear interpolation between your keyframes, because there's no way to implement Bezier in Spring LUS... at least yet.
    Workaround: Use a lot of keyframes if you want smooth motion.

  • You have to apply scaling transforms before export, and you cannot use scaling in your animations. In fact, you're limited to using LocRot.

  • You cannot use inverse kinematics, because you cannot use bones (at least, not without amount of effort making this approach self-defeating. This might be addressed in the future, but don't hold your breath).

blender2lus's People

Contributors

picassoct avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

blender2lus's Issues

gravitas-style export

Support automatically generating a scriptEnv and a "headless" animation table export mode to allow the logic part of the script to include externally stored animations.

This further divides coding logic and arting animations, allowing animators to swap individual animations without caring for logic.

Compact the addon into a single file

Downloaded the script.
Installed in Folder:
D:\Program Files (x86)\Blender Foundation\Blender\2.77\scripts\addons\blender2lus-master\io_anim_lus
Addon does not appear
Reinstalled in
D:\Dev\io_anim_lus
Again not recognized.
Blender Version is 2.77a
Operating system is Win10
Do not know if there is a local python environment installed beyond blender.
Would love to see work not go to waste. As they say, every succesfull software endavour turns a great man into a caretaker. Welcome to the uglys side of softare ;D

Animation time scaling, interruption, reverse support

Any extended usage of the addon for ZK requires that the animations are able to

  • respect slow ( = slower/faster playback);
  • be interrupted at any time and resumed without jerking to start ( = resume-at-keyframe)
  • and be reversed from the current position ( = above, but also play in reverse).

Fight..

Begun the model format war has - in the left corner (Beherith) with s3o, the spring format. In the right corner (Anarchid) (DAE) .

He who has more features and better support for the gamedevs - shall win the future.

Are you ready?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.