Description

Blender Templates

Storing meeting notes here as a record of IRC conversation, may move this to other planning docs.

This page aims to make Blender's templates concrete, so we can make a start on their implementation.

2017 March 6,7

Meeting with Campbell Barton & Mike Pan

Blender 101, User Perception

Even though users may shy away from simplified software, in some cases the simplified versions of applications have become dominant:

(Mozilla -> Phoenix -> Firebird -> Firefox) is an example of this.

Done well, a simplified Blender has the potential to become popular, so while we must start with small steps, we should keep in mind a simplified Blender need not be a crippled application (as it often is with shareware or educational versions).

"Blender 101" is a simple title but sounds a bit like ''"Kiddies First 3D Program"'' which may stop people from taking it seriously.

Will templates share UI scripts?

Then they can choose to add their own UI, or use Python to import parts of Blender's default UI.

This way template developers can choose how much to share. If they really want they could import the UI for an entire region and use Python to manipulate its functions, while this is quite advanced, common changes such as filtering whats displayed could be put into a module.

This gives a good balance between maintainability and flexibility.

So, we will initially use Blender's UI. But allow to replace parts of it as the template requires.

Will templates share keymaps?

We will follow similar conventions to the UI here, where templates may replace keymaps as needed.

This depends on exactly whats planned for 2.8x too.

How to 'Hide' Options?

While hiding tools is simple (users just wont have direct access to tools), hiding options for rendering, animation for eg has implications because someone may load a file with some options enabled and not understand why one data-block behaves differently.

Use presets, this way we allow users to avoid tweaking many options, Mike suggests to show the preset in the panel header and have these panels start collapsed. This way users can select presets in most cases and don't need to get involved with setting values.

Blender's current preset system is quite weak though, we would most likely want to detect presets from values, which would need to be calculated and cached for fast redrawing. There is also the issue that old files may be loaded that have one setting different from the preset, so it will show as "Custom". This is infact not so trivial to solve in a nice way, so for now we can accept using existing limited presets, but ideally Blender's preset-support will be improved if they're going to be used more.

An alternative would be to store the preset ID in the file and apply it on load... this has trade offs too and may complicate things is we like to modify templates since files will have their settings changed on load, depending on their Blender version.

Users may just want to tweak a setting they know is enabled in a file and the 101 interface may not display it. Campbell likes to keep the option open for a generated spread-sheet style UI (similar to data-block browser but better organized). So users can change settings if they really want (without leaving the 101 template).

No need to do this early on, and best we try make 101 as good as we can without resorting to fallback advanced UI.

Templates could declare a callback code that runs on loading a blend file that warns of options which are hidden and likely to cause problems.

Possibly with the ability to change those settings (examples of options might include lock-view-to-cursor or transform-object-centers.... although how to handle this isn't well defined).

Can templates contain assets?

Yes, however they won't contain special features for asset management. They will be limited to features already in Blender:

Startup Blend.

Add-on's that insert menu entries, to the object "Add" menu for examples.

File browser (open to a textures directory)

Library browser (open inside a library blend).

Recommended ways to use assets within a template will be included in an example template to set some reasonable conventions.

templates/{template_name}/assets/{data_type}/{asset_name}.blend for example. With a script to list them.

Work on improving Blender's asset manager is important, but unrelated to the 101 project.

How will templates be stored on disk?

Each template is a dir, in either Blender's system or home directory (as with add-ons), eg: /usr/share/blender/2.79/templates or ~/.config/blender/2.79/templates

Templates can be installed similar to how add-ons can be installed (simply extract zip into a directory).

Templates are application-data, however startup.blend will be saved in home directory using a structure that matches the templates/ directory as stored in the system path.

User-level templates will be supported, as with add-ons, so templates will be detected in the users home directory too.

Templates startup.blend will be named so there are 2 files (startup.blend & factory_startup.blend ?), One which is never written to, allowing the original to stay pristine so users can go back to the original without re-installing the template.

Templates will manage their own assets and we will not restrict or define exactly how they do this however using Blend files per asset will be recommended.

Templates will have their own startup.blend equivalent.

Templates can be selected from the splash screen.

Once selected and saved as a default, templates will be used immediately on load, but will still be able to be changed from the splash.

How will templates run?

First the template will load it's associated startup.blend

Then a startup script will run

While there are no explicit rules on what the script will do, common operations will be:

Add an addon directory so templates can bundle their own addons.

Register its own interface classes to override Blender's default.

Register its own keymaps.

How does this impact Blender's default configuration?

It's not clear at this point, but we are thinking it might be simplest to have the default configuration also be a template. This wouldn't make any significant changes and means we don't need to account for a special case which isn't a template but shows up in template selector as one.

How will we manage templates?

Where exactly templates are maintained is an open-topic, but we suggest to have repository for templates (svn for binary files). Alternative would be to use Blender's current lib/ svn.

We will include a template template for people interested in writing their own :)

