[Bf-python] Patch/For object functions.

Campbell Barton cbarton at metavr.com
Wed Jun 2 01:39:48 CEST 2004


Hi All, I have made a patch that demonstraights a way to seperate the
GUI side of a function so Python can accsess the functions as well
without any UI conflicts. using the apply_object() function.
Heres how it works. nothing groundbreaking at all but it works and is
easy to understand.

For 'foo()' functions that have UI spesific code move it into 'foo_ui()'
All user interface functions will call foo_ui() while python can call foo()

_____________ Example

void foo_ui()
{
     if(okee('do foo')==0) return;
     switch foo()
     {
         case 0:
           error('Some Error')
         case 1:
           allqueue(REDRAWVIEW3D, 0);
           break;

     }

}

int foo()
{
     .....
     return 0;
     ......
     return 1;
}

_________________

Having foo return an error code means that the python interface code can 
make use of the values to raise python exeptions with coherent error 
messages.

I have done a test case with ApplySizeRot()
Just select the objects (my patch also adds ob.sel ) and run ApplySizeRot

eg

from Blender import *
Object.ApplySizeRot()

If you think this is a good way to go about it then I can add all object 
functions to python.

- Cam

-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: size_rot.txt
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20040602/7bd50b5c/attachment.txt>


More information about the Bf-python mailing list