-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature: AutoMagicCoding (NSCoding alternative) for nodes with actions. #141
Conversation
To demonstrate that CCLayerMultiplex saves/loads as expected.
…rid. CCGrid test passed.
* Added name. * Frames printed as array - this will print description of each frame.
…om cache. Part of #9.
…ons, since it's merged now.
Ok, feature-amc-actions is merged to feature-amc, here's little overview what's changed: Actions Support Added
It should be mentioned that all supported actions, including action containers, like CCRepeat, CCSequence and others, who don't call -step: / change elapsed_ of inside actions are also supported AND can be saved in ANY INTERMEDIATE state properly. Tests Changed
|
Looks like GitHub doesn't allow to sequence commit & comments in Pull Request, sorry. Another new thing is that AMC isn't a submodule anymore - it's plain source. This will be pushed to Pull Request in few minutes. |
Ok, updated description, renamed Pull Request from "Feature: AutoMagicCoding (NSCoding alternative) for nodes." to "Feature: AutoMagicCoding (NSCoding alternative) for nodes with actions." |
Nice work. I'll try to integrate this into the first RC release of 1.1. |
great feature. I added some comments/questions in the cocos2d thread: |
…Log in prepareChildrenAfterAMCLoad.
Well, i added some AMC support to cocos2d-iphone recently.
Actions AM support not yet added, so almost everything after loading will stand still (there are some exceptions used to demonstrate some stuff tough, but it's done via starting actions after loading).
BTW i think it's pretty good way to demonstrate actual saved state after loading, so probably even after adding actions support - in old test i will stop all actions before saving to have the same photo capture effect.
Anyway, here's what i got...
What's new
TODO: remove submodule, use easier path, update all files , that uses that path.
before adding actions amc support & merging it all - it's better to have AMC
as a submodule - easier to maintain.
doesn't retain nodes (Used for restoring links after loading, such as
CCMenuItem target & other).
header is still used) - CCMenuItem was refactored a little for
better AMC support, now blocks used directly, but it's still
backward compatible with old iOS versions & now you can set
target/selector or block after creating CCMenuItem (or it's subclasses).
should be 5 bytes at least, to avoid KVC failure (corrupted isa
pointer & garbage value returned).
AMC sources.
TODO: test XCode3 templates, i don't have XCode3, so i can't test it.
(There was no Layers test before - so added new one).
(Used instead of existing test, cause it includes deprecated class children,
that will not be supported by AMC).
progressTimer before).
Nodes supported by AMC
As Riq said on forums: "serializing the TextureCache is sort of hackish."
( http: www.cocos2d-iphone.org/forum/topic/16980#post-95815 )
So we will save only key (filepath) for Texture, making developer responsible
for creating custom texture on deserialization
(-initWithDictionaryRepresentation: method) or saving generated texture to
documents or cache folder & setting it's key to that path, so next time it could
be loaded from there.
(Used by CCSpriteBatchNode, so tested everywhere where BatchNode is tested.)
(Can be saved as array of texture keys - can be useful for preloading all
needed for scene textures)
You know - i'll better just trust the Magic, cause Magic is VERY powerfull!
Target saved as name of CCNode in CCNodeRegistry, selecter saved as
NSString. It's impossible to save Blocks - user should manually restore
them after loading
(CCNodeRegistry can be used to obtain target nodes).
(btw found a bug - different acnhorPoints for radial timers aren't supported)
Actions supported by AMC
CCAction.m
CCActionInterval.m
CCActionTween.m
CCActionProgressTimer.m
CCActionInstant.m
CCActionCamera.m
CCActionEase.m
Not Supported
Anyway - it should be possible, just needs time.
Only if do first ammount of tests that saves transition & 2nd - that loads it.
themselves - should be used by developer expicitly ).
All issues regarding AMC support for Cocos2D-iPhone is here:
https://github.com/psineur/cocos2d-iphone/issues?labels=feature-amc+branch
Issue about "More Nodes Support": psineur#19
Issue about "More Actions Support": psineur#18
All basic functional of Cocos2D-iPhone is supported and stable.
AMC isn't a submodule anymore.
Probably this can be merged now.
This functionality is enough for me to start working on Editor for Cocos2D.
So i will update this Pull Request only with critical fixes, or after releasing first public version of editor.
P.S. See big comment below for additional "What's New" regarding actions support.