<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META name=GENERATOR content="MSHTML 8.00.6001.18812"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>You can read 
armatures (all poseChannel and bone fields that matters in the GE) and you can 
write pose channels (only position/orientation though).</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>The&nbsp;detailed 
documentation on this API in the BPY_GE directory that you will find in the 
builds. Open the index.html in your browser and select the BL_ArmatureObject, 
BL_ArmatureChannel, BL_ArmatureBone classes on the left panel: you will find all 
the properties that you can read or write in the GE.</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>Here is an example 
on how you can get access to the pose channels in a Python controller in the 
GE:</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>cont = 
GameLogic.getCurrentController()</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># get reference to 
armature object<BR>arm = cont.owner&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># list of pose 
channels for all bones</FONT><BR></SPAN><SPAN class=093203219-14092009><FONT 
size=2 face=Arial>channels&nbsp;= arm.channels</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># access by bone 
name&nbsp;&nbsp;&nbsp; </FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 
face=Arial>pose=channels['Bone']&nbsp;&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># read current joint 
rotation</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>print 
(pose.joint_rotation)</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># set joint rotation 
for next frame</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>pose.joint_rotation 
= [0.0, 0.0, 0.1]</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># you can also set 
euler angle</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># 
pose.euler_rotation = [x,y,z]</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># you can get rest 
pose information from the bone</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>bone = 
pose.bone</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># all properties are 
read-only</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>print 
(bone.bone.mat)</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial># make sure the pose 
gets updated on next graphic frame<BR>arm.update()<BR></FONT></SPAN><SPAN 
class=093203219-14092009><FONT size=2 face=Arial></FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>The above code shows 
the path of references:</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 
face=Arial>GameLogic.getCurrentController().owner.channels["&lt;bone_name&gt;"].&lt;pose 
properties&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>
<DIV><SPAN class=093203219-14092009><FONT size=2 
face=Arial>GameLogic.getCurrentController().owner.channels["&lt;bone_name&gt;"].bone.&lt;bone 
properties&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT 
color=#0000ff></FONT></SPAN>&nbsp;</DIV></FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial>There is also a path 
for constraints:</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT size=2 face=Arial><SPAN 
class=093203219-14092009><FONT size=2 
face=Arial>GameLogic.getCurrentController().owner.constraints["&lt;bone_name&gt;:&lt;constraint_name&gt;"].&lt;constraint 
properties&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=093203219-14092009><FONT 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093203219-14092009>Thanks for confirming that the build works 
on a recent Ubuntu distro, I have upgrade mine for a long time.</SPAN></DIV>
<DIV><SPAN class=093203219-14092009></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093203219-14092009>/benoit</SPAN></DIV></FONT></SPAN>
<BLOCKQUOTE 
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left><FONT size=2 
  face=Tahoma>-----Original Message-----<BR><B>From:</B> 
  robotics-bounces@blender.org [mailto:robotics-bounces@blender.org] <B>On 
  Behalf Of </B>Florian Lier<BR><B>Sent:</B> lundi 14 septembre 2009 
  18:18<BR><B>To:</B> Blender and Robotics<BR><B>Subject:</B> Re: [Robotics] 
  Python control of armature in the GE<BR><BR></FONT></DIV>Hey all,<BR><BR>for 
  claryfication ... I can read write armatures in the GE now?!<BR>This is what I 
  understood from the last mails :)<BR><BR>My goal is to write a time triggered 
  script which manipulates the armature.<BR><BR>Benoit - if so, can you provide 
  us with some sample code?<BR><BR>BTW: You build works fine on Ubuntu (32Bit) ) 
  9.04<BR><BR><BR>Cheers, Florian<BR><BR><BR>Benoit Bolsee wrote: 
  <BLOCKQUOTE cite=mid:CE4AFF92E2034862B6991B53E33D5D9E@Benoit95 type="cite"><PRE wrap="">Blender 2.5 needs Python 3.1 indeed (at least the GE). 
