Provide shorter Promotion screen option without panel tearing#1211
Provide shorter Promotion screen option without panel tearing#1211kdm2k6 wants to merge 1 commit intolong-war-2:masterfrom kdm2k6:LWotC-Promotion-Screen-Tearing-Fix-VS2
Conversation
|
One issue with the shorter promotion screen is that SPARK pawns almost completely hide the Master Sergeant column at certain rotations. |
NOTE : Whenever I refer to a promotion screen, I am referring to the "New Promotion Screen by Default" promotion screen. ------------------------------ Problem : If you enter a soldier's promotion screen then quickly cycle through soldiers, using a controller or a mouse and keyboard, you will notice strange panel tearing on the right side of the screen. Explanation : It turns out that when you choose to view a soldier's promotions, you are actually viewing a 3D Flash movie which is embedded with : [1] a NPSBDP_UIArmory_PromotionHero promotion screen [2] a bunch of other stuff, including 3D models. Interestingly, it appears that the promotion screen is given a certain area of the movie with which to occupy; a viewport of sorts. Furthermore, the promotion screen appears incapable of moving outside of this bounding rectangle. Now, if a soldier has more than 7 ranks, NPSBDP_UIArmory_PromotionHero.OnInit calls the function ResizeScreenForBrigadierRank whose goal is to add space for an 8th rank column. Within this function : 1.] The promotion screen width is increased 2.] A variety of background panel's have their width increased to fit the new 8th column. 3.] The promotion screen is shifted to the right so that the 8th column is placed in the correct position. 4.] Many of the panels, which are now too far to the right due to step #3, are moved back to the left a bit. The main problem here is that the promotion screen width increase, combined with the UI element shifting, results in the main background panel being placed upon against the bounding rectangle given to the promotion screen by the 3D Flash movie. This, by itself, isn't a problem. However, when a distortion effect is added in, you end up with parts of the background panel moving outside of the promotion screen bounding rectangle and 'wrapping around' to the other side of the bounding rectangle. Solution : One way in which this problem can be solved is by removing the distortion effect from the promotion screen. This works; however, it is not the method I ended up going with. Here is what I did within NPSBDP_UIArmory_PromotionHero.ResizeScreenForBrigadierRank : 1.] I removed the promotion screen width increase since it really wasn't needed. The promotion screen was already well over 1700 pixels; furthermore, elongating a UIScreen seems to actually stretch the panels placed upon it. 2.] I increased the width of a variety of background UIPanel's, much like in the original promotion screen, to make way for the 8th rank column. 3.] I shifted the whole promotion screen away from the left side of its bounding rectangle; this could be done since, with a shorter promotion screen, it would no longer sneak behind the soldier pawn. 4.] I modified the location of the 8th rank column so it wouldn't sit on top of the 7th rank column. 5.] I made a few other minor UI location adjustments. Since the promotion screen's panels were no longer close to the bounding rectangle, the distortion effect could safely play without resulting in any panel tearing/wrapping. Final thoughts : Ultimately, I kept the original promotion screen, and made it the default, since many people will be used to its width and location. Within XComLW_UI.ini I created a config variable, USE_SHORTER_PROMOTION_SCREEN, which, when enabled, substitutes the 'original' promotion screen with the 'shortened' promotion screen. This way users can choose to use the longer promotion screen with panel tearing or the shorter promotion screen without panel tearing. ------------------------------ Problem : Since the shorter promotion screen was moved to the right, to prevent it from hitting the bounding rectangle given to it by the 3D flash movie, Sparks and any other large pawn'd characters would overlap the 8th rank column. Solution : The 'hero' promotion screen umap file, 3DUIBP_Armory_Promotion_Hero.umap, was modified in the following ways : 1.] The camera was rotated a bit, with respect to the Z-Axis, so that the soldier pawn appears farther to the right. 2.] The screen object, within the umap, was moved along the Y axis so that it appears farther to the left. ------------------------------ Problem : The scroll bar would change position when switching from 'fullscreen' mode to 'windowed' mode; in other words, it would look ok in one mode but not the other. Solution : It turns out that this problem only occurred when the scrollbar was being anchored to the screen; consequently, anchoring was removed and its X location was updated accordingly within NPSBDP_UIArmory_PromotionHero.InitPromotion. Now, the scrollbar remains on the right side of the promotion screen regardless of the screen mode. ------------------------------ Modifies : NPSBDP_UIArmory_PromotionHeroColumn The Flash rank label has now been replaced with 2 UITexts; this allows a label such as 'Master Sergeant' to appear on 2 lines. Additionally, to make room for this change, the rank icon and 'rank up' icon have been moved up. NOTE : The rank label UITexts are filled according to this algorithm : 1.] The rank label is split into a string array, using a space as the delimeter. 2.] The 1st word, if it exists, goes into the 1st UIText. 3.] The 2nd word, if it exists, goes into the 2nd UIText. If there are more than 2 words, the 2nd UIText is a concatenation of the 2nd word to the 'nth' word separated by spaces.
|
When you have time try it out :
The umap seems to be the only way to make camera and screen changes within a 3D Flash movie. There are a couple small issues :
|
pledbrook
left a comment
There was a problem hiding this comment.
This looks good. I'll add the content file to git when I merge.
|
Just tested with the normal promotion screen and the new NPSBD umap doesn't work well with it, as the left edge of the promotion panel is off screen. At this point, I'm questioning whether it's viable to have a flag for this. We probably need to commit either to the original or the shorter screen. |
|
@kdm2k6 There's an 'OverrideUIArmoryScale' highlander event that we could potentially use to shrink oversized pawns. Does that sound like a reasonable approach in place of the camera changes in the umap? |
|
That could possibly work for the shorter promotion screen since, according to my comments, it sounds like the main reason for the camera changes were to prevent the pawns from blocking the promotion screen. I'll take a look at some point; however, it might not be for a while as I'm working on other things and need to get myself back into a 'modding mood'. |
|
If you remember how these changes work, do you know if it's possible to shift the short promotion screen to the left while still fixing the tearing? I'm messing around with the X positions in |
|
Sadly, shrinking the pawns doesn't really fix the problem without a corresponding shift in the promotion screen. SPARKs are just too wide. To stop them from overlapping the MSGT column would require a scaling that makes them look like toys. |
|
If I remember correctly, within Individual elements are moved left or right via calls like : I believe that I moved the screen fairly close to the left edge while still preventing panel tearing; in other words, I'm not sure how much more the screen can be moved to the left without tearing beginning to appear. |
|
@kdm2k6 I've moved this to the Community Promotion Screen, which I'm planning to switch to soon in place of the integrated NPSBD. The shorter promotion screen isn't universally popular (mostly because of what it does to the column headers). Wondering if "One way in which this problem can be solved is by removing the distortion effect from the promotion screen" might be the better option? Although to be honest, I prefer the shorter version. |
|
No problem. Thanks for letting me know. |
|
(As mentioned previously, moved to Community Promotion Screen) |
NOTE : Whenever I refer to a promotion screen, I am referring to the "New Promotion Screen by Default" promotion screen.
Problem : If you enter a soldier's promotion screen then quickly cycle through soldiers, using a controller or a mouse and keyboard, you will notice strange panel tearing on the right side of the screen.
Explanation : It turns out that when you choose to view a soldier's promotions, you are actually viewing a 3D Flash movie which is embedded with : [1] a
NPSBDP_UIArmory_PromotionHeropromotion screen [2] a bunch of other stuff, including 3D models. Interestingly, it appears that the promotion screen is given a certain area of the movie with which to occupy; a viewport of sorts. Furthermore, the promotion screen appears incapable of moving outside of this bounding rectangle.Now, if a soldier has more than 7 ranks,
NPSBDP_UIArmory_PromotionHero.OnInitcalls the functionResizeScreenForBrigadierRankwhose goal is to add space for an 8th rank column. Within this function :The main problem here is that the promotion screen width increase, combined with the UI element shifting, results in the main background panel being placed upon against the bounding rectangle given to the promotion screen by the 3D Flash movie. This, by itself, isn't a problem. However, when a distortion effect is added in, you end up with parts of the background panel moving outside of the promotion screen bounding rectangle and 'wrapping around' to the other side of the bounding rectangle.
Solution : One way in which this problem can be solved is by removing the distortion effect from the promotion screen. This works; however, it is not the method I ended up going with.
Here is what I did within
NPSBDP_UIArmory_PromotionHero.ResizeScreenForBrigadierRank:UIScreenseems to actually stretch the panels placed upon it.UIPanel's, much like in the original promotion screen, to make way for the 8th rank column.Since the promotion screen's panels were no longer close to the bounding rectangle, the distortion effect could safely play without resulting in any panel tearing/wrapping.
Final thoughts :
Ultimately, I kept the original promotion screen, and made it the default, since many people will be used to its width and location.
Within
XComLW_UI.iniI created a config variable,USE_SHORTER_PROMOTION_SCREEN, which, when enabled, substitutes the 'original' promotion screen with the 'shortened' promotion screen. This way users can choose to use the longer promotion screen with panel tearing or the shorter promotion screen without panel tearing.Problem : Since the shorter promotion screen was moved to the right, to prevent it from hitting the bounding rectangle given to it by the 3D flash movie, Sparks and any other large pawn'd characters would overlap the 8th rank column.
Solution : The 'hero' promotion screen umap file,
3DUIBP_Armory_Promotion_Hero.umap, was modified in the following ways :Problem : The scroll bar would change position when switching from 'fullscreen' mode to 'windowed' mode; in other words, it would look ok in one mode but not the other.
Solution : It turns out that this problem only occurred when the scrollbar was being anchored to the screen; consequently, anchoring was removed and its X location was updated accordingly within
NPSBDP_UIArmory_PromotionHero.InitPromotion. Now, the scrollbar remains on the right side of the promotion screen regardless of the screen mode.Modifies :
NPSBDP_UIArmory_PromotionHeroColumn.ucThe Flash rank label has now been replaced with 2
UITexts; this allows a label such as 'Master Sergeant' to appear on 2 lines. Additionally, to make room for this change, the rank icon and 'rank up' icon have been moved up.NOTE : The rank label
UITexts are filled according to this algorithm :UIText.UIText.If there are more than 2 words, the 2nd
UITextis a concatenation of the 2nd word to the 'nth' word separated by spaces.