﻿<?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%2FCode_snippets%2FProperties</id>
	<title>Dev:Py/Scripts/Cookbook/Code snippets/Properties - 版の履歴</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%2FCode_snippets%2FProperties"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Code_snippets/Properties&amp;action=history"/>
	<updated>2026-08-18T23:27:51Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Code_snippets/Properties&amp;diff=104755&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/Code_snippets/Properties&amp;diff=104755&amp;oldid=prev"/>
		<updated>2018-06-28T19:43:22Z</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:43時点における版&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/Code_snippets/Properties&amp;diff=104754&amp;oldid=prev</id>
		<title>wiki&gt;Brecht: moved Dev:2.5/Py/Scripts/Cookbook/Code snippets/Properties to Dev:Py/Scripts/Cookbook/Code snippets/Properties: remove version namespace</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Py/Scripts/Cookbook/Code_snippets/Properties&amp;diff=104754&amp;oldid=prev"/>
		<updated>2015-12-27T19:24:33Z</updated>

		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Properties&quot; class=&quot;mw-redirect&quot; title=&quot;Dev:2.5/Py/Scripts/Cookbook/Code snippets/Properties&quot;&gt;Dev:2.5/Py/Scripts/Cookbook/Code snippets/Properties&lt;/a&gt; to &lt;a href=&quot;/Dev:Py/Scripts/Cookbook/Code_snippets/Properties&quot; title=&quot;Dev:Py/Scripts/Cookbook/Code snippets/Properties&quot;&gt;Dev:Py/Scripts/Cookbook/Code snippets/Properties&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.5x|Dev:2.5/Py/Scripts/Cookbook/Code_snippets/World_view_renderer|Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface}}&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
==RNA properties versus ID properties==&lt;br /&gt;
In Blender there are two different types of properties: ID properties and RNA properties. An RNA property extends the definition of a given data structure. It must be declared before it is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
bpy.types.Object.myRnaInt = bpy.props.IntProperty(&lt;br /&gt;
    name = &amp;quot;RNA int&amp;quot;,&lt;br /&gt;
    min = -100,&lt;br /&gt;
    max = 100,&lt;br /&gt;
    default = 33)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once declared, RNA properties are accessed with the dot syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cube.myRnaInt = -99&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the declaration of the RNA property &amp;lt;code&amp;gt;myRnaInt&amp;lt;/code&amp;gt; extends the definition of the Object data structure, every object will have this property.&lt;br /&gt;
&lt;br /&gt;
An ID property is added to a single datablock, without affecting other data of the same type. It does not need any prior declaration, but is automatically defined when it is set, e.g&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cube.data[&amp;quot;MyIdInt&amp;quot;] = 4711&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ID properties can only be integers, floats, and strings; other types will be automatically converted. Hence the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cube.data[&amp;quot;MyIdBool&amp;quot;] = True&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines an integer ID property and not a boolean.&lt;br /&gt;
&lt;br /&gt;
Properties are stored in the blend file, but property declarations are not.&lt;br /&gt;
&lt;br /&gt;
Here is a script wich creates three meshes, assigns various properties and prints their values to the console.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
# File properties.py&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
import bpy&lt;br /&gt;
from bpy.props import *&lt;br /&gt;
&lt;br /&gt;
# Clean the scene and create some objects&lt;br /&gt;
bpy.ops.object.select_by_type(type='MESH')&lt;br /&gt;
bpy.ops.object.delete()&lt;br /&gt;
bpy.ops.mesh.primitive_cube_add(location=(-3,0,0))&lt;br /&gt;
cube = bpy.context.object&lt;br /&gt;
bpy.ops.mesh.primitive_cylinder_add(location=(0,0,0))&lt;br /&gt;
cyl = bpy.context.object&lt;br /&gt;
bpy.ops.mesh.primitive_uv_sphere_add(location=(3,0,0))&lt;br /&gt;
sphere = bpy.context.object&lt;br /&gt;
&lt;br /&gt;
# Define RNA props for every object&lt;br /&gt;
bpy.types.Object.myRnaInt = IntProperty(&lt;br /&gt;
    name = &amp;quot;RNA int&amp;quot;, &lt;br /&gt;
    min = -100, max = 100,&lt;br /&gt;
    default = 33)&lt;br /&gt;
