Example #1
0
void readRotationElement(FbxPropertyT<FbxDouble3>& prop,
                         EFbxRotationOrder fbxRotOrder,
                         bool quatInterpolate,
                         osgAnimation::UpdateMatrixTransform* pUpdate,
                         osg::Matrix& staticTransform,
                         FbxScene& fbxScene)
{
    if (isAnimated(prop, fbxScene))
    {
        if (quatInterpolate)
        {
            if (!staticTransform.isIdentity())
            {
                pUpdate->getStackedTransforms().push_back(
                    new osgAnimation::StackedMatrixElement(staticTransform));
                staticTransform.makeIdentity();
            }
            pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedQuaternionElement(
                        "quaternion", makeQuat(prop.Get(), fbxRotOrder)));
        }
        else
        {
            const char* curveNames[3] = {FBXSDK_CURVENODE_COMPONENT_X, FBXSDK_CURVENODE_COMPONENT_Y, FBXSDK_CURVENODE_COMPONENT_Z};
            osg::Vec3 axes[3] = {osg::Vec3(1,0,0), osg::Vec3(0,1,0), osg::Vec3(0,0,1)};

            FbxDouble3 fbxPropValue = prop.Get();
            fbxPropValue[0] = osg::DegreesToRadians(fbxPropValue[0]);
            fbxPropValue[1] = osg::DegreesToRadians(fbxPropValue[1]);
            fbxPropValue[2] = osg::DegreesToRadians(fbxPropValue[2]);

            int order[3] = {0, 1, 2};
            getRotationOrder(fbxRotOrder, order);

            for (int i = 0; i < 3; ++i)
            {
                int j = order[2-i];
                if (isAnimated(prop, curveNames[j], fbxScene))
                {
                    if (!staticTransform.isIdentity())
                    {
                        pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
                        staticTransform.makeIdentity();
                    }

                    pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement(
                                std::string("rotate") + curveNames[j], axes[j], fbxPropValue[j]));
                }
                else
                {
                    staticTransform.preMultRotate(osg::Quat(fbxPropValue[j], axes[j]));
                }
            }
        }
    }
    else
    {
        staticTransform.preMultRotate(makeQuat(prop.Get(), fbxRotOrder));
    }
}
Example #2
0
void Image::dump(TextStream& ts) const
{
    if (isAnimated())
        ts.dumpProperty("animated", isAnimated());

    if (isNull())
        ts.dumpProperty("is-null-image", true);

    ts.dumpProperty("size", size());
}
Example #3
0
void Model::prepareSkinning()
{
	if( !mesh->isAnimated() ) return;

	size_t numBones = mesh->getSkeleton()->getBones().size();
	bones.resize( numBones );
}
Example #4
0
void FloatingWidget::showOver(QWidget * widget, int size, Place place) {
	qDebug("FloatingWidget::showOver");

	int w = widget->width() * size / 100;
	int h = height();
	resize( w, h );

	//qDebug("widget x: %d, y: %d, h: %d, w: %d", widget->x(), widget->y(), widget->width(), widget->height());

	int x = (widget->width() - width() ) / 2;
	int y;
	if (place == Top) 
		y = 0 + _margin;
	else
		y = widget->height() - height() - _margin;

	QPoint p = widget->mapToGlobal(QPoint(x, y));

	//qDebug("FloatingWidget::showOver: x: %d, y: %d, w: %d, h: %d", x, y, w, h);
	//qDebug("FloatingWidget::showOver: global x: %d global y: %d", p.x(), p.y());
	move(p);

	if (isAnimated()) {
		Movement m = Upward;
		if (place == Top) m = Downward;
		showAnimated(p, m);
	} else {
		show();
	}
}
Example #5
0
void readScaleElement(FbxPropertyT<FbxDouble3>& prop,
                      osgAnimation::UpdateMatrixTransform* pUpdate,
                      osg::Matrix& staticTransform,
                      FbxScene& fbxScene)
{
    FbxDouble3 fbxPropValue = prop.Get();
    osg::Vec3d val(
        fbxPropValue[0],
        fbxPropValue[1],
        fbxPropValue[2]);

    if (isAnimated(prop, fbxScene))
    {
        if (!staticTransform.isIdentity())
        {
            pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
            staticTransform.makeIdentity();
        }
        pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedScaleElement("scale", val));
    }
    else
    {
        staticTransform.preMultScale(val);
    }
}
Example #6
0
void ProgressIndicator::paintEvent(QPaintEvent * /*event*/)
{
    if (!m_displayedWhenStopped && !isAnimated())
        return;

    int width = qMin(this->width(), this->height());

    QPainter p(this);
    p.setRenderHint(QPainter::Antialiasing);

    int outerRadius = (width-1)*0.5;
    int innerRadius = (width-1)*0.5*0.38;

    int capsuleHeight = outerRadius - innerRadius;
    int capsuleWidth  = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
    int capsuleRadius = capsuleWidth/2;

    for (int i=0; i<12; i++)
    {
        QColor color = m_color;
        color.setAlphaF(1.0f - (i/12.0f));
        p.setPen(Qt::NoPen);
        p.setBrush(color);
        p.save();
        p.translate(rect().center());
        p.rotate(m_angle - i*30.0f);
        p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
        p.restore();
    }
}
Example #7
0
STabItem *SiliTab::insertTab( int index , const QIcon & icon , const QString & name )
{
    if( isAnimated() && p->animation->isActive() )
        p->animation->finish();

    STabItem *item = new STabItem();
        item->setText( name );
        item->setIcon( icon );
        item->setFixedSize( 0 , 0 );
        item->setStyleSheet( p->defaultStyle );

    p->list.insert( index , item );
    p->layout->insertWidget( index , item );

    if( this->isAnimated() )
        p->animation->start( item , p->default_items_size , SAnimation::RESIZE , 10 , SAnimation::MIN_MAX );
    else
        this->anim_finished( item );


    connect( item , SIGNAL(clicked(STabItem*))      , SLOT(clicked_on_item(STabItem*)) );
    connect( item , SIGNAL(entered(STabItem*))      , SLOT(on_item(STabItem*))         , Qt::QueuedConnection );
    connect( item , SIGNAL(leaved(STabItem*))       , SLOT(close_on_item(STabItem*))   , Qt::QueuedConnection );
    connect( item , SIGNAL(closeRequest(STabItem*)) , SLOT(close_request(STabItem*))   );

    item->click();

    return item;
}
Example #8
0
void View::keyPressEvent(QKeyEvent *e)
{
    const qreal c_keyFactor = 2.0;
    switch(e->key())
    {
       case Qt::Key_Space:  setAnimated( !isAnimated() ); break;
       case Qt::Key_Up   :
                if(e->modifiers() & Qt::ControlModifier )
                    setRoll( roll() + c_keyFactor );
                else
                    setRotate( rotate() + QVector3D(-c_keyFactor , 0, 0) );
                break;
       case Qt::Key_Down :
                if(e->modifiers() & Qt::ControlModifier )
                    setRoll( roll() - c_keyFactor );
                else
                    setRotate( rotate() + QVector3D(c_keyFactor , 0, 0) );
                break;

       case Qt::Key_Left :  setRotate( rotate() + QVector3D(0           , 0, -c_keyFactor) ); break;
       case Qt::Key_Right:  setRotate( rotate() + QVector3D(0           , 0, c_keyFactor) ); break;
       case Qt::Key_Plus :  setScale( scale() * 1.2 ); break;
       case Qt::Key_Minus:  setScale( scale() / 1.2 ); break;
       case Qt::Key_A    :  if(e->modifiers() & Qt::ControlModifier )
                                 toggleVisualHint( VH_ShowAxis);
                            break;
       case Qt::Key_P    :  if(e->modifiers() & Qt::ControlModifier )
                                toggleVisualHint( VH_ShowPlane);
                            break;
       default:
            break;
    }
}
Example #9
0
void Model::update( float delta )
{
	mesh = meshHandle.Resolve();

	if( !mesh || !mesh->isLoaded() )
		return;

	if( !modelBuilt ) build();

	if(updateSkin)
	{
		updateSkinning();
		updateSkin = false;
	}

	if( mesh->isAnimated() )
	{
		if( animations.empty() )
			setAnimation( mesh->getBindPose().get() );

		if( animationEnabled )
		{
			updateAnimations(delta);
			updateFinalAnimationBones();
		}

		updateAttachments();
	}

	//updateDebugRenderable();
	Geometry::update(delta);
}
Example #10
0
/*!
 * \brief Blinks the diode once.
 */