Regarding Blender module, yes it's gone, you need to switch to the new
RNA and operator API.
You have the documentation (still partial) here :
 <A class=moz-txt-link-freetext href="http://www.graphicall.org/ftp/ideasman42/html/bpy-module.html">http://www.graphicall.org/ftp/ideasman42/html/bpy-module.html</A>

The principle is that you get reference to the data block you want to
manipulate from the context
(<A class=moz-txt-link-freetext href="http://www.graphicall.org/ftp/ideasman42/html/bpy.types.Context-class.h">http://www.graphicall.org/ftp/ideasman42/html/bpy.types.Context-class.h</A>
tml): you start from the main and dig through it.

Afaik it's not available in the GE yet.
So in the GE you must stick with GE API only, which hasn't changed.
You will noticed that I implemented proxy classes in the GE to bone,
pose channel, and armatures. So you don't need bpy for that.

I hope this news are not too disappointing ;-)

Regards,
Benoit



  </PRE>
    <BLOCKQUOTE type="cite"><PRE wrap="">-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:robotics-bounces@blender.org">robotics-bounces@blender.org</A> 
[<A class=moz-txt-link-freetext href="mailto:robotics-bounces@blender.org">mailto:robotics-bounces@blender.org</A>] On Behalf Of Markus Mehrwald
Sent: vendredi 11 septembre 2009 16:04
To: Blender and Robotics
Subject: Re: [Robotics] Python control of armature in the GE


Hi Benoit,

I figured out some other problems now. I got Blender to compile only 
with Pyhton 3.1 but now I cannot use my scripts anymore with 
the error:

Traceback (most recent call last):
   File "Steuerung.py", line 4, in &lt;module&gt;
ImportError: No module named Blender

Do you know what this could be or is there already a 
documentation for 2.5?

Thanks,
Markus

Benoit Bolsee schrieb:
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">I fixed CMake in the itasc branch. Sorry for the delay.

/benoit

      </PRE>
        <BLOCKQUOTE type="cite"><PRE wrap="">-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:robotics-bounces@blender.org">robotics-bounces@blender.org</A>
[<A class=moz-txt-link-freetext href="mailto:robotics-bounces@blender.org">mailto:robotics-bounces@blender.org</A>] On Behalf Of Markus Mehrwald
Sent: vendredi 11 septembre 2009 11:21
To: Blender and Robotics
Subject: Re: [Robotics] Python control of armature in the GE


Hi,

I just managed it to compile the branch with the ikplugin. For some
reasons I was not able to compile because of a few errors. I 
think its 
just some little changes in the CMake files. First of all the 
BIK_api.h 
was not found. I did it quick and dirty by copying the full 
path in the 
files where it is needed. The second thing was that obviously 
the libs 
bf_ikplugin and bf_ITASC are not in the list of libs to link 
against. Maybe you did not update the CMakeList or was it a 
problem of my computer?

Regards,
Markus


Benoit Bolsee schrieb:
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">Hi,
 
I have added support for controlling armatures through
          </PRE></BLOCKQUOTE><PRE wrap="">Python in the
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">GE.
This is provided through the new proxy class
          </PRE></BLOCKQUOTE><PRE wrap="">BL_ArmatureChannel that
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">corresponds to the pose channel structure. Most attributes match
directly the Blender bPoseChannel structure but I added a 
'joint_rotation' attribute that gives direct access to 
          </PRE></BLOCKQUOTE><PRE wrap="">joint angles. You
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">can use this attribute to set the joint angles from
          </PRE></BLOCKQUOTE><PRE wrap="">external data or
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">your own calculation and the armature will move according
          </PRE></BLOCKQUOTE><PRE wrap="">to it. If the
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">armature is controlled by IK, you can read the joint angles
          </PRE></BLOCKQUOTE><PRE wrap="">computed by
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">the algorithm. Full details is provided in the BPY documentation
included in the packages below. Download them if you want 
          </PRE></BLOCKQUOTE><PRE wrap="">to know more
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap="">about it.
 
