Changeset 301
- Timestamp:
- 07/10/08 03:30:47 (3 months ago)
- Files:
-
- GtkRadiant/trunk/config.py (modified) (1 diff)
- GtkRadiant/trunk/include/isurfaceplugin.h (modified) (1 diff)
- GtkRadiant/trunk/plugins/surface/surfacedialog.cpp (modified) (3 diffs)
- GtkRadiant/trunk/radiant/brush_primit.cpp (modified) (3 diffs)
- GtkRadiant/trunk/radiant/drag.cpp (modified) (1 diff)
- GtkRadiant/trunk/radiant/mainframe.cpp (modified) (3 diffs)
- GtkRadiant/trunk/radiant/preferences.cpp (modified) (4 diffs)
- GtkRadiant/trunk/radiant/preferences.h (modified) (1 diff)
- GtkRadiant/trunk/radiant/select.cpp (modified) (1 diff)
- GtkRadiant/trunk/radiant/surfaceplugin.cpp (modified) (9 diffs)
- GtkRadiant/trunk/radiant/xywindow.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
GtkRadiant/trunk/config.py
r247 r301 237 237 env.Append( LIBS = 'z' ) 238 238 239 env.Append( C FLAGS = baseflags )239 env.Append( CCFLAGS = baseflags ) 240 240 env.Append( CXXFLAGS = baseflags + [ '-fpermissive', '-fvisibility-inlines-hidden' ] ) 241 241 env.Append( CPPPATH = [ 'include', 'libs' ] ) GtkRadiant/trunk/include/isurfaceplugin.h
r195 r301 63 63 texdef_t texdef; // Working texdef 64 64 texdef_t orig_texdef; // Original, for baselining changes 65 brushprimit_texdef_t orig_bp_texdef; // Original, for undo 65 66 }; 66 67 GtkRadiant/trunk/plugins/surface/surfacedialog.cpp
r283 r301 1028 1028 1029 1029 rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); 1030 rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0);1030 rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 4); 1031 1031 gtk_widget_show (rotate_value_spinbutton); 1032 1032 gtk_table_attach (GTK_TABLE (table1), rotate_value_spinbutton, 1, 2, 10, 11, … … 1079 1079 1080 1080 rotate_offset_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); 1081 rotate_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_offset_spinbutton_adj), 0, 2);1081 rotate_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_offset_spinbutton_adj), 0, 4); 1082 1082 gtk_widget_show (rotate_offset_spinbutton); 1083 1083 gtk_table_attach (GTK_TABLE (table1), rotate_offset_spinbutton, 2, 3, 10, 11, … … 1122 1122 1123 1123 rotate_step_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); 1124 rotate_step_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_step_spinbutton_adj), 1, 2);1124 rotate_step_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_step_spinbutton_adj), 1, 4); 1125 1125 gtk_widget_show (rotate_step_spinbutton); 1126 1126 gtk_table_attach (GTK_TABLE (table1), rotate_step_spinbutton, 3, 4, 10, 11, GtkRadiant/trunk/radiant/brush_primit.cpp
r299 r301 187 187 #ifdef DBG_BP 188 188 // check this matrix is orthogonal 189 if (fabs(texMat[0][0]* texMat[0][1]+texMat[1][0]*texMat[1][1])>ZERO_EPSILON)189 if (fabs(texMat[0][0]*1.0L*texMat[0][1]+texMat[1][0]*1.0L*texMat[1][1])>ZERO_EPSILON) 190 190 Sys_Printf("Warning : non orthogonal texture matrix in TexMatToFakeTexCoords\n"); 191 191 #endif 192 scale[0]=sqrt(texMat[0][0]* texMat[0][0]+texMat[1][0]*texMat[1][0]);193 scale[1]=sqrt(texMat[0][1]* texMat[0][1]+texMat[1][1]*texMat[1][1]);192 scale[0]=sqrt(texMat[0][0]*1.0L*texMat[0][0]+texMat[1][0]*1.0L*texMat[1][0]); 193 scale[1]=sqrt(texMat[0][1]*1.0L*texMat[0][1]+texMat[1][1]*1.0L*texMat[1][1]); 194 194 #ifdef DBG_BP 195 195 if (scale[0]<ZERO_EPSILON || scale[1]<ZERO_EPSILON) … … 211 211 } 212 212 else 213 *rot = RAD2DEG( atan2( texMat[1][0] , texMat[0][0]) );213 *rot = RAD2DEG( atan2( texMat[1][0]*1.0L, texMat[0][0]*1.0L ) ); 214 214 shift[0] = -texMat[0][2]; 215 215 shift[1] = texMat[1][2]; … … 220 220 void FakeTexCoordsToTexMat( float shift[2], float rot, float scale[2], vec_t texMat[2][3] ) 221 221 { 222 texMat[0][0] = scale[0] * cos( DEG2RAD(rot ) );223 texMat[1][0] = scale[0] * sin( DEG2RAD(rot ) );224 texMat[0][1] = - 1.0f * scale[1] * sin( DEG2RAD(rot ) );225 texMat[1][1] = scale[1] * cos( DEG2RAD(rot ) );222 texMat[0][0] = scale[0] *1.0L* cos( DEG2RAD( 1.0L*rot ) ); 223 texMat[1][0] = scale[0] *1.0L* sin( DEG2RAD( 1.0L*rot ) ); 224 texMat[0][1] = -scale[1] *1.0L* sin( DEG2RAD( 1.0L*rot ) ); 225 texMat[1][1] = scale[1] *1.0L* cos( DEG2RAD( 1.0L*rot ) ); 226 226 texMat[0][2] = -shift[0]; 227 227 texMat[1][2] = shift[1]; GtkRadiant/trunk/radiant/drag.cpp
r289 r301 771 771 { 772 772 move[i] = drag_xvec[i]*(x - pressx) + drag_yvec[i]*(y - pressy); 773 if ( !g_PrefsDlg.m_bNoClamp)773 if (g_PrefsDlg.m_bSnap) 774 774 { 775 775 move[i] = floor(move[i]/g_qeglobals.d_gridsize+0.5)*g_qeglobals.d_gridsize; GtkRadiant/trunk/radiant/mainframe.cpp
r289 r301 3825 3825 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), (g_PrefsDlg.m_bGLLighting) ? TRUE : FALSE); 3826 3826 item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_snaptogrid")); 3827 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), ( !g_PrefsDlg.m_bNoClamp) ? TRUE : FALSE);3827 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), (g_PrefsDlg.m_bSnap) ? TRUE : FALSE); 3828 3828 3829 3829 item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_view_cubicclipping")); … … 4659 4659 g_bIgnoreCommands++; 4660 4660 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), 4661 ( !g_PrefsDlg.m_bNoClamp) ? TRUE : FALSE);4661 (g_PrefsDlg.m_bSnap) ? TRUE : FALSE); 4662 4662 g_bIgnoreCommands--; 4663 4663 } … … 5687 5687 void MainFrame::OnSnaptogrid() 5688 5688 { 5689 g_PrefsDlg.m_b NoClamp ^= 1;5689 g_PrefsDlg.m_bSnap ^= 1; 5690 5690 g_PrefsDlg.SavePrefs (); 5691 5691 5692 5692 GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_snaptogrid")); 5693 5693 g_bIgnoreCommands++; 5694 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), g_PrefsDlg.m_b NoClamp ? FALSE : TRUE);5694 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), g_PrefsDlg.m_bSnap ? TRUE : FALSE); 5695 5695 g_bIgnoreCommands--; 5696 5696 } GtkRadiant/trunk/radiant/preferences.cpp
r298 r301 97 97 #define PLUGINTOOLBAR_KEY "PluginToolBar" 98 98 #define NOCLAMP_KEY "NoClamp" 99 #define SNAP_KEY "Snap" 99 100 #define PREFAB_KEY "PrefabPath" 100 101 #define USERINI_KEY "UserINIPath" … … 636 637 m_bPluginToolbar = TRUE; 637 638 m_bNoClamp = FALSE; 639 m_bSnap = TRUE; 638 640 m_strUserPath = ""; 639 641 m_nRotation = 0; … … 2337 2339 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL); 2338 2340 2341 // Snap to grid 2342 check = gtk_check_button_new_with_label (_("Snap to grid")); 2343 gtk_widget_show (check); 2344 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); 2345 AddDialogData (check, &m_bSnap, DLG_CHECK_BOOL); 2346 2339 2347 // Select patch by bounding box 2340 2348 check = gtk_check_button_new_with_label (_("Select patches by bounding box")); … … 2907 2915 2908 2916 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE); 2917 mLocalPrefs.GetPref(SNAP_KEY, &m_bSnap, TRUE); 2909 2918 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, ""); 2910 2919 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45); GtkRadiant/trunk/radiant/preferences.h
r297 r301 580 580 bool m_bNoClamp; 581 581 //++timo this is most likely broken, I don't know what it's supposed to do 582 bool m_bSnap; 582 583 Str m_strUserPath; 583 584 int m_nRotation; GtkRadiant/trunk/radiant/select.cpp
r289 r301 736 736 int i; 737 737 738 if ( g_PrefsDlg.m_bNoClamp)738 if (!g_PrefsDlg.m_bSnap) 739 739 { 740 740 Select_GetTrueMid(mid); GtkRadiant/trunk/radiant/surfaceplugin.cpp
r297 r301 74 74 brush_t *b; 75 75 texdef_to_face_t *position, *prev_pos; 76 brushprimit_texdef_t bp; 76 77 77 78 if(selected_brushes.next != &selected_brushes) … … 86 87 position->face = f; 87 88 position->brush = b; 88 position->texdef = f->texdef; 89 position->orig_texdef = f->texdef; 89 position->texdef = f->texdef; 90 if(g_qeglobals.m_bBrushPrimitMode) 91 { 92 ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL); 93 TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale); 94 position->orig_bp_texdef = bp; 95 } 96 position->orig_texdef = position->texdef; 90 97 prev_pos->next = position; 91 98 prev_pos = position; … … 104 111 position->brush = b; 105 112 position->texdef = f->texdef; 106 position->orig_texdef = f->texdef; 113 if(g_qeglobals.m_bBrushPrimitMode) 114 { 115 ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL); 116 TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale); 117 position->orig_bp_texdef = bp; 118 } 119 position->orig_texdef = position->texdef; 107 120 prev_pos = position; 108 121 for(i=1; i<g_ptrSelectedFaces.GetSize(); i++) … … 114 127 position->brush = b; 115 128 position->texdef = f->texdef; 116 position->orig_texdef = f->texdef; 129 if(g_qeglobals.m_bBrushPrimitMode) 130 { 131 ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL); 132 TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale); 133 position->orig_bp_texdef = bp; 134 } 135 position->orig_texdef = position->texdef; 117 136 prev_pos->next = position; 118 137 prev_pos = position; … … 188 207 SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->orig_texdef, bFit_to_Scale); 189 208 else 190 SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, NULL);209 SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, &texdef_to_face->orig_bp_texdef, bFit_to_Scale); 191 210 192 211 Undo_Start("set facelist texdefs"); … … 205 224 SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->texdef, bFit_to_Scale); 206 225 else 207 SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, NULL , bFit_to_Scale); 226 { 227 brushprimit_texdef_t brushprimit_texdef; 228 FakeTexCoordsToTexMat(texdef_to_face->texdef.shift, texdef_to_face->texdef.rotate, texdef_to_face->texdef.scale, brushprimit_texdef.coords); 229 SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, &brushprimit_texdef , bFit_to_Scale); 230 } 208 231 Brush_Build(texdef_to_face->brush); 209 232 if(bFit_to_Scale) … … 223 246 // Over-write the orig_texdef list, cementing the change. 224 247 for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next) 248 { 225 249 texdef_to_face->orig_texdef = texdef_to_face->texdef; 250 texdef_to_face->orig_bp_texdef = texdef_to_face->face->brushprimit_texdef; 251 } 226 252 } 227 253 } … … 233 259 { 234 260 texdef_to_face_t* temp_texdef_face_list; 261 brushprimit_texdef_t bp; 235 262 236 263 if (!si_texdef_face_list) … … 242 269 Brush_Build(temp_texdef_face_list->brush,true,true,false,false); 243 270 // Write changes to our working Texdef list 271 272 if(g_qeglobals.m_bBrushPrimitMode) 273 { 274 ConvertTexMatWithQTexture(&temp_texdef_face_list->face->brushprimit_texdef, QERApp_Shader_ForName( temp_texdef_face_list->face->texdef.GetName() )->getTexture(), &bp, NULL); 275 TexMatToFakeTexCoords(bp.coords, temp_texdef_face_list->face->texdef.shift, &temp_texdef_face_list->face->texdef.rotate, temp_texdef_face_list->face->texdef.scale); 276 } 244 277 temp_texdef_face_list->texdef = temp_texdef_face_list->face->texdef; 245 278 } GtkRadiant/trunk/radiant/xywindow.cpp
r289 r301 1502 1502 { 1503 1503 delta[i] = xvec[i] * (x - m_nPressx) + yvec[i] * (y - m_nPressy); 1504 if ( !g_PrefsDlg.m_bNoClamp)1504 if (g_PrefsDlg.m_bSnap) 1505 1505 { 1506 1506 delta[i] = floor(delta[i] / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize; … … 2136 2136 void XYWnd::SnapToPoint (int x, int y, vec3_t point) 2137 2137 { 2138 if (g_PrefsDlg.m_bNoClamp) 2138 if (g_PrefsDlg.m_bSnap) 2139 { 2140 XY_ToGridPoint(x, y, point); 2141 } 2142 else 2139 2143 { 2140 2144 XY_ToPoint(x, y, point); 2141 }2142 else2143 {2144 XY_ToGridPoint(x, y, point);2145 2145 } 2146 2146 }