void HacLed::blink()
{
    if (isAnimated())
		return;

    setChecked(true);
    QTimer::singleShot(100, this, SLOT(toggle()));
}
 // -------------------------------------------
 // Figure out whether a given plug is animated
 AnimationResult AnimationHelper::isAnimated ( 
     AnimationSampleCache *acache,
     const MObject& node,
     const String& attribute )
 {
     MStatus status;
     MPlug p = MFnDependencyNode ( node ).findPlug ( attribute.c_str(), &status );
     return ( status != MStatus::kSuccess ) ? kISANIM_None : isAnimated ( acache, p );
 }
Example #12
0
bool Model::open()
{
    MPQFile f(filename.c_str());

    ok = !f.isEof();

    if (!ok)
    {
        f.close();
        printf("Error loading model %s\n", filename.c_str());
        return false;
    }

    memcpy(&header, f.getBuffer(), sizeof(ModelHeader));
    if(header.nBoundingTriangles > 0) {

#if 0
        animated = isAnimated(f);
        if(animated)
        {
            f.close();
            return false;
        }
#endif
        trans = 1.0f;
        origVertices = (ModelVertex*)(f.getBuffer() + header.ofsVertices);

        vertices = new Vec3D[header.nVertices];
        normals = new Vec3D[header.nVertices];

        for (size_t i=0; i<header.nVertices; i++)
        {
            origVertices[i].pos = fixCoordSystem(origVertices[i].pos);
            origVertices[i].normal = fixCoordSystem(origVertices[i].normal);
            vertices[i] = origVertices[i].pos;
            normals[i] = origVertices[i].normal.normalize();
        }

        ModelView *view = (ModelView*)(f.getBuffer() + header.ofsViews);

        uint16 *indexLookup = (uint16*)(f.getBuffer() + view->ofsIndex);
        uint16 *triangles = (uint16*)(f.getBuffer() + view->ofsTris);

        nIndices = view->nTris;
        indices = new uint16[nIndices];
        for (size_t i = 0; i<nIndices; i++)
        {
            indices[i] = indexLookup[triangles[i]];
        }
        f.close();
    } else {
        //printf("not included %s\n", filename.c_str());
        return false;
    }
    return true;

}
Example #13
0
void NickView::unanimatedExpandAll()
{
    // since of Qt Version 4.8.0 the default expandAll will not properly work if
    // animations are enabled. Therefore we perform an unanimated expand when a
    // model is set or a toplevel node is inserted.
    bool wasAnimated = isAnimated();
    setAnimated(false);
    expandAll();
    setAnimated(wasAnimated);
}
Example #14
0
void HacLed::setPeriod(int period)
{
    if (period==d->period)
		return;

	d->period = period;
    if (isAnimated()) {
        killTimer(d->timer);
        d->timer = startTimer(d->period);
    }
}
Example #15
0
	void Sprite::animate()
	{
		if ( !isAnimated() )
		{
			return;
		}

		if ( ( timer->getCurrentTime() - previousTime ) > frameTime )
		{
			getNextFrame();
		}
	}