&lt;br /&gt;
bpy.types.Object.myRnaFloat = FloatProperty(&lt;br /&gt;
    name = &amp;quot;RNA float&amp;quot;, &lt;br /&gt;
    default = 12.345,&lt;br /&gt;
    min = 1, max = 20)&lt;br /&gt;
&lt;br /&gt;
bpy.types.Object.myRnaString = StringProperty(&lt;br /&gt;
    name = &amp;quot;RNA string&amp;quot;, &lt;br /&gt;
    default = &amp;quot;Ribonucleic acid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
bpy.types.Object.myRnaBool = BoolProperty(&lt;br /&gt;
    name = &amp;quot;RNA bool&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
bpy.types.Object.myRnaEnum = EnumProperty(&lt;br /&gt;
    items = [('one', 'eins', 'un'), &lt;br /&gt;
            ('two', 'zwei', 'deux'), &lt;br /&gt;
            ('three', 'drei', 'trois')],&lt;br /&gt;
    name = &amp;quot;RNA enum&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Set the cube's RNA props&lt;br /&gt;
cube.myRnaInt = -99&lt;br /&gt;
cube.myRnaFloat = -1&lt;br /&gt;
cube.myRnaString = &amp;quot;I am an RNA prop&amp;quot;&lt;br /&gt;
cube.myRnaBool = True&lt;br /&gt;
cube.myRnaEnum = 'three'&lt;br /&gt;
&lt;br /&gt;
# Create ID props fore cube mesh by setting them.&lt;br /&gt;
cube.data[&amp;quot;MyIdInt&amp;quot;] = 4711&lt;br /&gt;
cube.data[&amp;quot;MyIdFloat&amp;quot;] = 666.777&lt;br /&gt;
cube.data[&amp;quot;MyIdString&amp;quot;] = &amp;quot;I am an ID prop&amp;quot;&lt;br /&gt;
cube.data[&amp;quot;MyIdBool&amp;quot;] = True&lt;br /&gt;
&lt;br /&gt;
# Print all properties&lt;br /&gt;
def printProp(rna, path):&lt;br /&gt;
    try:&lt;br /&gt;
        print('    %s%s =' % (rna.name, path), eval(&amp;quot;rna&amp;quot;+path))&lt;br /&gt;
    except:&lt;br /&gt;
        print('    %s%s does not exist' % (rna.name, path))&lt;br /&gt;
&lt;br /&gt;
for ob in [cube, cyl, sphere]:&lt;br /&gt;
    print(&amp;quot;%s RNA properties&amp;quot; % ob)&lt;br /&gt;
    printProp(ob, &amp;quot;.myRnaInt&amp;quot;)&lt;br /&gt;
    printProp(ob, &amp;quot;.myRnaFloat&amp;quot;)&lt;br /&gt;
    printProp(ob, &amp;quot;.myRnaString&amp;quot;)&lt;br /&gt;
    printProp(ob, &amp;quot;.myRnaBool&amp;quot;)&lt;br /&gt;
    printProp(ob, &amp;quot;.myRnaEnum&amp;quot;)&lt;br /&gt;
    print(&amp;quot;%s ID properties&amp;quot; % ob.data)&lt;br /&gt;
    printProp(ob.data, '[&amp;quot;MyIdInt&amp;quot;]')&lt;br /&gt;
    printProp(ob.data, '[&amp;quot;MyIdFloat&amp;quot;]')&lt;br /&gt;
    printProp(ob.data, '[&amp;quot;MyIdString&amp;quot;]')&lt;br /&gt;
    printProp(ob.data, '[&amp;quot;MyIdBool&amp;quot;]')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The script print the following output to the console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;bpy_struct, Object(&amp;quot;Cube&amp;quot;)&amp;gt; RNA properties&lt;br /&gt;
    Cube.myRnaInt = -99&lt;br /&gt;
    Cube.myRnaFloat = 1.0&lt;br /&gt;
    Cube.myRnaString = I am an RNA prop&lt;br /&gt;
    Cube.myRnaBool = True&lt;br /&gt;
    Cube.myRnaEnum = three&lt;br /&gt;
&amp;lt;bpy_struct, Mesh(&amp;quot;Cube.001&amp;quot;)&amp;gt; ID properties&lt;br /&gt;
    Cube.001[&amp;quot;MyIdInt&amp;quot;] = 4711&lt;br /&gt;
    Cube.001[&amp;quot;MyIdFloat&amp;quot;] = 666.777&lt;br /&gt;
    Cube.001[&amp;quot;MyIdString&amp;quot;] = I am an ID prop&lt;br /&gt;
    Cube.001[&amp;quot;MyIdBool&amp;quot;] = 1&lt;br /&gt;
&amp;lt;bpy_struct, Object(&amp;quot;Cylinder&amp;quot;)&amp;gt; RNA properties&lt;br /&gt;
    Cylinder.myRnaInt = 33&lt;br /&gt;
    Cylinder.myRnaFloat = 12.345000267028809&lt;br /&gt;
    Cylinder.myRnaString = Ribonucleic acid&lt;br /&gt;
    Cylinder.myRnaBool = False&lt;br /&gt;
    Cylinder.myRnaEnum = one&lt;br /&gt;
&amp;lt;bpy_struct, Mesh(&amp;quot;Cylinder&amp;quot;)&amp;gt; ID properties&lt;br /&gt;
    Cylinder[&amp;quot;MyIdInt&amp;quot;] does not exist&lt;br /&gt;
    Cylinder[&amp;quot;MyIdFloat&amp;quot;] does not exist&lt;br /&gt;
    Cylinder[&amp;quot;MyIdString&amp;quot;] does not exist&lt;br /&gt;
    Cylinder[&amp;quot;MyIdBool&amp;quot;] does not exist&lt;br /&gt;
&amp;lt;bpy_struct, Object(&amp;quot;Sphere&amp;quot;)&amp;gt; RNA properties&lt;br /&gt;
    Sphere.myRnaInt = 33&lt;br /&gt;
    Sphere.myRnaFloat = 12.345000267028809&lt;br /&gt;
    Sphere.myRnaString = Ribonucleic acid&lt;br /&gt;
    Sphere.myRnaBool = False&lt;br /&gt;
    Sphere.myRnaEnum = one&lt;br /&gt;
&amp;lt;bpy_struct, Mesh(&amp;quot;Sphere&amp;quot;)&amp;gt; ID properties&lt;br /&gt;
    Sphere[&amp;quot;MyIdInt&amp;quot;] does not exist&lt;br /&gt;
    Sphere[&amp;quot;MyIdFloat&amp;quot;] does not exist&lt;br /&gt;
    Sphere[&amp;quot;MyIdString&amp;quot;] does not exist&lt;br /&gt;
    Sphere[&amp;quot;MyIdBool&amp;quot;] does not exist&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Code_Snippets_PropsCube.png|640px]]&lt;br /&gt;
All three objects have RNA properties, because they are an extension of the Object datatype. The cube's RNA properties have the values assigned by the program, except the &amp;lt;code&amp;gt;myRnaFloat&amp;lt;/code&amp;gt; value which is not allowed to be smaller than 1. No properties were set for the cylinder and the sphere, but they still have RNA properties with default values.&lt;br /&gt;
&lt;br /&gt;
The cube mesh has ID properties set by the program. Note that the MyIdBool property is the integer 1 rather than the boolean True.&lt;br /&gt;
&lt;br /&gt;
The object properties are displayed in the in the UI panel under Properties, and also in the object context. The mesh properties be found in the mesh context.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Code_Snippets_PropsSphere.png|640px]]&lt;br /&gt;
As we saw in the printout, we can access the sphere object's RNA properties. However, they do not show up in user interface. Apparently only set properties are stored in the Object data block. We can use an RNA property that has not been set in a script; it then takes the default value. In contrast, a error is raised if we try to access a non-set ID property.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Code_Snippets_PropsLinkedCube.png|640px]]&lt;br /&gt;
Properties are compatible with file linking. Save the blend file and link the cube into a new file. Both the RNA and ID properties appear in the new file, but they are greyed out because they can not be accessed in the linking file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Code_Snippets_PropsProxyCube.png|640px]]&lt;br /&gt;
If we proxify the linked cube, the object properties belong to the proxy object datablock, and can be modified in the linking file. In contrast, the mesh properties belong to the mesh datablock and can not be changed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Code_Snippets_PropsBlenderRestarted.png|640px]]&lt;br /&gt;
As mentioned above, properties are stored in the blend files but property declarations are not. Quit and restart Blender and open the file which we save above. The &amp;lt;code&amp;gt;myRnaBool&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;myRnaEnum&amp;lt;/code&amp;gt; properties have been converted to integers. They were in fact stored as integers all the time, but were displayed as booleans and enums due to the property declarations stored in the Object data type.&lt;br /&gt;
&lt;br /&gt;
To confirm that the RNA properties have turned into ID properties, execute the following script.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
# File print_props.py&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
import bpy&lt;br /&gt;
&lt;br /&gt;
def printProp(rna, path):&lt;br /&gt;
    try:&lt;br /&gt;
        print('    %s%s =' % (rna.name, path), eval(&amp;quot;rna&amp;quot;+path))&lt;br /&gt;
    except:&lt;br /&gt;
        print('    %s%s does not exist' % (rna.name, path))&lt;br /&gt;
