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

joe joeedh at gmail.com
Tue Mar 3 01:07:09 CET 2009


What do you mean, parameter for op ID?

I designed this, because the existing API was kindof slow and annoying
to use.  Kindof like why the py people made Py_BuildValue I imagine.
I never could memorize all the relevant functions, and especially not
the ID codes for slots/operators, and was tired of constantly having
to look stuff up.  Plus it takes a fair amount of code just to call an
operator, even simple ones, which gets annoying.  And finally I didn't
want all that code necassary for operator calling duplicated all over
the UI code, where it'd be a huge pain if we ever have to change
anything.

Joe

On Mon, Mar 2, 2009 at 1:12 PM, GSR <gsr.b3d at infernal-iceberg.com> wrote:
> 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
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list