Other fix in this build is correct matrix operation with 
          </PRE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">MathUtils:
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap=""><A class=moz-txt-link-freetext href="http://lists.blender.org/pipermail/bf-blender-cvs/2009-Septemb">http://lists.blender.org/pipermail/bf-blender-cvs/2009-Septemb</A>
er/022245.html
        </PRE>
          <BLOCKQUOTE type="cite"><PRE wrap=""> 
For those who want to experiment, I made two builds on graphicall:
 
Linux:

          </PRE></BLOCKQUOTE><PRE wrap=""><A class=moz-txt-link-freetext href="http://graphicall.org/builds/builds/showbuild">http://graphicall.org/builds/builds/showbuild</A>.&gt;
        </PRE></BLOCKQUOTE><PRE wrap="">php?action=show&amp;id=1082
      </PRE>
        <BLOCKQUOTE type="cite"><PRE wrap="">&lt;<A class=moz-txt-link-freetext href="http://graphicall.org/builds/builds/showbuild.php?action=show">http://graphicall.org/builds/builds/showbuild.php?action=show</A>
        </PRE></BLOCKQUOTE><PRE wrap="">&amp;id=1082&gt;
      </PRE>
        <BLOCKQUOTE type="cite"><PRE wrap="">Windows:

        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=""><A class=moz-txt-link-freetext href="http://graphicall.org/builds/builds/showbuild">http://graphicall.org/builds/builds/showbuild</A>.&gt;
    </PRE></BLOCKQUOTE><PRE wrap=""><!---->php?action=show&amp;id=1080 
  </PRE>
    <BLOCKQUOTE type="cite"><PRE wrap=""><A class=moz-txt-link-rfc2396E href="http://graphicall.org/builds/builds/showbuild">&lt;http://graphicall.org/builds/builds/showbuild&gt;</A>
    </PRE></BLOCKQUOTE><PRE wrap=""><!---->.php?action=show&amp;id=1080
  </PRE>
    <BLOCKQUOTE type="cite">
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap=""> 
If your system is not in this list, you can check out the itasc 
branch and compile. For those interested in the 
        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">implementation, look 
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap="">at the BL_ArmatureChannel.cpp module in 
        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">source/gameengine/converter. 
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap="">If
        </PRE></BLOCKQUOTE><PRE wrap="">you
      </PRE>
        <BLOCKQUOTE type="cite"><PRE wrap="">have some ideas to extend the API, you are welcome to make your own
additions and send me the diff, I will review and commit 
        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">them to SVN.
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap=""> 
The itasc branch will be merged with 2.5 in the coming 
        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">days, it would
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap="">be
nice to get some feedback before I start the merge.
 
/benoit.
 



        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">---------------------------------------------------------------------
    </PRE>
      <BLOCKQUOTE type="cite">
        <BLOCKQUOTE type="cite"><PRE wrap="">-
--

_______________________________________________
Robotics mailing list
<A class=moz-txt-link-abbreviated href="mailto:Robotics@blender.org">Robotics@blender.org</A>
<A class=moz-txt-link-freetext href="http://lists.blender.org/mailman/listinfo/robotics">http://lists.blender.org/mailman/listinfo/robotics</A>
        </PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap="">_______________________________________________
Robotics mailing list
<A class=moz-txt-link-abbreviated href="mailto:Robotics@blender.org">Robotics@blender.org</A>
<A class=moz-txt-link-freetext href="http://lists.blender.org/mailman/listinfo/robotics">http://lists.blender.org/mailman/listinfo/robotics</A>

    </PRE></BLOCKQUOTE><PRE wrap=""><!---->
_______________________________________________
Robotics mailing list
<A class=moz-txt-link-abbreviated href="mailto:Robotics@blender.org">Robotics@blender.org</A>
<A class=moz-txt-link-freetext href="http://lists.blender.org/mailman/listinfo/robotics">http://lists.blender.org/mailman/listinfo/robotics</A>

  </PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>