-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UV rotation UI improvement #79
Conversation
PullRequest のほうありがとうございます。
また
についても解決されなければ、ユーザインタフェース上、ユーザに混乱を与えるので修正していただければと思います。 |
MToon/Editor/MToonInspector.cs
Outdated
@@ -317,7 +320,11 @@ private void Draw(MaterialEditor materialEditor, Material[] materials) | |||
materialEditor.TexturePropertySingleLine(new GUIContent("Mask", "Auto Animation Mask Texture (R)"), _uvAnimMaskTexture); | |||
materialEditor.ShaderProperty(_uvAnimScrollX, "Scroll X (per second)"); | |||
materialEditor.ShaderProperty(_uvAnimScrollY, "Scroll Y (per second)"); | |||
materialEditor.ShaderProperty(_uvAnimRotation, "Rotation (per second)"); | |||
uvRotationUnit = (MToon.RotationUnit)EditorGUILayout.EnumPopup("Rotation Unit", uvRotationUnit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int
から enum
のキャストも dynamic なキャストになるのは危険なので、下の方に定義してある PopUpEnum<T>
を使用していただければと思います。
debug用(シェーダに渡される値の確認用)に残していましたが、削除しました。
行いました。
解決しました。
MaterialPropertyではないので使用できませんでした。そのため、switch文で実装しました。 また、先のプルリクエストより動作の変更があり、角度単位の変更をインスペクタ共通で変更されるようにしました。単位系が混在するとややこしいので、一回変更すれば他も変更された方が便利かなと考えた次第です。 |
修正のほう、ありがとうございます!マージさせていただきます。
良いとおもいます! |
MToon/Editor/MToonInspector.cs
Outdated
} | ||
case MToon.RotationUnit.Radians: | ||
{ | ||
return val / 2.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
すみません、最後にひとつだけ……こちらは 2.0f
ではなくて 2.0f * Math.PI
ではないでしょうか?
お手数をおかけしまして申し訳ありません。ご指摘の通りです。修正いたしました。 私自身書いたコードには良くも悪くも無頓着であるので、関数、変数、ロジック、コードフォーマット等々ご自由に変更していただいて構いません。 |
修正のほうありがとうございます。 |
about #13 (comment)
UI側で値をEnum単位に応じて変換してからシェーダに渡すようにしてみました。
既知の問題:単位を変換しても、UIの値がそれに追従しない。(360度/secー(回転に変更)->360回転/sec、になる。