Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spine-ts #121

Closed
scottmcdonnell opened this issue Sep 26, 2016 · 19 comments
Closed

Spine-ts #121

scottmcdonnell opened this issue Sep 26, 2016 · 19 comments

Comments

@scottmcdonnell
Copy link

scottmcdonnell commented Sep 26, 2016

What is the plan with spine-ts? I had a quick look here at adding some Pixi to it, but have got stuck already.

Here is the example but it is not applying the local transform on update. Not sure of the workings of the new PIXI v4 transforms.

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 26, 2016

Thank you, that will help me to integrate spine-ts.

!@#$ im stupid!

Check if its PIXI.TransformStatic either PIXI.Transform, not just latter

Also, I'm going to create branch, change the build system, and I'll add you to contributors, lets try this in separate branch.

@scottmcdonnell
Copy link
Author

I made a little progress - the TransformStatic helped
Separate Slot Container class to keep refs to Display Objects.

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 26, 2016

The most difficult part will be loader, it is async.

OK, gonna add your stuff today in separate branch, as planned. Then we make it to master

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 26, 2016

I dont undrestand some typescript stuff regarding modules, I need help with that.

Currently spine-ts compiles all files from folder somehow and I dont understand how to do it the same way as PIXI does.

For example, we have module "spine" inside of directory "core", it contains all files in this directory. How can I include this as a module from "index.ts" which will be entry for browserify?

Also I want all core to be found inside "PIXI.spine.SpineRuntime" namespace. How do I do that?

@ivanpopelyshev
Copy link
Collaborator

@englercj said that Its better to convert module to imports first, so I'll do that.

@scottmcdonnell
Copy link
Author

It may be best to keep the spine-ts core files untouched so the runtime can be easily updated. What about having the runtimes as a package dependency and importing just the spine-ts/build/spine-core.js?

@ivanpopelyshev
Copy link
Collaborator

I dont think we can leave them in pure form, there are too many hacks in original pixi-spine for that. I can ask Mario (spine-ts author) to change the way it builds, but for now we have to change everything on ES6 modules manually.

@ivanpopelyshev
Copy link
Collaborator

Having it as package dep is bad too because I also want to generate TS header automagically.

@scottmcdonnell
Copy link
Author

scottmcdonnell commented Sep 27, 2016

Good point, but it may still be possible to keep the hacks and the original spine-ts in separate files, leaving data in the the core then the display implementation in the new pixi part. For example I moved the sprites array from the Slot(core) to the SlotContainer(pixi) so that the Slot remains unchanged.

@englercj
Copy link
Collaborator

If we could keep the original lib as a dependency and apply our hacks to it that would be awesome. You should be able to generate the dts file that includes spine even with it as a dep.

@scottmcdonnell
Copy link
Author

At the moment the runtimes are missing a package.json (I opened an issue)
so for the moment I am testing just adding the build/spine-core.js and ts definition file manually and importing it import './spine-ts/build/spine-core' - working so far.

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 28, 2016

OK, that's my branch: https://github.com/pixijs/pixi-spine/tree/spine-ts

it can be built with "npm run build", and this thing will create definitions: "tsc -p tsconfig-2.json"

Definitions are wrong, but I'm going to just integrate pixi changes first, then fix their generation. If we specify "outFile" and not "outDir", they will be in one file, but format is bad anyway.

@ivanpopelyshev
Copy link
Collaborator

IT WORKS!

https://github.com/pixijs/pixi-spine/tree/spine-ts

There are a few changes, I'm going to change API a bit, add deprecated stuff :) Path Constraints are working!

@scottmcdonnell
Copy link
Author

Super work!

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 29, 2016

Current problems:

  • RENAMES (according to last pixi-spine)

Atlas to TextureAtlas
SkeletonJsonParser to SkeletonJson

setAnimation to setAnimationWith
setAnimationByName to setAnimation

addAnimation to addAnimationWith
addAnimationByName to addAnimation
hasAnimationByName to hasAnimation

So you'll have problem with "byName" suffix, just remove it from your code.

  • possible rejection of older versions of spine

gonna merge JSON parser with older one

  • EVENTS, they are just different, but I'll return our API a bit later. Currently you have to add special listener to state, and it must have all functions:
animation.state.addListener({
    /** Invoked when the current animation triggers an event. */
    event : function(trackIndex, event) { alert('event fired '+event.data) }

    /** Invoked when the current animation has completed.
     * @param loopCount The number of times the animation reached the end. */
    complete : function(trackIndex, loopCount) {}

        /** Invoked just after the current animation is set. */
    start: function (trackIndex) {}

        /** Invoked just before the current animation is replaced. */
    end: function (trackIndex) {}
})

@scottmcdonnell
Copy link
Author

scottmcdonnell commented Sep 29, 2016

It works great! Check out Stretchyman and Spineboy now in pixi-spine.

Only thing not working for me is the Stretchman head rotation - setting the bone rotation is not updating the sprite rotation?

@ivanpopelyshev
Copy link
Collaborator

Yeah, we have to add this feature to pixi-spine.

@ivanpopelyshev
Copy link
Collaborator

So, I think we can close that :) lets work on one rotation in the pther issue

@ivanpopelyshev
Copy link
Collaborator

That thing: #115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants