Esempio n. 1
0
void CurveEditTool::KeyDown( const KeyboardInput& e )
{
    CurveEditMode mode = m_HotEditMode;

    switch (e.GetKeyCode())
    {
    case TXT('M'):
        m_HotEditMode = CurveEditModes::Modify;
        break;

    case TXT('I'):
        m_HotEditMode = CurveEditModes::Insert;
        break;

    case TXT('R'):
        m_HotEditMode = CurveEditModes::Remove;
        break;

    default:
        Base::KeyDown( e );
        break;
    }

    if ( mode != m_HotEditMode )
    {
        m_Generator->GetContainer()->Read();
    }
}
Esempio n. 2
0
void CurveCreateTool::KeyPress( const KeyboardInput& e )
{
  const int keyCode = e.GetKeyCode();

  switch( keyCode )
  { 
  case WXK_RETURN:
    {
      AddToScene();
      break;
    }
  }

  __super::KeyPress( e );
}
Esempio n. 3
0
void CurveCreateTool::KeyPress( const KeyboardInput& e )
{
    const int keyCode = e.GetKeyCode();

    switch( keyCode )
    { 
    case KeyCodes::Return:
        {
            AddToScene();
            break;
        }
    }

    Base::KeyPress( e );
}
Esempio n. 4
0
void CreateTool::KeyPress( const KeyboardInput& e )
{
	if (e.GetKeyCode() == KeyCodes::Return)
	{
		AddToScene();

		// create new at position
		Place(Matrix4::Identity);

		// render
		m_Scene->Execute(true);
	}
	else
	{
		e.Skip();
	}
}
Esempio n. 5
0
void CurveEditTool::KeyPress( const KeyboardInput& e )
{
    if ( !m_Scene->IsEditable() )
    {
        return;
    }

    int32_t keyCode = e.GetKeyCode();

    if ( keyCode == KeyCodes::Left || keyCode == KeyCodes::Up || keyCode == KeyCodes::Right || keyCode == KeyCodes::Down )
    {
        OS_SceneNodeDumbPtr selection = m_Scene->GetSelection().GetItems();

        if ( selection.Empty() )
        {
            return;
        }

        CurveControlPoint* point = Reflect::SafeCast<CurveControlPoint>( selection.Front() );

        if ( !point )
        {
            return;
        }

        Curve* curve = Reflect::SafeCast<Curve>( point->GetParent() );

        if ( !curve )
        {
            return;
        }

        int32_t index =  curve->GetIndexForControlPoint( point );

        if ( index == -1 )
        {
            return;
        }

        uint32_t countControlPoints = curve->GetNumberControlPoints();
        if ( keyCode == KeyCodes::Left || keyCode == KeyCodes::Down )
        {
            index--;
            index += countControlPoints;
            index %= countControlPoints;
        }
        else if ( keyCode == KeyCodes::Right || keyCode == KeyCodes::Up ) 
        {
            index++;
            index %= countControlPoints;
        }

        point = curve->GetControlPointByIndex( index );

        selection.Clear();
        selection.Append( point );
        m_Scene->GetSelection().SetItems( selection );
    }

    Base::KeyPress( e );
}