void 
LauncherScene::onBlenderAnmFinish(BlenderAnimation* p,int s,int e)
{
	if (isInEditMode()&&p == m_pBldAnm)
	{

		if (nextEditBlockBldAni == Enter_Ani)
		{
			setBlockFocus_EM(1);
			initEditFocus();
			nextEditBlockBldAni = Left_Ani;
			hasEnterEditAniFinished = true;
		}
		else if (nextEditBlockBldAni == Left_Ani)
		{
			flyMenuFocus_EM();
			nextEditBlockBldAni = None;
			if (getBlockByID(getCurrentFocusIndex_EM())->isDelete())
			{
				Block::getEditFocus()->setVisible(false);
			}
		}
		else if ( nextEditBlockBldAni == Right_Ani)
		{
			flyMenuFocus_EM();
			nextEditBlockBldAni = None;
			Block::getEditFocus()->setVisible(true);
		}
	}
	else if (!isInEditMode()&&p == m_pEditPageAnm)
	{
		blockWholeTranslation(1,m_currentID);
 	}
}
Example #2
0
// returns true if intercepted (stops event bubbling), false otherwise
bool basicShape::interceptMouseClick(ofMouseEventArgs &e){
	if( isInEditMode() ){
		// toggle GUI ?
		if( guiToggle.inside(e.x, e.y) ){
			drawShapeGui = !drawShapeGui;
			shapeGui.setPosition( guiToggle.getTopRight()+ofVec2f(5,20));
			return true;
		}
		
		// over shapeGui ?
		else if(drawShapeGui && shapeGui.getShape().inside(e.x,e.y)){
			// if click on name, then ask for new name... #hacky
			ofxBaseGui* nameLabel = basicShapeGui.getControl(GUIinfo_ShapeName);
			if(nameLabel && nameLabel->getShape().inside(e.x, e.y) ){
				shapeName = ofSystemTextBoxDialog("Enter the shape name...", shapeName);
				ofLogNotice("basicShape::interceptMouseClick") << "New shape name: " << shapeName;
			}
			
			return true;
		}
		
		// on position handler ?
		else if( position.interceptMouseClick(e) ){
			
			// erase whole shape ?
			if( ofGetKeyPressed('r') || ofGetKeyPressed('R') ){
				pleaseDeleteMe = true;
			}
			
			return true;
		}
	}
	
	return false;
}
Example #3
0
// - - - - - -
// EDITING CONTROL
// - - - - - -
bool basicShape::enableEditMode(){
	if(isInEditMode()) return true;
	
	// remember
	bEditMode = true;
	activeHandle = NULL;
	
	position.setEditable( true );
	
	// enable GUI
	guiToggle = ofRectangle( boundingBox.getTopRight()+5, 10, 10 );
	// restrict to visible space
	if( guiToggle.getPosition().x+guiToggle.getWidth() >= ofGetWidth() ){
		guiToggle.x = guiToggle.getPosition().x-shapeGui.getWidth();
	}
	if( guiToggle.getPosition().y+guiToggle.getHeight() >= ofGetWidth() ){
		guiToggle.y = guiToggle.getPosition().y-shapeGui.getHeight();
	}
	//guiToggle
	//guiTabBar->addLabel("+", OFX_UI_FONT_SMALL);
	
	// set GUI color
	setColorFromGroupID();
	
	return (bEditMode==true);
}
void UB1HEditableGraphicsCircleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option)
    Q_UNUSED(widget)

    UBAbstractGraphicsItem::setStyle(painter);

    int rx = wIsNeg ? -mRadius : mRadius;
    int ry = hIsNeg ? -mRadius : mRadius;

    int x = wIsNeg ? -mRadius : 0;
    int y = hIsNeg ? -mRadius : 0;

    x *= 2;
    y *= 2;

    //N/C - NNE - 20140312 : Litle work around for avoid crash under MacOs 10.9
    QPainterPath path;
    path.addEllipse(QRect(x, y, mRadius*2, mRadius*2));

    painter->drawPath(path);

    if(isInEditMode()){
        QPen p;
        p.setColor(QColor(128, 128, 200));
        p.setStyle(Qt::DotLine);
        p.setWidth(pen().width());

        painter->setPen(p);
        painter->setBrush(QBrush());

        painter->drawRect(0, 0, rx*2, ry*2);
    }
}
void 
LauncherScene::onTranslationAnmFinish(TranslationAnm* p)
{
	if ( !isInEditMode() && p == m_ppEditBkFocusAnm[1])
	{
		m_pBldAnm->play();
		m_pEditPageAnm->play();
		m_pExitEMAnm->play();
		for (int i = 0;i<__MAX_BLOCK_NUM;i++)
		{
			m_ppBlocklist[i]->playAnimation();
		}
	}
	else if (isInEditMode() && p == Block::getFocusEditAnm())
	{
		hasFinishEditSBA = true;
	}
}
QPainterPath UB1HEditableGraphicsCircleItem::shape() const
{
    QPainterPath path;
    if(isInEditMode()){
        path.addRect(boundingRect());
    }else{
        path.addEllipse(boundingRect());
    }

    return path;
}
Example #7
0
// called after the shape was (hard) edited
// used to sync extra short-hand data with the basic shape original data
// ex: sync relative points with absolute points
void basicShape::onShapeEdited(){
	
	// update boundingbox
	calculateBoundingBox();
	
#ifdef KM_EDITOR_APP
	// update GUI Toggle ?
	if( isInEditMode() ){
		guiToggle.setPosition( boundingBox.getBottomLeft()+ofPoint(-5,5) );
	}
#endif
}
Example #8
0
QRectF UB3HEditablesGraphicsBasicShapeItem::adjustBoundingRect(QRectF rect) const
{
    rect = UBAbstractEditableGraphicsShapeItem::adjustBoundingRect(rect);

    if(isInEditMode()){
        qreal r = horizontalHandle()->radius();

        rect.adjust(-r, -r, r, r);
    }

    return rect;
}
QPainterPath UB1HEditableGraphicsSquareItem::shape() const
{
    QPainterPath path;

    if(isInEditMode()){
        path.addRect(boundingRect());
    }else{
        int h = hIsNeg ? -mSide : mSide;
        int w = wIsNeg ? -mSide : mSide;

        path.addRect(0, 0, w, h);
    }

    return path;
}
QRectF UB1HEditableGraphicsSquareItem::boundingRect() const
{
    int x = wIsNeg ? -mSide : 0;
    int y = hIsNeg ? -mSide : 0;

    QRectF rect(x, y, mSide, mSide);

    rect = adjustBoundingRect(rect);

    if(isInEditMode()){
        qreal r = mHandles.at(0)->radius();
        rect.adjust(-r, -r, r, r);
    }

    return rect;
}
QRectF UB1HEditableGraphicsCircleItem::boundingRect() const
{
    int x = wIsNeg ? -mRadius : 0;
    int y = hIsNeg ? -mRadius : 0;

    x *= 2;
    y *= 2;

    QRectF rect(QRect(x, y, mRadius*2, mRadius*2));

    rect = adjustBoundingRect(rect);

    if(isInEditMode()){
        qreal r = getHandle()->radius();

        rect.adjust(-r, -r, r, r);
    }

    return rect;
}
Example #12
0
// draws the shape for the editor
void basicShape::render(){
	
	// synch color if maxGroupID changed
	/*if(prevMaxGroupID != maxGroupID){
		prevMaxGroupID = maxGroupID;
		setColorFromGroupID();
	 }*/
	
	ofPushStyle();
	
	// show container box
	ofSetColor( 255, 150 );
	ofNoFill();
	ofDrawRectangle( boundingBox );
	
	if(isInEditMode()){
		
		// new colors!
		ofSetColor( fgColor, 200 );
		ofFill();
		
		// draw center position
		position.draw();
		
		// draw gui toggle
		ofSetColor(fgColor, 200);
		ofFill();
		ofDrawRectangle(guiToggle);
		
		ofSetColor(0, 200);
		ofNoFill();
		ofDrawRectangle(guiToggle);
		
		// draw additional shape gui.
		if( drawShapeGui ) shapeGui.draw();
	}
	
	// reset
	ofPopStyle();
}