šŸŽ² ViewDice Overlay (ViewCube)

I was originally going to call it ViewCube, but many other programs already call it that. So, Iā€™m taking a chance. ā€œLet a die be cast.ā€ So thatā€™s how I have a reason to ā€œplayā€. :slight_smile:

One of the things that inspired me was AutoCAD and other programs that use it. I made a basic version when Overlay came out, but it never worked properly, so it just sat in a drawer. The second thing was when Eneroth released North Arrow and Axes Overlay, I took mine out from a mist, and gave it a little play.

That is - you can see the beta version - here.

:game_die: ViewDice Ā©Dezmo

ViewDice is primarily designed for the Overlays feature released in SU2023.

But I try to push its boundaries by allowing it to be used interactively alongside other Tools.
The idea is to automatically switch to tool mode when you hover your mouse on the characteristic point of the cube or the icons, so you can use your mouse/keyboard events to control the views, then ā€œthe controlā€ will be returned to the tool currently in use.

However for some cases - see below - you need to use an assigned keyboard shortcut - instead of mouse click - to utilize the corresponding command. You might need to get used to pressing a button instead of a click, but thatā€™s exactly the trick!
The assigned keyboard shortcut can always be used instead of a mouse click.

(This is changed in RC1, compared to Beta1- so you can not switch to Tool mode manually anymore.)

So, the features are:
(see additional features added in later releases bellow)

  • Keep track of your model orientation including North angle and axes, with a simple rotating cube (dice), compass and some icons.
  • 42 predefined ā€œStandard Viewā€.
  • actually, you can double the above, because it can be set to use - display the dice according to - the global axis or the actual, user defined (or current context) axes.
  • set view by cardinal directions (North, West, East, South)
  • display the compass according of Solar North of the model (The compass plane always oriented by Global axes)
  • opposite view
  • change between perspective and parallel projection camera

Limitless possibility camera rotations:

  • around the global or actual origin, using axes as pivot axes.

  • around the camera target (aka center of screen) using the camera direction (and the axes derived therefrom) as pivot axes.

  • placing a selected (hovered) point of the model in the center of the screen (pan) and zooming, so that the target remains in the center. This one can be switched off (via Setting, Function Tab) , because it may disturb another Tool UI.
    -Note: This command is not possible to execute by mouse click, only available by pressing keyboard shortcut! (Or in Tool mode in earlier version of SU)

  • And last but not least, a ā€œgameā€. I only give you one dice (not like in Vegas, two), but this one can stand on its edges and corners too. So, pushing on the dice icon randomly puts the camera to one of the 26 currently reachable top and bottomā€™ish or sideā€™is view.
    It may not be super useful, but for example you can admire your model at the end of the day from different random perspectivesā€¦ it only cost a few extra lines of code and an hour of image editing, which I enjoyed anyway.

Configurable parameters and User Interface:

  • two kind of zoom method, zooming factor, rotation angles
  • set the tilt angle of the top and bottomā€™ish views
  • Set the model Solar North angle
  • 7 color-scheme (relatively easy to add more)
  • adjustable UI size and location
  • adjust the keyboard repeat sensitivity
  • animated camera transaction (experimental, not stable, save/backup your model before use)
  • set the hover sensitivity (experimental, might only be there for a betas)

Usage :
The menu is located under the main menu Camera.
(On Windows it should be the 3rd one, on Mac -most likely will be the last)
If the ViewDice overlay is not enabled, the menu/toolbar icon will enable it. (It is the same as if you tick the box in an Overlays Tray.)
If the ViewDice overlay is enabled, clicking on this menu/toolbar icon wonā€™t do anything.*
You can switch ViewDice off (and of course, on) on the Overlay Tray.

As mentioned, some commands may only be available only by a keyboard shortcut.
Therefore, it is one of the essential part of this plugin to set your preferred letter (keystrokes) of the keyboard as a shortcut first. Really! Please, set the shortcut for:
*Menu>>Windows>>Preferences>> Shortcuts: Camera/ViewDice :game_die:

