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 dragonbones's alpha has not cascade bug #4068

Merged
merged 4 commits into from Mar 21, 2019

Conversation

@sunnylanwanjun
Copy link
Contributor

@sunnylanwanjun sunnylanwanjun commented Mar 20, 2019

issue:https://github.com/cocos-creator/2d-tasks/issues/1054
关联pr:cocos-creator/engine-native#1704
修复dragonbones父骨骼透明度没有与子骨骼透明度级联的问题
修复spine dragonbones 启用预乘时,修改节点透明度,出现“曝光“现象的问题。

@pandamicro pandamicro requested a review from 2youyou2 Mar 20, 2019
@sunnylanwanjun sunnylanwanjun changed the title Fix db fade Fix dragonbones's alpha has not cascade bug Mar 20, 2019
extensions/dragonbones/webgl-assembler.js Show resolved Hide resolved
@@ -141,7 +145,8 @@ let armatureAssembler = {
}

if (slot.childArmature) {
this.realTimeTraverse(slot.childArmature, slot._worldMatrix);
parentOpacity *= slotColor.a / 255;
Copy link
Member

@jareguo jareguo Mar 20, 2019

这会导致 slot 很多时,parentOpacity 被修改多次

Copy link
Contributor Author

@sunnylanwanjun sunnylanwanjun Mar 20, 2019

不会计算多次,但的确会影响同级slot,改了。

_r = color.r * _nodeR * _multiply;
_g = color.g * _nodeG * _multiply;
_b = color.b * _nodeB * _multiply;
_a *= _nodeA;
Copy link
Member

@jareguo jareguo Mar 20, 2019

为什么预乘的话,不把 rgb 通道不把 nodeA 也算进去呢?

Copy link
Contributor Author

@sunnylanwanjun sunnylanwanjun Mar 21, 2019

这个是参照spine的做法,由于历史遗留,也就没改这个做法,不过个人感觉也应该算进去,联想到之前有人说预乘的时候spine修改节点透明度,有种曝光的感觉,刚刚测试了下,就是这个原因造成的。

@jareguo jareguo merged commit f22fe5a into cocos-creator:v2.0-release Mar 21, 2019
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants