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

fix wrong particle properties in cpp when callback after loading particle file #193

Conversation

@Marssssssss
Copy link
Contributor

Marssssssss commented Oct 30, 2019

re:cocos-creator/2d-tasks#1934
这里目前的行为是在异步加载资源之后调用回调才更新 particleSystem 中的粒子数据,但是更新完以后不会将数据传给 jsb-particle,导致 cpp 文件内的相关类维护的粒子数据仍然是初始值。解决方法是在异步回调的方法体结束前将值传给 jsb-particle 保证数据是最新的。

@sunnylanwanjun

This comment has been minimized.

Copy link
Contributor

sunnylanwanjun commented Oct 30, 2019

重写了_initWithDictionary方法,原来重写 _applyFile方法没用了吧?
`
let _applyFile = PSProto._applyFile;

PSProto._applyFile = function () {
_applyFile.call(this);
this._initProperties();
};
`

@holycanvas

This comment has been minimized.

Copy link
Collaborator

holycanvas commented Oct 30, 2019

麻烦确认一下,这样改了之后,
image,切换particleSystem的custom选项和SpriteFrame选项有没有什么问题

@Marssssssss Marssssssss force-pushed the Marssssssss:v2.2.1-releaseforfixabug branch from 5200968 to e8e96e0 Oct 30, 2019
@Marssssssss Marssssssss force-pushed the Marssssssss:v2.2.1-releaseforfixabug branch from e8e96e0 to 11441e5 Oct 30, 2019
@Marssssssss

This comment has been minimized.

Copy link
Contributor Author

Marssssssss commented Oct 30, 2019

重写了_initWithDictionary方法,原来重写 _applyFile方法没用了吧?
`
let _applyFile = PSProto._applyFile;

PSProto._applyFile = function () {
_applyFile.call(this);
this._initProperties();
};
`

applyFile 方法从逻辑上来看确实是没用了, 新的提交里面将这个方法的重写删掉了。

@Marssssssss

This comment has been minimized.

Copy link
Contributor Author

Marssssssss commented Oct 30, 2019

麻烦确认一下,这样改了之后,
image,切换particleSystem的custom选项和SpriteFrame选项有没有什么问题

模拟器运行时在控制台里面更改这两个选项之后没有问题。

@holycanvas

This comment has been minimized.

Copy link
Collaborator

holycanvas commented Oct 30, 2019

嗯嗯,因为这里有这个判断所以要再确认一下
image

@holycanvas holycanvas merged commit dddfc17 into cocos-creator-packages:v2.2.1-release Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.