﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AKazanbas%2FGsoc2009%2FBlog</id>
	<title>利用者:Kazanbas/Gsoc2009/Blog - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AKazanbas%2FGsoc2009%2FBlog"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kazanbas/Gsoc2009/Blog&amp;action=history"/>
	<updated>2026-04-21T05:35:36Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kazanbas/Gsoc2009/Blog&amp;diff=88089&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kazanbas/Gsoc2009/Blog&amp;diff=88089&amp;oldid=prev"/>
		<updated>2018-06-28T18:41:43Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 18:41時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kazanbas/Gsoc2009/Blog&amp;diff=88088&amp;oldid=prev</id>
		<title>2009年6月16日 (火) 09:36にwiki&gt;Kazanbasによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kazanbas/Gsoc2009/Blog&amp;diff=88088&amp;oldid=prev"/>
		<updated>2009-06-16T09:36:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Blog  ==&lt;br /&gt;
&lt;br /&gt;
=== May 7th  ===&lt;br /&gt;
&lt;br /&gt;
Current state: py export API is (almost?) ready, py import API is w.i.p.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== May 10th  ===&lt;br /&gt;
&lt;br /&gt;
Baby-steps: bpy.meshes[&amp;quot;Cube&amp;quot;].verts[0].co is a vector and is editable. &lt;br /&gt;
&lt;br /&gt;
Why is bpy.meshes.verts readonly? Is this RNA limitation? Probably this has to do something with EditMesh conversion i.e. memory allocation effectiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Most important:''' I have to learn RNA internals to answer these questions. Start with using RNA... then how RNA stores data, then... and finally how RNA gets exposed to python.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== May 12th  ===&lt;br /&gt;
&lt;br /&gt;
Studying RNA. Will dump here new things I get to know. &lt;br /&gt;
&lt;br /&gt;
FIXED: Tell brecht about typos [http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNAExampleCode here] in set_vertex_selected in calls to RNA_pointer_create, RNA_id_pointer_create and RNA_property_identifier first arg is redundant, replace RNA_property_float_set_array with RNA_property_float_set_index.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
What is &amp;quot;ID struct&amp;quot;, &amp;quot;ID property&amp;quot;? The description of the ID struct RNA definition says:&amp;amp;nbsp;&amp;quot;Base type for datablocks, defining a unique name, linking from other libraries and garbage collection.&amp;quot;. So &amp;quot;ID struct&amp;quot; means ID struct's derived struct?&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== May 14th&amp;lt;br&amp;gt;  ===&lt;br /&gt;
&lt;br /&gt;
So, RNA allows to define RNA structs. RNA struct can then be associated with an SDNA struct. Each struct can have properties, functions (methods?). &lt;br /&gt;
&lt;br /&gt;
==== RNA auto-generation  ====&lt;br /&gt;
&lt;br /&gt;
Curiously, RNA_blender_cpp.h and RNA_blender.h generated by makesrna are not used? They serve as demos of cool stuff that can be done with RNA?&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
For rna_mesh.c (compiled on preprocess and runtime), makesrna generates rna_mesh_gen.c which contains functions that operate on RNA structs and property RNAs that describe each property and refer to those functions. Functions include _get, _set, _length, _begin, _next, _end, etc. Property RNAs are named like &amp;quot;rna_[struct]_[property]&amp;quot;, functions - like &amp;quot;[struct]_[property]_[function]&amp;quot; (e.g. rna_Mesh_verts, Mesh_verts_get). &lt;br /&gt;
&lt;br /&gt;
In rna_mesh.c - the runtime part - manually written functions&amp;amp;nbsp;exist like &amp;quot;rna_[struct]_[property]_[function]&amp;quot;, these are referred to by generated functions in rna_mesh_gen.c and replace them. &lt;br /&gt;
&lt;br /&gt;
==== Summary&amp;lt;br&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
===== makesrna  =====&lt;br /&gt;
&lt;br /&gt;
So the preprocess works like this:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*generate RNA database by calling definition functions (like rna_mesh_define) specified in PROCESS_ITEMS. The functions define all structs and their properties.&amp;lt;br&amp;gt; &lt;br /&gt;
*produce _gen.c files&lt;br /&gt;
&lt;br /&gt;
_gen.c files can be built then. &lt;br /&gt;
&lt;br /&gt;
===== Now I know that...  =====&lt;br /&gt;
&lt;br /&gt;
...RNA is an API to ''define, examine and manipulate structures at runtime''. &lt;br /&gt;
&lt;br /&gt;
=== May 16th  ===&lt;br /&gt;
&lt;br /&gt;
Collections can take form of arrays and dictionaries (associative array). To lookup values, use RNA_property_collection_lookup_int for arrays and&amp;amp;nbsp;RNA_property_collection_lookup_string for dicts.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Fixed [[BlenderDev/Blender2.5/RNAExampleCode|this]] ([http://wiki.blender.org/index.php?title=BlenderDev/Blender2.5/RNAExampleCode&amp;amp;diff=prev&amp;amp;oldid=75113 diff]). &lt;br /&gt;
&lt;br /&gt;
Interesting excerpt from [[BlenderDev/Blender2.5/RNA|here]], could help understand what ID struct is:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;blockquote&amp;gt;A pointer to an RNA struct is always wrapped in a PointerRNA struct. This contains the actual data pointer and the struct type. It also contains the data pointer and the type of the ID datablock that the data belongs to. ''This is necessary in some cases, as for example a vertex by itself does not provide enough information to update the dependency graph, we need to know the mesh this vertex came from.''&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
IDEA: Why not, in RNA, allow collections to be editable? Methods like add, insert, remove, etc.? &lt;br /&gt;
&lt;br /&gt;
Learnt what [[BlenderDev/ID Property|ID props]] and ID structs are. Thanks ideasman_42! &lt;br /&gt;
&lt;br /&gt;
=== May 17th  ===&lt;br /&gt;
&lt;br /&gt;
If generic collection add is impossible then maybe &lt;br /&gt;
&amp;lt;pre&amp;gt;object = bpy.data.add_object(ob_type)&lt;br /&gt;
object.add_geometry(verts, faces, ...)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
How about using operators for this? Find more about it.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[BlenderDev/Blender2.5/PythonAPI#macro-style-access|Macro-style access]]? &lt;br /&gt;
&lt;br /&gt;
=== May 17th - Sunday meeting  ===&lt;br /&gt;
&lt;br /&gt;
Discussed with brecht about add/remove functions on RNA collection. He thinks it's a good idea. &lt;br /&gt;
&lt;br /&gt;
Hint: RNA already handles getting/setting array items - learn from this code to find out all the different kinds of lists used. &lt;br /&gt;
&lt;br /&gt;
Come up with a proposal and send it to ML? &lt;br /&gt;
&lt;br /&gt;
=== May 20th  ===&lt;br /&gt;
&lt;br /&gt;
According to the code in RNA_def_property_collection_sdna, RNA currently supports two types of lists: regular C arrays and ListBase linked lists.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
So, to implement collection add, I need to find functions that add to listbase and find out how to reallocate an array.&lt;br /&gt;
&lt;br /&gt;
=== May 23rd ===&lt;br /&gt;
Linked lists are modified with BLI_addhead, BLI_addtail and other funcs declared in source/blender/blenlib/BLI_listbase.h. Arrays, at least vertices, edges and faces in Mesh, are allocated with MEM_callocN (see load_editMesh).&lt;br /&gt;
&lt;br /&gt;
====EditMesh====&lt;br /&gt;
EditMesh is created on enter edit mode (make_editMesh in ED_object_enter_editmode), all geometry modifications like extrude are done on EditMesh, once we exit edit mode (ED_object_exit_editmode), EditMesh is converted back to Mesh (load_editMesh). In EditMesh verts and faces are linked lists.&lt;br /&gt;
&lt;br /&gt;
====TODO====&lt;br /&gt;
*EditMesh is efficient only when doing a series of operations? If so, RNA collection `add` on Mesh could directly add verts. Still need to figure out how to keep edges consistent with faces? I still don't know how these two are related?&lt;br /&gt;
*also see other examples of collection add, e.g. how new object is added, new scene, new mesh, new material. These do additional operations apart from listbase append?&lt;br /&gt;
&lt;br /&gt;
====svn====&lt;br /&gt;
Oops, spoiled my svn branch with a wrong merge command :-)&lt;br /&gt;
&lt;br /&gt;
Will read svn-book to fix this.&lt;br /&gt;
&lt;br /&gt;
FIXED. When doing merge it's important to write down the right-hand revision and use it on next merge.&lt;br /&gt;
&lt;br /&gt;
=== May 26th ===&lt;br /&gt;
====tdd?====&lt;br /&gt;
IDEA: use TDD to validate new RNA collection methods.&lt;br /&gt;
&lt;br /&gt;
Haven't used [http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C C testing frameworks] before.&lt;br /&gt;
&lt;br /&gt;
So, [http://check.sourceforge.net/ check] or [http://cmockery.googlecode.com/svn/trunk/doc/index.html Cmockery]?&lt;br /&gt;
====mainstream====&lt;br /&gt;
*discussed with ideasman and brecht, got hints on what to do&lt;br /&gt;
*started obj exporter conversion&lt;br /&gt;
*renamed (in my branch) &amp;quot;exec&amp;quot; bpy operator method to &amp;quot;execu&amp;quot; for py2.5 compat.&lt;br /&gt;
&lt;br /&gt;
NEXT: get operator stuff working, continue exporter conversion&lt;br /&gt;
&lt;br /&gt;
=== May 27th ===&lt;br /&gt;
Operator are not getting context in exec, invoke or poll.&lt;br /&gt;
&lt;br /&gt;
For exporter, I need &amp;lt;strong&amp;gt;context&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Poll isn't called yet?&lt;br /&gt;
&lt;br /&gt;
Also, operator [[BlenderDev/Blender2.5/WinterCamp/TechnicalDesign#Operator_Prototype_Code|property definition]] doesn't work?&lt;br /&gt;
&lt;br /&gt;
=== June 1st ===&lt;br /&gt;
Whew!&lt;br /&gt;
&lt;br /&gt;
Spent lots of time to figure out that in bpy getattr on RNA_Context objects does some magic to provide props like &amp;quot;active_object&amp;quot;, etc. (see pyrna_struct_getattro). The absense &amp;quot;active_object&amp;quot; in RNA_Context definition confused me.&lt;br /&gt;
&lt;br /&gt;
So, to pass context to py operators I just need to pass it as is, pointer to bContext!&lt;br /&gt;
&lt;br /&gt;
Oops!&lt;br /&gt;
&lt;br /&gt;
According to my [[User:Kazanbas/Gsoc2009/Proposal#Project_Schedule|project schedule]], by mid June basic data imp/export should be ready... :-)&lt;br /&gt;
&lt;br /&gt;
=== June 2nd ===&lt;br /&gt;
Ok, now that context is passed to operators, I can continue with OBJ exporter conversion. I'll read [http://www.python.org/dev/peps/pep-0008/ PEP-8] first.&lt;br /&gt;
Also, on todo: &lt;br /&gt;
*bring file selector back&lt;br /&gt;
*generic `extend` for RNA collection&lt;br /&gt;
&lt;br /&gt;
=== June 9th ===&lt;br /&gt;
Painting over, fun begins!&lt;br /&gt;
&lt;br /&gt;
Started OBJECT_OT_apply_transform...&lt;br /&gt;
&lt;br /&gt;
Read again http://lists.blender.org/pipermail/bf-taskforce25/2009-March/000544.html that kaito pointed me to a long ago.&lt;br /&gt;
&lt;br /&gt;
Interestingly the new python API is just a plain mapping to C!&lt;br /&gt;
&lt;br /&gt;
Will dive into Python C API - need to know how object allocation/deallocation works to be able to create/delete meshes for temporary use.&lt;br /&gt;
&lt;br /&gt;
=== June 10th ===&lt;br /&gt;
*Added Main.add_mesh and Mesh.copy.&lt;br /&gt;
*Rewrote Mesh.copy to copy data between meshes.&lt;br /&gt;
*Couldn't RNA-wrap obmat field of Object.&lt;br /&gt;
&lt;br /&gt;
Now looking at operator property declaration. For file selector we need a string property declared. Then WM_event_add_fileselect(bContext*, wmOperator*) can be wrapped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== June 16th ===&lt;br /&gt;
What's been done:&lt;br /&gt;
*string property definable on operators - property definition code is hackish!&lt;br /&gt;
*imp/exp operator registration working. Implemented in Python.&lt;br /&gt;
*file selector working&lt;br /&gt;
*basic OBJ exporter working&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
*what other important things exporter needs?&lt;br /&gt;
*generic rna add, remove for importer&lt;br /&gt;
&lt;br /&gt;
== TODO  ==&lt;br /&gt;
&lt;br /&gt;
*apply [http://www.python.org/dev/peps/pep-0008/ PEP-8] in scripts&lt;br /&gt;
*&amp;lt;strike&amp;gt;learn how to use RNA&amp;lt;/strike&amp;gt; &lt;br /&gt;
*&amp;lt;strike&amp;gt;quick brain-dump: RNA collection modification is difficult/impossible, better study prev py APIs, find patterns and design a new API based on custom RNA funcs&amp;amp;nbsp;&amp;lt;/strike&amp;gt; RNA collection add/remove is possible and desirable &lt;br /&gt;
*besides adding objects and object data any other things needed for importers? study existing import scripts to answer this&amp;lt;br&amp;gt; &lt;br /&gt;
*refresh my memory on python syntax using [http://pleac.sourceforge.net/pleac_python/index.html this] and other resources &lt;br /&gt;
*the result should go to `end-user spec` &lt;br /&gt;
*RNA (is said to be used?) in animation, animation is about creating keys, how RNA handles this? does it? &lt;br /&gt;
*&amp;lt;strike&amp;gt;aswer the question: is it possible to define a single generic `new` method that will work on meshes, objects, scenes and other collections?&amp;lt;/strike&amp;gt; yep, indeed&lt;br /&gt;
*how uvs are combined/related with verts and faces, are there tfaces? need to refresh my memory on these (although there's probably not much&amp;amp;nbsp;:-) this could be helpful for Chingiz too &lt;br /&gt;
*how edges affect the topology? do they at all?&lt;/div&gt;</summary>
		<author><name>wiki&gt;Kazanbas</name></author>
		
	</entry>
</feed>