&lt;br /&gt;
ob = bpy.context.object&lt;br /&gt;
print(&amp;quot;%s RNA properties&amp;quot; % ob)&lt;br /&gt;
printProp(ob, &amp;quot;.myRnaInt&amp;quot;)&lt;br /&gt;
printProp(ob, &amp;quot;.myRnaFloat&amp;quot;)&lt;br /&gt;
printProp(ob, &amp;quot;.myRnaString&amp;quot;)&lt;br /&gt;
printProp(ob, &amp;quot;.myRnaBool&amp;quot;)&lt;br /&gt;
printProp(ob, &amp;quot;.myRnaEnum&amp;quot;)&lt;br /&gt;
print(&amp;quot;%s ID properties&amp;quot; % ob)&lt;br /&gt;
printProp(ob, '[&amp;quot;myRnaInt&amp;quot;]')&lt;br /&gt;
printProp(ob, '[&amp;quot;myRnaFloat&amp;quot;]')&lt;br /&gt;
printProp(ob, '[&amp;quot;myRnaString&amp;quot;]')&lt;br /&gt;
printProp(ob, '[&amp;quot;myRnaBool&amp;quot;]')&lt;br /&gt;
printProp(ob, '[&amp;quot;myRnaEnum&amp;quot;]')&lt;br /&gt;
print(&amp;quot;%s ID properties&amp;quot; % ob.data)&lt;br /&gt;
printProp(ob.data, '[&amp;quot;MyIdInt&amp;quot;]')&lt;br /&gt;
printProp(ob.data, '[&amp;quot;MyIdFloat&amp;quot;]')&lt;br /&gt;
printProp(ob.data, '[&amp;quot;MyIdString&amp;quot;]')&lt;br /&gt;
printProp(ob.data, '[&amp;quot;MyIdBool&amp;quot;]')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This script prints the following text to the terminal.&lt;br /&gt;
&amp;lt;pre&lt;br /&gt;
&amp;lt;bpy_struct, Object(&amp;quot;Cube&amp;quot;)&amp;gt; RNA properties&lt;br /&gt;
    Cube.myRnaInt does not exist&lt;br /&gt;
    Cube.myRnaFloat does not exist&lt;br /&gt;
    Cube.myRnaString does not exist&lt;br /&gt;
    Cube.myRnaBool does not exist&lt;br /&gt;
    Cube.myRnaEnum does not exist&lt;br /&gt;
