Stored Views : User defined 3dview presets. Update 24/05/11

Stored Views

User defined views, pov, layers and display presets.

Update : 24/05/11

Script : space_view3d_stored_views.py ( to place in your addon folder )
Release : 0.2.2

New in 0.2.2 :

  • References to objects are still valids even if the object’s name has changed
  • Checks on data import : i.e. : check if object referenced exists
  • Improved (hopefully fixed) logic for previous / toggle
  • support for trunk build (changed api in r36710)
  • misc. UI tweaks (import/export are no longer ina pop-up menu)
  • stored views name display in 3d view (experimental)
  • wiki and tracker urls

New in 0.2 :

  • Quadview support (limited : can only save the upper right viewport status)
  • Import settings from another scene (images below)
  • Import / Export settings to .blsv files + preset folder

Video demo:

Where and what is saved :
Stored Views can be accessed in the property panel of the 3d view.
It has 4 modes of operation, depending on which the following are saved or restored:

  • POV - Point of view

[LIST]

  • point of view, obviously

  • perspective mode: perspective, orthographic or camera

  • field of view : lens

  • clipping: start and end

  • view lock : center of rotation, cursor or object

  • Layers

  • visible scene or view layers

  • layers lock : determining if scene or views layers are visisble

  • Display

  • viewport shading : textured, solid, wireframe or boundbox

  • show only render setting

  • show outiline selected setting

  • show relationship lines setting

  • grid settings : show and settings

  • axis visibility

  • material mode: texture face, multitexture or glsl

  • texture solid setting

  • quadview settings (0.2)

  • View

  • all of the pov, layers and display settings

[/LIST]

Import / Export :
As of 0.2, stored views can also be imported/exported to a .blsv file (largely inspired from Theme Manager from Crouch). Settings can also be imported from an another scene. You can also choose to replace the current settings or append to them.
As 0.2.2, import/export might be filtered according to the differents modes

View name display :
View name display can be toggled in the option subpanel. If the current 3d view status is different from the last set stored views the name will disappear. Furthermore, an indicator appear into the list to show which stored view is currently selected.

Warning : this feature is still experimental. But if you try and blender crash, I’m interested in knowing what you did to make it crash (console output would be nice)

Know limitations / Bugs :

  • Quad view limited support (I didn’t find where’s it stores all the data…)
  • stored views name display in 3d view is still experimental (blender might crash)
3 Likes

beautiful addon! i shall be using this, Thank you. Gets saved with the blend somehow, neat functionality!

In fact, configs are saved in the current scene data. I have to look for a way to import them from a new scene for which you have not copied all the data.
I might, perhaps, code an import/export from/to another .blend or an external file. It depends on the use cases. But i’ll wait for some feedback about that.

Yes, the only thing I can do is check if it is a quad view, and then there’s only data for the upper right viewport. For the other viewports, the only data I can access is their locked , synced and clipped status. Personnaly I don’t use quad view much, but I can still easily add limited support for it.

nice, but, so… set your blender screens, and save as default? Make sure you have “don’t load” for options?

Neither do I, at first coming from 3dsmax it was useful, but because you can’t drag around the window handles of the quadview, it doesn’t provide the functionality that I need. Using the keyboard shortcuts, and being able to have as many views open solved that.

This tool is pretty cool for doing fast openGL renders from odd angles :slight_smile: (and i’m sure people will find many uses for it, and the code that supports it)

For now, the addon data is stored per scene basis, and this imply a per .blend basis.

Say you set up your custom views in the default .blend, default scene. And then save as default. At this point, each new .blend, based on this default, will have your default views. But if you open another blend, in which no custom views were set, for now you have too set them up again.

In fact, configs are saved in the current scene data. I have to look for a way to import them from a new scene for which you have not copied all the data.
I might, perhaps, code an import/export from/to another .blend or an external file. It depends on the use cases. But i’ll wait for some feedback about that.

It is still very nice, since a single project and the preferred views used there will NOT affect the default status and all the other projects - I think this is a very good thing :slight_smile: Thank you for doing this, it makes a very good tool as a by-project helper.

Great for colabrative scene work, where other artists want to show each other prefered or problematic angles.

+1 really usefull addon, thankyou.

Great addon, very usefull. Thanks!
Maybe it could save image dimensions also, linked with a saved camera.
So it could act as camera manager, and have cameras with different render sizes in the same scene.

Saving reference to a camera or an object is quite tricky. At least I didn’t find exactly how to yet. For now, I only save the name string. But if the name is ulteriorly changed, the reference is lost (A fact that I forgot to mention in the limitations. For now it just fail somewhat gracefully). I didn’t find a way to update the reference. If someone has an idea how to, I’m all ears…

Addon Updated to version 0.2 (see first post)

What’s new :

  • QuadView support - limited to the upper right viewport
  • Import settings from another scene
  • Import / export to .blsv preset files + preset folder

Really useful! Thanks!

@nfloyd