*If the ViewDice overlay is not enabled, the keyboard shortcut will enable it. (It is the same as if you tick the box in an Overlays Tray.)
If the ViewDice overlay is enabled, when you move the mouse cursor over the cube-compass figure or one of the icons in the corner, a description of the command will appear next to the icons, at which point you need left click with mouse or press the aforementioned assigned key on the keyboard.

The standard view commands are on the corners, edges and faces of the cube and on the letters on the compass circle.

On the icons -where the Ā± signs are- the rotation and zoom commands are placed. The small triangle represents the opposite view.

The axes icon ā€œstarā€ at the very corner will be colored by red-green-blue if you have adjusted the drawing axes or you are in a component, group editing context and its axes location or directions are different from the Global axes. If the current drawing axes are not different from the Global axes the ā€œstarā€ lines will get the theme color.
If you initiate the command, hovering on the axes icon you can change to display and set the views by Global or local axes. The open circle around the ā€œstarā€ will represent the Global, without the circle being local.

The rectangle -trapeze icon does the same thing as the camera menu perspective / parallel command.

You can have an imagination about the Dice icon, since I talked about the ā€œgameā€ above.

The gear icon, as you guess, opens the setting and parameter dialog.

Some usage, parameter explanation (video):

Tool mode: only for SketchUp 2020 to 2022.
You can activate the Viewdice Tool by the menu/Toolbar icon. (Similar as above).
It is not ā€œmandatoryā€ here, but if you assign a keyboard shortcut to it, this shortcut can be used instead of mouse left click if the ViewDice Tool is already active, similar as mentioned in Overlay mode above.

A Tool mode is a little special, like the other native camera related tools (Orbit, Pan, Zoomā€¦) you can activate it during another Tool operation and by pressing Esc it will handle back the control to the previous Tool to its suspended stateā€¦

SketchUp 2023.0. or newer required for Overlay function. Changed in RC1 to: You Canā€™t run as Tool.
Will run on SketchUp 2020 to 2022 as a Tool.
Will not work on older versions than these.

Known issues & to-doā€™s:

  • The zoom-in doesnā€™t work as I imagined, but at least I gave two -not that bad - methodsā€¦ Iā€™ll continue to investigate the matter.

  • If another Tool is active and it draws something on the screen, it may flicker. (E.g., the Selection tool rectangle.). This is improved in RC1.

  • In some cases, the used Tool does not fully hand over control to ViewDice - e.g. the second phase of the Scale Toolā€¦ In this case, mouse events are not available, but the assigned keyboard shortcut can be used.

Some UI tuning might be necessary.

  • The settings window isā€¦improved a lot in RC1
  • The command hover sensitivity needs to be aligned to the screen-resolution, scaling, compass sizeā€¦ Currently the user can influence it a bit in settings. It seems that the icon hover sensitivity is okay now In RC1, the setting influencing the dice figure hovers only.
  • There are some visual glitches here and there. (I hope you donā€™t notice them allā€¦)
  • Typos, grammar, spellingā€¦

Others:

  • Setting the north angle does not create an undoable action. You have to remember yourself. (Actually, this is a fact, it cannot be changed.)

  • If the animation transitions time is set more than 0 to the new camera (new view), it is unpredictable when it will really finish. It depends on the model, computer, whateverā€¦)
    This causes ViewDice to not show the correct command until you move the mouse - or other unexpected behavior if you try to repeat the same command. Specially it is problematic in new RC1 mouse wheel rotation.
    I have had a few rare cases after using lots of transitions - where Sketchup would crash, however Iā€™m not 100% sure if the crashes are actually related, but it only happened when the transition time was set.
    I might remove this feature completely, even though the transition looks coolā€¦

