KSP-RO / ProceduralParts

A continuation of StretchySRBs, which is a continuation of StretchyTanks
71 stars 79 forks source link

[KSP1.1]Part Icons in Editor are being drawn at wrong ZDepth. #197

Closed jwvanderbeck closed 8 years ago

jwvanderbeck commented 8 years ago

In the editor parts bin, the Proc part icons are drawn at the wrong ZDepth somehow, causing them to appear above the UI elements.

screenshot 2016-04-25 18 56 16

OtherBarry commented 8 years ago

Well clearly it's just because they're better than all the other parts.

On Tue, Apr 26, 2016 at 11:57 AM, jwvanderbeck notifications@github.com wrote:

In the editor parts bin, the Proc part icons are drawn at the wrong ZDepth somehow, causing them to appear above the UI elements.

[image: screenshot 2016-04-25 18 56 16] https://cloud.githubusercontent.com/assets/161126/14804371/860b8958-0b17-11e6-8bd7-dfba4d291e81.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Swamp-Ig/ProceduralParts/issues/197

Polymaker commented 8 years ago

I would really like to fix this issue but I've no idea what and where to look for. As anyone has an idea?

OtherBarry commented 8 years ago

A while ago there was an issue with proc part images expanding over other elements. If you can find the commit with that fix it might point you in the right direction. My memory of its not that great, it's possible it was caused by conflicts with another mod, so if it's not easy to find it's probably not on this GitHub.

On Tuesday, 13 September 2016, James William Turner < notifications@github.com> wrote:

I would really like to fix this issue but I've no idea what and where to look for. As anyone has an idea?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Swamp-Ig/ProceduralParts/issues/197#issuecomment-246532866, or mute the thread https://github.com/notifications/unsubscribe-auth/AGol-ewvgr_2fX9_Li41cFxOB7cXaAQhks5qpeeZgaJpZM4IPhq_ .

Sent from my iPhone

NathanKell commented 8 years ago

EditorPartIcon creates the scale IIRC.

Polymaker commented 8 years ago

I did a quick search and nothing seems to reference EditorPartIcon in the source. Maybe there is code related to the icon in the '*.mu' file since it's an Unity prefab? Or is EditorPartIcon supposed to work by itself and somehow it has trouble with PP models? Guess I've gonna need to search deeper.

EDIT*** I opened the Unity package (used for creating 'cylinderTank.mu' I think) in the 'Source\CalcsAndModels' folder, and it looks like it has a script attached to it but it is missing from the package.

Polymaker commented 8 years ago

I've managed to fix the scale of the part inside the icon (eg. the structural part) but I have not found what cause the icon to be drawn over other UI elements. I was thinking that it had to do with unity layers but the EditorPartIcon class assign the layer "UIAdditional" to each icon prefab.

NathanKell commented 8 years ago

It is likely that all icons are drawn on top, just the rest are small enough it doesn't matter?

Polymaker commented 8 years ago

They're not only drawn over the other icons (correct scaling would fix that), they also appear over the cost/symmetry panel. I don't really know how Unity GUI works so I'm not sure if it's only an ordering problem or it has to do with shaders.

Polymaker commented 8 years ago

YESS! Problem solved! The icon mesh material must have the "KSP/ScreenSpaceMask" shader, but in the UpdateTexture method it was assigned to either "KSP/Bumped Specular" or "KSP/Specular". I'll make merge that fix in a moment. EDIT*** I did just notice that the texture seems a little too bright now...

NathanKell commented 8 years ago

Ooh, awesome find! :)