PDA

View Full Version : Issue command outside a LayoutGeneric



avogad
04-24-2007, 08:28 AM
Hi all,

I'd like to issue a command from another plugin type than a LayoutGeneric. I tried

#define LWCOMMANDFUNC_GLOBAL "LW Command Interface"
typedef int ( *LWCommandFunc )( const char *cmd );

LWCommandFunc *evaluate;
evaluate = global( LWCOMMANDFUNC_GLOBAL, GFUSE_TRANSIENT );

as described in the SDK but it doesn't work.

Is there another way to do it ?!

Cheers

Lightwolf
04-24-2007, 08:32 AM
Hm, it works here. In what context are you calling the command, and how?

Cheers,
Mike

avogad
04-24-2007, 09:00 AM
I'm calling that function in the Evaluate function of an ItemMotionHandler doing

evaluate(cmd); where cmd is the string containing my command.

I don't master programming and I'm not familiar with typedef. Do I have to define a function ?!, or something else in addition to the #define and the typedef ?!

Lightwolf
04-24-2007, 09:05 AM
I'm calling that function in the Evaluate function of an ItemMotionHandler...
I suppose exactly that is the problem.

evaluate() is not officially suported and can not be called at all times, I suppose this is what happens in your case. When evaluation motions, LW is in no state to actually receive commands.

Cheers,
Mike

avogad
04-24-2007, 09:10 AM
Ho ok,

What I wanted to do was setting the zoom factor of a camera as I would set its position, rotation, ...

Would u know a way to do that without using commands ?!

EDIT: without creating an envelope

Cheers

Lightwolf
04-24-2007, 09:15 AM
Would u know a way to do that without using commands ?!

Not off hand, I'd need to dig into the SDK...
Have you looked at the LWEnvelopeFuncs?

Basically find the channel group and channel associated with the camera and then change the envelope directly using setKey...

Cheers,
Mike

avogad
04-24-2007, 09:28 AM
change the envelope directly using setKey...

That is the tricky point! I want to do it without setting keys...

For several days, I've been working on a motion exporter. That plugin exports the motion of all items in a binary file. Then I erase all the keys of all items and I apply an ItemMotionhandler linked to those files. The plugin reads values into the file, create an array and set those values to the item through the Evaluate() function.

The result is that scenes are much lighter (0 keys into the scene file), the new motion files as well and the navigation into LW is faster.

Anyway, to improve the plugin, the last thing I would have to do is set the ZoomFactor the same way than the position, rotation, scaling.

Lightwolf
04-24-2007, 09:31 AM
That is the tricky point! I want to do it without setting keys...

For several days, I've been working on a motion exporter. That plugin exports the motion of all items in a binary file. Then I erase all the keys of all items and I apply an ItemMotionhandler linked to those files. The plugin reads values into the file, create an array and set those values to the item through the Evaluate() function.

The result is that scenes are much lighter (0 keys into the scene file), the new motion files as well and the navigation into LW is faster.

Anyway, to improve the plugin, the last thing I would have to do is set the ZoomFactor the same way than the position, rotation, scaling.
Ah, I see. I hope you don't intend to render in lwsn then, since it doesn't support commands...

Hm, can't think of anything else, except maybe applying a channel handler to the envelope, that should work.

Cheers,
Mike

avogad
04-24-2007, 09:35 AM
Hey I didn't see that!

I'm gonna have a look through the ChannelHandler to do it.

Cheers.

Jarno
04-24-2007, 09:03 PM
Maybe your command isn't correct?

Setting a key in the envelope probably won't work if the user hasn't activated the envelope on the zoom.

---JvdL---

avogad
04-25-2007, 06:44 AM
Thanks for your answers.

The channel handler works perfectly, my problem is now to add this handler to all my cameras. The ApplyServer command tells me I can't apply my plugin. Is there a specific command to add ChannelHandlers ?!

Cheers

avogad
04-25-2007, 07:06 AM
Sorry, I found it. I used ApplyServer instead of GE_ApplyServer.

Cheers