Skip to content
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

[guide] Changing the ink menu item's index if you need it. #18

Closed
clembu opened this issue Jul 7, 2016 · 1 comment
Closed

[guide] Changing the ink menu item's index if you need it. #18

clembu opened this issue Jul 7, 2016 · 1 comment

Comments

@clembu
Copy link

clembu commented Jul 7, 2016

I recently added a few script templates to my Unity installation, because I'm using a lot of custom editors and scriptable objects, and this happened:
ink-order-templates

As you see, there is no longer a separator before the ink item. This is because my templates use the order space between 90 and 100: the same thing would happen if you created an asset menu item with an order of 95 for example. Though in that case, unless your assets are heavily related to scripts, I'd suggest you change your own order to above 120, because it's way easier.

It's not a problem in itself, so you could ignore it. But if it bothers you, like me, because you heavily rely on the separators to survey a menu, here's what you must change:

  1. Go to Assets/Plugins/Ink/Editor/Tools.
  2. Open the file InkEditorUtils.
  3. Go to line 46. You're looking for this chunk of code:
[MenuItem("Assets/Create/Ink", false, 100)]
        public static void CreateNewInkFile () {
            string fileName = "New Ink.ink";
            string filePath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(GetSelectedPathOrFallback(), fileName));
            CreateNewInkFile(filePath);
        }
  1. Change the 100 value to whatever you need.

small explanation of how menu order indices work
Note that the order of the scene item is 191 and the last shader item has an order of 90 (pseudo-ignored for the separator because its parent menu has the order of the first shader, which is 83).
If you want a separator, you need a gap of at least 11 order indices between two items. So, by default, you have enough space between the scripts "section" and the scene "section" to fit 9 individual separated items, of orders 94, 105, 116, 127, 138, 149, 160, 171, and 182. Remember that if you have nested items, only the smallest order of the whole architecture counts. (on my screenshot, Adventure contains a bunch of items, the smallest being Adventure/Interactions/Generic at 110 (which is why it's not separated from the ink item), and the biggest Adventure/Inventory/Item at 125, though to have a separator to the next item, that item would only need to be of order 121 at least, because Adventure is registered at 110.)

@tomkail
Copy link
Collaborator

tomkail commented Jul 7, 2016

Wowee, you should write the documentation! We'll change it to 120, good
call!

On Thursday, 7 July 2016, Clément Busschaert notifications@github.com
wrote:

I recently added a few script templates to my Unity installation, because
I'm using a lot of custom editors and scriptable objects, and this happened:
[image: ink-order-templates]
https://cloud.githubusercontent.com/assets/13928490/16650316/d8b68b58-443d-11e6-8b7c-d70272f062aa.PNG

As you see, there is no longer a separator before the ink item. This is
because my templates use the order space between 90 and 100: the same thing
would happen if you created an asset menu item with an order of 95 for
example. Though in that case, unless your assets are heavily related to
scripts, I'd suggest you change your own order to above 120, because it's
way easier.

It's not a problem in itself, so you could ignore it. But if it bothers
you, like me, because you heavily rely on the separators to survey a menu,
here's what you must change:

  1. Go to Assets/Plugins/Ink/Editor/Tools.
  2. Open the file InkEditorUtils.
  3. Go to line 46. You're looking for this chunk of code:

[MenuItem("Assets/Create/Ink", false, 100)]
public static void CreateNewInkFile () {
string fileName = "New Ink.ink";
string filePath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(GetSelectedPathOrFallback(), fileName));
CreateNewInkFile(filePath);
}

  1. Change the 100 value to whatever you need.

small explanation of how menu order indices work
Note that the order of the scene item is 191 and the last shader item has
an order of 90 (pseudo-ignored for the separator because its parent menu
has the order of the first shader, which is 83).
If you want a separator, you need a gap of at least 11 order indices
between two items. So, by default, you have enough space between the
scripts "section" and the scene "section" to fit 9 individual separated
items, of orders 94, 105, 116, 127, 138, 149, 160, 171, and 182. Remember
that if you have nested items, only the smallest order of the whole
architecture counts. (on my screenshot, Adventure contains a bunch of
items, the smallest being Adventure/Interactions/Generic at 110 (which is
why it's not separated from the ink item), and the biggest
Adventure/Inventory/Item at 125, though to have a separator to the next
item, that item would only need to be of order 121 at least, because
Adventure is registered at 110.)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#18, or mute the
thread
https://github.com/notifications/unsubscribe/ABMd0A04EbXrEvX9sNso-a0r9MFkbTpZks5qTN8pgaJpZM4JG-dZ
.

@tomkail tomkail closed this as completed Aug 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants