PDA

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


phoelix
01-23-2009, 10: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->mm.SetEdgeSel(edgeToSelect,true);

targetPolyObj is an instance from the polyObject class.

any thoughts?, thanks :D

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

phoelix
01-24-2009, 02: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 :'(.

SyncViewS
01-24-2009, 11:08 AM
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);
MAXScript_interface->ForceCompleteRedraw();

return &ok;
}

def_visible_primitive(customSelEdge, "customSelEdge");
Cheers

- Enrico

phoelix
01-24-2009, 11:46 AM
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-24-2009, 11:46 AM
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.