One default template included in Blender is likely so developers can use Blender without installing templates.

How will user preferences for templates be separated?

Templates will have their their own user-preferences, created when the user saves their preferences.

Only some settings for them will be used.

Rule of thumb, anything you may re-configure on a different system (DPI, OpenGL preferences, tablet options... etc) wont be used as part of template preferences.

Templates will not share user preferences ''(this may be changed in the future for clever overlaying of preferences)''

Should templates contain themes?

Since themes are entirely a users personal preference, its not essential to include them in the template.

Mike suggests to at least support the ability for templates to set theme colors so template creators can do some of their own *branding*.

If branding is part of templates it came up that we might want to support custom splash artwork (keeping the top area containing Blender name and logo). This isn't needed for templates at all, but template authors may appreciate the ability.

I think this is a pretty fine proposal, although there are a few key-points that I'm not sure about, or which I imagined in a different way at least.

From what I got from here and the mailing list thread, templates would at the bare minimum consist out of a .blend file and usually a startup script. This startup script would manage all the other stuff like loading assets appending workspaces, etc.
For the end user, that however means even for basic creation of templates, some Python/BPY knowledge is required (if loading a .blend file isn't enough).
I think we should do this a bit differently, giving uses the option to create (and adjust) templates without having to do any Python scripting. For that I think a default template configuration should be consisting out of multiple things:

startup.blend including scene and workspace setup

UserPref (overrides), including add-on setup - note that manipulators should be handled through add-ons I guess.

Asset setup (asset engine to use, paths to premade assets, etc)

Whatever I might be missing :)

Each of them would be optional, users could decide to skip saving for each of them and/or skip loading for each of them. On top of that we can still allow having a startup script to do all kinds of advanced things.
I'm also not quite sure how you'd imagine users to create templates - would that be integrative functionaity that users can do from within Blender, or would that be something users would do from outside (as in - creating a template folder tree and moving needed resources into it).

Regarding the system settings, I agree that the DPI shouldn't be a part of the template, however the UI scale should. E.g. I would expect the simplified templates (101 template, 3D printing, etc) to have a slightly increased UI scale for the sake of readability (space and work efficiency is a bit less important here). Luckily with D2539, that would be resolved in that the DPI would be managed by the OS DPI, and the interface drawing scale would finally become an interface-only user preference option.

Next I think some stuff you introduce as being template setups should be done indirectly through the workspace setup. For example the UI filtering (hiding buttons/panels to simplify task for a workflow) was intended to be handled per workspace. The same is the case for add-ons and keymaps - we want to allow setting them up per workspace - although I can see it would also be useful to manage them globally through templates. In either case, I don't see a need for making any of this a typical template thing, UserPref and workspace setup should already provide enough flexibility to handle all this.
That means templates would make heavy use out of the workspace design.

Basically the idea I had is that all functionality we need for templates will be available as normal features within Blender, templates would do nothing but using these to create a ready-to-use preset state of Blender for a given user-group. And: having to do any Python scripting should not be the requirement for non-super-advanced functionality, creating templates still falls under that category IMHO.

In fact this is already the case - You can just use startup and preferences with no scripts.

The reason the proposal says that some Python will be needed, is because selectively removing parts of the interface can't be done any-other way.

Basically, there is no hard requirement for Python, functionality of workspaces allows configuration of the interface, templates will use it automatic.

On the other hand in practice it may be that anyone who is serious about writing a template will just end up needing to use Python (if we dont give enough useful ways to avoid this).

IMHO this is a stretch-goal, we can evaluate once the basics are working well.

Nothing you suggests conflicts with the current plans AFAICS. Your suggestions just depend on Blender2.8x features.
I wanted to avoid doing this, mainly so we don't end up failing or being postponed indefinitely in the case some 2.8x targets aren't met.

I see mention here of hiding items which seems very sensible. However, for someone looking to learn a new tools having to move from one interface to another can be quite difficult. Will there be the option to disable buttons?

