On Mon, Dec 1, 2008 at 12:48 PM, Timothy Baldridge <span dir="ltr">&lt;<a href="mailto:tbaldridge@gmail.com">tbaldridge@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">&gt; What remains is a lot of calls like &quot;Add constraint&quot; or &quot;Delete<br>
&gt; modifier&quot;, which is currently a very undefined piece of Blender code,<br>
&gt; closely tied to the buttons for such options. At this moment it&#39;s well<br>
&gt; possible we don&#39;t tackle all of that via Operators, still allowing<br>
&gt; direct callbacks to buttons (just for the sake of simpler migration).<br>
<br>
</div>It seems to me that part of these issues come from the fact that we&#39;re<br>
trying to squish the rather procedural API of C into the OOP based<br>
programming of Python.</blockquote><div>&nbsp;</div><div>Nah it&#39;s not too bad.&nbsp; A lot of things map fairly well.&nbsp; I don&#39;t think we&#39;ve really had much trouble in this area.&nbsp; It&#39;s not nearly as hard as it might look.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
I&#39;m assuming the issue with things like modifier stacks is that<br>
currently every list of objects in Blender uses a different method of<br>
data modifiying? So in some cases we have linked lists and other times<br>
we have vectors (arrays). Perhaps what we need is a Standard Template<br>
Library for blender. In this way we can make the internal Blender code<br>
more closely match the Python code.</blockquote><div>&nbsp;</div><div>Not really, the modifier system works using a quasi-OOP design itself, using DerivedMesh to access data.&nbsp; And we do have standard functions for manipulating several kinds of lists.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
It seems to me that the best way way to have Python access the<br>
modifier stacks would be with Python lists:<br>
<br>
obj = getObject(&quot;MyBlenderObject&quot;)<br>
mod = BuildModifyer()<br>
obj.modifiers.append(mod)</blockquote><div>&nbsp;</div><div>That&#39;s how most of the py API works already.&nbsp; It&#39;s actually not all that hard to write custom list wrappers when you need them. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
But while we&#39;re on the subject of rewriting everything, should we<br>
stick with C instead of C++? Now I know, most C++ code is often (or<br>
perhaps most times) abused, but well written C++ code can aid<br>
readability. It seems to me that allot of Blender code could be<br>
simplified by using the OOP-ness of C++. &nbsp;In general the 3d tool set<br>
is object based. We take a object and set the transform and rotation<br>
attributes of that object. We use modifiers to warp object. It seems<br>
that the code should express this to some extent. In the end it&#39;s<br>
really 6 of one half a dozen of the other, but C++ would help new<br>
coders make a easier transition from Python to C++.</blockquote><div><br>That&#39;d require rewriting most of the core blender code, which isn&#39;t really worth it for the benefits (especially since C++ is so much more complicated than C).<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
</blockquote></div>The issue isn&#39;t really the fact we&#39;re using C, or any procedural/OOP clashes (remember python supports both an OOP and a procedural approach to things).&nbsp; What ton was talking about specifically is that the new API should always try and use the appropriate C API in blender to do things, even if the part of the code someone&#39;s trying to wrap in python doesn&#39;t use that API itself yet (in which case the py coder would have to rework it to use the API, or something like that).<br>
<br>Joe<br>