@@ -125,7 +125,6 @@ void CurveEditor::updateCurves( bool onRelease ) {
125125 auto oldPoint = pointComponent->m_point ;
126126 unsigned int curveIdSize = pointComponent->m_curveId .size ();
127127
128- CurveFactory factory;
129128 m_viewer->makeCurrent ();
130129
131130 for ( unsigned int i = 0 ; i < curveIdSize; i++ ) {
@@ -292,9 +291,9 @@ void CurveEditor::addPointInCurve( const Vector3& worldPos, int mouseX, int mous
292291 auto e = ro->getComponent ();
293292
294293 int curveIndex = -1 ;
295- for ( int i = 0 ; i < m_curveEntities.size (); i ++ ) {
296- if ( m_curveEntities[i ] == e ) {
297- curveIndex = i ;
294+ for ( int z = 0 ; z < m_curveEntities.size (); z ++ ) {
295+ if ( m_curveEntities[z ] == e ) {
296+ curveIndex = z ;
298297 break ;
299298 }
300299 }
@@ -359,35 +358,14 @@ void CurveEditor::processPicking( const Vector3& worldPos ) {
359358 auto transformTranslate = Transform::Identity ();
360359 transformTranslate.translate ( worldPos - point );
361360
362- auto transform = Transform::Identity ();
363- transform = m_selectedRo->getLocalTransform () * transformTranslate;
361+ auto transform = m_selectedRo->getLocalTransform () * transformTranslate;
364362 m_selectedRo->setLocalTransform ( transform );
365363
366- if ( m_smooth && !( m_currentPoint == 0 || m_currentPoint == 1 ||
367- m_currentPoint == m_pointEntities.size () - 2 ||
368- m_currentPoint == m_pointEntities.size () - 1 ) ) {
364+ if ( !( m_currentPoint == 0 || m_currentPoint == 1 ||
365+ m_currentPoint == m_pointEntities.size () - 2 ||
366+ m_currentPoint == m_pointEntities.size () - 1 ) ) {
369367
370- if ( m_currentPoint % 3 == 2 ) {
371- auto pointMid = m_pointEntities[m_currentPoint + 1 ];
372- pointComponent = m_pointEntities[m_currentPoint + 2 ];
373- auto symTransform =
374- computePointTransform ( pointComponent, pointMid->m_point , worldPos );
375- auto ro = m_roMgr->getRenderObject ( pointComponent->getRenderObjects ()[0 ] );
376- ro->setLocalTransform ( symTransform );
377-
378- if ( m_tangentPoints.empty () ) { m_tangentPoints.push_back ( m_currentPoint + 2 ); }
379- }
380- else if ( m_currentPoint % 3 == 1 ) {
381- auto pointMid = m_pointEntities[m_currentPoint - 1 ];
382- pointComponent = m_pointEntities[m_currentPoint - 2 ];
383- auto symTransform =
384- computePointTransform ( pointComponent, pointMid->m_point , worldPos );
385- auto ro = m_roMgr->getRenderObject ( pointComponent->getRenderObjects ()[0 ] );
386- ro->setLocalTransform ( symTransform );
387-
388- if ( m_tangentPoints.empty () ) { m_tangentPoints.push_back ( m_currentPoint - 2 ); }
389- }
390- else if ( m_currentPoint % 3 == 0 ) {
368+ if ( m_currentPoint % 3 == 0 ) {
391369 auto leftRo = m_roMgr->getRenderObject (
392370 m_pointEntities[m_currentPoint - 1 ]->getRenderObjects ()[0 ] );
393371 auto leftTransform = leftRo->getTransform () * transformTranslate;
@@ -403,6 +381,28 @@ void CurveEditor::processPicking( const Vector3& worldPos ) {
403381 m_tangentPoints.push_back ( m_currentPoint + 1 );
404382 }
405383 }
384+ else if ( m_smooth ) {
385+ if ( m_currentPoint % 3 == 2 ) {
386+ auto pointMid = m_pointEntities[m_currentPoint + 1 ];
387+ pointComponent = m_pointEntities[m_currentPoint + 2 ];
388+ auto symTransform =
389+ computePointTransform ( pointComponent, pointMid->m_point , worldPos );
390+ auto ro = m_roMgr->getRenderObject ( pointComponent->getRenderObjects ()[0 ] );
391+ ro->setLocalTransform ( symTransform );
392+
393+ if ( m_tangentPoints.empty () ) { m_tangentPoints.push_back ( m_currentPoint + 2 ); }
394+ }
395+ else if ( m_currentPoint % 3 == 1 ) {
396+ auto pointMid = m_pointEntities[m_currentPoint - 1 ];
397+ pointComponent = m_pointEntities[m_currentPoint - 2 ];
398+ auto symTransform =
399+ computePointTransform ( pointComponent, pointMid->m_point , worldPos );
400+ auto ro = m_roMgr->getRenderObject ( pointComponent->getRenderObjects ()[0 ] );
401+ ro->setLocalTransform ( symTransform );
402+
403+ if ( m_tangentPoints.empty () ) { m_tangentPoints.push_back ( m_currentPoint - 2 ); }
404+ }
405+ }
406406 }
407407 updateCurves ();
408408}
0 commit comments