Good work, when you are done adding stuff please give me a
pastebin.compaste of the header and cpp and i will put them to the
repo! Or just attach
the files, or we can give you git access if you can handle git commits.

The exit crash is still a bit open, it is because we kill the py objects,
then the one that is sending the signals gets killed and we guess (with
toni) that it goes and pokes the dead py ptrs somehow. Its kind of weird why
qt would do that but it propably fails somewhere there. This is propably one
reason why python was not uninitialized properly in the previous python
module. disconnecting should be similar obj.diconnect("sameSignal()",
receiverCallable) if it goes wrong the py will print suggestions for you.

Best regards,
Jonne Nauha
Adminotech developer


On Mon, Aug 1, 2011 at 4:41 PM, ilikia <t...@ee.oulu.fi> wrote:

>
> OK, I've got more fun for you guys. I added these functions into
> PythonScriptModule/TundraWrapper class:
>
> in the header:
>
> //getters for float3 x, y and z coordinates
>        float x(float3* self);
>        float y(float3* self);
>        float z(float3* self);
>
> in the source:
>
> float TundraDecorator::x(float3* self)
>    {
>        return self->x;
>    }
>
>    float TundraDecorator::y(float3* self)
>    {
>        return self->y;
>    }
>
>    float TundraDecorator::z(float3* self)
>    {
>        return self->z;
>    }
>
> and ran it in py like this:
>
> import tundra as tundra
>
> class CameraTest:
>
>    def __init__(self):
>
>        tundra.LogInfo("***** Python CameraTest starting *****")
>         tundra.Frame().connect("Updated(float)", self.update)
>
>    def update(self, frametime):
>
>        print
>
> tundra._pythonscriptmodule.GetActiveCamera().GetComponentRaw("EC_Placeable").Position().x()
>        print
>
> tundra._pythonscriptmodule.GetActiveCamera().GetComponentRaw("EC_Placeable").Position().y()
>        print
>
> tundra._pythonscriptmodule.GetActiveCamera().GetComponentRaw("EC_Placeable").Position().z()
>
> = = = = =
> It works, hooray. But my efforts to do the same with the rotation
> haven't so far. Tried something like this:
>
> float3 TundraDecorator::rotation(Quat* self)
>    {
>        return self->ToEulerZYX;
>    }
> Which compiles, but crashes at runtime, if I try this:
>
> print
>
> tundra._pythonscriptmodule.GetActiveCamera().GetComponentRaw("EC_Placeable").Orientation().rotation().z()
>
> same thing with this:
>
> float3 TundraDecorator::rot(Transform* self)
>    {
>        return self->rot;
>    }
>
> and in py
>
> print
>
> tundra._pythonscriptmodule.GetActiveCamera().GetComponentRaw("EC_Placeable").transform.rot().z()
>
> Crashes.
>
> Ahh, one more stupid question: should probably add a graceful exit
> function of some kind, because the line at init
>
> tundra.Frame().connect("Updated(float)", self.update)
>
> causes a crashdump at Tundra exit. A hint on disconnecting gracefully?
>
> --
> http://groups.google.com/group/realxtend
> http://www.realxtend.org
>

-- 
http://groups.google.com/group/realxtend
http://www.realxtend.org

Reply via email to