It’s a pity we didn’t know about each other.

i just completed my version of a stored view addon…I think we should share some of the code. Mine also allows you to browse the views with a hot key… the idea being that when one changes view (especially when working on large data sets) that you can quickly go back to a previous view… I found this functionality missing in Blender.

Funny -> I called my addon the same :slight_smile: Here’s the link for the code

http://www.pasteall.org/21697/python

http://www.pasteall.org/pic/show.php?id=12424

I actually don’t care that much about storing fixed views as what it was necessary for me to be able to have a “view history”, i.e every time you change your view using the mouse, it should record it somewhere for reuse. This is a common feature in the high end CAD systems that I’ve been exposed to and something I really wanted.

Anyhooo…I still have to complete the auto-recording:(, yours seems to be complete :yes:
*

Yeah, sorry. I had no idea someone was effectively trying to achieve the same thing. I remember reading a post in which someone was using a keyframed camera to kind of saving point of views. I thought it a bit too hackish to my taste and ending up coding something, as someone said it wouldn’t be too difficult.

Once I had the infrastructure in place to save and restore point of views, I extended it to layers and display settings. So now, the script has 4 modes : points of views, layers, display settings and “views” ( which encompass the other 3)

I’ve been exposed to CAD systems too… so the confluence of ideas might have come from there…

My script doesn’t auto-record per say.

Depending on the mode, a ‘view’ is either the point of view, the layers displayed, the display settings or all of that.

When the previous button is pressed, the script compare the current displayed view with the one which has been restored (or saved) last. If it’s the same, the view restored before that one is fetched and restored. Otherwise (the current view has changed), the previously restored view is fetched instead.

From that point on, the previous button act as a toggle button : whatever the view was when the previous button was pressed for the first time become the ‘previous’ view.

So, there’s no “history”. I also thought of a real history. But for that, the script would have to always ‘observe’ the 3d view and determine when it is adequate to push it to the history. And I currently have no idea of the criteria I could use for that purpose. (on top of that, the script would have to be constantly running instead of being called by the user).

Another problem I have, and it seems you have also encountered it, is how to save the ‘reference’ to a camera, or an object for that matter. Currently the script only save the object’s name string. So if this name is changed after the view is saved, the script can’t retrieve the object. Now that I think of it, perhaps saving the pointer address, and then loop through bpy.data.objects if the name string has changed. If the pointer address doesn’t change during a “session”, that might work. On opening a .blend file, the script would have to update the pointer address saved along with the name.

For now, on my list of todos:

  • hotkeys
  • display of the currently selected view name
  • selectively save and restore settings : which ‘mode’ (views, pov, layers, displays) are saved or imported
  • saved list reordering
  • preferred views slots, which could then be restored, or cycled through with hotkeys

To record the history you need to use the PASS_THROUGH option in your operator. It took me quite a while just to figure that out.

The problem I’m facing at this stage is that multiple events (e.g WHEELMOUSEUP, WHEELMOUSEDOWN) is recorded, but it all entails only 1 end result -> the view was changed. So to decide which event to stop recording at and save the information is the problem.

I like the way that yours has buttons next to the views - I think i’ll use that too:)

Todo list for me… recording a real history (mine is also saved in the scene by the way… we seem to share ideas without knowing :slight_smile: this is SO cool ). You can take my code to see how I used the hotkey implementation to scroll the views… I used a pass_through operator

Gotta go…I’ll check on this post soon

in so many way, this is VERY useful. Thank you for coding and sharing! Really liking the layers saving feature too!

Hi,
I can’t activate the addon in the very last builds (standard trunk windows x64 on graphicall). The box remains unclickable. However it works on an older revision (36691). Is this normal ?
Thanks…
Sebastien

There has been an api change at revision 36710 that breaks the script. I will upload a new version handling it soon.

In the meantime, as a temporary fix, you can alter this line:


from io_utils import ExportHelper, ImportHelper

as follow :


from bpy_extras.io_utils import ExportHelper, ImportHelper

or even better, as it should handle both release and trunk builds


try:
    from io_utils import ExportHelper, ImportHelper
except:
    from bpy_extras.io_utils import ExportHelper, ImportHelper

Hopefully that’s the culprit. As I didn’t developped against the very last build, I’ll have to give it a closer look.

Thank’s for the heads up

Well, I admit I’m not into development stuff and lack knowledge about it. I searched the line code in the .py script using notepad but guess that it’s not the right place to search and replace. What’s the process ?

(by the way, fantastic addon, very useful !!! thanks !)

notepad is sufficient for that. (or even blender text editor)

The line in question is near the top of the file (line 42), after the gpl block, the addon info and the changelog


import gzip
from io_utils import ExportHelper, ImportHelper  # #### this line #####  
import os
import pickle
import shutil
import hashlib

Replace the line in question with the code snippet from my previous post (copy, paste, or just type - a .py file is just a text file after all) and save the file. And that should be it.