MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / on3DMouseDown

Method on3DMouseDown

Engine/source/navigation/guiNavEditorCtrl.cpp:290–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
291{
292 mGizmo->on3DMouseDown(event);
293
294 if(!isFirstResponder())
295 setFirstResponder();
296
297 mouseLock();
298
299 // Construct a LineSegment from the camera position to 1000 meters away in
300 // the direction clicked.
301 // If that segment hits the terrain, truncate the ray to only be that length.
302
303 Point3F startPnt = event.pos;
304 Point3F endPnt = event.pos + event.vec * 1000.0f;
305
306 RayInfo ri;
307
308 U8 keys = Input::getModifierKeys();
309 bool shift = keys & SI_LSHIFT;
310 bool ctrl = keys & SI_LCTRL;
311
312 if(mMode == mLinkMode && !mMesh.isNull())
313 {
314 if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
315 {
316 U32 link = mMesh->getLink(ri.point);
317 if(link != -1)
318 {
319 if(mLink != -1)
320 mMesh->selectLink(mLink, false);
321 mMesh->selectLink(link, true, false);
322 mLink = link;
323 LinkData d = mMesh->getLinkFlags(mLink);
324 Con::executef(this, "onLinkSelected", Con::getIntArg(d.getFlags()));
325 }
326 else
327 {
328 if(mLink != -1)
329 {
330 mMesh->selectLink(mLink, false);
331 mLink = -1;
332 Con::executef(this, "onLinkDeselected");
333 }
334 else
335 {
336 if(mLinkStart != Point3F::Max)
337 {
338 mMesh->addLink(mLinkStart, ri.point);
339 if(!shift)
340 mLinkStart = Point3F::Max;
341 }
342 else
343 {
344 mLinkStart = ri.point;
345 }
346 }
347 }

Callers

nothing calls this directly

Calls 13

executefFunction · 0.85
getIntArgFunction · 0.85
getLinkMethod · 0.80
selectLinkMethod · 0.80
getLinkFlagsMethod · 0.80
addLinkMethod · 0.80
renderTileDataMethod · 0.80
setPathDestinationMethod · 0.80
isNullMethod · 0.45
castRayMethod · 0.45
getFlagsMethod · 0.45
getTileMethod · 0.45

Tested by

no test coverage detected