DragonBones / DragonBonesCPP

DragonBones C++ Runtime
MIT License
396 stars 228 forks source link

Bone Slot class setVisible change suggest #187

Open namuda opened 6 years ago

namuda commented 6 years ago

void Bone::setVisible(bool value) { if (_visible == value) { return; } _visible = value; for (const auto & slot : _armature->getSlots()) { if (slot->getParent() == this) { slot->_updateVisible(); } } }

void Slot::setVisible(bool value) { if (_visible == value) { return; } _visible = value; _updateVisible(); }

void CCSlot::_updateVisible() { _renderDisplay->setVisible(_parent->getVisible()); // Only the visible state of the bone is used. }

-- suggest Bone class void Bone::setVisible(bool value) { if (_visible == value) { return; } _visible = value; for (const auto & slot : _armature->getSlots()) { if (slot->getParent() == this) { slot->setVisible(_visible); //Change:Apply to bone sub-slot visible state slot->_updateVisible(); } } }

CCSlot class void CCSlot::_updateVisible() { _renderDisplay->setVisible(getVisible());//Change:Apply slot visible state }

The existing setVisible() function can not apply the visible state on a slot by itself. I hope you can use both the slot and the visible state of the bone. I would like to be able to use both the slot and bone visible states.