MoI discussion forum
MoI discussion forum

Full Version: named view new script

Show messages: All  1-20

From: pressure (PEER)
2 Apr 2023   [#1]
Here's a new script for making and restoring named views. It's based on Teddy Lindsey's excellent ViewManager, but with a few differences:




It only works with v5 beta (version Mar-28-2023) or newer. Installation is a little different because this is an “instant script” rather than a “command”. That means it should go in a “scripts” folder. A “scripts” folder doesn't exist by default, so you might need to make it inside of the Moi appdata folder.

On Windows you can find the Moi appdata folder by typing Win+R to bring up the Windows "Run" dialog and then type in:
%AppData%\Moi\

On Mac from a Finder window, go to the menu and pick Go > "Go to folder" and type in:
~/Library/Application Support/Moi/

You should see “moi.ini” and a folder “commands”. Create a new folder scripts if it doesn't already exist directly inside the folder “Moi”. Then move NamedView.htm and NamedView.js into the “scripts” folder. Finally, set up a shortcut key by going to Options > Shortcut Keys and type in NamedView as the command name.

EDIT 2023-12-20 new version uploaded with bug fixes

- Peer

Attachments:
NamedView.zip

Image Attachments:
NamedView.png 


From: Metin (METIN_SEVEN)
20 Dec 2023   [#2] In reply to [#1]
This is great, Peer, thanks a lot for this, just what I needed.

And thanks to Teddy for the initial version as well.
From: pressure (PEER)
20 Dec 2023   [#3] In reply to [#2]
Glad you're using it Metin.

The version you downloaded had some bugs. I've updated the download link above with a new version.

- Peer
From: Metin (METIN_SEVEN)
21 Dec 2023   [#4] In reply to [#3]
Thanks Peer!

A little request, if possible…

Right now, after having saved a view, it requires four actions / clicks to restore the view:

1. activate the script,
2. click on the dropdown menu,
3. click again to select a view from the dropdown menu,
4. press Done or right-click.

I usually use just one view for an illustration, and navigate the 3D view a lot, then restore the stored view again. It would be more convenient if the last saved view is activated by default in the drop-down menu, so you'd just need to activate the script, then press Done (or right-click) to restore the last-saved view.

If possible, it would be even more convenient to have a separate command / script to directly restore the last-saved view with one keystroke or button, so you'd only need to activate the other script if you want to change or add a stored view.

Many thanks in advance for considering this, if it's possible.
From: Frenchy Pilou (PILOU)
21 Dec 2023   [#5]
?
When you save a 3Dm file then exit

When you re open this file it returns as it was at the save! ;)

(position, size etc...
From: Frenchy Pilou (PILOU)
21 Dec 2023   [#6] In reply to [#1]
I put it inside the folder commands because it's don't appear on the general list of scripts...
All is working fine!

Except this opt.text = 'Select a view' can't be translated!...


From: pressure (PEER)
21 Dec 2023   [#7] In reply to [#4]
Hi Metin,

Re:
> It would be more convenient if the last saved view is activated by
> default in the drop-down menu, so you'd just need to activate the
> script, then press Done (or right-click) to restore the last-saved view.

I think you can get that behavior now if there's only 1 view saved. Check the box "autoload". The next time you run the script the 1 saved view will get restored immediately.

Does that do what you want?

- Peer
From: pressure (PEER)
21 Dec 2023   [#8] In reply to [#6]
Thanks for translating it Pilou!

What's the problem that you're having with translating opt.text = 'Select a view' ?

- Peer
From: Frenchy Pilou (PILOU)
21 Dec 2023   [#9] In reply to [#8]
it is not taken into account!
Maybe inside a dictionary... maybe somewhere in a folder...or maybe impossible with this actual structure...
I will ask to Michael! :)
From: pressure (PEER)
21 Dec 2023   [#10] In reply to [#9]
Pilou,

I think if you replace
code:
opt.text = 'Select a view';

with
code:
opt.text = 'your translation text';

That should show up in the dropdown.

- Peer
From: Metin (METIN_SEVEN)
21 Dec 2023   [#11] In reply to [#7]
Hi Peer,

What I'd like is restoring a saved view as easy as possible, preferably with one hotkey, as I need to return to the view about 100 times during a single MoI session. I constantly rotate, pan and zoom the 3D view to make adjustments, and it would be great if I could easily return to your script's last-saved view after each adjustment.

Thanks!
From: Frenchy Pilou (PILOU)
21 Dec 2023   [#12] In reply to [#10]
I am affraid not! :)
From: Frenchy Pilou (PILOU)
21 Dec 2023   [#13]
Semi resolve! :)

I had both in Scripts and commands

Now works fine in Scripts! OK!

but when i move them in Commands i have a message! ;(
NamedView is missing or was renamed

and then



sure they are not in the Scripts folder but at the first time this morning that was working fine! :)

Fact to translate is maybe the glitch ...
I will try with the English version! :)

No it's the same don't works in the folder commands and nothing in the folder Script!

That works only alone in the folder scripts! :)

EDIT that works when both in Folder Commands & Scripts!
Maybe the accents ...


Bingo!
Yes definitly verified : alone in commands don't works, alone in scripts works but not list, in both works + list! :)
From: pressure (PEER)
22 Dec 2023   [#14] In reply to [#13]
Hi Pilou,

Re:
> alone in commands don't works

This plugin should go in scripts only. It won't work as well if it's in commands. Specifically, if it (or a duplicate of it) is in commands and it is run in the middle of another command it will cancel that other command.

Re:
> alone in scripts works but not list

That's because the thing that's generating the list is only looking in commands and and not in scripts. What's the add-on that's generating the list? The one from Max Smirnov?

- Peer
From: pressure (PEER)
22 Dec 2023   [#15] In reply to [#11]
Hi Metin,

Re:
> What I'd like is restoring a saved view as
> easy as possible, preferably with one
> hotkey, as I need to return to the view
> about 100 times during a single MoI
> session.

Yup that's exactly what I use this script for. Initially I aimed for the kind of quick recall you're talking about, but couldn't quite figure out a good UI for that. Like if the last saved view is the one that's loaded then there's the problem that maybe it's not the last saved one that I want and there's no way to reorder the views.

Do you actually need the ability to save multiple views? I don't: I use one .3dm for each illustration and so only ever have one view.

- Peer
From: Frenchy Pilou (PILOU)
22 Dec 2023   [#16] In reply to [#14]
Yes the scripts list by Max!
But magically with your 2 files inside the folders that is working! :)
And you win a shortcut! ;)
From: Metin (METIN_SEVEN)
22 Dec 2023   [#17] In reply to [#15]
Hi Peer,

Ah, now I get the Autoload function, sorry. I thought that meant that the last view would be automatically set after loading a 3DM scene, but it means that the last saved view is automatically activated.

That's great, thanks again!
From: pressure (PEER)
22 Dec 2023   [#18] In reply to [#17]
Hi Metin,

Re:
> but it means that the last saved view is automatically activated.

Not really. Autoload only works if there's exactly 1 saved view. If there are 2 or more saved views then it won't do anything.

- Peer
From: Metin (METIN_SEVEN)
22 Dec 2023   [#19] In reply to [#18]
That's fine, I usually need only one view. Thanks again!
From: BurrMan
22 Dec 2023   [#20] In reply to [#13]
“”””” Bingo!
Yes definitly verified ”””””

There was a setting in the custom ui that was a limit on how many items it would show. Years ago i had to change this to get wverything to show all the time.

I dont remember where, but if you are being “truncated” then look for this.

Show messages: All  1-20