View Full Version : How to update mesh edge selection in SDK?

01 January 2009, 11:11 PM
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 is an instance from the polyObject class.

any thoughts?, thanks :D

01 January 2009, 11:42 PM
Hi, not using SDK that had a similar issue while scripting.
You probably need to call the 'update' function

01 January 2009, 03:08 AM
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 :'(.

01 January 2009, 12:08 PM
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();
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;
throw RuntimeError ("Edge index not integer or out of range for ", obj->GetObjectName());

poly->SetEdgeSel(edgeIndex, TRUE);

return &ok;

def_visible_primitive(customSelEdge, "customSelEdge");

- Enrico

01 January 2009, 12:46 PM
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.

CGTalk Moderation
01 January 2009, 12:46 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.