﻿<?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%3APy%2FScripts%2FCookbook%2FPanels_and_Operators%2FPing_Pong</id>
	<title>Dev:Py/Scripts/Cookbook/Panels and Operators/Ping Pong - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3APy%2FScripts%2FCookbook%2FPanels_and_Operators%2FPing_Pong"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&amp;action=history"/>
	<updated>2026-07-04T01:15:25Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&amp;diff=101433&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&amp;diff=101433&amp;oldid=prev"/>
		<updated>2018-06-28T19:40:20Z</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日 (木) 19:40時点における版&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:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&amp;diff=101432&amp;oldid=prev</id>
		<title>wiki&gt;Brecht: moved Dev:2.5/Py/Scripts/Cookbook/Panels and Operators/Ping Pong to Dev:Py/Scripts/Cookbook/Panels and Operators/Ping Pong: remove version namespace</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&amp;diff=101432&amp;oldid=prev"/>
		<updated>2015-12-27T19:24:34Z</updated>

		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/Dev:2.5/Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&quot; class=&quot;mw-redirect&quot; title=&quot;Dev:2.5/Py/Scripts/Cookbook/Panels and Operators/Ping Pong&quot;&gt;Dev:2.5/Py/Scripts/Cookbook/Panels and Operators/Ping Pong&lt;/a&gt; to &lt;a href=&quot;/Dev:Py/Scripts/Cookbook/Panels_and_Operators/Ping_Pong&quot; title=&quot;Dev:Py/Scripts/Cookbook/Panels and Operators/Ping Pong&quot;&gt;Dev:Py/Scripts/Cookbook/Panels and Operators/Ping Pong&lt;/a&gt;: remove version namespace&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Page/Header|2.5|Reload|Next Page}}&lt;br /&gt;
&lt;br /&gt;
This script is a simple introduction to Panels and Operators using Blender Python scripting. The following description hopefully fulfills it's purpose (to describe).&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import bpy&lt;br /&gt;
 &lt;br /&gt;
class OBJECT_PT_pingpong(bpy.types.Panel):&lt;br /&gt;
    bl_label = &amp;quot;Ping Pong&amp;quot;&lt;br /&gt;
    bl_space_type = &amp;quot;PROPERTIES&amp;quot;&lt;br /&gt;
    bl_region_type = &amp;quot;WINDOW&amp;quot;&lt;br /&gt;
    bl_context = &amp;quot;object&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    is_left = True&lt;br /&gt;
 &lt;br /&gt;
    def draw_header(self, context):&lt;br /&gt;
        layout = self.layout&lt;br /&gt;
        layout.label(text=&amp;quot;&amp;quot;, icon=&amp;quot;PHYSICS&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
    def draw(self, context):&lt;br /&gt;
        layout = self.layout&lt;br /&gt;
        &lt;br /&gt;
        row = layout.row()&lt;br /&gt;
        split = row.split(percentage=0.5)&lt;br /&gt;
        col_left = split.column()&lt;br /&gt;
        col_right = split.column()&lt;br /&gt;
 &lt;br /&gt;
        if self.is_left:&lt;br /&gt;
            col_left.operator(&amp;quot;object.pingpong&amp;quot;, text=&amp;quot;Ping&amp;quot;)&lt;br /&gt;
        else:&lt;br /&gt;
            col_right.operator(&amp;quot;object.pingpong&amp;quot;, text=&amp;quot;Pong&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
class OBJECT_OT_pingpong(bpy.types.Operator):&lt;br /&gt;
    bl_label = &amp;quot;Ping Pong Operator&amp;quot;&lt;br /&gt;
    bl_idname = &amp;quot;object.pingpong&amp;quot;&lt;br /&gt;
    bl_description = &amp;quot;Move the ball&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    def execute(self, context):&lt;br /&gt;
        OBJECT_PT_pingpong.is_left = not OBJECT_PT_pingpong.is_left&lt;br /&gt;
        self.report({'INFO'}, &amp;quot;Moving the ball&amp;quot;)&lt;br /&gt;
        return {'FINISHED'}&lt;br /&gt;
    &lt;br /&gt;
def register():&lt;br /&gt;
    bpy.utils.register_module(__name__)&lt;br /&gt;
    &lt;br /&gt;
def unregister():&lt;br /&gt;
    bpy.utils.unregister_module(__name__)&lt;br /&gt;
    &lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    register()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== OBJECT_PT_pingpong ===&lt;br /&gt;
&lt;br /&gt;
The OBJECT_PT_pingpong class is to draw the gui (it is a Panel subclass).&lt;br /&gt;
&lt;br /&gt;
; ''bl_space_type''&lt;br /&gt;
: is the kind of space it shows up. Here it's the Properties Editor (&amp;lt;code&amp;gt;'PROPERTIES'&amp;lt;/code&amp;gt;).&lt;br /&gt;
; ''bl_region_type''&lt;br /&gt;
: is the kind of region it shows up in. &amp;lt;code&amp;gt;'WINDOW'&amp;lt;/code&amp;gt; is the main region of every area / space type.&lt;br /&gt;
; ''bl_context''&lt;br /&gt;
: is when the panel will show (so you will need to have an object selected, for the panel to show up). The combination of the space type &amp;lt;code&amp;gt;'PROPERTIES'&amp;lt;/code&amp;gt; and the context &amp;lt;code&amp;gt;'object'&amp;lt;/code&amp;gt; will show the panel in the Object tab of the Properties Editor.&lt;br /&gt;
; ''bl_label''&lt;br /&gt;
: is the text displayed in the header.&lt;br /&gt;
; ''is_left''&lt;br /&gt;
: is a custom class variable which we use to determine which button needs to be displayed.&lt;br /&gt;
; ''draw_header()''&lt;br /&gt;
: is used to draw extra things in the header. In our case an icon. You can also use it to draw a checkbox that enables or disables all the settings in the panel (the actual action / state change it not handled here however).&lt;br /&gt;
; ''draw()''&lt;br /&gt;
: defines the visual elements of the panel. There is a single row, which is split in half. Each half contains a column. Additionally we draw a button in one of these columns. The 'is_left' variable determines which one we draw. These buttons refer to an operator called &amp;lt;code&amp;gt;object.pingpong&amp;lt;/code&amp;gt;, which is the ''bl_idname'' of the next class.&lt;br /&gt;
&lt;br /&gt;
=== OBJECT_OT_pingpong ===&lt;br /&gt;
&lt;br /&gt;
The OBJECT_OT_pingpong class defines our custom operator.&lt;br /&gt;
&lt;br /&gt;
; ''bl_label''&lt;br /&gt;
: is the default text that's used by buttons in the user-interface (which we overwrite by for instance: text=&amp;quot;Ping&amp;quot; )&lt;br /&gt;
; ''bl_idname''&lt;br /&gt;
: is what we use to refer to this operator.&lt;br /&gt;
; ''bl_description''&lt;br /&gt;
: is the text that shows up when you hover over a button that calls this operator (a tooltip).&lt;br /&gt;
; ''execute()''&lt;br /&gt;
: is called whenever a button of this operator is clicked.&lt;br /&gt;
; ''report()''&lt;br /&gt;
: displays a message in the main header of Blender. After this line we also set the 'is_left' variable to the other value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Page/Footer|Reload|Next Page}}&lt;/div&gt;</summary>
		<author><name>wiki&gt;Brecht</name></author>
		
	</entry>
</feed>