This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This snippet demonstrates how to get currently selected scene interface and | |
obtain number of mesh items in the scene from it. | |
Generally, selections are managed via selection service and are stored | |
as packets. So what we are doing is we are getting recent selection | |
of the cinema type from the selection service which comes as a pointer | |
to the selection packet. We then use scene packet translation object | |
to extract scene interface out of the packet we received pointer to from | |
selection service. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To read user value we spawn a new user value command. | |
* Then, we are using the attributes interface set to the command | |
* to set command's first argument to the name of the user value | |
* that we want to read. | |
* Next we obtain the index the of "value" argument so we can query | |
* command for this argument and store user value's value in the value array. | |
* The final step is to read the value from value array and put it | |
* inside value int variable. In this case we know it's an int | |
* so we go with GetInt() directly. If you do not know value's type | |
* you can get it using .Type() method on the ValueArray interface. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This snippet demonstrates a function that will open a Yes/No dialog in MODO using dialog service. | |
* | |
* To create a dialog we need dialog service. We use dialog service to allocate message object | |
* that will determine the type of dialog that we will open and will contain the text of the message | |
* that we want to display. The text needs to be set in the message table in a config file. | |
* Next we set message object to our message passing message table name and message key | |
* and we use SetCode() method to set the type of a dialog that we want to open. | |
* Finally, we open such prepared message via dialog service | |
* and translate the result into boolean value. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned index; | |
CLxUser_Scene scene; | |
CLxUser_ChannelRead rchan; | |
CLxUser_Mesh umesh; | |
// Base mesh is CLxUser_Mesh | |
if (LXx_OK(item.ChannelLookup (LXsICHAN_MESH_MESH, &index))) { | |
item.GetContext (scene); | |
scene.GetChannels (rchan, LXs_ACTIONLAYER_EDIT); | |
if (rchan.Object (itm, index, umesh)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This function allows for querying a command argument. | |
* It's possible to set any other command's arguments first | |
* prior to the query. This is done by passing a map with | |
* argument name/value pairs. | |
*/ | |
bool queryCmdArg(const char* cmdName, const char* argName, std::map<std::string, CLxUser_Value>& otherArgs, CLxUser_ValueArray& valArray) | |
{ | |
CLxUser_CommandService cmdSrv; | |
CLxUser_Command cmd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <lxu_command.hpp> | |
class CustomNotifier : public CLxCommandNotifier | |
{ | |
public: | |
CustomNotifier (); | |
virtual ~CustomNotifier () {} | |
virtual void cn_Parse (std::string &args) {}; | |
virtual unsigned int cn_Flags (int code) { return LXfCMDNOTIFY_VALUE; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* An example on how to add gradient channel to a custom item. | |
* Gradient will also have default 1.0 flat value. | |
*/ | |
LxResult | |
CPackage::pkg_SetupChannels ( | |
ILxUnknownID addChan) | |
{ | |
CLxUser_AddChannel ac (addChan); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* If you want to create dependencies between channels on a custom item | |
* such that one channel enable state depends on some other channel value | |
* (on the same item) you need to implement ChannelUI interface for your item. | |
*/ | |
/* This is needed to obtain the implemented custom item type. | |
* (see DependencyCountIndex() method below) | |
*/ | |
static CLxItemType cit_self (MY_CUSTOM_ITEM_TYPE_NAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import modo | |
item = modo.Scene().selected[0] | |
cmdSvc = lx.service.Command() | |
cmd = cmdSvc.Spawn(lx.symbol.iCTAG_NULL, 'texture.reference') | |
attr = lx.object.Attributes(cmd) | |
val = attr.Value(attr.Lookup("item"), True) | |
valRef = lx.object.ValueReference(val) | |
valRef.SetObject(item) | |
cmd.Execute(lx.symbol.fCMD_EXEC_DEFAULT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This snippet demonstrates two of the ways to obtain item's inverted world transform matrix. | |
*/ | |
// --- METHOD 1 | |
CLxUser_Scene scene; | |
item.Context (scene); | |
CLxUser_ChannelRead chanRead; | |
CLxUser_SelectionService selSvc; |