Hi Martin,

>From what you've written it's difficult to know exactly what you've done
wrong or are mis-understand.  A complete c++ example would be easier to
know exactly what you've done and to recreate the problem.

The role of the outputParameters in the ScriptEngine::run(.., Parameters&
outputParameters); method is to serve as a list of parameters that the
script itself populates.  The way you use it is to pass in an empty
Parameters vector, this then will have zero of more osg::Object's assigned
to on completion of the run(..) call.

Does this help?

Robert.


On 19 February 2015 at 09:17, Martin Ferry <[email protected]> wrote:

> Hi, Robert
>
> I have success with small example on OSG version 3.3.3. I call lua
> function.
>
> function test (s)
>         k = s.Name;
>         print(k);
>         s.Name="InScript";
>         print(s.Name);
>         no = new("osg::Group");
>         no.Name = "Node2";
>         s:addChild(no);
>     return no;
> end
>
> as input parameters in code is
> osg::ref_ptr<osg::Group>inNode = new osg::Group;
>                 inNode->setName("Start");
>                 inputParameters.push_back(inNode);
>
> outuput parameters
> osg::ref_ptr<osg::Group>outNode = new osg::Group;
>                 outputParameters.push_back(outNode);
>
> and output :
> Start
> InScript
> input node name = InScript
> num children 1
>  Child node name : Node2
> output node name =
>
> As you can see, output parameter node has not set new name from csript.
> Can you tell me where is the problem, or how to use output parameters ?
>
> And second example.
> lua code
>
> function test2(a)
>         --print(a)
>         return 0;
>         end
>
> input parameter
> inputParameters.push_back(new
> osg::Vec3fValueObject("vector",osg::Vec3f()));
>
> output parameter
> osg::ref_ptr<osg::Vec3fValueObject> svo = new
> osg::Vec3fValueObject("return", osg::Vec3f());
>                 outputParameters.push_back(svo);
> output
> Lua error : attempt to call a table value
> script run failed
>
> This simple example doesn't work. It work with base value objects as
> string or double but not with osg value objects as Matrixd. Can you please
> tell me where is the problem? Whatever I try, it still doesn't work.
>
> This is very basic examples and I think it can help all people starting
> with scripting in OSG.
>
> Thank you!
>
> Cheers,
> Martin
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=62725#62725
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to