Hi Robert

I don't know which way you want to test the script so I attached the sample 
that uses it.

Hope it helps
Julien



mp3butcher wrote:
> the  simpliest script would be
> 
> 
> Code:
> function test (s) 
>       cb=s.UpdateCallback;
> end
> 
> 
> 
> 
> robertosfield wrote:
> > Hi Julien,
> > 
> > On 5 July 2016 at 01:52, Julien Valentin <> wrote:
> > 
> > > you have forgotten the Quat case in LuaEngine from my last submision 
> > > attachment
> > > 
> > 
> > I didn't quite forget, rather in refactoring all the Vec, Quat and
> > Plane code I missed adding Quat and Plane support to two places where
> > it was missing previously.  Looking at your original submission I now
> > see you added in Quat handling as well as the Vec, but once I had
> > started down the path of refator I didn't refer to again as I thought
> > I had the idea of what you were trying to achieve.
> > 
> > I've just checked in the missing Quat and Plane handling.  Fingers
> > crossed this is all the cases handled now.
> > 
> > 
> > > Further I began to play with lua meta model access and found something 
> > > that look like a bug :
> > > when i tried to get Callback from a node it crashes
> > > It surely as something to do with virtual inheritance
> > > so I replaced ObjectSerializer get method in osgDB/Serializer
> > > with this code
> > > virtual bool get(const osg::Object& obj, void* value) { const C& object = 
> > > OBJECT_CAST<const C&>(obj);*(reinterpret_cast<const osg::Object**>(value 
> > > )) =dynamic_cast<const osg::Object*>( (object.*_getter)()); return true; }
> > > Now I access Node callback without crashing
> > > 
> > > Does it sound good to you?
> > > 
> > 
> > Looking at the original code it looks like you've added the
> > dynamic_cast<const osg::Object*>.   I'm surprised this is needed as
> > the getting should be returning a Callback pointer of some kind which
> > should already be an osg::Object.  If this is crashing then I can only
> > guess there is an issue with the virtual inheritance somewhere along
> > the line.
> > 
> > Could you post a .lua script that reproduces the crash?
> > 
> > Robert.
> > _______________________________________________
> > osg-submissions mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> > 
> >  ------------------
> > Post generated by Mail2Forum
> 


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68014#68014




#include <osgViewer/Viewer>
#include <osg/ScriptEngine>
#include <osgDB/ReadFile>
const char*test=" function test (s)\n"
                        "cb=s.UpdateCallback;\n"
                    "end \n";

int main( int , char** )
{

    osg::Group *root= new osg::Group();
    root->getOrCreateUserDataContainer()->addUserObject(osgDB::readFile<osg::ScriptEngine>("ScriptEngine.lua"));
    osg::Script *script=new osg::Script();
    script->setLanguage("lua");
    script->setScript(test);
    osg::ScriptNodeCallback *scripten=new osg::ScriptNodeCallback(script,"test");
    root->setUpdateCallback(scripten);

    osgViewer::Viewer viewer;
    viewer.setSceneData( root );
    return viewer.run();
}
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to