Re-order some UI related gubbins...
This commit is contained in:
parent
6eb872b4c0
commit
9115c39fba
18 changed files with 358 additions and 66 deletions
11
src/brush.h
11
src/brush.h
|
@ -624,6 +624,10 @@ void fit(const Vector3 &normal, const Winding &winding, float s_repeat, float t_
|
|||
{
|
||||
Texdef_FitTexture(m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat);
|
||||
}
|
||||
void align(const Plane3 &plane, const Vector3 &normal, const Winding &winding, int alignment)
|
||||
{
|
||||
Texdef_AlignTexture(m_projection, plane, normal, winding, m_shader.width(), m_shader.height(), alignment);
|
||||
}
|
||||
|
||||
void emitTextureCoordinates(Winding &winding, const Vector3 &normal, const Matrix4 &localToWorld)
|
||||
{
|
||||
|
@ -1317,6 +1321,13 @@ void FitTexture(float s_repeat, float t_repeat)
|
|||
texdefChanged();
|
||||
}
|
||||
|
||||
void AlignTexture(int alignment)
|
||||
{
|
||||
undoSave();
|
||||
m_texdef.align(m_plane.plane3(), m_plane.plane3().normal(), m_winding, alignment);
|
||||
texdefChanged();
|
||||
}
|
||||
|
||||
void EmitTextureCoordinates()
|
||||
{
|
||||
Texdef_EmitTextureCoordinates(m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding,
|
||||
|
|
|
@ -1147,6 +1147,89 @@ void Texdef_FitTexture(TextureProjection &projection, std::size_t width, std::si
|
|||
Texdef_normalise(projection, (float) width, (float) height);
|
||||
}
|
||||
|
||||
|
||||
void Texdef_AlignTexture(TextureProjection &projection, const Plane3 &plane, const Vector3 &normal, const Winding &w, std::size_t width, std::size_t height, int alignment)
|
||||
{
|
||||
if (w.numpoints < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix4 st2tex;
|
||||
Texdef_toTransform(projection, (float) width, (float) height, st2tex);
|
||||
|
||||
// the current texture transform
|
||||
Matrix4 local2tex = st2tex;
|
||||
{
|
||||
Matrix4 xyz2st;
|
||||
Texdef_basisForNormal(projection, normal, xyz2st);
|
||||
matrix4_multiply_by_matrix4(local2tex, xyz2st);
|
||||
}
|
||||
|
||||
// the bounds of the current texture transform
|
||||
AABB bounds;
|
||||
for (Winding::const_iterator i = w.begin(); i != w.end(); ++i) {
|
||||
Vector3 texcoord = matrix4_transformed_point(local2tex, (*i).vertex);
|
||||
aabb_extend_by_point_safe(bounds, texcoord);
|
||||
}
|
||||
bounds.extents.z() = 1;
|
||||
|
||||
AABB perfect;
|
||||
perfect.extents = bounds.extents;
|
||||
printf("Bounds: %f %f %f\n", bounds.origin.x(), bounds.origin.y(), bounds.origin.z());
|
||||
|
||||
switch (alignment) {
|
||||
case 0:
|
||||
printf("Top Left\n");
|
||||
perfect.origin = Vector3(0, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
printf("Top Center\n");
|
||||
perfect.origin = Vector3(width /2, 0, 0);
|
||||
break;
|
||||
case 2:
|
||||
printf("Top Right\n");
|
||||
perfect.origin = Vector3(width, 0, 0);
|
||||
break;
|
||||
case 3:
|
||||
printf("Middle Left\n");
|
||||
perfect.origin = Vector3(0.0, 0.5, 0);
|
||||
break;
|
||||
case 4:
|
||||
printf("Middle Center\n");
|
||||
perfect.origin = Vector3(0.5, 0.5, 0);
|
||||
break;
|
||||
case 5:
|
||||
printf("Middle Right\n");
|
||||
perfect.origin = Vector3(1.0, 0.5, 0);
|
||||
break;
|
||||
case 6:
|
||||
printf("Bottom Left\n");
|
||||
perfect.origin = Vector3(0.0, 1.0, 0);
|
||||
break;
|
||||
case 7:
|
||||
printf("Bottom Center\n");
|
||||
perfect.origin = Vector3(0.5, 1.0, 0);
|
||||
break;
|
||||
case 8:
|
||||
printf("Bottom Right\n");
|
||||
perfect.origin = Vector3(1.0, 1.0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// the difference between the current texture transform and the perfectly fitted transform
|
||||
Matrix4 matrix(matrix4_translation_for_vec3(bounds.origin - perfect.origin));
|
||||
|
||||
/*
|
||||
matrix4_pivoted_scale_by_vec3(matrix, bounds.extents, perfect.origin);
|
||||
matrix4_affine_invert(matrix);
|
||||
*/
|
||||
|
||||
// apply the difference to the current texture transform
|
||||
matrix4_premultiply_by_matrix4(st2tex, matrix);
|
||||
Texdef_fromTransform(projection, (float) width, (float) height, st2tex);
|
||||
Texdef_normalise(projection, (float) width, (float) height);
|
||||
}
|
||||
|
||||
float Texdef_getDefaultTextureScale()
|
||||
{
|
||||
return g_texdef_default_scale;
|
||||
|
|
|
@ -128,6 +128,7 @@ void Texdef_Rotate(TextureProjection &projection, float angle);
|
|||
|
||||
void Texdef_FitTexture(TextureProjection &projection, std::size_t width, std::size_t height, const Vector3 &normal,
|
||||
const Winding &w, float s_repeat, float t_repeat);
|
||||
void Texdef_AlignTexture(TextureProjection &projection, const Plane3 &plane, const Vector3 &normal, const Winding &w, std::size_t width, std::size_t height, int alignment);
|
||||
|
||||
void
|
||||
Texdef_EmitTextureCoordinates(const TextureProjection &projection, std::size_t width, std::size_t height, Winding &w,
|
||||
|
|
|
@ -591,7 +591,6 @@ void Scene_BrushFitTexture_Selected(scene::Graph &graph, float s_repeat, float t
|
|||
});
|
||||
SceneChangeNotify();
|
||||
}
|
||||
|
||||
void Scene_BrushFitTexture_Component_Selected(scene::Graph &graph, float s_repeat, float t_repeat)
|
||||
{
|
||||
Scene_ForEachSelectedBrushFace(graph, [&](Face &face) {
|
||||
|
@ -600,6 +599,21 @@ void Scene_BrushFitTexture_Component_Selected(scene::Graph &graph, float s_repea
|
|||
SceneChangeNotify();
|
||||
}
|
||||
|
||||
void Scene_BrushAlignTexture_Selected(scene::Graph &graph, int alignment)
|
||||
{
|
||||
Scene_ForEachSelectedBrush_ForEachFace(graph, [&](Face &face) {
|
||||
face.AlignTexture(alignment);
|
||||
});
|
||||
SceneChangeNotify();
|
||||
}
|
||||
void Scene_BrushAlignTexture_Component_Selected(scene::Graph &graph, int alignment)
|
||||
{
|
||||
Scene_ForEachSelectedBrushFace(graph, [&](Face &face) {
|
||||
face.AlignTexture(alignment);
|
||||
});
|
||||
SceneChangeNotify();
|
||||
}
|
||||
|
||||
TextureProjection g_defaultTextureProjection;
|
||||
|
||||
const TextureProjection &TextureTransform_getDefault()
|
||||
|
@ -1300,30 +1314,30 @@ void Brush_registerCommands()
|
|||
GlobalCommands_insert("BrushRock", BrushPrefab::SetCaller(g_brushrock));
|
||||
|
||||
GlobalCommands_insert("Brush3Sided", BrushMakeSided::SetCaller(g_brushmakesided3),
|
||||
Accelerator('3', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('3', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush4Sided", BrushMakeSided::SetCaller(g_brushmakesided4),
|
||||
Accelerator('4', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('4', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush5Sided", BrushMakeSided::SetCaller(g_brushmakesided5),
|
||||
Accelerator('5', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('5', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush6Sided", BrushMakeSided::SetCaller(g_brushmakesided6),
|
||||
Accelerator('6', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('6', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush7Sided", BrushMakeSided::SetCaller(g_brushmakesided7),
|
||||
Accelerator('7', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('7', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush8Sided", BrushMakeSided::SetCaller(g_brushmakesided8),
|
||||
Accelerator('8', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('8', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("Brush9Sided", BrushMakeSided::SetCaller(g_brushmakesided9),
|
||||
Accelerator('9', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('9', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
|
||||
GlobalCommands_insert("ClipSelected", makeCallbackF(ClipSelected), Accelerator(GDK_KEY_Return));
|
||||
GlobalCommands_insert("SplitSelected", makeCallbackF(SplitSelected),
|
||||
Accelerator(GDK_KEY_Return, (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("FlipClip", makeCallbackF(FlipClipper),
|
||||
Accelerator(GDK_KEY_Return, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_Return, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
|
||||
GlobalCommands_insert("MakeDetail", makeCallbackF(Select_MakeDetail),
|
||||
Accelerator('M', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('M', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("MakeStructural", makeCallbackF(Select_MakeStructural),
|
||||
Accelerator('S', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('S', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
}
|
||||
|
||||
void Brush_constructMenu(ui::Menu menu)
|
||||
|
|
|
@ -100,6 +100,9 @@ void Scene_BrushFitTexture_Selected(scene::Graph &graph, float s_repeat, float t
|
|||
|
||||
void Scene_BrushFitTexture_Component_Selected(scene::Graph &graph, float s_repeat, float t_repeat);
|
||||
|
||||
void Scene_BrushAlignTexture_Selected(scene::Graph &graph, int alignment);
|
||||
void Scene_BrushAlignTexture_Component_Selected(scene::Graph &graph, int alignment);
|
||||
|
||||
void Brush_constructMenu(ui::Menu menu);
|
||||
|
||||
extern Callback<void()> g_texture_lock_status_changed;
|
||||
|
|
|
@ -713,17 +713,17 @@ void Camera_motionDelta(int x, int y, unsigned int state, void *data)
|
|||
case 0:
|
||||
cam->m_strafe = (state & GDK_SHIFT_MASK) != 0;
|
||||
if (cam->m_strafe) {
|
||||
cam->m_strafe_forward = (state & GDK_LOCK_MASK) != 0;
|
||||
cam->m_strafe_forward = (state & GDK_CONTROL_MASK) != 0;
|
||||
} else {
|
||||
cam->m_strafe_forward = false;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
cam->m_strafe = (state & GDK_LOCK_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
|
||||
cam->m_strafe = (state & GDK_CONTROL_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
|
||||
cam->m_strafe_forward = false;
|
||||
break;
|
||||
case 2:
|
||||
cam->m_strafe = (state & GDK_LOCK_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
|
||||
cam->m_strafe = (state & GDK_CONTROL_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
|
||||
cam->m_strafe_forward = cam->m_strafe;
|
||||
break;
|
||||
}
|
||||
|
@ -2029,15 +2029,6 @@ void GlobalCamera_LookThroughCamera()
|
|||
CamWnd_LookThroughCamera(*g_camwnd);
|
||||
}
|
||||
|
||||
|
||||
void GlobalCamera_Refresh(void)
|
||||
{
|
||||
CamWnd &camwnd = *g_camwnd;
|
||||
Camera_updateModelview(camwnd.getCamera());
|
||||
Camera_updateProjection(camwnd.getCamera());
|
||||
CamWnd_Update(camwnd);
|
||||
}
|
||||
|
||||
/* sets origin and angle to 0,0,0 coords */
|
||||
void XYZ_SetOrigin(const Vector3 &origin);
|
||||
void GlobalCamera_GoToZero(void)
|
||||
|
@ -2171,18 +2162,18 @@ void CamWnd_Construct()
|
|||
|
||||
GlobalToggles_insert("ToggleCubicClip", makeCallbackF(Camera_ToggleFarClip),
|
||||
ToggleItem::AddCallbackCaller(g_getfarclip_item),
|
||||
Accelerator('\\', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('\\', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("CubicClipZoomIn", makeCallbackF(Camera_CubeIn),
|
||||
Accelerator('[', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('[', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("CubicClipZoomOut", makeCallbackF(Camera_CubeOut),
|
||||
Accelerator(']', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(']', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
|
||||
GlobalCommands_insert("UpFloor", makeCallbackF(Camera_ChangeFloorUp), Accelerator(GDK_KEY_Prior));
|
||||
GlobalCommands_insert("DownFloor", makeCallbackF(Camera_ChangeFloorDown), Accelerator(GDK_KEY_Next));
|
||||
|
||||
GlobalToggles_insert("ToggleCamera", ToggleShown::ToggleCaller(g_camera_shown),
|
||||
ToggleItem::AddCallbackCaller(g_camera_shown.m_item),
|
||||
Accelerator('C', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('C', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("LookThroughSelected", makeCallbackF(GlobalCamera_LookThroughSelected));
|
||||
GlobalCommands_insert("LookThroughCamera", makeCallbackF(GlobalCamera_LookThroughCamera));
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ void Entity_Construct()
|
|||
GlobalCommands_insert("EntityColor", makeCallbackF(Entity_setColour), Accelerator('K'));
|
||||
GlobalCommands_insert("NormalizeColor", makeCallbackF(Entity_normalizeColor));
|
||||
GlobalCommands_insert("ConnectSelection", makeCallbackF(Entity_connectSelected),
|
||||
Accelerator('K', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('K', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("KillConnectSelection", makeCallbackF(Entity_killconnectSelected),
|
||||
Accelerator('K', (GdkModifierType) (GDK_SHIFT_MASK)));
|
||||
GlobalCommands_insert("GroupSelection", makeCallbackF(Entity_groupSelected));
|
||||
|
|
|
@ -251,16 +251,16 @@ void ConstructFilters()
|
|||
}
|
||||
add_filter_command(EXCLUDE_LIGHTS, "FilterLights", Accelerator('0', (GdkModifierType) GDK_MOD1_MASK));
|
||||
add_filter_command(EXCLUDE_STRUCTURAL, "FilterStructural",
|
||||
Accelerator('D', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('D', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
if (g_pGameDescription->mGameType != "doom3") {
|
||||
add_filter_command(EXCLUDE_LIGHTGRID, "FilterLightgrid", accelerator_null());
|
||||
}
|
||||
add_filter_command(EXCLUDE_CURVES, "FilterPatches", Accelerator('P', (GdkModifierType) GDK_LOCK_MASK));
|
||||
add_filter_command(EXCLUDE_DETAILS, "FilterDetails", Accelerator('D', (GdkModifierType) GDK_LOCK_MASK));
|
||||
add_filter_command(EXCLUDE_HINTSSKIPS, "FilterHintsSkips", Accelerator('H', (GdkModifierType) GDK_LOCK_MASK));
|
||||
add_filter_command(EXCLUDE_CURVES, "FilterPatches", Accelerator('P', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
add_filter_command(EXCLUDE_DETAILS, "FilterDetails", Accelerator('D', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
add_filter_command(EXCLUDE_HINTSSKIPS, "FilterHintsSkips", Accelerator('H', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
add_filter_command(EXCLUDE_MODELS, "FilterModels", Accelerator('M', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
add_filter_command(EXCLUDE_TRIGGERS, "FilterTriggers",
|
||||
Accelerator('T', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('T', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
if (g_pGameDescription->mGameType != "doom3") {
|
||||
add_filter_command(EXCLUDE_BOTCLIP, "FilterBotClips", Accelerator('M', (GdkModifierType) GDK_MOD1_MASK));
|
||||
add_filter_command(EXCLUDE_DECALS, "FilterDecals", Accelerator('D', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
|
|
|
@ -3021,7 +3021,7 @@ void Texdef_ToggleExpansion()
|
|||
void MainFrame_Construct()
|
||||
{
|
||||
/*GlobalCommands_insert("Sleep", makeCallbackF(thunk_OnSleep),
|
||||
Accelerator('P', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));*/
|
||||
Accelerator('P', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));*/
|
||||
GlobalCommands_insert("NewMap", makeCallbackF(NewMap));
|
||||
GlobalCommands_insert("OpenMap", makeCallbackF(OpenMap), Accelerator('O', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("ImportMap", makeCallbackF(ImportMap));
|
||||
|
@ -3049,7 +3049,7 @@ void MainFrame_Construct()
|
|||
GlobalCommands_insert("SelectInside", makeCallbackF(Select_Inside));
|
||||
GlobalCommands_insert("SelectTouching", makeCallbackF(Select_Touching));
|
||||
GlobalCommands_insert("ExpandSelectionToEntities", makeCallbackF(Scene_ExpandSelectionToEntities),
|
||||
Accelerator('E', (GdkModifierType) (GDK_MOD1_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('E', (GdkModifierType) (GDK_MOD1_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("Preferences", makeCallbackF(PreferencesDialog_showDialog));
|
||||
|
||||
GlobalCommands_insert("ToggleEntityInspector", makeCallbackF(EntityInspector_ToggleShow), Accelerator('N'));
|
||||
|
@ -3120,14 +3120,14 @@ void MainFrame_Construct()
|
|||
|
||||
GlobalCommands_insert("CSGSubtract", makeCallbackF(CSG_Subtract),
|
||||
Accelerator('U', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("CSGMerge", makeCallbackF(CSG_Merge), Accelerator('U', (GdkModifierType) GDK_LOCK_MASK));
|
||||
GlobalCommands_insert("CSGMerge", makeCallbackF(CSG_Merge), Accelerator('U', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("CSGMakeHollow", makeCallbackF(CSG_MakeHollow));
|
||||
GlobalCommands_insert("CSGMakeRoom", makeCallbackF(CSG_MakeRoom));
|
||||
|
||||
Grid_registerCommands();
|
||||
|
||||
GlobalCommands_insert("SnapToGrid", makeCallbackF(Selection_SnapToGrid),
|
||||
Accelerator('G', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('G', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
|
||||
GlobalCommands_insert("SelectAllOfType", makeCallbackF(Select_AllOfType),
|
||||
Accelerator('A', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
|
@ -3137,13 +3137,13 @@ void MainFrame_Construct()
|
|||
GlobalCommands_insert("TexRotateCounter", makeCallbackF(Texdef_RotateAntiClockwise),
|
||||
Accelerator(GDK_KEY_Prior, (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("TexScaleUp", makeCallbackF(Texdef_ScaleUp),
|
||||
Accelerator(GDK_KEY_Up, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_Up, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("TexScaleDown", makeCallbackF(Texdef_ScaleDown),
|
||||
Accelerator(GDK_KEY_Down, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_Down, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("TexScaleLeft", makeCallbackF(Texdef_ScaleLeft),
|
||||
Accelerator(GDK_KEY_Left, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_Left, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("TexScaleRight", makeCallbackF(Texdef_ScaleRight),
|
||||
Accelerator(GDK_KEY_Right, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_Right, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("TexShiftUp", makeCallbackF(Texdef_ShiftUp),
|
||||
Accelerator(GDK_KEY_Up, (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("TexShiftDown", makeCallbackF(Texdef_ShiftDown),
|
||||
|
|
|
@ -2369,7 +2369,7 @@ void Map_Construct()
|
|||
GlobalCommands_insert("RegionSetXY", makeCallbackF(RegionXY));
|
||||
GlobalCommands_insert("RegionSetBrush", makeCallbackF(RegionBrush));
|
||||
GlobalCommands_insert("RegionSetSelection", makeCallbackF(RegionSelected),
|
||||
Accelerator('R', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('R', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
|
||||
GlobalPreferenceSystem().registerPreference("LastMap", make_property_string(g_strLastMap));
|
||||
GlobalPreferenceSystem().registerPreference("LoadLastMap", make_property_string(g_bLoadLastMap));
|
||||
|
|
|
@ -708,11 +708,11 @@ void PatchPreferences_construct()
|
|||
void Patch_registerCommands()
|
||||
{
|
||||
GlobalCommands_insert("InvertCurveTextureX", makeCallbackF(Patch_FlipTextureX),
|
||||
Accelerator('I', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('I', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("InvertCurveTextureY", makeCallbackF(Patch_FlipTextureY),
|
||||
Accelerator('I', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("NaturalizePatch", makeCallbackF(Patch_NaturalTexture),
|
||||
Accelerator('N', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('N', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("PatchCylinder", makeCallbackF(Patch_Cylinder));
|
||||
GlobalCommands_insert("PatchDenseCylinder", makeCallbackF(Patch_DenseCylinder));
|
||||
GlobalCommands_insert("PatchVeryDenseCylinder", makeCallbackF(Patch_VeryDenseCylinder));
|
||||
|
@ -729,36 +729,36 @@ void Patch_registerCommands()
|
|||
GlobalCommands_insert("SimplePatchMesh", makeCallbackF(Patch_Plane),
|
||||
Accelerator('P', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("PatchInsertInsertColumn", makeCallbackF(Patch_InsertInsertColumn),
|
||||
Accelerator(GDK_KEY_KP_Add, (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator(GDK_KEY_KP_Add, (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("PatchInsertAddColumn", makeCallbackF(Patch_InsertAddColumn));
|
||||
GlobalCommands_insert("PatchInsertInsertRow", makeCallbackF(Patch_InsertInsertRow),
|
||||
Accelerator(GDK_KEY_KP_Add, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_KP_Add, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("PatchInsertAddRow", makeCallbackF(Patch_InsertAddRow));
|
||||
GlobalCommands_insert("PatchDeleteFirstColumn", makeCallbackF(Patch_DeleteFirstColumn));
|
||||
GlobalCommands_insert("PatchDeleteLastColumn", makeCallbackF(Patch_DeleteLastColumn),
|
||||
Accelerator(GDK_KEY_KP_Subtract, (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator(GDK_KEY_KP_Subtract, (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("PatchDeleteFirstRow", makeCallbackF(Patch_DeleteFirstRow),
|
||||
Accelerator(GDK_KEY_KP_Subtract, (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator(GDK_KEY_KP_Subtract, (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("PatchDeleteLastRow", makeCallbackF(Patch_DeleteLastRow));
|
||||
GlobalCommands_insert("InvertCurve", makeCallbackF(Patch_Invert),
|
||||
Accelerator('I', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('I', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("RedisperseRows", makeCallbackF(Patch_RedisperseRows),
|
||||
Accelerator('E', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('E', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("RedisperseCols", makeCallbackF(Patch_RedisperseCols),
|
||||
Accelerator('E', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('E', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("SmoothRows", makeCallbackF(Patch_SmoothRows),
|
||||
Accelerator('W', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('W', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("SmoothCols", makeCallbackF(Patch_SmoothCols),
|
||||
Accelerator('W', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('W', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("MatrixTranspose", makeCallbackF(Patch_Transpose),
|
||||
Accelerator('M', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('M', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("CapCurrentCurve", makeCallbackF(Patch_Cap),
|
||||
Accelerator('C', (GdkModifierType) GDK_SHIFT_MASK));
|
||||
GlobalCommands_insert("CycleCapTexturePatch", makeCallbackF(Patch_CycleProjection),
|
||||
Accelerator('N', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('N', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("MakeOverlayPatch", makeCallbackF(Patch_OverlayOn), Accelerator('Y'));
|
||||
GlobalCommands_insert("ClearPatchOverlays", makeCallbackF(Patch_OverlayOff),
|
||||
Accelerator('L', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('L', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
}
|
||||
|
||||
void Patch_constructToolbar(ui::Toolbar toolbar)
|
||||
|
|
|
@ -362,9 +362,9 @@ void Pointfile_Construct()
|
|||
|
||||
GlobalCommands_insert("TogglePointfile", makeCallbackF(Pointfile_Toggle));
|
||||
GlobalCommands_insert("NextLeakSpot", makeCallbackF(Pointfile_Next),
|
||||
Accelerator('K', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('K', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalCommands_insert("PrevLeakSpot", makeCallbackF(Pointfile_Prev),
|
||||
Accelerator('L', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('L', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
}
|
||||
|
||||
void Pointfile_Destroy()
|
||||
|
|
|
@ -771,6 +771,17 @@ void Select_FitTexture(float horizontal, float vertical)
|
|||
SceneChangeNotify();
|
||||
}
|
||||
|
||||
|
||||
void Select_AlignTexture(int alignment)
|
||||
{
|
||||
if (GlobalSelectionSystem().Mode() != SelectionSystem::eComponent) {
|
||||
Scene_BrushAlignTexture_Selected(GlobalSceneGraph(), alignment);
|
||||
}
|
||||
Scene_BrushAlignTexture_Component_Selected(GlobalSceneGraph(), alignment);
|
||||
|
||||
SceneChangeNotify();
|
||||
}
|
||||
|
||||
inline void hide_node(scene::Node &node, bool hide)
|
||||
{
|
||||
hide
|
||||
|
|
|
@ -80,6 +80,8 @@ void Select_ShiftTexture(float x, float y);
|
|||
|
||||
void Select_FitTexture(float horizontal = 1, float vertical = 1);
|
||||
|
||||
void Select_AlignTexture(int alignment);
|
||||
|
||||
void FindReplaceTextures(const char *pFind, const char *pReplace, bool bSelected);
|
||||
|
||||
void HideSelected();
|
||||
|
|
|
@ -469,6 +469,43 @@ void SurfaceInspector_FitTexture()
|
|||
Select_FitTexture(getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical);
|
||||
}
|
||||
|
||||
void SurfaceInspector_AlignTopLeft()
|
||||
{
|
||||
Select_AlignTexture(0);
|
||||
}
|
||||
void SurfaceInspector_AlignTop()
|
||||
{
|
||||
Select_AlignTexture(1);
|
||||
}
|
||||
void SurfaceInspector_AlignTopRight()
|
||||
{
|
||||
Select_AlignTexture(2);
|
||||
}
|
||||
void SurfaceInspector_AlignLeft()
|
||||
{
|
||||
Select_AlignTexture(3);
|
||||
}
|
||||
void SurfaceInspector_AlignCenter()
|
||||
{
|
||||
Select_AlignTexture(4);
|
||||
}
|
||||
void SurfaceInspector_AlignRight()
|
||||
{
|
||||
Select_AlignTexture(5);
|
||||
}
|
||||
void SurfaceInspector_AlignBottomLeft()
|
||||
{
|
||||
Select_AlignTexture(6);
|
||||
}
|
||||
void SurfaceInspector_AlignBottom()
|
||||
{
|
||||
Select_AlignTexture(7);
|
||||
}
|
||||
void SurfaceInspector_AlignBottomRight()
|
||||
{
|
||||
Select_AlignTexture(8);
|
||||
}
|
||||
|
||||
static void OnBtnPatchdetails(ui::Widget widget, gpointer data)
|
||||
{
|
||||
Patch_CapTexture();
|
||||
|
@ -525,6 +562,57 @@ static void OnBtnFaceFit(ui::Widget widget, gpointer data)
|
|||
SurfaceInspector_FitTexture();
|
||||
}
|
||||
|
||||
|
||||
static void OnBtnTopLeft(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignTopLeft();
|
||||
}
|
||||
static void OnBtnTopCenter(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignTop();
|
||||
}
|
||||
static void OnBtnTopRight(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignTopRight();
|
||||
}
|
||||
|
||||
|
||||
static void OnBtnMiddleLeft(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignLeft();
|
||||
}
|
||||
static void OnBtnMiddleCenter(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignCenter();
|
||||
}
|
||||
static void OnBtnMiddleRight(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignRight();
|
||||
}
|
||||
|
||||
|
||||
static void OnBtnBottomLeft(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignBottomLeft();
|
||||
}
|
||||
static void OnBtnBottomCenter(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignBottom();
|
||||
}
|
||||
static void OnBtnBottomRight(ui::Widget widget, gpointer data)
|
||||
{
|
||||
getSurfaceInspector().exportData();
|
||||
SurfaceInspector_AlignBottomRight();
|
||||
}
|
||||
|
||||
typedef const char *FlagName;
|
||||
|
||||
const FlagName surfaceflagNamesDefault[32] = {
|
||||
|
@ -915,6 +1003,92 @@ ui::Window SurfaceInspector::BuildDialog()
|
|||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
auto frame = ui::Frame("Alignment");
|
||||
frame.show();
|
||||
vbox.pack_start(frame, FALSE, FALSE, 0);
|
||||
{
|
||||
auto table = ui::Table(3, 3, FALSE);
|
||||
table.show();
|
||||
frame.add(table);
|
||||
gtk_table_set_row_spacings(table, 5);
|
||||
gtk_table_set_col_spacings(table, 5);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(table), 5);
|
||||
{
|
||||
ui::Widget button = ui::Button("Top-Left");
|
||||
button.show();
|
||||
table.attach(button, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnTopLeft), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Top");
|
||||
button.show();
|
||||
table.attach(button, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnTopCenter), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Top-Right");
|
||||
button.show();
|
||||
table.attach(button, {2, 3, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnTopRight), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Left");
|
||||
button.show();
|
||||
table.attach(button, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnMiddleLeft), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Center");
|
||||
button.show();
|
||||
table.attach(button, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnMiddleCenter), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Right");
|
||||
button.show();
|
||||
table.attach(button, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnMiddleRight), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Bottom-Left");
|
||||
button.show();
|
||||
table.attach(button, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnBottomLeft), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Bottom");
|
||||
button.show();
|
||||
table.attach(button, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnBottomCenter), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
{
|
||||
ui::Widget button = ui::Button("Bottom-Right");
|
||||
button.show();
|
||||
table.attach(button, {2, 3, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
|
||||
button.connect("clicked",
|
||||
G_CALLBACK(OnBtnBottomRight), 0);
|
||||
button.dimensions(60, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string_empty(g_pGameDescription->getKeyValue("si_flags"))) {
|
||||
{
|
||||
auto frame = ui::Frame("Surface Flags");
|
||||
|
|
|
@ -1987,6 +1987,8 @@ gboolean TextureBrowser_tagMoveHelper(ui::TreeModel model, ui::TreePath path, Gt
|
|||
g_assert(selected != NULL);
|
||||
|
||||
auto rowref = gtk_tree_row_reference_new(model, path);
|
||||
|
||||
if (rowref != NULL)
|
||||
*selected = g_slist_append(*selected, rowref);
|
||||
|
||||
return FALSE;
|
||||
|
@ -2920,7 +2922,7 @@ void TextureBrowser_Construct()
|
|||
GlobalToggles_insert("ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused),
|
||||
ToggleItem::AddCallbackCaller(g_TextureBrowser.m_hideunused_item), Accelerator('U'));
|
||||
GlobalCommands_insert("ShowAllTextures", makeCallbackF(TextureBrowser_showAll),
|
||||
Accelerator('A', (GdkModifierType) GDK_LOCK_MASK));
|
||||
Accelerator('A', (GdkModifierType) GDK_CONTROL_MASK));
|
||||
GlobalCommands_insert("ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator('T'));
|
||||
GlobalToggles_insert("ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders),
|
||||
ToggleItem::AddCallbackCaller(g_TextureBrowser.m_showshaders_item));
|
||||
|
|
|
@ -164,7 +164,7 @@ ModifierFlags modifiers_for_state(unsigned int state)
|
|||
if (state & GDK_SHIFT_MASK) {
|
||||
modifiers |= c_modifierShift;
|
||||
}
|
||||
if (state & GDK_LOCK_MASK) {
|
||||
if (state & GDK_CONTROL_MASK) {
|
||||
modifiers |= c_modifierControl;
|
||||
}
|
||||
if (state & GDK_MOD1_MASK) {
|
||||
|
|
|
@ -476,7 +476,7 @@ inline unsigned int buttons_for_event_button(GdkEventButton *event)
|
|||
break;
|
||||
}
|
||||
|
||||
if ((event->state & GDK_LOCK_MASK) != 0) {
|
||||
if ((event->state & GDK_CONTROL_MASK) != 0) {
|
||||
flags |= RAD_CONTROL;
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ inline unsigned int buttons_for_state(guint state)
|
|||
flags |= RAD_RBUTTON;
|
||||
}
|
||||
|
||||
if ((state & GDK_LOCK_MASK) != 0) {
|
||||
if ((state & GDK_CONTROL_MASK) != 0) {
|
||||
flags |= RAD_CONTROL;
|
||||
}
|
||||
|
||||
|
@ -2932,13 +2932,13 @@ void XYWindow_Construct()
|
|||
|
||||
GlobalToggles_insert("ToggleView", ToggleShown::ToggleCaller(g_xy_top_shown),
|
||||
ToggleItem::AddCallbackCaller(g_xy_top_shown.m_item),
|
||||
Accelerator('V', (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator('V', (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
GlobalToggles_insert("ToggleSideView", ToggleShown::ToggleCaller(g_yz_side_shown),
|
||||
ToggleItem::AddCallbackCaller(g_yz_side_shown.m_item));
|
||||
GlobalToggles_insert("ToggleFrontView", ToggleShown::ToggleCaller(g_xz_front_shown),
|
||||
ToggleItem::AddCallbackCaller(g_xz_front_shown.m_item));
|
||||
GlobalCommands_insert("NextView", makeCallbackF(XY_Next), Accelerator(GDK_KEY_Tab,
|
||||
(GdkModifierType) GDK_LOCK_MASK)); // fixme: doesn't show its shortcut
|
||||
(GdkModifierType) GDK_CONTROL_MASK)); // fixme: doesn't show its shortcut
|
||||
GlobalCommands_insert("ZoomIn", makeCallbackF(XY_ZoomIn), Accelerator(GDK_KEY_Delete));
|
||||
GlobalCommands_insert("ZoomOut", makeCallbackF(XY_ZoomOut), Accelerator(GDK_KEY_Insert));
|
||||
GlobalCommands_insert("ViewTop", makeCallbackF(XY_Top), Accelerator(GDK_KEY_KP_Home));
|
||||
|
@ -2946,7 +2946,7 @@ void XYWindow_Construct()
|
|||
GlobalCommands_insert("ViewFront", makeCallbackF(XY_Front), Accelerator(GDK_KEY_KP_End));
|
||||
GlobalCommands_insert("Zoom100", makeCallbackF(XY_Zoom100));
|
||||
GlobalCommands_insert("CenterXYView", makeCallbackF(XY_Focus),
|
||||
Accelerator(GDK_KEY_Tab, (GdkModifierType) (GDK_SHIFT_MASK | GDK_LOCK_MASK)));
|
||||
Accelerator(GDK_KEY_Tab, (GdkModifierType) (GDK_SHIFT_MASK | GDK_CONTROL_MASK)));
|
||||
|
||||
GlobalPreferenceSystem().registerPreference("ClipCaulk", make_property_string(g_clip_useCaulk));
|
||||
|
||||
|
|
Loading…
Reference in a new issue