﻿<?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%3AKoilz%2F2.66.1_Tutorial_-_Add_a_bool</id>
	<title>利用者:Koilz/2.66.1 Tutorial - Add a bool - 版の履歴</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%3AKoilz%2F2.66.1_Tutorial_-_Add_a_bool"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.66.1_Tutorial_-_Add_a_bool&amp;action=history"/>
	<updated>2026-07-04T23:55:27Z</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:Koilz/2.66.1_Tutorial_-_Add_a_bool&amp;diff=142947&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:Koilz/2.66.1_Tutorial_-_Add_a_bool&amp;diff=142947&amp;oldid=prev"/>
		<updated>2018-06-28T20:56:54Z</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日 (木) 20:56時点における版&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:Koilz/2.66.1_Tutorial_-_Add_a_bool&amp;diff=142946&amp;oldid=prev</id>
		<title>2013年7月1日 (月) 00:41にwiki&gt;Koilzによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.66.1_Tutorial_-_Add_a_bool&amp;diff=142946&amp;oldid=prev"/>
		<updated>2013-07-01T00:41:07Z</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;== Tutorial - Add a bool ==&lt;br /&gt;
&lt;br /&gt;
; This is short tutorial, how to add a bool property to user_preference.&lt;br /&gt;
&lt;br /&gt;
; I dont know how to setup patches with the build i use.&lt;br /&gt;
; I write fake patches and edit the source code directly.&lt;br /&gt;
&lt;br /&gt;
; This is the kind of property you are going to add.&lt;br /&gt;
&lt;br /&gt;
[[File:K_bool_00.PNG]]&lt;br /&gt;
&lt;br /&gt;
; To do this we need patch three files.&lt;br /&gt;
: blender\source\blender\makesdna\DNA_userdef_types.h&lt;br /&gt;
: blender\source\blender\makesrna\intern\rna_userdef.c&lt;br /&gt;
: blender\release\scripts\startup\bl_ui\space_userpref.py&lt;br /&gt;
&lt;br /&gt;
== DNA ==&lt;br /&gt;
&lt;br /&gt;
; DNA, struct DNA, is where the blender data is defined.&lt;br /&gt;
; There are different types, enums, structs (which memory usually allocates), etcetra.&lt;br /&gt;
&lt;br /&gt;
; Open blender\source\blender\makesdna\DNA_userdef_types.h.&lt;br /&gt;
; Look for the, eUserpref_UI_Flag, and eUserpref_UI_Flag2 enums.&lt;br /&gt;
&lt;br /&gt;
; The max used in this list is 32.&lt;br /&gt;
; Add a new one to the bottom of eUserpref_UI_Flag2. Or 3 if exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Index: source/blender/makesdna/DNA_userdef_types.h&lt;br /&gt;
===================================================================&lt;br /&gt;
-	USER_TRACKPAD_NATURAL	= (1 &amp;lt;&amp;lt; 2)&lt;br /&gt;
+	USER_TRACKPAD_NATURAL	= (1 &amp;lt;&amp;lt; 2),&lt;br /&gt;
+ 	USER_MY_PROPERTY	= (1 &amp;lt;&amp;lt; 3)&lt;br /&gt;
===================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RNA ==&lt;br /&gt;
&lt;br /&gt;
; RNA is the python interface.&lt;br /&gt;
; Before you can use the property in user preferences with python, you need to setup the interface.&lt;br /&gt;
&lt;br /&gt;
; Open blender\source\blender\makesrna\intern\rna_userdef.c&lt;br /&gt;
; Look for the, rna_def_userdef_view function.&lt;br /&gt;
; Scroll down to /* display */.&lt;br /&gt;
&lt;br /&gt;
; Copy the code from a bool type property, then add it to the end of the /* display */ section.&lt;br /&gt;
; Modify the names.&lt;br /&gt;
: &amp;quot;my_property&amp;quot;&lt;br /&gt;
: &amp;quot;uiflag2&amp;quot;&lt;br /&gt;
: USER_MY_PROPERTY&lt;br /&gt;
: &amp;quot;Property&amp;quot;&lt;br /&gt;
: &amp;quot;My Property&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Index: source/blender/makesrna/intern/rna_userdef.c&lt;br /&gt;
===================================================================&lt;br /&gt;
+	prop = RNA_def_property(srna, &amp;quot;my_property&amp;quot;, PROP_BOOLEAN, PROP_NONE);&lt;br /&gt;
+	RNA_def_property_boolean_sdna(prop, NULL, &amp;quot;uiflag2&amp;quot;, USER_MY_PROPERTY);&lt;br /&gt;
+	RNA_def_property_ui_text(prop, &amp;quot;Property&amp;quot;, &amp;quot;My Property&amp;quot;);&lt;br /&gt;
+	&lt;br /&gt;
===================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
&lt;br /&gt;
; Open blender\release\scripts\startup\bl_ui\space_userpref.py&lt;br /&gt;
&lt;br /&gt;
; Add the property to the display section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Index: release/scripts/startup/bl_ui/space_userpref.py&lt;br /&gt;
===================================================================&lt;br /&gt;
+        col.prop(view, &amp;quot;my_property&amp;quot;)&lt;br /&gt;
===================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Compile blender.&lt;br /&gt;
&lt;br /&gt;
; If all works, you should see and be able to set &amp;quot;my_property&amp;quot; in User_Preference, Interface.&lt;br /&gt;
&lt;br /&gt;
; You can now use this bool/property for conditional code in C or Python.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Koilz</name></author>
		
	</entry>
</feed>