Example #16
0
void RaisedButton::mouseReleaseEvent(QMouseEvent *e) {
	ButtonWidget::mouseReleaseEvent(e);
	if (isAnimated()) {
		_hover.setStartValue(float(_st.fill_opacity * 2));
		_hover.setEndValue(float(0.0));
		_hover.setDuration(25);
		_hover.animStart();
	} else {
		_opacity.setStartValue(float(_st.fill_opacity));
		update();
	}
}
Example #17
0
int QMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 4)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 1: *reinterpret_cast< Qt::ToolButtonStyle*>(_v) = toolButtonStyle(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isAnimated(); break;
        case 3: *reinterpret_cast< bool*>(_v) = documentMode(); break;
        case 4: *reinterpret_cast< QTabWidget::TabShape*>(_v) = tabShape(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isDockNestingEnabled(); break;
        case 6: *reinterpret_cast<int*>(_v) = QFlag(dockOptions()); break;
        case 7: *reinterpret_cast< bool*>(_v) = unifiedTitleAndToolBarOnMac(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 1: setToolButtonStyle(*reinterpret_cast< Qt::ToolButtonStyle*>(_v)); break;
        case 2: setAnimated(*reinterpret_cast< bool*>(_v)); break;
        case 3: setDocumentMode(*reinterpret_cast< bool*>(_v)); break;
        case 4: setTabShape(*reinterpret_cast< QTabWidget::TabShape*>(_v)); break;
        case 5: setDockNestingEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 6: setDockOptions(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 7: setUnifiedTitleAndToolBarOnMac(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #18
0
Model::Model(std::string name, bool forceAnim) : ManagedItem(name), forceAnim(forceAnim)
{
	// replace .MDX with .M2
	char tempname[256];
	strcpy(tempname,name.c_str());
	tempname[name.length()-2] = '2';
	tempname[name.length()-1] = 0;

	MPQFile f(tempname);
	ok = !f.isEof();

	if (!ok) {
		gLog("Error loading model [%s]\n", tempname);
		return;
	}

	memcpy(&header, f.getBuffer(), sizeof(ModelHeader));

	// HACK: these particle systems are way too active and cause horrible horrible slowdowns
	// I'm removing them until I can fix emission speed so it doesn't get this crazy
	if (false
	|| name=="World\\Kalimdor\\Orgrimmar\\Passivedoodads\\Orgrimmarbonfire\\Orgrimmarsmokeemitter.Mdx"	
	//|| name=="World\\Kalimdor\\Orgrimmar\\Passivedoodads\\Orgrimmarbonfire\\Orgrimmarbonfire01.Mdx"	
	) {
        header.nParticleEmitters = 0;
	}

	animated = isAnimated(f) || forceAnim;  // isAnimated will set animGeometry and animTextures

	gLog("Loading model %s%s\n", tempname, animated ? " (animated)" : "");

	trans = 1.0f;

	vbuf = nbuf = tbuf = 0;

	globalSequences = 0;
	animtime = 0;
	anim = 0;
	colors = 0;
	lights = 0;
	transparency = 0;
	particleSystems = 0;
	ribbons = 0;
	if (header.nGlobalSequences) {
		globalSequences = new int[header.nGlobalSequences];
		memcpy(globalSequences, (f.getBuffer() + header.ofsGlobalSequences), header.nGlobalSequences * 4);
	}

	if (animated) initAnimated(f);
	else initStatic(f);

	f.close();
}
Example #19
0
void FloatActionButton::mouseReleaseEvent(QMouseEvent *e) {
	ButtonWidget::mouseReleaseEvent(e);
	if (isAnimated()) {
		isTransparent() ? _hover.setStartValue(float(_st.fill_opacity)) : _hover.setStartValue(float(_st.fill_opacity * 2));
		_hover.setEndValue(float(0.0));
		_hover.setDuration(25);
		_hover.animStart();
	} else {
		isTransparent() ? _opacity.setStartValue(float(0.0)) : _opacity.setStartValue(float(_st.fill_opacity));
		update();
	}
}
Example #20
0
void FloatActionButton::mousePressEvent(QMouseEvent *e) {
	ButtonWidget::mousePressEvent(e);
	if (isAnimated()) {
		isTransparent() ? _hover.setStartValue(float(_st.fill_opacity)) : _hover.setStartValue(float(_st.fill_opacity * 2));
		_eff.setStartValue(float(_st.height + 15.0f));
		_shape == Shape::Circle ? _eff.setEndValue(float(width() * 2)) : _eff.setEndValue(float(width() * 3) + 15.0f);
		_eff.setDuration(20);
		_eff.animStart();
	} else {
		isTransparent() ? _opacity.setStartValue(float(_st.fill_opacity)) : _opacity.setStartValue(float(_st.fill_opacity * 2));
		update();
	}
}
Example #21
0
    //___________________________________________________
    void Button::leaveEvent( QEvent *event )
    {

        KCommonDecorationButton::leaveEvent( event );

        if( _status&Hovered && buttonAnimationsEnabled() )
        {
            _glowAnimation->setDirection( Animation::Backward );
            if( !isAnimated() ) _glowAnimation->start();
        }

        _status &= ~Hovered;
        parentUpdate();

    }
Example #22
0
    //___________________________________________________
    void Button::enterEvent( QEvent *event )
    {

        KCommonDecorationButton::enterEvent( event );
        _status |= Hovered;

        if( buttonAnimationsEnabled() )
        {

            _glowAnimation->setDirection( Animation::Forward );
            if( !isAnimated() ) _glowAnimation->start();

        } else parentUpdate();

    }
Example #23
0
void RaisedButton::mousePressEvent(QMouseEvent *e) {
	ButtonWidget::mousePressEvent(e);
	if (isAnimated()) {
		_x = e->pos().x();
		_y = e->pos().y();
		_hover.setStartValue(float(_st.fill_opacity * 2));
		_eff.setStartValue(float(_st.height));
		_eff.setEndValue(float(width() * 2));
		_eff.setDuration(25);
		_eff.animStart();
	} else {
		_opacity.setStartValue(float(_st.fill_opacity * 2));
		update();
	}
}
Example #24
0
void Model::setAnimationFade(const std::string& name, float fadeTime)
{
	assert( mesh != nullptr );

	if( !mesh->isAnimated() )
		return;

	if( animations.size() >= 2 )
		animations[1] = animations[0];
	else
		animations.push_back( animations[0] );
		
	setAnimation(name);
	animationFadeTime = fadeTime;
	animationCurrentFadeTime = 0;
}
Example #25
0
		void updateSunLightInteraction()
		{
			if ( ent->hasStageWithoutBlendFunc() == false )
			{
				if ( shadowVolume )
				{
					delete shadowVolume;
					shadowVolume = 0;
				}
				return;
			}
			if ( shadowVolume == 0 )
			{
				shadowVolume = new rIndexedShadowVolume_c;
			}
			else
			{
				if ( ent->isAnimated() == false )
				{
					if ( absSilChangeCount == ent->getSilChangeCount() )
					{
						if ( rf_sunLight_printUnchangedInteractions.getInt() )
						{
							g_core->Print( "sunLightEntityInteraction_c::updateSunLightInteraction: %s didnt change\n",
										   ent->getModelName() );
						}
						addDrawCall();
						return;
					}
				}
			}
			ent->updateAnimatedEntity();
			absSilChangeCount = ent->getSilChangeCount();
			if ( rf_usePointLightForSun.getInt() )
			{
				vec3_c pos = rf_sunLight->getFakePointLightPosition();
				ent->getMatrix().getInversed().transformPoint( pos );
				shadowVolume->createShadowVolumeForEntity( ent, pos, rf_sunLight->getFakePointLightRadius() );
			}
			else
			{
				vec3_c dir = RF_GetSunDirection();
				ent->getMatrix().getInversed().transformNormal( dir );
				shadowVolume->createDirectionalShadowVolumeForEntity( ent, dir, 5000 );
			}
			addDrawCall();
		}
Example #26
0
void RaisedButton::paintEvent(QPaintEvent*) {
	QPainter p(this);
	p.setPen(Qt::NoPen);

	if (isEnabled()) {
		p.setBrush(_st.color);
		p.setOpacity(1.0);
		p.setRenderHint(QPainter::Antialiasing);
		p.drawRoundedRect(rect(), _st.border_radius, _st.border_radius);
		p.setRenderHint(QPainter::Antialiasing, false);

		if (state() != ButtonState::None) {
			p.setBrush(QColor(0, 0, 0));
			p.setOpacity(_opacity.currentf());
			p.drawRoundedRect(rect(), _st.border_radius, _st.border_radius);
		}

		if (state() == ButtonState::Pressed || state() == ButtonState::Released && isAnimated()) {
			p.setOpacity(_hover.currentf());
			p.drawEllipse(QRectF(_x - (_st.height / 2) + (_eff.currentf() / 2), _y - (_st.height / 2) + (_eff.currentf() / 2), _st.height - _eff.currentf(), _st.height - _eff.currentf()));
		}

		if (text().isEmpty()) return;
		p.setOpacity(1.0);
		p.setFont(font());
		p.setPen(QColor("#FFFFFF"));
		p.setRenderHint(QPainter::TextAntialiasing, false);
		if (pixmap().isNull()) p.drawText(rect(), Qt::AlignCenter, text());
		else p.drawText(QRect(0, 0, width() - pixmapScaledSize(), height()), Qt::AlignCenter, text());

		p.setRenderHint(QPainter::SmoothPixmapTransform);
		if (!pixmap().isNull())
			p.drawPixmap(QRect(width() - pixmapScaledSize() - pixmapScaledSize() / 2, (height() - pixmapScaledSize()) / 2, pixmapScaledSize(), height() - (height() - pixmapScaledSize())), pixmap());
		p.setRenderHint(QPainter::SmoothPixmapTransform, false);
	} else {
		p.setBrush(QColor(0, 0, 0));
		p.setOpacity(0.12);
		p.drawRoundedRect(rect(), _st.border_radius, _st.border_radius);

		if (text().isEmpty()) return;
		p.setFont(font());
		p.setPen(QColor(0, 0, 0));
		p.setOpacity(0.26);
		p.drawText(rect(), Qt::AlignCenter, text());
	}
}
Example #27
0
void Model::updateSkinning()
{
	if( !mesh->isAnimated() ) return;
	
	bool isCPU = skinningMode == SkinningMode::CPU;
	String shader = isCPU ? "VertexLit" : "VertexLitSkinned";
	
	for( size_t i = 0; i < renderables.size(); ++i )
	{
		const RenderBatch* rend = renderables[i].get();
	
		Material* material = rend->getMaterial().Resolve();
		material->setShader(shader);
	}

	//if( !isCPU ) rebuildPositions();
}
Example #28
0
void BitmapImage::dump(TextStream& ts) const
{
    Image::dump(ts);

    ts.dumpProperty("type", m_source.filenameExtension());

    if (isAnimated()) {
        ts.dumpProperty("frame-count", m_frameCount);
        ts.dumpProperty("repetitions", m_repetitionCount);
        ts.dumpProperty("current-frame", m_currentFrame);
    }
    
    if (m_solidColor)
        ts.dumpProperty("solid-color", m_solidColor.value());
    
    m_source.dump(ts);
}
Example #29
0
void RaisedButton::onHovered(bool hover) {
	if (isAnimated()) {
		if (hover) {
			_opacity.setStartValue(float(0.0));
			_opacity.setEndValue(float(_st.fill_opacity));
			_opacity.setDuration(15);
			_opacity.animStart();
		} else {
			_opacity.setStartValue(float(_st.fill_opacity));
			_opacity.setEndValue(float(0.0));
			_opacity.setDuration(15);
			_opacity.animStart();
		}
	} else {
		hover ? _opacity.setStartValue(float(_st.fill_opacity)) : _opacity.setStartValue(float(0.0));
	}
}
Example #30
0
    //_______________________________________________
    QColor Button::buttonDetailColor(const QPalette &palette) const
    {
        auto d( qobject_cast<Decoration*>( decoration().data() ) );
        if( d->isAnimated() )
        {

            return KColorUtils::mix(
                buttonDetailColor( palette, false ),
                buttonDetailColor( palette, true ),
                d->opacity() );

        } else {

            return buttonDetailColor( palette, isActive());

        }

    }