MoI discussion forum
MoI discussion forum

Full Version: View Manager Script

Show messages:  1  2-21  22-41  42-45

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
From: Michael Gibson
23 Mar 2022   [#25] In reply to [#19]
Hi Teddy, for renaming there is an "Edit name" dialog that you can use if it would be more convenient.

That goes like this:

code:
    var dlg = moi.ui.createDialog( 'EditNameDialog.htm', 'resizeable,defaultWidth:26em,fixedHeight' );

    /* If you want to initialize the starting name text do this: */
    dlg.htmlWindow.nameval = 'initname';

    var result = dlg.window.doModal();
    if ( result !== -1 ) /* return value of -1 means canceled */
    {
          /* new name in result */
    }


- Michael
From: Michael Gibson
23 Mar 2022   [#26] In reply to [#24]
Hi Jörg,

re:
> Please take a look to my edit in my last post.

So it sounds like the main function of the proper view being restored is ok now. For now if you have problems renaming the views inside the command you should be able to do it by editing the .json file in a text editor.

- Michael
From: Teddy Lindsey (TEDDYLINDSEY)
24 Mar 2022   [#27]
Thanks for the feedback everyone!

Michael: thanks for the tip on using the EditNameDialog! I didn't realize that was possible. I'm sure you're really busy but I would love to see a scripting guide that goes over the various capabilities of the underlying API and object model. It would be super helpful! Also, how would I go about changing the "Cancel" button to an "OK" or "Close" button?

I've attached a new version (v0.2.2) that incorporates the following changes based on the feedback and bugs reported:
- Delete and Rename buttons are only enabled when a view is selected (thanks Marco).
- Renaming now uses a dialog prompt which is much better.

Attachments:
View Manager 0.2.2.zip


From: Michael Gibson
24 Mar 2022   [#28] In reply to [#27]
Hi Teddy, thanks for your updates!

re:
> I'm sure you're really busy but I would love to see a scripting guide that goes over the various
> capabilities of the underlying API and object model. It would be super helpful!

Unfortunately that's a very time consuming area of work, both in generating the documentation itself as well as the time intensive nature of supporting developers.

It's just not an area that I am able to focus on as of yet, not until more stuff is finished up in base MoI itself.


> Also, how would I go about changing the "Cancel" button to an "OK" or "Close" button?

Do you mean on the edit name dialog? It should be showing an OK button on it already.

- Michael
From: Teddy Lindsey (TEDDYLINDSEY)
24 Mar 2022   [#29] In reply to [#28]
Michael: I completely understand having too much on your plate to keep the docs up to date. Hopefully someone in the community could pick that up again at some point.

For the Cancel button, I want to change the one that appears in the sidebar panel. I'm using a commandDialog for my script. Maybe I should be using a different type of component?

Image Attachments:
view_manager_cancel_button.jpg 


From: Michael Gibson
24 Mar 2022   [#30] In reply to [#29]
Hi Teddy,

re:
> For the Cancel button, I want to change the one that appears in the sidebar panel.

For that at the bottom of your ViewManager.htm file, replace this:

code:
<moi:CommandCancel />


with this:

code:
<moi:CommandDoneCancel />


There is no MoI command that puts "OK" or "Close" in that command ui area so if you want it to have one of those you would need to do it manually instead of using a control template.

You can see what <moi:CommandDoneCancel> and other controls expand to by finding the file CommandDoneCancel.htm in the ui folder. When the parser finds a control name with the moi: prefix, it looks if there is an .htm file with that name and if there is it takes the contents of that and inserts it.

- Michael
From: Teddy Lindsey (TEDDYLINDSEY)
24 Mar 2022   [#31] In reply to [#30]
Michael: Thanks for the tip about how the UI components work. I was able to put a Done button inline and it looks better now.

I've attached an update (v.0.2.3) with the following changes:
- Now displaying a "Done" button to close the panel instead of "Cancel".
- View Manager now checks if the 3DM file has been saved before activating so that it knows where to save the "filename.views.json" file which is saved alongside the 3DM file and contains the view settings.

Attachments:
View Manager 0.2.3.zip


From: pixelhouse
24 Mar 2022   [#32]
Hi TEDDY,

now it works like a charme!
Many thanks for your support :)
I love this script and it helps a lot to work together wit Illustrator to create outputs out of the same view.

Best regards
Jörg
From: pressure (PEER)
11 Aug 2022   [#33]
Attached is a version of ViewManager that loads the first saved view (if a saved view exists) as soon as the script is run. It's good for going back to a single view again and again. It will be annoying if that's not part of your workflow.

April 4, 2023: a script with this feature is now at http://moi3d.com/forum/index.php?webtag=MOI&msg=11036.1

- Peer
From: Don (DON_CHEKE)
21 Sep 2022   [#34]
I am running MoI v3 and trying to get the view manager script running but I am having errors and issues.

I have placed the script here: C:\Program Files (x86)\MoI 3.0\commands



I get a error when I try and run the script after using the shortcut keys.



This is my shortcut.



Can someone tel me what I am doing wrong?

Also. which is the latest? View Manager 0.2.1 or View Manager 0.2.3. It was kind of hard to tell from the order in this thread. Sorry?

Image Attachments:
Screen-0003.jpg  Screen-0004.jpg  Screen-0005.jpg 


From: Teddy Lindsey (TEDDYLINDSEY)
21 Sep 2022   [#35] In reply to [#34]
The latest official version is v0.2.3.

The files appear to be installed in the wrong location:

Installation
Extract the attached ViewManager_v0.1.zip archive and move the ViewManager.htm and ViewManager.js files into your MOI Commands folder.
On Windows the folder is located C:\Documents and Settings\[your user name]\Application Data\Moi\commands
From: Don (DON_CHEKE)
21 Sep 2022   [#36] In reply to [#35]
I don't see a windows path like you show. I don't see a C:/Documents and Settings.

The only path I see that is similar is C:\Users\Don Cheke\AppData\Roaming\Moi\commands and when placed here it does not find it.



Are you sure you are showing the right windows path?

Image Attachments:
Screen-0010.jpg 


From: Teddy Lindsey (TEDDYLINDSEY)
21 Sep 2022   [#37] In reply to [#36]
I wonder if the location where MOI 3.0 stores files like these is different than later versions? I created this using v4.0.
From: Michael Gibson
21 Sep 2022   [#38] In reply to [#34]
Hi Don, with the update to save/restore the "up" direction in addition to the camera and target point, this script now requires functionality that was added in for MoI v4 and won't work with MoI v3 anymore.

You can probably get it to work with v3 by changing the line in ViewManager.htm where the error is happening to this instead (removing the 3rd parameter):

code:
    vp.setCameraAndTarget(cameraPoint, targetPoint);


That will then work with v3 but will reintroduce the problem that if the view has any "tilt" rotation to it that will be lost.

- Michael
From: Michael Gibson
21 Sep 2022   [#39] In reply to [#37]
Hi Teddy,

re:
> I wonder if the location where MOI 3.0 stores files like these is different than later versions? I created this using v4.0.

Yes version 3 didn't support having commands in appdata, that was new for MoI v4.

- Michael
From: Don (DON_CHEKE)
21 Sep 2022   [#40] In reply to [#38]
Thanks Michael. I couldn't remember when changes occurred, but that makes sense. I did use v4 while in beta, but I hadn't upgraded due to the fact I haven't been using the program much. Just today, however, I came across a new reason to use MoI but I am not sure I really need the view manager for what I am doing, I just thought I might.

I will give MoI a tip of the hat in my next Design Talk when it comes out as it has made my day with it's .eps import function from a 2D vector drawing program called Affinity Designer that doesn't have dxf or dwg export functions, which I would have typically used when I used Adobe Illustrator.

You know, every time I use MoI I am simply amazed at its capabilities and it ease of use. Keep up the great work! I should really just go ahead and update, even if it is only to show my support.

EDIT: I upgraded to v4. View Manager now works as expected. Thanks.
From: Michael Gibson
21 Sep 2022   [#41] In reply to [#40]
Hi Don, thanks very much for the upgrade and the kind words! :)

- Michael

Show messages:  1  2-21  22-41  42-45