From 23a3a51e16c72d347f15790ed9e4d7bdc2d4f44a Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Fri, 23 Jan 2004 19:24:45 +0000 Subject: Blender's debug mode only worked on startup: - G.f's G_DEBUG flag was being erased in blenkernel/intern/blender.c's setup_app_data: G.f= bfd->globalf // added a line above it to fix this: if (G.f & G_DEBUG) bfd->globalf |=G_DEBUG; G.f= bfd->globalf; BPython: - debug info now only shown if Blender is started with '-d' option - added ~/.blender/scripts to modules sys.path - added two new functions to Blender.sys: basename and splitext - added doc for Blender.sys, updated other docs --- source/blender/python/api2_2x/doc/Registry.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source/blender/python/api2_2x/doc/Registry.py') diff --git a/source/blender/python/api2_2x/doc/Registry.py b/source/blender/python/api2_2x/doc/Registry.py index c7e981a69d0..390669eb37d 100644 --- a/source/blender/python/api2_2x/doc/Registry.py +++ b/source/blender/python/api2_2x/doc/Registry.py @@ -12,9 +12,9 @@ dictionary, which is deleted when the script finishes. This is done to avoid problems with name clashes and garbage collecting. But the result is that data created by a script isn't kept after it leaves, for itself or others to access later: the data isn't persistent. The Registry module was created to -give script authors a way around this limitation. In Python terms, the -Registry holds a dictionary of dictionaries. +give script authors a way around this limitation. +In Python terms, the Registry holds a dictionary of dictionaries. You should use it to save Python objects only, not BPython (Blender Python) objects -- but you can save BPython object names, since those are strings. Also, if you need to save a considerable amount of data, please save to a @@ -23,14 +23,14 @@ can simply be read from a file. Two uses for this module: -a) Save configuration data from your script's gui (button values) so that the +a) To save data from a script that another script will need to access later. + +b) To save configuration data from your script's gui (button values) so that the next time the user runs your script, the changes will still be there. Later we can make Blender save the Registry so that its data won't be lost after users quit the program. And also add an option to save as a Text that can be kept in a .blend file, letting users keep script data there. -b) Save data from a script that another one will need to access later. - Example:: import Blender @@ -40,15 +40,15 @@ Example:: myvar1 = 0 myvar2 = 3.2 mystr = "hello" - # + # then check if they are already at the Registry (saved on a - # previous execution of your script): + # previous execution of this script): dict = Registry.GetKey('MyScript') if dict: # if found, get the values saved there myvar1 = dict['myvar1'] myvar2 = dict['myvar2'] mystr = dict['mystr'] - # + # let's create a function to update the Registry when we need to: def update_Registry(): d = {} @@ -56,9 +56,11 @@ Example:: d['myvar2'] = myvar2 d['mystr'] = mystr Blender.Registry.SetKey('MyScript', d) + # ... - # here goes the main part of your script ... + # here goes the main part of the script ... # ... + # at the end, before exiting, we use our helper function: update_Registry() # note1: better not update the Registry when the user cancels the script -- cgit v1.2.3