&amp;lt;bpy_struct, Object(&amp;quot;Cube&amp;quot;)&amp;gt; ID properties&lt;br /&gt;
    Cube[&amp;quot;myRnaInt&amp;quot;] = -99&lt;br /&gt;
    Cube[&amp;quot;myRnaFloat&amp;quot;] = 1.0&lt;br /&gt;
    Cube[&amp;quot;myRnaString&amp;quot;] = I am an RNA prop&lt;br /&gt;
    Cube[&amp;quot;myRnaBool&amp;quot;] = 1&lt;br /&gt;
    Cube[&amp;quot;myRnaEnum&amp;quot;] = 2&lt;br /&gt;
&amp;lt;bpy_struct, Mesh(&amp;quot;Cube.001&amp;quot;)&amp;gt; ID properties&lt;br /&gt;
    Cube.001[&amp;quot;MyIdInt&amp;quot;] = 4711&lt;br /&gt;
    Cube.001[&amp;quot;MyIdFloat&amp;quot;] = 666.777&lt;br /&gt;
    Cube.001[&amp;quot;MyIdString&amp;quot;] = I am an ID prop&lt;br /&gt;
    Cube.001[&amp;quot;MyIdBool&amp;quot;] = 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If we restore the property declarations, the ID properties are converted into RNA properties again.&lt;br /&gt;
