// make the shift increments match the grid settings // the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size // this depends on a scale value if you have selected a particular texture on which you want it to work: // we move the textures in pixels, not world units. (i.e. increment values are in pixel) // depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize // increment * scale = gridsize // hscale and vscale are optional parameters, if they are zero they will be set to the default scale // NOTE: the default scale depends if you are using BP mode or regular. // For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f // see fenris #2810 void DoSnapTToGrid( float hscale, float vscale ){ l_pIncrement = Get_SI_Inc(); if ( hscale == 0.0f ) { hscale = 0.25f; } if ( vscale == 0.0f ) { vscale = 0.25f; } #ifdef _DEBUG Sys_Printf( "DoSnapToGrid: grid %g hscale %g vscale %g\n", GridSize(), hscale, vscale ); #endif l_pIncrement->shift[0] = GridSize() / hscale; l_pIncrement->shift[1] = GridSize() / vscale; // now some update work // FIXME: doesn't look good here, seems to be called several times SetTexMods(); }
FVector2D UBlendSpace::CalculateThreshold() const { FVector2D GridSize(BlendParameters[0].GridNum, BlendParameters[1].GridNum); FVector GridMin(BlendParameters[0].Min, BlendParameters[1].Min, 0.f); FVector GridMax(BlendParameters[0].Max, BlendParameters[1].Max, 0.f); FBox GridDim(GridMin, GridMax); FVector2D CoordDim (GridDim.GetSize()); // it does not make sense to put a lot of samples between grid // since grid is the sample points at the end, you don't like to have too many samples within the grid. // make sure it has enough space between - also it avoids tiny triangles return CoordDim/GridSize*0.3f; }