So this is more related to having a user configurable interface, while this is planned for 2.8 [1] - I don't think this project depends on it. And most likely its not for every button but for toolbars only.

@Campbell Barton (campbellbarton) my issue is with students transferring from 101 to the full program interface (my experience is mainly with 11-18 year olds). If the step between 101 and full involves moving buttons around and others suddenly appearing out of nowhere I fear that they will feel that they are learnign two interfaces. 'Disabling' rather than hiding buttons could give the developer the option to make a consistent interface across both modes, and make the transition easier

@Peter Kemp (peterejkemp) - there are many open design questions relating to how best to make a Blender thats optimal for people to learn Blender.

As I understand it, Blender-101 is intended to be a heavily simplified Blender. For those who want a Blender with the ability to selectively disable some parts of Blender, this seems like a much smaller task and could even be a separate template that just overlays default Blender, giving some control on which parts to disable.

So, today i have been playing a bit with the new templates system. And of course the very first thing i did was to let Blender crash with it :)

It is really nothing serious though and i could find the reason very quickly: I just have used a wrong height for splash.png However maybe the templates system could be a little bit more graceful and either rescale the splash image so that it matches or at least reject the image if it does not fit, maybe replace it by a dummy image saying 'you fool can't read the numbers can you?' or something :)

So... i had written a long text here trying to explain how i want to make use of templates for our Addon. But at the end i somehow got the impression that Templates is meant for something different - maybe much much bigger even - than what we want:

In our use case we have 4 workflow scenarios and 3 user skill levels. And we want to provide "the best interface" for each combination of (Workflow, Skill-level) I guess we have to wait for the workflow project in 2.8 for this?

Today i found something that might be related to the application templates. That is: When i start a new blend file by using File -> New then i see that addons seem to be reloaded. At least i could see that the unregister() function of our Addon was called. This might even be wanted behavior so i just mention it here for the case that it is relevant.

But i found another more serious issue:

When i press F8 to reload the Addons or when i load an existing file, or when i restart Blender then everything runs just fine. But when i do File -> New then i get this error:

bpy.types.Scene.MocapProp = PointerProperty(type = MocapProp)
for bone in data.get_mtui_bones():
setattr(MocapProp, bone, StringProperty() )
# ====================================================
# I am not entirely sure but i believe the following line creates the problem:
# ====================================================
MocapProp.sources = bpy.props.CollectionProperty(type=StringListProp)
MocapProp.targets = bpy.props.CollectionProperty(type=StringListProp)
# Remind: This code works when i press F8, or when i restart Blender
# so i am not sure what i am doing wrong here. It worked for years :)
# And it works in 2.78c (just checked)

As i suspected this is not a bug in the application templates. I was able to fix this issue in our Addon. The problem shows up because application templates seem to enforce addons to reload when a new blend file is opened. For some reason the order of class definition matters in this case, while with F8 the problem does not show up.

I only needed to change the order of class definitions so that "used" classes are defined before the "using" classes. All is well now :)

Add a custom icon to the top menu bar to indicate when a specific template is enabled, see image below. I guess an application template could do this anyways, but then it will be up to the developers where that icon will be placed or how it will behave.

From a user point of view it might be better to have this strictly defined so that all apptemplates show at least one common method to place a brief info about the apptemplate.

change the splash on hover

I created 3 application templates. For each template i have created its own splash.png When i now open the splash screen to select an application template then would it be an idea to show the apptemplate splash image when hovering over its selection button?

Like for example when i hover the mouse over the 'avastar textured' selector then the splash of that apptemplate shows up, etc... This could let me 'scroll' through the apptemplates and get more information about what they are used for from the splash before i enable the apptemplate, see image:

Talked on IRC, will leave this as-is for now since T50845 plans much bigger changes to the top-bar.

I'm not convinced this is really needed, the splash lets the user know at startup what template they use, and the template will typically have characteristics that make it distinguishable from other configurations that you can tell its different.

For now you can name the screen (which makes sense, mostly the screen layout will have something to do with the template).

Further, a template is capable of adding icons/text if you really want. Although its not greatl if everyone does this differently.

Then from the splash screen i switched from Default to my new template. Now If i switch back to Default template, the splash changes, but the default startup file is not loaded. When I click Default again, it is loaded.

I was able to circumvent this problem by saving the startup.blend and userpref.blend (while being in the Default template) to user config