Another benefit would be that the same path is taken when executing python and regular code, which means testing framework can be done in python and test blender C API as well.<br><br><div class="gmail_quote">On Fri, Mar 20, 2009 at 12:09 PM, Nathan Vegdahl <span dir="ltr"><<a href="mailto:cessen@cessen.com">cessen@cessen.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">This looks almost identical to what I proposed, except that it's<br>
written much more clearly, and operators don't use the low-level API<br>
to do their work.<br>
<br>
The reason I suggested that operators do their work through the<br>
low-level API is because it ensures that the low-level API is<br>
complete. At least it does once all the operators have been ported,<br>
which can be done over time.<br>
<br>
One of the things I love about the operator design is that it ensures<br>
that everything the user can do, Python can do, because anything<br>
exposed to the user *has* to be implemented as an operator.<br>
I think it's important that any low-level API have similar assurances<br>
of completeness. So I suggest again that the goal be to eventually<br>
port operators to use the API to do work with actual data. I may be<br>
missing some important implementation details, but it seems like this<br>
would be straight-forward.<br>
<br>
Some secondary benefits:<br>
- Reduced code duplication.<br>
- The blender console could echo API calls in addition to operator<br>
calls. This is great for learning the API, or just refreshing your<br>
memory how to do something if you forgot.<br>
<br>
--Nathan V<br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Mar 20, 2009 at 7:30 AM, Brecht Van Lommel <<a href="mailto:brecht@blender.org">brecht@blender.org</a>> wrote:<br>
> Hi,<br>
><br>
> After some more discussion on IRC, here is another proposal, not unlike<br>
> the Blender API one, but with some tweaks to get it more feasible and<br>
> incremental.<br>
><br>
> a) Blender 2.5 is about tools and the event system, and operators remain<br>
> just that. They are always context sensitive. Getting blender<br>
> functionality working as such tools is the #1 priority for 2.5.<br>
><br>
> b) A secondary low level API provides access for python scripts. This is<br>
> very much like the Blender API proposal. What I would like to see<br>
> different there however is that it should be defined in the editor<br>
> modules (close to the operators), and not have the operators call any<br>
> auto-generated functions.<br>
><br>
> c) Operators are still available for python to call, but they are<br>
> context sensitive. This means they are mostly useful in macro like<br>
> scripts. The low level API permits to do context-less operations.<br>
><br>
><br>
> To demonstrate what this means in practice, let me show an example. This<br>
> is the current delete objects operator:<br>
> <a href="http://pasteall.org/4641/c" target="_blank">http://pasteall.org/4641/c</a><br>
><br>
> This is how it would look in the earlier context-decoupled method:<br>
> <a href="http://pasteall.org/4640/c" target="_blank">http://pasteall.org/4640/c</a><br>
><br>
> And here it is using a separate operator and low level python function:<br>
> <a href="http://pasteall.org/4642/c" target="_blank">http://pasteall.org/4642/c</a><br>
><br>
> Advantages:<br>
> - Low level python functions can be added incrementally, not interfering<br>
> with 2.5 targets much.<br>
> - Operator design does not get complicated further.<br>
> - There is a clear distinction between operators and python functions,<br>
> permitting better API design.<br>
><br>
> Disadvantages:<br>
> - Means we will likely release 2.5 with reduced python functionality.<br>
> How much depends on efforts to improve the API.<br>
> - Duplicate code in defining operator properties and function<br>
> parameters.<br>
> - Effort is needed to get operators accessible context-less for python.<br>
> Unavoidable in any design?<br>
><br>
> Brecht.<br>
><br>
><br>
> _______________________________________________<br>
> Bf-taskforce25 mailing list<br>
> <a href="mailto:Bf-taskforce25@blender.org">Bf-taskforce25@blender.org</a><br>
> <a href="http://lists.blender.org/mailman/listinfo/bf-taskforce25" target="_blank">http://lists.blender.org/mailman/listinfo/bf-taskforce25</a><br>
><br>
_______________________________________________<br>
Bf-taskforce25 mailing list<br>
<a href="mailto:Bf-taskforce25@blender.org">Bf-taskforce25@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-taskforce25" target="_blank">http://lists.blender.org/mailman/listinfo/bf-taskforce25</a><br>
</div></div></blockquote></div><br>