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

Projects
None yet
2 participants
@sunnylanwanjun
Copy link
Contributor

commented Mar 20, 2019

issue:cocos-creator/2d-tasks#1054
关联pr:cocos-creator/cocos2d-x-lite#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

Show resolved Hide resolved extensions/dragonbones/webgl-assembler.js
@@ -141,7 +145,8 @@ let armatureAssembler = {
}

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

This comment has been minimized.

Copy link
@jareguo

jareguo Mar 20, 2019

Contributor

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

This comment has been minimized.

Copy link
@sunnylanwanjun

sunnylanwanjun Mar 20, 2019

Author Contributor

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

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

This comment has been minimized.

Copy link
@jareguo

jareguo Mar 20, 2019

Contributor

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

This comment has been minimized.

Copy link
@sunnylanwanjun

sunnylanwanjun Mar 21, 2019

Author Contributor

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

@jareguo jareguo merged commit f22fe5a into cocos-creator:v2.0-release Mar 21, 2019

1 check passed

ci/circleci: test Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.