Jump to content

Quick format question


mduffor

Recommended Posts

Hey Mike and Lucid,

I'm wrapping up implementing my own scml parser, and had a few quick questions.

Timeline keys have a <key> tag, with <object> or <bone> child elements.  Am I correct in assuming that the <key> tag will only ever have a single child element, either of type <object> or of type <bone>?

In Animation::setCurrentTime (), you loop by modding the newTime against 360.  Why 360?

Also in Animation::setCurrentTime, you pass "currentTime" down to updateCharacter().  Was that supposed to be "newTime" instead?  Same question goes for keyFromRef, where it calls interpolate() at the bottom.

Similar question for Animation::mainlineKeyFromTime, should the comparisons be using "time" instead of "currentTime"?

In BoneTimelineKey, you name the variables "length" and "width", but then use "length" and "height" in paint().  I'm assuming height should be width there.

 

And finally, while I have you in the habit of answering questions, any word yet on mesh deformation support in Spriter?  Is it something you are targeting for calendar year 2017?

 

Cheers!

Michael Duffy

 

Link to comment
Share on other sites

9 hours ago, mduffor said:

Am I correct in assuming that the <key> tag will only ever have a single child element, either of type <object> or of type <bone>?

Yes

9 hours ago, mduffor said:

In Animation::setCurrentTime (), you loop by modding the newTime against 360.  Why 360?

Also in Animation::setCurrentTime, you pass "currentTime" down to updateCharacter().  Was that supposed to be "newTime" instead?  Same question goes for keyFromRef, where it calls interpolate() at the bottom.

Similar question for Animation::mainlineKeyFromTime, should the comparisons be using "time" instead of "currentTime"?

In BoneTimelineKey, you name the variables "length" and "width", but then use "length" and "height" in paint().  I'm assuming height should be width there.

Which implementation are you using for reference?  It sounds like a bug duplicating the angle code for the 360.   You may be using an out of date reference.  What's the url?

Mesh Deformation will be in Spriter 2 (free upgrade for Spriter Pro owners).  I apologize for any frustration it may cause, but we don't have an ETA for thatt.

 

Link to comment
Share on other sites

The reference I'm using is from a post on this forum from February:

http://www.brashmonkey.com/ScmlDocs/ScmlReference.html
 

I briefly looked over the code of the C++ implementation, and I see that there are a lot of features that aren't covered by the spec (such as eventlines, soundlines, taglines, and varlines, as well as primitive types outside of bones and sprites), but it is easier to implement from the spec than from the code of a specific implementation.  


I'm not planning on needing mesh deformation for my current project, but it would be very nice to utilize on my next one.  If there is anything you need from the community in order to help the process along, I'm sure people would be available to help. :-)

Cheers!

Link to comment
Share on other sites

I see. I didn't realize we still had that up anywhere.  It is a bit out of date, and as you've noticed, has a few mistakes.

On 6/17/2017 at 0:12 PM, mduffor said:

In Animation::setCurrentTime (), you loop by modding the newTime against 360.  Why 360?

That should be

newTime=newTime%length; // this->length of Animation
On 6/17/2017 at 0:12 PM, mduffor said:

Also in Animation::setCurrentTime, you pass "currentTime" down to updateCharacter().  Was that supposed to be "newTime" instead?  Same question goes for keyFromRef, where it calls interpolate() at the bottom.

Correct.

On 6/17/2017 at 0:12 PM, mduffor said:

In BoneTimelineKey, you name the variables "length" and "width", but then use "length" and "height" in paint().  I'm assuming height should be width there.

Correct again.

 

On 6/19/2017 at 0:23 PM, mduffor said:

I'm not planning on needing mesh deformation for my current project, but it would be very nice to utilize on my next one.  If there is anything you need from the community in order to help the process along, I'm sure people would be available to help.

Thanks for the offer.  For now, just patience.  As soon as that changes, we will let you know.

Link to comment
Share on other sites

  • 4 weeks later...
On 21/06/2017 at 8:13 AM, lucid said:

 

That should be


newTime=newTime%length; // this->length of Animation

 

Not exactly. Since it's possible in the editor to put a key at the exact end of the timeline (at the length), the actual length of the animation and the one you should be modding with should be length + 1. (Or it would be more intelligent to prevent having timeline key with their time = length of the animation)

If I have an animation of length 120 and I can place a timeline key at 0 and at 120, I have in fact 121 possibilities to place my timeline key. Also, If the newtime is 120 (exactly on a timeline key) and I mod it by 120, it will become 0 meaning the last timeline key will be completly skipped.

Example (with 5 of length and 6 frames):

test.png

Link to comment
Share on other sites

You are correct. 
Something along the lines of this would be more appropriate:

if(looping)
{
    while (newTime > animationLength)
    {
        newTime -= animationLength;
    }
    while (newTime < 0)
    {
        newTime += animationLength;
    }
}    
else
{
    newTime = min(newTime,animationLength);
} 

 

Link to comment
Share on other sites

Thanks for the catch on that, WinterGuardian.  Also thanks for the updated approach, lucid.

It took a bit of testing, but I managed to get my implementation working about two weeks ago.  Now I'm working on fleshing out more of the core game loop, and then I can move into final art production where I'll be able to actually use Spriter in my code.

 

Cheers!

mduffor

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...