﻿<?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=Dev%3A2.8%2FSource%2FPython%2FUpdatingScripts</id>
	<title>Dev:2.8/Source/Python/UpdatingScripts - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3A2.8%2FSource%2FPython%2FUpdatingScripts"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.8/Source/Python/UpdatingScripts&amp;action=history"/>
	<updated>2026-06-15T09:41:56Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:2.8/Source/Python/UpdatingScripts&amp;diff=153941&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.8/Source/Python/UpdatingScripts&amp;diff=153941&amp;oldid=prev"/>
		<updated>2018-06-28T21:23:19Z</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日 (木) 21:23時点における版&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=Dev:2.8/Source/Python/UpdatingScripts&amp;diff=153940&amp;oldid=prev</id>
		<title>wiki&gt;Klutz: /* Module Registration */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.8/Source/Python/UpdatingScripts&amp;diff=153940&amp;oldid=prev"/>
		<updated>2018-06-14T10:55:01Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Module Registration&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Updating Scripts from 2.7x =&lt;br /&gt;
&lt;br /&gt;
This page lists change you may need to make to your scripts so they run in 2.8x.&lt;br /&gt;
&lt;br /&gt;
== Module Registration ==&lt;br /&gt;
&lt;br /&gt;
Module registration (&amp;lt;tt&amp;gt;bpy.utils.register_module&amp;lt;/tt&amp;gt;) convenience function has been removed, since keeping track of this information adds unnecessary overhead.&lt;br /&gt;
&lt;br /&gt;
Add-ons should assign their classes to a tuple or list and register/unregister them directly.&lt;br /&gt;
&lt;br /&gt;
eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
classes = (&lt;br /&gt;
    FooClass,&lt;br /&gt;
    BarClass,&lt;br /&gt;
    BazClass,&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
def register():&lt;br /&gt;
    from bpy.utils import register_class&lt;br /&gt;
    for cls in classes:&lt;br /&gt;
        register_class(cls)&lt;br /&gt;
&lt;br /&gt;
def unregister():&lt;br /&gt;
    from bpy.utils import unregister_class&lt;br /&gt;
    for cls in reversed(classes):&lt;br /&gt;
        unregister_class(cls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To avoid having to copy &amp;amp; paste the functions above, you can use &amp;lt;tt&amp;gt;bpy.utils.register_classes_factory&amp;lt;/tt&amp;gt; utility function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
classes = (&lt;br /&gt;
    FooClass,&lt;br /&gt;
    BarClass,&lt;br /&gt;
    BazClass,&lt;br /&gt;
)&lt;br /&gt;
register, unregister = bpy.utils.register_classes_factory(classes)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have an addon with many classes, the list can be generated using this patch: https://developer.blender.org/P455&lt;br /&gt;
&lt;br /&gt;
== Class Registration ==&lt;br /&gt;
&lt;br /&gt;
See {{BugReport|52599}} for proposal and details.&lt;br /&gt;
&lt;br /&gt;
==== Access (bpy.types) ====&lt;br /&gt;
&lt;br /&gt;
Now only [Header, Menu, Operator, Panel, UIList] are accessed from &amp;lt;tt&amp;gt;bpy.types&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Generally scripts access classes they define by importing their own modules,&lt;br /&gt;
so this should not impact many scripts.&lt;br /&gt;
&lt;br /&gt;
==== Naming ====&lt;br /&gt;
&lt;br /&gt;
In Blender2.7x it was too easy to accidentally register multiple classes with the same name.&lt;br /&gt;
&lt;br /&gt;
To prevent collisions 2.8x enforces naming conventions ''(already in use across much of Blender's code-base)''&lt;br /&gt;
&lt;br /&gt;
This constraint applies to the &amp;lt;tt&amp;gt;bl_idname&amp;lt;/tt&amp;gt; of each class (or the class name which is used if no bl_idname is defined in the class).&lt;br /&gt;
&lt;br /&gt;
These are: &amp;lt;tt&amp;gt;UPPER_CASE_{SEPARATOR}_mixed_case&amp;lt;/tt&amp;gt;, in the case of a menu the regular expression is:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;tt&amp;gt;[A-Z][A-Z0-9_]*_MT_[A-Za-z0-9_]+&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each classes separator is listed below:&lt;br /&gt;
&lt;br /&gt;
* Header -&amp;gt; &amp;lt;tt&amp;gt;_HT_&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Menu -&amp;gt; &amp;lt;tt&amp;gt;_MT_&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Operator -&amp;gt; &amp;lt;tt&amp;gt;_OT_&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Panel -&amp;gt; &amp;lt;tt&amp;gt;_PT_&amp;lt;/tt&amp;gt;&lt;br /&gt;
* UIList -&amp;gt; &amp;lt;tt&amp;gt;_UL_&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid Examples:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;OBJECT_OT_fancy_tool&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;SOME_HEADER_HT_my_header&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;PANEL123_PT_myPanel&amp;lt;/tt&amp;gt; ''(lower case is preferred but mixed case is supported)''.&lt;br /&gt;
&lt;br /&gt;
At time of writing names that don't conform to this convention will warn on startup.&lt;br /&gt;
Eventually we will make this into an error, eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Warning: 'Oscurart Files Tools' doesn't contain '_PT_' with prefix &amp;amp; suffix&lt;br /&gt;
Warning: 'Oscurart Overrides' doesn't contain '_PT_' with prefix &amp;amp; suffix&lt;br /&gt;
Warning: 'Oscurart Animation Tools' doesn't contain '_PT_' with prefix &amp;amp; suffix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scene Layer Access ==&lt;br /&gt;
&lt;br /&gt;
TODO.&lt;br /&gt;
&lt;br /&gt;
== Object Selection Access ==&lt;br /&gt;
&lt;br /&gt;
TODO.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Klutz</name></author>
		
	</entry>
</feed>