darkFunction to Orx Converter

2»

Comments

  • jimjim
    edited August 2013
    Yeah, actually I was talking about child, as you can see, in the config, I made Head,Torso,Legs,Hands child of object.
    So, child of child can also have animations ? This way it would be very easy to simulate darkFunction animation system, which is kind of close to skeletal animation.
  • edited August 2013
    Yes, that can be done. However, in order to simulate skeletal animation you'll currently need to combine traditional animation and orxFXs.
  • jimjim
    edited October 2013
    I gave some more thought on multi-sprite animation in DarkFunction, I tried to do it from config. I was kind of right about the way I wanted to go but now I see I hit a dead end. Its still possible to do but using only config is not possible. So here is what I did, it does not do much, head just go up and down but I shows what I was talking about. In config
    [StickMan]
    ChildList = Head # Torso # LeftLeg # RightLeg
    Position = (100,100,0)
    
    [Head]
    Graphic = HeadG
    AnimationSet = HeadAnimSet
    Position = (50,-200,0)
    
    [HeadG]
    Texture = ../data/anim/head.png
    
    [HeadAnimSet]
    AnimationList = HeadIdle # HeadJump
    LinkList = HeadIdleLoop # HeadIdle2Jump #  HeadJump2Idle  # HeadJumpLoop    
    
    [HeadJumpLoop]
    Source = HeadJump
    Destination = HeadJump
    
    [HeadIdleLoop]
    Source = HeadIdle
    Destination = HeadIdle
    
    [HeadJump2Idle]
    Source = HeadJump
    Destination = HeadIdle
    
    [HeadIdle2Jump]
    Source = HeadIdle
    Destination = HeadJump
    
    [HeadJump]
    DefaultKeyDuration = .5
    KeyData1 = HeadJumpAnim1
    KeyData2 = HeadJumpAnim2
    
    [HeadIdle]
    DefaultKeyDuration = .5
    KeyData1 = HeadIdleAnim1
    
    [HeadJumpAnim1 @ HeadG]
    Pivot = (0,20,0)
    
    [HeadJumpAnim2 @ HeadG]
    Pivot = (0,0,0)
    
    [HeadIdleAnim1 @ HeadG]
    Pivot = (0,0,0)
    
    ; others are defined as same way
    
    Then in code
    // get objects from object event create then set animation as 
    orxObject_SetTargetAnim(head,"HeadJump");
    orxObject_SetTargetAnim(head,"TorsoJump");
    orxObject_SetTargetAnim(leftLeg,"LeftLegJump");
    orxObject_SetTargetAnim(rightLeg,"RightLegJump");
    
    It was all good now, but when I tried to apply Rotation on key frame it does not work, as I can see we can only define Pivot and Flip for "Graphics" but not Rotation.
    As we can define Angle in DarkFunction, without rotation it is not possible to make a complete darkfuntion anim importer. Though we can apply Rotation from code, using KeyEventValue as Rotation, I have to look more into it.

    One more thing, is there any gotcha the way I defined my animation for multi-sprite or there could be a better way to achieve this type of animation?
  • edited October 2013
    Jim, you and I scarily follow similar developments paths, and every time I look for a concept I am working on, I find your posts :)

    It seems I do need a multi-sprite support, as my head and arm of my character will be separate from the rest of the body.

    So I'll be looking very closely at the converter to support this.

    But I don't intend for orx to handle the two parts for me... I'll have twin configs for all the animation and links: one for body and one for arm & head.

    Then I'll ensure in my code that the two objects stay together or make one object a child of the other. Cross that bridge when I come to it.
  • jimjim
    edited October 2013
    Yep, I will be going this way too, one thing I did not mention is, the example animation in DarkFuntion editor is a mess, its way too complicated to handle manually, there each frame consist of around 30 individual sprite, which is insane.

    So, in my implementation I would be using fixed and less amount of sprites. It would be really a cool addition to orx, because I have not seen this type of animation often, of course it is different than skeletal, it is still frame based animation.

    If DarkFunction does not work, I might make an animation tool like DF but with some features that I wanted, as I was talking to a java guy who is a friend of mine.
  • edited October 2013
    I'll certainly be able to take in two or more layers of animations, but I'll be splitting them up into their own animation sets.

    Perhaps with some autonaming... though maybe I should be more strict that the naming largely coming from how things are configured in darkFunction. I dunno.

    I'll have to take a look again how I went about it.

    There's some messy recursive code in there which I don't like.

    Once I get my anim calculation stuff done, I'll get back onto this. Hopefully next week.
  • jimjim
    edited November 2013
    Bump, I wanted iarwain to see the code I posted earlier, is it okay to manage multi-sprite animation this way ?
    Only thing I had to do manually is, rotation per frame, which I have to set from code not a big deal though.

    I think when, animation channel would be available it would take orx animation to a new level. I am not clear about features of animation channel but I think it would be possible to add FX or transform (rotation, scale ) per frame or per key.
  • edited November 2013
    Yes, it looks fine to me! :)

    And yes you're right about animations channel. It's the first step for skeletal animation to separate keys into different channels (sprite, transforms, events, ...).
  • edited May 2016
    V1.05 added. This version finally supports multiple layers of animation. Each layer becomes an ANIM config section of its own.

    I've changed the interface as well. Now, you browse for the anim, file rather than the sprite file. The sprite file is determined from the anim file, checked for existence and autoloaded.

    Instructions on the wiki will be updated shortly.

    darkfunction_converter_screenshot105.png

    See first post for updated version.
  • jimjim
    edited November 2013
    Oh, great :) Gonna check it tomorrow. Btw how did you handle sprite angle ? I mean where did you store angle data in config ?
  • edited November 2013
    No I haven't supported angle. Hmmmm.....

    Because each sprite frame in darkFunction can have an angle, ie, the angle can be animated, the closest we could have in orx is a custom EventName/Value pair.

    So perhaps we could have:

    KeyEventName1 = Angle
    KeyEventValue1 = 13
    KeyEventName2 = Angle
    KeyEventValue2 = 45

    This would be quite possible and then the rotation in degrees would have to be handled and rotated with your own code.
  • edited May 2016
    New version 1.9 has been released. I realised that I had never allowed the standalone conversion of a spritesheet.

    Before now, an animation had to be defined as well.

    DarkFunctionToOrx19.png

    https://forum.orx-project.org/uploads/legacy/fbfiles/files/DarkFunctionToOrx19.zip
Sign In or Register to comment.