[Bf-committers] [19167] branches/bmesh/blender/source/ blender: Created a printf-style method of calling operators.

GSR gsr.b3d at infernal-iceberg.com
Mon Mar 2 21:12:29 CET 2009


Hi,
joeedh at gmail.com (2009-03-02 at 0508.48 +0100):
> Revision: 19167
>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19167
> Author:   joeedh
> Date:     2009-03-02 05:08:24 +0100 (Mon, 02 Mar 2009)
> 
> Log Message:
> -----------
> Created a printf-style method of calling operators. I did this to cut down on duplicated
> code, and also because calling operators was such a pain.  The basic form of the format
> is "opname %[code]", where each % matches to an argument.
> 
> The codes are fairly simple:
>  d - int
>  i - int
>  f - float
>  h[v/e/f] - all verts/edges/faces with a certain header flag.
>  f[v/e/f] - all verts/edges/faces with a certain flag.
> 
> For example:
> 
>   EDBM_CallOpf(em, op, "dissolveverts %hv", BM_SELECT)
> 
> will call the dissolve verts operator.
> 
> The relevent functions are:
> //calls a bmesh operator, doing necassary conversions and error reporting.
> int EDBM_CallOpf(EditMesh *em, struct wmOperator *op, char *fmt, ...);
> 
> //execute an operator
> int BMO_CallOpf(BMesh *bm, char *fmt, ...);
> //initializes but doesn't execute an op.
> int BMO_InitOpf(BMesh *bm, BMOperator *op, char *fmt, ...);
> //vlist version of above.
> int BMO_VInitOpf(BMesh *bm, BMOperator *op, char *fmt, va_list vlist);
> 
> Note this system is dependant on getting the slot codes from the argument
> order.  I'd like to make it better, possibly pass in slot names, but that'd
> mean actually giving the slots names (which I can do, but wanted to discuss with
> Briggs and others what I have now first).

Out of curiosity, what is the advantage of this system vs one with a
parameter for OP ID and other for flags (for example)?

GSR
 


More information about the Bf-committers mailing list