#include <mlWEMWrapper.h>
Inherits MLRefCountedBaseWrapper.
|
static ml::RefCountedBase * | createObject (const QVariantList &arguments) |
|
A class that wraps WEM objects for use in scripting.
If you need fast ray intersection with the WEM, have a look at the MLWEMBoundingVolumeHierarchyWrapper.
◆ NotificationType
Enumeration of notification types.
Enumerator |
---|
WEM_NOTIFICATION_NONE | no notification at all (for initializing).
|
WEM_NOTIFICATION_SELECTION | a part has been selected.
|
WEM_NOTIFICATION_FINISHED | an interaction on a part has been finished.
|
WEM_NOTIFICATION_REPAINT | a part needs a repainting.
|
WEM_NOTIFICATION_INTERACTION_INIT | an interaction module needs initialization.
|
◆ addPatchCopy
Add a copy of the given patch to this WEM.
◆ addQuadPatchFromNumPyArray
MLWEMPatchWrapper * MLWEMWrapper::addQuadPatchFromNumPyArray |
( |
PyObject * | nodePositions, |
|
|
PyObject * | quadIndices ) |
|
slot |
Adds a new quad patch.
Call notifyObservers() to let others know about this. The nodePositions should be a numpy array of 3D vectors. The quad indices should be a 2D numpy array with 4 indices per quad. The indices refer to the node positions. The node normals and bounding box are automatically calculated.
◆ addTrianglePatchFromNumPyArray
MLWEMPatchWrapper * MLWEMWrapper::addTrianglePatchFromNumPyArray |
( |
PyObject * | nodePositions, |
|
|
PyObject * | triangleIndices ) |
|
slot |
Adds a new triangle patch.
Call notifyObservers() to let others know about this. The nodePositions should be a numpy array of 3D vectors. The triangle indices should be a 2D numpy array with 3 indices per triangle. The indices refer to the node positions. The node normals and bounding box are automatically calculated.
◆ createNearestPointOnSurfaceObject
Returns a object which allows to get the nearest point on the WEM efficiently (or None, if the patches of this WEM are not triangle patches).
- Note
- The user is responsible for discarding this object if the WEM has changed, crashes are possible if the object is still used otherwise.
◆ createObject()
static ml::RefCountedBase * MLWEMWrapper::createObject |
( |
const QVariantList & | arguments | ) |
|
|
static |
Create new WEM object; this is used by MLAB.createMLBaseObject to create a WEM.
If the arguments are empty, a new WEM will be created. If the arguments are a single WEM wrapper, a new copy of the WEM will be returned.
◆ deregisterForNotification
void MLWEMWrapper::deregisterForNotification |
( |
unsigned int | flags, |
|
|
MLABModule * | module, |
|
|
QString | methodName ) |
|
slot |
Remove notification callback: deregister the method determined by methodName of the given module for the WEM notifications defined by flags.
◆ getId
int MLWEMWrapper::getId |
( |
| ) |
const |
|
slot |
◆ getName
QString MLWEMWrapper::getName |
( |
| ) |
const |
|
slot |
◆ getNumWEMPatches
int MLWEMWrapper::getNumWEMPatches |
( |
| ) |
const |
|
slot |
Returns the number of WEMs in the list.
◆ getWEMPatchAt
Returns a pointer to the WEMPatch at the given position in the internal list.
◆ getWEMPatchById
Returns a pointer to the WEMPatch with the given unique id.
Returns NULL if no such WEMPatch is stored in the list.
◆ getWEMPatches
Returns a list with all WEMPatches.
◆ getWEMPatchIndex [1/2]
unsigned int MLWEMWrapper::getWEMPatchIndex |
( |
int | id | ) |
const |
|
slot |
Returns the index of the WEMPatch with the given id in its list.
◆ getWEMPatchIndex [2/2]
Returns the index of the given WEMPatch in its list.
◆ hasWEMPatch
Returns whether there is the given WEMPatch in the list.
◆ isValid
bool MLWEMWrapper::isValid |
( |
| ) |
const |
|
slot |
Returns whether the WEM is valid.
The WEM is valid if at least one member WEMPatch is non-NULL and contains a non-zero amount of faces and nodes.
◆ loadWEMSurface
bool MLWEMWrapper::loadWEMSurface |
( |
QString | filename, |
|
|
bool | generateEdges = true ) |
|
slot |
Loads the geometry from a file given by its file name.
◆ mergeAllPatchesIntoSinglePatch
void MLWEMWrapper::mergeAllPatchesIntoSinglePatch |
( |
| ) |
|
|
slot |
Flattens all WEMPatches to one triangle WEMPatch.
◆ notifyObservers
Notify the observers of a WEM that it has changed.
The type is an OR combination of the NotificationType. Call this after modifying patches.
◆ registerForNotification
void MLWEMWrapper::registerForNotification |
( |
unsigned int | flags, |
|
|
MLABModule * | module, |
|
|
QString | methodName ) |
|
slot |
Add notification callback: register the method determined by methodName of the given module for the WEM notifications defined by flags.
In Python scripting, the registered method name is called with a list of arguments that is filled with the following infos in that order:
- patchId
- repaintNodes
- repaintEdges
- repaintFaces
- repaintBoundingBoxes
- selectionFaceHit
- selectionWasClicked
- selectionHitPoint
◆ removeAll
void MLWEMWrapper::removeAll |
( |
| ) |
|
|
slot |
◆ removeWEMPatchAt
void MLWEMWrapper::removeWEMPatchAt |
( |
int | index | ) |
|
|
slot |
Removes the WEMPatch at given index.
Beware that a previously returned wrapper for the patch will be invalid. Call notifyObservers() to notify observers!
◆ removeWEMPatchById
void MLWEMWrapper::removeWEMPatchById |
( |
int | index | ) |
|
|
slot |
Removes the WEMPatch with the given id.
Beware that a previously returned wrapper for the patch will be invalid. Call notifyObservers() to notify observers!
◆ saveWEMSurface
void MLWEMWrapper::saveWEMSurface |
( |
QString | filename | ) |
|
|
slot |
Saves the geometry to the given file name.
◆ setName
void MLWEMWrapper::setName |
( |
QString | name | ) |
|
|
slot |
Set name of the WEM to the given string.