* preferences->Clipper->"Reset Flipped State" (on cut done and on manipulator changed), "Reset Points on Split", "2 Points in 2D Views"
This commit is contained in:
parent
8339ebfb23
commit
522cac75dc
|
|
@ -36,7 +36,15 @@ GdkCursor* g_clipper_cursor;
|
|||
ClipperPoints g_clipper_points( g_vector3_identity, g_vector3_identity, g_vector3_identity );
|
||||
bool g_clipper_flipped = false;
|
||||
|
||||
/* preferences */
|
||||
bool g_clipper_caulk = true;
|
||||
bool g_clipper_resetFlip = true;
|
||||
bool g_clipper_resetPoints = true;
|
||||
bool g_clipper_2pointsIn2d = true;
|
||||
|
||||
bool Clipper_get2pointsIn2d(){
|
||||
return g_clipper_2pointsIn2d;
|
||||
}
|
||||
|
||||
bool Clipper_ok(){
|
||||
return GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eClip && plane3_valid( plane3_for_points( g_clipper_points._points ) );
|
||||
|
|
@ -75,6 +83,9 @@ void Clipper_modeChanged( bool isClipper ){
|
|||
if( g_pParentWnd->GetCamWnd() )
|
||||
gdk_window_set_cursor( CamWnd_getWidget( *g_pParentWnd->GetCamWnd() )->window, cursor );
|
||||
}
|
||||
|
||||
if( g_clipper_resetFlip )
|
||||
g_clipper_flipped = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -83,7 +94,11 @@ void Clipper_modeChanged( bool isClipper ){
|
|||
|
||||
void Clipper_do( bool split ){
|
||||
Scene_BrushSplitByPlane( GlobalSceneGraph(), Clipper_getPlanePoints(), g_clipper_caulk, split );
|
||||
if( g_clipper_resetPoints ){
|
||||
GlobalSelectionSystem().SetManipulatorMode( SelectionSystem::eClip ); /* reset points this way */
|
||||
if( g_clipper_resetFlip )
|
||||
g_clipper_flipped = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -114,7 +129,11 @@ void Clipper_doFlip(){
|
|||
#include "commands.h"
|
||||
#include "signal/isignal.h"
|
||||
void Clipper_constructPreferences( PreferencesPage& page ){
|
||||
page.appendCheckBox( "", "Caulk Clipper Splits", g_clipper_caulk );
|
||||
page.appendCheckBox( "", "Caulk Clipper Cuts", g_clipper_caulk );
|
||||
GtkWidget* resetFlip = page.appendCheckBox( "", "Reset Flipped State", g_clipper_resetFlip );
|
||||
GtkWidget* resetPoints = page.appendCheckBox( "", "Reset Points on Split", g_clipper_resetPoints );
|
||||
Widget_connectToggleDependency( resetFlip, resetPoints );
|
||||
page.appendCheckBox( "", "2 Points in 2D Views", g_clipper_2pointsIn2d );
|
||||
}
|
||||
void Clipper_constructPage( PreferenceGroup& group ){
|
||||
PreferencesPage page( group.createPage( "Clipper", "Clipper Tool Settings" ) );
|
||||
|
|
@ -135,6 +154,9 @@ void Clipper_Construct(){
|
|||
|
||||
Clipper_registerCommands();
|
||||
GlobalPreferenceSystem().registerPreference( "ClipperCaulk", BoolImportStringCaller( g_clipper_caulk ), BoolExportStringCaller( g_clipper_caulk ) );
|
||||
GlobalPreferenceSystem().registerPreference( "ClipperResetFlip", BoolImportStringCaller( g_clipper_resetFlip ), BoolExportStringCaller( g_clipper_resetFlip ) );
|
||||
GlobalPreferenceSystem().registerPreference( "ClipperResetPoints", BoolImportStringCaller( g_clipper_resetPoints ), BoolExportStringCaller( g_clipper_resetPoints ) );
|
||||
GlobalPreferenceSystem().registerPreference( "Clipper2PointsIn2D", BoolImportStringCaller( g_clipper_2pointsIn2d ), BoolExportStringCaller( g_clipper_2pointsIn2d ) );
|
||||
Clipper_registerPreferencesPage();
|
||||
|
||||
typedef FreeCaller1<const Selectable&, Clipper_SelectionChanged> ClipperSelectionChangedCaller;
|
||||
|
|
|
|||
|
|
@ -46,5 +46,6 @@ void Clipper_setPlanePoints( const ClipperPoints& points );
|
|||
void Clipper_Construct();
|
||||
void Clipper_Destroy();
|
||||
void Clipper_modeChanged( bool isClipper );
|
||||
bool Clipper_get2pointsIn2d();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3726,18 +3726,19 @@ public:
|
|||
if( !m_points[2].m_set ){
|
||||
m_points[2].m_point = m_points[0].m_point + m_viewdir * vector3_length( m_points[0].m_point - m_points[1].m_point );
|
||||
}
|
||||
Clipper_setPlanePoints( ClipperPoints( m_points[0].m_point, m_points[1].m_point, m_points[2].m_point ) );
|
||||
Clipper_setPlanePoints( ClipperPoints( m_points[0].m_point, m_points[2].m_point, m_points[1].m_point ) ); /* points order corresponds the plane, we want to insert */
|
||||
}
|
||||
else{
|
||||
Clipper_setPlanePoints( ClipperPoints( g_vector3_identity, g_vector3_identity, g_vector3_identity ) );
|
||||
}
|
||||
}
|
||||
std::size_t newPointIndex() const {
|
||||
std::size_t newPointIndex( const View& view ) const {
|
||||
const std::size_t maxi = ( !view.fill() && Clipper_get2pointsIn2d() )? 2 : 3;
|
||||
std::size_t i;
|
||||
for( i = 0; i < 3; ++i )
|
||||
for( i = 0; i < maxi; ++i )
|
||||
if( !m_points[i].m_set )
|
||||
break;
|
||||
return i;
|
||||
return i % maxi;
|
||||
}
|
||||
void newPoint( const Vector3& point, const View& view ){
|
||||
{ /* update m_viewdir */
|
||||
|
|
@ -3750,11 +3751,9 @@ public:
|
|||
if( view.fill() ) //viewdir, taken this way in perspective view is negative for some reason
|
||||
m_viewdir *= -1;
|
||||
}
|
||||
std::size_t i = newPointIndex();
|
||||
if( i == 3 ){
|
||||
i = 0;
|
||||
const std::size_t i = newPointIndex( view );
|
||||
if( i == 0 )
|
||||
m_points[1].m_set = m_points[2].m_set = false;
|
||||
}
|
||||
m_points[i].m_set = true;
|
||||
m_points[i].m_point = point;
|
||||
|
||||
|
|
@ -3787,7 +3786,7 @@ public:
|
|||
Vector3 point = vector4_projected( matrix4_transformed_vector4( matrix4_full_inverse( view.GetViewMatrix() ), Vector4( 0, 0, 0, 1 ) ) );
|
||||
vector3_snap( point, GetSnapGridSize() );
|
||||
{
|
||||
const std::size_t i = newPointIndex() % 3;
|
||||
const std::size_t i = newPointIndex( view );
|
||||
point[maxi] = m_bounds.origin[maxi] + ( i == 2? -1 : 1 ) * m_bounds.extents[maxi];
|
||||
}
|
||||
newPoint( point, view );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user