[Closed] How to update mesh edge selection in SDK?
hi there!.
I’m creating an edge selection tool plugin with the 3ds max sdk, the problem that i have is when i set the edge selection, it doesn’t update in viewports until i pan or rotate the view. I tryed redrawing viewports but it didn’t work.
this is the line:
targetPolyObj->mm.SetEdgeSel(edgeToSelect,true);
targetPolyObj is an instance from the polyObject class.
any thoughts?, thanks
Hi, not using SDK that had a similar issue while scripting.
You probably need to call the ‘update’ function
well… is not scripting actually (i’m programming a .dlx in visual C++ with the 3ds max sdk).
i have searched some update functions but haven’t found any yet (inside the MNMesh or polyObject class), maybe there’s one there but i don’t know which :(.
i have tried the LocalDataChanged function from the ePoly class but it didn’t success either :’(.
Hi Felix,
I guess you only missed to refresh viewports after setting the edge
// <void> customSelEdge <Poly poly> <Integer edgeIndex>
Value* customSelEdge_cf(Value** arg_list, int count) {
check_arg_count(customSelEdge, 2, count);
Object* obj = NULL;
MNMesh* poly = NULL;
int edgeIndex = 0;
if (is_node(arg_list[0])) {
obj = ((MAXNode*)arg_list[0])->to_node()->GetObjectRef();
if (obj->ClassID() == EPOLYOBJ_CLASS_ID)
poly = &((PolyObject*)obj)->GetMesh();
else
throw RuntimeError ("Poly operation on non-Poly ", obj->GetObjectName());
}
if ( is_integer_number(arg_list[1]) && (arg_list[1]->to_int() > 0) && (arg_list[1]->to_int() <= poly->nume) )
edgeIndex = arg_list[1]->to_int() -1;
else
throw RuntimeError ("Edge index not integer or out of range for ", obj->GetObjectName());
poly->SetEdgeSel(edgeIndex, TRUE);
[B]MAXScript_interface->ForceCompleteRedraw();[/B]
return &ok;
}
def_visible_primitive(customSelEdge, "customSelEdge");
Cheers
- Enrico
Wow!, thanks a lot Enrico, it’s just what i needed, works perfect!.
I’ve tryed using RedrawViews() from the interface class, but it didn’t work.
That line does! thanks :D.