View Full Version : ApplyServer and Channels
Dodgy
03-07-2007, 05:46 PM
Hi all,
could anyone give an example of how to apply a plugin to a channel. I started off trying ApplyServer, then moved onto GE_ApplyServer in a CommandInput() but I just can't get it to work. Anyone care to show me what I'm missing? I got it to work with other types of plugins, but this eludes me.
Here's what I tried:
CommandInput("GE_GetLayoutSel");
CommandInput("GE_FilterSelection \"*.Dissolve*\"");
CommandInput("GE_SelectAllCurves");
RefreshNow();
RedrawNow();
com="GE_ApplyServer SERVER_CHANNEL_H MGPlugCF";
CommandInput(com);
I alternatively tried to apply expressions using GE_CreateExpression, but kept getting a crash when an object's name had a space in it. Can I use " or something similar to encapsulate the expression, as " doesn't seem to work.
Thanks,
Mike
Dodgy
03-07-2007, 06:23 PM
Thankfully I got the expressions to work, " did allow me to encapsulate the expression, i must have had some other error before, but I would still like to see an example of channel filter handling please if anyone has any :)
GregMalick
03-07-2007, 06:50 PM
Hi Dodgy,
Please let me know if you ever figure out how to remove an expression..
Jarno
03-07-2007, 11:42 PM
com="GE_ApplyServer SERVER_CHANNEL_H MGPlugCF";
CommandInput(com);
That should be:
com="GE_ApplyServer ChannelHandler MGPlugCF";
CommandInput(com);
The SERVER_CHANNEL_H is a constant in LScript which expands to the string "ChannelHandler". Putting it in a string of course doesn't expand it.
Also make sure you have the correct name of the plugin. It should be the internal name, which can be different from the displayed name. Check the LWEXT config file. Use the Name in the plugin's entry. For example, Cycler is internally known as LW_Cycler.
---JvdL---
Jarno
03-08-2007, 12:15 AM
Please let me know if you ever figure out how to remove an expression..
It would be pretty interesting if you manage to do that.
It is possible to add a command to remove an expression from a channel, but then you'd have the problem of finding out which expressions are attached to the channel to begin with.
---JvdL---
GregMalick
03-08-2007, 02:44 AM
It would be pretty interesting if you manage to do that.
It is possible to add a command to remove an expression from a channel, but then you'd have the problem of finding out which expressions are attached to the channel to begin with.
---JvdL---
I'm assuming it would be a similar form like:
GE_CreateExpression <expressionname> <expression>
GE_AttachExpression <channelname> <expressionname>
GE_AttachExpressionID <channelid> <expressionname>
but more like:
GE_DestroyExpression <expressionname>
GE_DetachExpression <channelname> <expressionname>
GE_DetachExpressionID <channelid> <expressionname>
:D
In the plugin I'm writing, I know what expressions I've attached.
And I save this info in the scene file.
A User could manually remove an expression outside the plugin.
If so, the command should just be gracefully ignored by LW.
Then again, having an expressionID would be nice as would being able to iterate through a channel to know what's attached... ;D
Dodgy
03-08-2007, 05:26 AM
That should be:
com="GE_ApplyServer ChannelHandler MGPlugCF";
CommandInput(com);
The SERVER_CHANNEL_H is a constant in LScript which expands to the string "ChannelHandler". Putting it in a string of course doesn't expand it.
---JvdL---
Ah, That would explain it :) Got it working now thanks :)
jeremyhardin
03-08-2007, 05:33 AM
I'm assuming it would be a similar form like:
GE_CreateExpression <expressionname> <expression>
GE_AttachExpression <channelname> <expressionname>
GE_AttachExpressionID <channelid> <expressionname>
but more like:
GE_DestroyExpression <expressionname>
GE_DetachExpression <channelname> <expressionname>
GE_DetachExpressionID <channelid> <expressionname>
:D
In the plugin I'm writing, I know what expressions I've attached.
And I save this info in the scene file.
A User could manually remove an expression outside the plugin.
If so, the command should just be gracefully ignored by LW.
Then again, having an expressionID would be nice as would being able to iterate through a channel to know what's attached... ;D
:agree: Yep. Absolutely agree. If I can attach it in Lscript, then I can see lots of cases where I'd want the ability to detach it just the same.
adamredwoods
03-09-2007, 03:21 PM
I've tried to come up with a "GE_RemoveExpression" solution, but can't seem to come up with anything.
I was even tempted in creating a C plugin from the SDK, but even the SDK relies on "GE_Create" commands.
If you analyze the scene file, the info is stored under the "GraphEditor" at the end of the file. I don't think there's any proper way to access that info since it seems to be embedded in Lightwave, so I'm unsure how one could write a plugin in order to remove that info cleanly.
Does anyone know if Relativity2 allows Lscript access to add/remove expressions?
jeremyhardin
03-09-2007, 03:35 PM
I've tried to come up with a "GE_RemoveExpression" solution, but can't seem to come up with anything.
I was even tempted in creating a C plugin from the SDK, but even the SDK relies on "GE_Create" commands.
If you analyze the scene file, the info is stored under the "GraphEditor" at the end of the file. I don't think there's any proper way to access that info since it seems to be embedded in Lightwave, so I'm unsure how one could write a plugin in order to remove that info cleanly.
Does anyone know if Relativity2 allows Lscript access to add/remove expressions?
Not afaik. Unless I'm much mistaken, Lscript doesn't have any access to Relativity.
adamredwoods
03-09-2007, 07:49 PM
Hm. At some point Lightwave needs to allow these default plugins to start talking to one another so Lscript can modify settings.
Here's a longshot: I read in the Relativity2 docs that it can copy expressions to descendents. If that's the case, it has a means to communicate to itself via motion modifier intercommunication. Lightwave communicates generally by ComRing, Global store/recall, or file read/write.
I wonder if Newtek is willing to peep a little on the inner workings of Relativity so that developers can take advantage of this intercomm.
Otherwise, it may require a little hacking??
For global store/recall: check the registry
for file/readwrite: just see what files in the default directory get updated.
For comring, well, create a Master plugin that does some comring sniffing.
Anyhow, these are all very loose ideas. Perhaps someone out there can run with one of these ideas, or i may be just blowing smoke which I tend to do.
-Adam
Jarno
03-09-2007, 09:29 PM
I've tried to come up with a "GE_RemoveExpression" solution, but can't seem to come up with anything.
There are currently no paths which lead from the command system, the LWSDK, or LScript, to the expression removal code. So I'm not surprised that you couldn't come up with anything.
---JvdL---
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.