Hello,
I have 2 problems selecting faces. I currently have this:
IINode node = iface.GetINodeByHandle(handle);
if (node == null)
return;
iface.SelectNode(node, true);
iface.CommandPanelTaskMode = TASK_MODE_MODIFY; //2
IObject baseObjectRef = node.ObjectRef.FindBaseObject();
if (baseObjectRef.SubObjectLevel != 4)
baseObjectRef.ActivateSubobjSel(4, m_Global.XFormModes.Create());
ITriObject triObj = (ITriObject)node.EvalWorldState(0, true).Obj.ConvertToType(0, m_Global.TriObjectClassID);
var mesh = triObj.Mesh;
MasterNode tempMasterNode = m_MasterNodeList[handle];
IBitArray selectionArray = GetFacesBitArrayByID(treeNode.matID, tempMasterNode);
if (selectionArray != null)
mesh.FaceSel = selectionArray;
1st problem: ActivateSubobjSel method crashes Max when there are modifier on my node. Is there a way to go to the baseObject? Ignoring all the modifiers on top?
2nd problem: This code is working with EditableMesh object but doesn’t work very well with EditablePoly. I can change the ITriObject to IPolyObject so it works on EditablePoly but then it doesn’t work on EditableMesh. I was wondering though if it’s possible to make it work on these 2 base meshes without checking the baseObject first.
Thanks in advance,
Vin