View getUserValueCompare.cpp
/* | |
* 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; |
View queryComponentMode.cpp
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); |
View toolHandle.cpp
| |
#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> |
View toolPixelDraw.cpp
/* | |
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. | |
*/ |
View mouseProximity.cpp
// 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); |
View setupChannels.py
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() |
View getPolyUnderMouse.py
# 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), |
View onIdleEvent.cpp
#include "lx_visitor.hpp" | |
/* | |
* OnIdleVisitor is used to perform On Idle Event. | |
* Evaluate() method will be called once the on idle event is registered. | |
* | |
* If you add more methods to this class and want to access them from outside this is how you need to do it: | |
* onIdleVisitorInstance.loc.method(); | |
* You get direct access to this class contents via '.loc'. | |
* Don't ask me why ;). |
View undoGroup.CFG
http://modo.sdk.thefoundry.co.uk/wiki/Command_(lx-command.hpp)#.2814.29_SDK:_Undo_Group_Command_Example | |
<atom type="CommandUndoGroup"> | |
<hash type="Command" key="my.command">myUndoGroup</hash> | |
<hash type="GroupBehavior" key="myUndoGroup">undoPlusPrevious</hash> | |
</atom> |
View alignToView.py
import lx | |
import lxu | |
import modo | |
scene = modo.Scene() | |
i = scene.item('Locator') | |
# Get current MODO viewport interface | |
vs = lx.service.View3Dport() | |
currentViewIndex = vs.Current() |
NewerOlder