-__-
New in RC1:

  • When the mouse cursor is on the side of the cube (or on one of the side view arrows), you can use the mouse wheel or enter the rotation angle to rotate the view.
    -This will rotate the view around the target point (center of the screen), using the corresponding axis as the pivot axis of rotation. Apparently, the ā€œcorresponding axisā€ will be what you set for the ViewDice (local or global).
    Note: When you are using the ā€œRotate by ā€¦ axis ā€¦ā€ icons instead, the pivot point will be the origin of axes, which is - in most cases - different than above.

  • A mouse wheel and manually entering the rotation angle - or zooming factor, are also utilized if you hover your mouse cursor over the icons Ā± signs.

  • The wheel up or down roll will be always considered, so it doesnā€™t matter if you are over the + or the - sign. The + or the - sign only matters for click or keyboard shortcut.

  • You will see a label of the measurement box, when you can manually enter the value.
    -Should be 0.1<Zoom factor <100 and not 0. (+ or - sign will be ignored)
    The rotation angle should be number, non zero, positive or negative, the remainder of dividing by 360 will be taken into account.

  • Added modifier keys. If the mouse is over one of the ā€œstandardā€ view commands, you can influence whether to do Zoom Extents, Zoom Selection or Center Selection after the standard direction is set.
    If there is a selection:
    Hold SHIFT for Center Selection, CTRL for Zoom Extents, both for Zoom Selection.
    If there no selection:
    Hold CTRL to Zoom Extents
    You will see those advice at the Prompt line, at the bottom when relevant.

  • (Without the modifier keys, it will work almost the same as the Built-in Standard views. That is, the zoom level will not change, and the new target will be calculated based on the bounding box of the objects currently fully visible on the screen.)

  • The settings window has been better arranged/categorized now, using tabs.

  • Added setting for different rotation angles/ zoom factor for click and for mouse wheel.
    So, e.g. you can use the wheel for bigger steps of rotation/zooming and fine tune it by mouse clicks (or keyboard shortcut). Sure, you can freely adjust it according to your taste in settings.
    Dont forget, that you also will be able to enter the rotation angle / and zoom factor manually, at once instead using steps.

  • Added settings for background opacity around the Dice / Compass figure. (Appearance/ Dice bg. opacity) So if the mouse cursor is there this opacity is considered. If the cursor is not close to Dice, or opacity is 0 the the background of figures are transparent.

  • It is reported on Mac, that it crashes SketchUp on startup if the Overlay panel is opened. I added a code if it is a Mac platform ViewDice will be switched off right after initialization. So it wonā€™t remember its last state, you will always need to enable it manually. Unfortunately I have no idea about the Mac version, but perhaps it helpsā€¦

-__-

And as usual:
Tested on Windows only, mainly on SU 2023 (W11) and SU2021 (W10).
( Itā€™s a terrible pain to use the SU2024 on my dual-screen laptop. I deleted it permanently. I donā€™t see any chance of me testing anything on it. )

This extension is not signed, so you need to enable Unrestricted in Extension Manager>Settings, Loading Policy.
SketchUp 2023.0. or newer required for Overlay function.
Will run on SketchUp 2020 to 2022 as a Tool only.
Will not work on older versions than these.

No Warranty. Use at your own risk!
Nevertheless, I did my best not to cause any inconvenience.

I look forward to your feedback! Especially from Mac and SU2024 users.
Have fun!

The rbz file:
Important:
If you had Beta 1 installed, uninstall that first, restart SU and install this new version and restart SU again. Assign your keyboard shortcut again as mentioned above.
(If you get, ignore the warning about the shortcut already assigned to ViewDice ā€¦)
Dezmo_ViewDice_Beta1_2024_11_29_0606.rbz (959.1 KB)

Dezmo_ViewDiceRC1_2024_12_06_1942.rbz (976.4 KB)

11 Likes

Thank you, Dezmo!
Itā€™s working ok in SU2022 and SU2024.

3 Likes

Wow. Perfectly. Thank you.