&lt;br /&gt;
==Bone roll==&lt;br /&gt;
This program expects that the active object is an armature. It stores the roll angle of each editbone as a property of the corresponding bone, and finally prints the property values in the terminal. When executed with the armature in the picture selected, the terminal output is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Head    3.1416&lt;br /&gt;
    Arm_L   1.5708&lt;br /&gt;
    Leg_R  -2.7646&lt;br /&gt;
    Leg_L   2.7646&lt;br /&gt;
    Arm_R  -1.5708&lt;br /&gt;
    Torso   3.1416&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the property values are in radians. Angles are displayed in the viewport in degrees, but when accessed from Python they are expressed in radians. However, the Roll property is just some float property, and Blender does not know that is supposed to be an angle.&lt;br /&gt;
&lt;br /&gt;
To find the property in the user interface, we need to select the bone in pose mode and then toggle into edit mode, as shown in the picture.&lt;br /&gt;
[[File:Code_Snippets_BoneRoll.png|640px]]&lt;br /&gt;
This code is actually somewhat useful for a script that retargets motion capture data. In order to do so properly, we need to know the roll angles. However, they can not be found if the armature has been linked into another file and proxified. To access the roll angle &amp;lt;code&amp;gt;rig.data.edit_bones[name].roll&amp;lt;/code&amp;gt;, the armature must be toggled into edit mode, which is not possible with linked assets. But if the script has been executed in the file where the armature is defined, the Roll property can be accessed from the linking file as &amp;lt;code&amp;gt;rig.pose.bones[name].bone[&amp;quot;Roll&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
# File bone_roll.py&lt;br /&gt;
#----------------------------------------------------------&lt;br /&gt;
import bpy&lt;br /&gt;
&lt;br /&gt;
def createBoneRollProps(rig):&lt;br /&gt;
    if rig.type != 'ARMATURE':&lt;br /&gt;
        raise NameError(&amp;quot;Object not an armature&amp;quot;)&lt;br /&gt;
    bpy.context.scene.objects.active = rig&lt;br /&gt;
    try:&lt;br /&gt;
        bpy.ops.object.mode_set(mode='EDIT')    &lt;br /&gt;
        editable = (len(rig.data.edit_bones) &amp;gt; 0)&lt;br /&gt;
    except:&lt;br /&gt;
        editable = False&lt;br /&gt;
&lt;br /&gt;
    rolls = {}&lt;br /&gt;
    if editable:&lt;br /&gt;
        for eb in rig.data.edit_bones:&lt;br /&gt;
            rolls[eb.name] = eb.roll&lt;br /&gt;
        bpy.ops.object.mode_set(mode='POSE')    &lt;br /&gt;
        for pb in rig.pose.bones:&lt;br /&gt;
            pb.bone[&amp;quot;Roll&amp;quot;] = rolls[pb.name]&lt;br /&gt;
    else:&lt;br /&gt;
        try:&lt;br /&gt;
            bpy.ops.object.mode_set(mode='POSE')    &lt;br /&gt;
        except:&lt;br /&gt;
            raise NameError(&amp;quot;Armature is not posable. Create proxy&amp;quot;)&lt;br /&gt;
        for pb in rig.pose.bones:&lt;br /&gt;
            try:&lt;br /&gt;
                rolls[pb.name] = pb.bone[&amp;quot;Roll&amp;quot;]&lt;br /&gt;
            except:&lt;br /&gt;
                raise NameError(&amp;quot;Create roll props in asset file&amp;quot;)&lt;br /&gt;
    return rolls&lt;br /&gt;
&lt;br /&gt;
rolls = createBoneRollProps(bpy.context.object)&lt;br /&gt;
for (bname, roll) in rolls.items():&lt;br /&gt;
        print(&amp;quot;  %16s %8.4f&amp;quot; % (bname, roll))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
{{Page/Footer|Dev:2.5/Py/Scripts/Cookbook/Code_snippets/World_view_renderer|Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface}}&lt;/div&gt;</summary>
		<author><name>wiki&gt;Brecht</name></author>
		
	</entry>
</feed>