]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/surfacedialog.cpp
- Weird shiftvalues are now hidden to the user, shiftvalues will
[xonotic/netradiant.git] / radiant / surfacedialog.cpp
index 0343bbd2a9a388743cbf2011ff551b8b62a8ba32..7b2eb43e4489160dce24c08c0be1d31a21f640f1 100644 (file)
@@ -276,6 +276,7 @@ namespace
   CopiedString g_selectedShader;
   TextureProjection g_selectedTexdef;
   ContentsFlagsValue g_selectedFlags;
+  size_t g_selectedShaderSize[2];
 }
 
 void SurfaceInspector_SetSelectedShader(const char* shader)
@@ -328,8 +329,13 @@ void SurfaceInspector_SetCurrent_FromSelected()
 //This *may* be the point before it fucks up... Let's see!
 //Yep, there was a call to removeScale in there...
       Scene_BrushGetTexdef_Component_Selected(GlobalSceneGraph(), projection);
+         
       SurfaceInspector_SetSelectedTexdef(projection);
 
+         Scene_BrushGetShaderSize_Component_Selected(GlobalSceneGraph(), g_selectedShaderSize[0], g_selectedShaderSize[1]);
+         g_selectedTexdef.m_brushprimit_texdef.coords[0][2] = float_mod(g_selectedTexdef.m_brushprimit_texdef.coords[0][2], (float)g_selectedShaderSize[0]);
+         g_selectedTexdef.m_brushprimit_texdef.coords[1][2] = float_mod(g_selectedTexdef.m_brushprimit_texdef.coords[1][2], (float)g_selectedShaderSize[1]);
+
       CopiedString name;
       Scene_BrushGetShader_Component_Selected(GlobalSceneGraph(), name);
       if(string_not_empty(name.c_str()))
@@ -1194,6 +1200,10 @@ globalOutputStream() << "BP: (" << g_selectedBrushPrimitTexdef.coords[0][0] << "
 //Ok, it's screwed up *before* we get here...
   ShiftScaleRotate_fromFace(shiftScaleRotate, SurfaceInspector_GetSelectedTexdef());
 
+  // normalize again to hide the ridiculously high scale values that get created when using texlock
+  shiftScaleRotate.shift[0] = float_mod(shiftScaleRotate.shift[0], (float)g_selectedShaderSize[0]);
+  shiftScaleRotate.shift[1] = float_mod(shiftScaleRotate.shift[1], (float)g_selectedShaderSize[1]);
+
   {
     spin_button_set_value_no_signal(m_hshiftIncrement.m_spin, shiftScaleRotate.shift[0]);
     spin_button_set_step_increment(m_hshiftIncrement.m_spin, g_si_globals.shift[0]);