1 Like

Nice!

I like the simplicity of North Arrow for architectural work but for technical design this beats my Axes

2 Likes

Can we have a work mode that responds to simple mouse clicks on specific cube locations and buttons without additional command calls or tool activations? Curic has a similar plugin - Camera Gizmo - that works in a similar way.

Sure, your UI is more clear and less ā€œhungryā€ for resources.

But they can fit very well on each other!

ViewDice_Ene_AOv

.:wink:

Sure: RTFM! :wink:

@dezmo,

Nice job, but it doesnā€™t work very well on my computer (mac, SU 2024). Very tiny.
The dice roll while orbiting, but clicking on buttons does nothing.

Please read my first post, especially the bold letters and the very first animation. :wink:
If you want a ā€œclicking on buttonsā€ function you need to use the Tool mode.
Also you can change the size and location in a settings.
Click on for animated explanation in my first post:
Some usage, parameter explanation (animations):

Yes, I understand). I mean, can we interact with the overlay without additionally calling a special tool with the mouse pointer in the normal state.

Iā€™m not sure if I get you :thinking:

You do not need to call additional tool. Just hover your mouse cursor on a cube or icon, when you see the command hit the associated shortcut key.

Sorry, too quick testing.

Else, it crashes SketchUp on startup if the Overlay panel is opened.
I need to disable all extensions, close Overlay panel an after I can reopen SketchUp.

Hereā€™s how it works for me. To work with the ViewDice ā€œview cubeā€, I have to additionally activate the ViewDice-Tool with a hotkey or icon. Can we work with the ā€œview cubeā€ at once without calling the tool each time?
See Curicā€™s Camera Gizmo for an example. He doesnā€™t need an extra challenge.

:frowning: Hm. Unfortunately I canā€™t test it on a Mac, (thereā€™s not much chance it will ever happenā€¦) So I have no idea how it handles overlays. Anyway thanks for the feedback.
If thereā€™s any chance you see anything in the Ruby Console, or other ā€œlog fileā€ that you think contains something related to the crashā€¦would ben nice to see.

Still not get you, sorry!

You need to associate the hotkey to: ViewDice Command! (Not to ViewDice-Tool.)
So when you are in Overlay mode you not need to shitch to Tool mode, but hit the associated shortcut key. (In my computer I assigned ā€œWā€)

Or you activate the ViewDice-Tool via this menu (or you have a Toolbar also) and you can use your mouse, similar as your video.
(BTW. the associated shortcut key also works in Tool mode, so you can use the mouse left button OR the shortcut key. in TOOL mode.)

In overlay mode only the shortcut key associated to: ViewDice Command! will execute the hovered command

I think Curic is combining tools and overlays somehow but not sure how. Maybe using system api to check if the cursor is close to his overlay and let it take control :thinking:

2 Likes

Ah. @KScher I see now what you mean! :innocent: (Thanks to Julia!)

That is not possible in mineā€¦
( I have no experience with system api-s. :thinking: But maybe itā€™s possible to do something with .push_tool .pop_toolā€¦ I will check it on some dayā€¦ )

1 Like

Thank you @dezmo . In any case, the tool is great!

1 Like

It didnā€™t let me rest, so I quickly checked. And yes, it seams to be possible what you mentioned, but Iā€™m taking a little ā€œbreathā€ before making any changes, and I need to think more on it for proper implementation.
Anyway, thanks a lot for opening my eyes! :beer:

1 Like

Pushing and popping tool is for one tool interrupting another, like Camera tools, or for a ā€œtemporaryā€ tool that disappears once used, like Axes tool or Place tool.

To get an Overlay to respond to mouse events youā€™d need to go outside the official APIs which is fragiler and not really recommended :sweat_smile:. But it would be so cool to see.

Maybe itā€™s time to consider allowing overlays to respond to key events, but be very clear in the documentation how to use it and when :thinking:

1 Like