gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10778: Add getCharacterByTarget fun


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10778: Add getCharacterByTarget function
Date: Mon, 06 Apr 2009 12:16:59 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10778
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2009-04-06 12:16:59 +0200
message:
  Add getCharacterByTarget function 
modified:
  pythonmodule/gnashPythonExample.py
  pythonmodule/gnashpython.cpp
  pythonmodule/gnashpython.h
  pythonmodule/pyGnash.cpp
=== modified file 'pythonmodule/gnashPythonExample.py'
--- a/pythonmodule/gnashPythonExample.py        2009-04-06 09:55:48 +0000
+++ b/pythonmodule/gnashPythonExample.py        2009-04-06 10:16:59 +0000
@@ -112,4 +112,7 @@
     player.render(False)
 
 
+char = player.getCharacterByTarget('_root')
+print "_root has depth: "
+print char.depth()
 

=== modified file 'pythonmodule/gnashpython.cpp'
--- a/pythonmodule/gnashpython.cpp      2009-04-06 08:34:55 +0000
+++ b/pythonmodule/gnashpython.cpp      2009-04-06 10:16:59 +0000
@@ -434,6 +434,20 @@
 //
 
 GnashCharacter*
+GnashPlayer::getCharacterByTarget(const std::string& tgt)
+{
+    REQUIRE_VM_STARTED;
+
+    gnash::DisplayObject* c = _movieRoot->findCharacterByTarget(tgt);
+    
+    if (!c) return NULL;
+    
+    GnashCharacter* chr(new GnashCharacter(c));
+
+    return chr;
+}
+
+GnashCharacter*
 GnashPlayer::getCharacterById(int id)
 {
     REQUIRE_VM_STARTED;

=== modified file 'pythonmodule/gnashpython.h'
--- a/pythonmodule/gnashpython.h        2009-04-06 08:32:34 +0000
+++ b/pythonmodule/gnashpython.h        2009-04-06 10:16:59 +0000
@@ -97,6 +97,9 @@
     // Player state
     int getCurrentFrame() const;
     
+    // Display Objects
+    GnashCharacter* getCharacterByTarget(const std::string& tgt);
+
     // Sprites
     GnashCharacter* getCharacterById(int id);    
     GnashCharacter* getTopmostMouseEntity();

=== modified file 'pythonmodule/pyGnash.cpp'
--- a/pythonmodule/pyGnash.cpp  2009-04-04 10:39:24 +0000
+++ b/pythonmodule/pyGnash.cpp  2009-04-06 10:16:59 +0000
@@ -88,6 +88,10 @@
         .def("getTopmostMouseEntity", 
&pythonwrapper::GnashPlayer::getTopmostMouseEntity,
                        return_value_policy<manage_new_object>(),
                                "The active gnash.Character() under the 
pointer.")
+
+        .def("getCharacterByTarget", 
&pythonwrapper::GnashPlayer::getCharacterByTarget,
+                       return_value_policy<manage_new_object>(),
+                               "The gnash.Character() having given target.")
                                
         // Log messages
         .def("logSize", &pythonwrapper::GnashPlayer::logSize,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]