[Bf-python] Python API proposals

Dima Glibitsky dima.glib at gmail.com
Wed Nov 23 22:37:02 CET 2011


Thanks for the detailed answer, I'll explain my motivation.

In my cursor script, there are cases which, I think, don't really fit
into Scene/Screen storage model as it is now:
- Cursor history. I guess, logically it should be separate for each
scene, but currently I can't do this -- Undo/Redo would mess it up.
- Bookmarked locations. By design, these should not belong to screen
or scene (in this concern, they are similar to images). However,
operations on them should be, logically, undoable.
- Some visualization settings which should, logically, belong to User
Preferences.

A bit off-topic, but related: currently almost every operation results
in Undo history modification, even though they shouldn't behave like
that -- e.g. just changing 3D-view shading mode can overwrite all the
undone meaningful scene/mesh modifications with one useless action
(which wouldn't even change shading mode back when you press Undo).
I suggest that all (at least, many of) visualization/tool settings
shouldn't be undoable (take GIMP, for example) ;-)

P.S.
Another off-topic: are there any plans for the nearest releases to
make TextEditor's undo history separate? Please forgive my curiosity
:)


On Wed, Nov 23, 2011 at 3:22 PM, Campbell Barton <ideasman42 at gmail.com> wrote:
> currently blender doesnt really have a way to store global data in a
> blend file... data is attached to a scene/screen normally, why do you
> need this?
>
> Not what you are asking for but related, IMHO we should have a way to
> deal with user preferences for addons (or just any script).
>
> I plan to add at some stage and probably isn't all that hard - just
> need to add the ability to have user preference define new property
> types like we have now for IDs.
>
> While - bpy.data.global_preferences, could be added, Im not convinced
> we need it when we have scene properties and user preferences (albeit
> not for py scripts yet).
>
> The difference is that you have to save user preferences explicitly so
> the data wont necessarily be available across sessions.
>
> Regarding scenes for settings - that a scene is renamed shouldn't
> matter since you deal with the active scene (scenes store tool
> settings for example and renaming scenes isnt an issue), so guessing
> that your using a scene to store something which you in fact shouldn't
> be stored there.
>
> If you want you can always pickle any script runtime data and store in
> the blender user dir, and manage on your own.
>
> Interested to know how you intend to use this.
>
> - Campbell
>
> On Thu, Nov 24, 2011 at 12:01 AM, Dima Glibitsky <dima.glib at gmail.com> wrote:
>> Hi, yet another proposal:
>>
>> Some scripts need to store their global settings with .blend file, but
>> currently there is no way to do it reliably (properties added to
>> WindowManager are not saved, and properties added to Screen can become
>> inaccessible if the screen is renamed or deleted).
>>
>> - It would be a good practice to have data storage specifically for
>> this purpose, e.g. bpy.data.global_preferences.
>> - Also, it might be useful to have two types of such storage: one
>> modifications to which are tracked in Undo history, and one which
>> lives outside of Undo.
>> - Perhaps it was already requested, but it would be nice if there was
>> a tab in UserPreferences, or maybe a separate space type, devoted to
>> the addons' preferences (this could lessen the clutter in the main GUI
>> by moving rarely used settings to Prefernces).
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
>>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>



More information about the Bf-python mailing list