void StatusBar::onCelOpacityChange() { try { ContextWriter writer(UIContext::instance(), 500); DocumentRange range = App::instance()->getMainWindow()->getTimeline()->range(); if (range.enabled()) { for (Cel* cel : get_unique_cels(writer.sprite(), range)) cel->setOpacity(m_slider->getValue()); } else { Cel* cel = writer.cel(); if (cel) { // Update the opacity cel->setOpacity(m_slider->getValue()); } } // Update the editors update_screen_for_document(writer.document()); } catch (LockedDocumentException&) { // do nothing } }
// static Cel* Cel::createCopy(const Cel* other) { Cel* cel = new Cel(other->frame(), ImageRef(Image::createCopy(other->image()))); cel->setPosition(other->position()); cel->setOpacity(other->opacity()); return cel; }
static void slider_change_hook(Slider* slider) { try { ContextWriter writer(UIContext::instance()); Cel* cel = writer.cel(); if (cel) { // Update the opacity cel->setOpacity(slider->getValue()); // Update the editors update_screen_for_document(writer.document()); } } catch (LockedDocumentException&) { // do nothing } }