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">&lt;<a href="mailto:cessen@cessen.com">cessen@cessen.com</a>&gt;</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&#39;s<br>
written much more clearly, and operators don&#39;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&#39;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 &lt;<a href="mailto:brecht@blender.org">brecht@blender.org</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; After some more discussion on IRC, here is another proposal, not unlike<br>
&gt; the Blender API one, but with some tweaks to get it more feasible and<br>
&gt; incremental.<br>
&gt;<br>
&gt; a) Blender 2.5 is about tools and the event system, and operators remain<br>
&gt; just that. They are always context sensitive. Getting blender<br>
&gt; functionality working as such tools is the #1 priority for 2.5.<br>
&gt;<br>
&gt; b) A secondary low level API provides access for python scripts. This is<br>
&gt; very much like the Blender API proposal. What I would like to see<br>
&gt; different there however is that it should be defined in the editor<br>
&gt; modules (close to the operators), and not have the operators call any<br>
&gt; auto-generated functions.<br>
&gt;<br>
&gt; c) Operators are still available for python to call, but they are<br>
&gt; context sensitive. This means they are mostly useful in macro like<br>
&gt; scripts. The low level API permits to do context-less operations.<br>
&gt;<br>
&gt;<br>
&gt; To demonstrate what this means in practice, let me show an example. This<br>
&gt; is the current delete objects operator:<br>
&gt; <a href="http://pasteall.org/4641/c" target="_blank">http://pasteall.org/4641/c</a><br>
&gt;<br>
&gt; This is how it would look in the earlier context-decoupled method:<br>
&gt; <a href="http://pasteall.org/4640/c" target="_blank">http://pasteall.org/4640/c</a><br>
&gt;<br>
&gt; And here it is using a separate operator and low level python function:<br>
&gt; <a href="http://pasteall.org/4642/c" target="_blank">http://pasteall.org/4642/c</a><br>
&gt;<br>
&gt; Advantages:<br>
&gt; - Low level python functions can be added incrementally, not interfering<br>
&gt; with 2.5 targets much.<br>
&gt; - Operator design does not get complicated further.<br>
&gt; - There is a clear distinction between operators and python functions,<br>
&gt; permitting better API design.<br>
&gt;<br>
&gt; Disadvantages:<br>
&gt; - Means we will likely release 2.5 with reduced python functionality.<br>
&gt; How much depends on efforts to improve the API.<br>
&gt; - Duplicate code in defining operator properties and function<br>
&gt; parameters.<br>
&gt; - Effort is needed to get operators accessible context-less for python.<br>
&gt; Unavoidable in any design?<br>
&gt;<br>
&gt; Brecht.<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Bf-taskforce25 mailing list<br>
&gt; <a href="mailto:Bf-taskforce25@blender.org">Bf-taskforce25@blender.org</a><br>
&gt; <a href="http://lists.blender.org/mailman/listinfo/bf-taskforce25" target="_blank">http://lists.blender.org/mailman/listinfo/bf-taskforce25</a><br>
&gt;<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>