MoI discussion forum
MoI discussion forum

Full Version: View Manager Script

Show messages:  1-4  5-24  25-44  45

From: Larry Fahnoe (FAHNOE)
9 Nov 2020   [#5]
Hi Teddy,

Very handy script, thanks! This certainly beats my keeping notes on the settings in Options > View > 3D view angles.

--Larry
From: bemfarmer
10 Nov 2020   [#6] In reply to [#2]
So my problem with 3D view manipulation was the Option View Rotate/Pan/Zoom was set to World Z Axis.
I prefer Free Rotation, most of the time.
- Brian

I think a script for some 3D View camera position presets might be useful.
Did some searches back as far as 2016, re camera and target.
See Michael's script "SetNearestOrthoView".
From: TOM (SIRTOM)
19 Nov 2020   [#7]
Fantastic ! Thank you !
From: Teddy Lindsey (TEDDYLINDSEY)
21 Nov 2020   [#8]
I'm glad that folks are finding it useful! Please let me know if you run into any bugs or have improvements to suggest.

- Teddy
From: pixelhouse
22 Mar 2022   [#9]
hmm, it seems that the position of the saved view is inverted and I see my model from the bottom side.
I have tested out different angles and positions in Moi V4 but every saved position are totaly wrong.

I hit "v" (my shortcut for this script) to save the position of the view, its open the window to manage the saved positions. This works fine!
To hide the window I click "Cancel" so I can select and hide objects and hit v again to save the next view.
When I will go back to an defined position I hit v to open the window, I select my saved view and the camera is changing to the new position. But the position isn`t correct.



Best regards
Jörg

edit:

Here screensots of the position that I saved and the saved position from the View Manager.

Image Attachments:
screenshot viewmanager01.JPG  screenshot viewmanager02.JPG 


From: Michael Gibson
22 Mar 2022   [#10] In reply to [#9]
Hi Jörg, I tested over here and it was working fine for me.

I think the issue is that you're probably using Options > View > Rotate/Pan/Zoom options > Rotation style = "Free rotation" instead of "Rotate around world z axis" mode.

Currently this ViewManager script only saves and restores a camera and a target point, it does not save or restore the "up" direction that defines the view's rotation around that line.

This isn't an issue when using Rotation style = "Rotate around world z axis" view rotation mode because that mode always keeps the "up" direction along the world z axis. But when using Rotation style = "Free rotation" you can have some other "up direction" which will be lost.

I think it should only take a minor adjustment to the script to make it additionally save and restore the "up" direction, I'll give that a try.

- Michael
From: Michael Gibson
22 Mar 2022   [#11] In reply to [#9]
Hi Jörg, please give this updated version a try, it should save and restore the "up" direction too now.

- Michael

EDIT: Updated to work with locales that have comma as decimal point separator, new version a few messages down.
From: pixelhouse
22 Mar 2022   [#12] In reply to [#11]
Hi Michael,

I use the correct settings (world) for the rotation. I'm using another laguage, but this sould be not the problem.
I have made a screenshot of the Rotate/Pan/Zoom settings.

With the new script the model is rotating vertically.

I have nbo idea what the problem is.


Thanks for your support, guys!
Jörg




Image Attachments:
screenshot settings.JPG 


From: coi (MARCO)
23 Mar 2022   [#13] In reply to [#12]
nah..doesn't work here either.
From: Michael Gibson
23 Mar 2022   [#14] In reply to [#12]
Hi Jörg, what version do you have under Help > About MoI ?

- Michael
From: Michael Gibson
23 Mar 2022   [#15] In reply to [#12]
Hi Jörg, can you also please post an example .3dm file and the .views.json file that ViewManager saved?

Maybe it's an issue with the ViewManager script only saving out 2 decimal places when it writes out coordinate information to the .view.json file.

Or it could be a localization problem when commas are used for the decimal places. If I can see the output that it generated on your system maybe that will help me to figure out the problem.

- Michael
From: Teddy Lindsey (TEDDYLINDSEY)
23 Mar 2022   [#16] In reply to [#15]
Michael: thanks for jumping in and fixing the issue with the View Manager Script not handling the "up direction"!

It sounds like it might be helpful to separate out the X, Y and Z values for the camera, target and up Idirection into separate fields in the JSON to avoid localization issues with how commas are handled. I'd be happy to refactor script to handle this as well as a bug I've found that can cause duplication of views when renaming them.

Since it's been a while since I wrote this, I wanted to consult some documentation on scripting for Moi, but it looks like the sites I've used in the past are no longer around, e.g., http://moi.maxsm.net/api/

Can you point me to another site where I might be able to reacquaint myself with the API?
From: Michael Gibson
23 Mar 2022   [#17] In reply to [#16]
Hi Teddy, I think the Internet Archive snapshot of Max's API page might work:
https://web.archive.org/web/20200218200812/http://moi.maxsm.net:80/api/

re: Localization issue - I'm not really sure yet if that's why it's not working for some people. Maybe that can be confirmed or ruled out by checking out an example saved view file.

- Michael
From: Michael Gibson
23 Mar 2022   [#18] In reply to [#16]
Ok, I think it is a comma as decimal separator locale problem. The problem is the MoI point's toString() method uses a locale dependent method for making UI presentable text and the View Manager script is using that.

Here's a quick fix putting in a ptToString() function using built in toFixed() Javascript number to string conversion which shouldn't be locale dependent.

- Michael

EDIT: removed this version, there is a newer one right below.
From: Teddy Lindsey (TEDDYLINDSEY)
23 Mar 2022   [#19]
I've attached an update (View Manager v.0.2.1) that incorporates the latest fixes from Michael for the locale-specific comma problem in addition to the following improvements:
- Fixed a bug where renaming a view might cause duplicate views.
- Improved logic for creating new View names to avoid duplicating an existing View name.

- Teddy

Attachments:
View Manager 0.2.1.zip


From: Michael Gibson
23 Mar 2022   [#20] In reply to [#19]
Thanks Teddy!

- Michael
From: pixelhouse
23 Mar 2022   [#21]
Hi Michael,

I use the V4 Dec. 22 2020
I have saved a small scene in which there are 3 saved views.
I have tested the saved views and the problem still exist.

Thanks for your help!


Jörg

Hi TEDDY,

the new version seems to be good! I will test it out more and in the next hours.

Thanks a lot!

---Edit---

hmm, I still have problems. I have create 3 different views, have try to rename one of this, by clicking "save" all views are lost.
I don't understand, why we have only a "cancel" button and no "OK" button to save the views they are in the list. After Cancel the created views are lost, without click cancel, I can't select objects in the scene.

the positions of the saved views are now correct :)

Hope I can describe it clear to you :)

Attachments:
View Manager.zip


From: coi (MARCO)
23 Mar 2022   [#22]
yyaha..that is working now. tnx.
one tiny thing: if i delete a view, the drop down displays 'select a view'. but if i keep on pressing the delete button - without choosing a view - it silently keeps on deleting views starting with the oldest entry. maybe it would be possible to disable(and greying out) the delete button, if there is no actual view selected.
From: Michael Gibson
23 Mar 2022   [#23] In reply to [#21]
Hi Jörg, it looks like that .views.json file was created by the old script. You'll need to delete it and make a new one with the latest script and then that should be working.

- Michael
From: pixelhouse
23 Mar 2022   [#24] In reply to [#23]
Hi Michael,

yes, the file was created with the old script. Please take a look to my edit in my last post.

Greetings
Jörg

Show messages:  1-4  5-24  25-44  45