New attempts:

added these:

(header)
//getters for Transform pos,rot and scale float3 objects
float3 position(const Transform* self);
 float3 rotation(const Transform* self);
float3 scale(const Transform* self);

(source)

float3 TundraDecorator::position(const Transform* self)
    {
        return self->pos;
    }

    float3 TundraDecorator::rotation(const Transform* self)
    {
        return self->rot;
    }
        float3 TundraDecorator::scale(const Transform* self)
    {
        return self->scale;
    }
= = = =
they compile without errors but give this error at py runtime:

Error: PythonScriptModule: Called float3 rotation(), return type
'float3' is ignored because it is unknown to PythonQt. Probably you
should register it using qRegisterMetaType() or add a default
constructor decorator to the class.

- - - - - -
Now I might try registering or adding a constructor, but I don't know
whether to add it to TundraWrapper, to Transform (which I've included
of course) or to float3. This is a bit over my head...

On Aug 1, 5:19 pm, Jonne Nauha <jo...@adminotech.com> wrote:
> 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.

Might consider committing if I can make them work;-)

> 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.


Does not crash anymore, exits cleanly, thanks.

> 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