This file contains 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
# python | |
""" Get Channel Selection. | |
There is no utility class for handling channel selection | |
like there is for items and scenes so it has to be done manually. | |
""" | |
import lx | |
selection_service = lx.service.Selection() |
This file contains 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 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
# python | |
""" Snippet demonstrates how to filter item selection out so it contains | |
only items of required type (group items in this case). | |
Filtered items are printed out in Event Log. | |
""" | |
import lx | |
import lxu.select |
This file contains 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
/* | |
* The first method is by using user.value command. | |
* This seems like indirect way compared to direct API call but it is actually WAY faster. | |
* Especially as of MODO 14.1 release. | |
* Use this one to get user value! | |
*/ | |
CLxUser_CommandService cmdSrv; | |
CLxUser_Command userValCmd; | |
int value = 0; |
This file contains 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
scene_svc = lx.service.Scene() | |
sel_svc = lx.service.Selection() | |
pkt_trans = lx.object.ItemPacketTranslation(sel_svc.Allocate(lx.symbol.sSELTYP_ITEM)) | |
sel_type = sel_svc.LookupType(lx.symbol.sSELTYP_ITEM) | |
for i in xrange(sel_svc.Count(sel_type)): | |
pkt = sel_svc.ByIndex(sel_type, i) | |
item = pkt_trans.Item(pkt) | |
scene = item.Context() |
This file contains 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
# python | |
import lx | |
import modo | |
# This snippet queries polygon that is under a mouse. | |
# Querying polygon only works correctly on active meshes. | |
# That means that if mouse is over the mesh that is not active | |
# (was not selected prior to entering component mode), |
This file contains 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
LXtID4 currentTypes[4]; | |
LXtID4 vertex_type = srv_sel.LookupType(LXsSELTYP_VERTEX); | |
LXtID4 edge_type = srv_sel.LookupType(LXsSELTYP_EDGE); | |
LXtID4 poly_type = srv_sel.LookupType(LXsSELTYP_POLYGON); | |
LXtID4 item_type = srv_sel.LookupType(LXsSELTYP_ITEM); | |
currentTypes[0] = vertex_type; | |
currentTypes[1] = edge_type; | |
currentTypes[2] = poly_type; | |
currentTypes[3] = item_type; | |
LXtID4 cur = srv_sel.CurrentType(currentTypes); |
This file contains 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 <lx_tool.hpp> | |
#include <lx_toolui.hpp> | |
#include <lx_vmodel.hpp> | |
#include <lx_vector.hpp> | |
#include <lxu_attributes.hpp> | |
#include <lx_plugin.hpp> | |
#include <lx_layer.hpp> | |
#include <lx_mesh.hpp> | |
#include <lx_log.hpp> |
This file contains 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
/* | |
You return LXfTMOD_DRAW_PIXEL from your ToolModel::Flags method. | |
Then you'll be called for drawing into screen space. | |
If you support multiple drawing modes; 3D and screen space, | |
you can test in your Draw callback by calling ILxView::Flags, | |
and testing the return type for LXiVIEWv_PIXEL. | |
You can query the StrokeDraw object passed to your draw method for an ILxView. | |
When you're in your drawing call, you can call ILxView::Dimensions to get the size of the viewport | |
to calculate the position to draw. | |
*/ |
This file contains 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 is not entirely working as it crashes MODO when an item with this drawing | |
// is selected and transform tool is enable. So something somewhere has to return bad value at some point | |
// and this sample is not handling that. | |
// This code needs to be executed from within item's Draw method. | |
// Drawing is aborted if mouse pointer is more then 120 pixels from the item to be drawn. | |
// The idea is to only draw the item when mouse pointer is close enough to it. | |
#include <lx_vp.hpp> | |
CLxUser_View view(stroke); |
NewerOlder