mirror of
https://github.com/overte-org/overte.git
synced 2025-07-28 18:00:21 +02:00
Merge pull request #7973 from ctrlaltdavid/clipboard-dimensions
add Clipboard.getContentsDimensions() JavaScript method
This commit is contained in:
commit
b4721ec57e
4 changed files with 13 additions and 0 deletions
|
@ -14,6 +14,10 @@
|
||||||
ClipboardScriptingInterface::ClipboardScriptingInterface() {
|
ClipboardScriptingInterface::ClipboardScriptingInterface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 ClipboardScriptingInterface::getContentsDimensions() {
|
||||||
|
return qApp->getEntityClipboard()->getContentsDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
float ClipboardScriptingInterface::getClipboardContentsLargestDimension() {
|
float ClipboardScriptingInterface::getClipboardContentsLargestDimension() {
|
||||||
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ signals:
|
||||||
void readyToImport();
|
void readyToImport();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
glm::vec3 getContentsDimensions(); /// returns the overall dimensions of everything on the blipboard
|
||||||
float getClipboardContentsLargestDimension(); /// returns the largest dimension of everything on the clipboard
|
float getClipboardContentsLargestDimension(); /// returns the largest dimension of everything on the clipboard
|
||||||
bool importEntities(const QString& filename);
|
bool importEntities(const QString& filename);
|
||||||
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
|
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
|
||||||
|
|
|
@ -1284,6 +1284,7 @@ class ContentsDimensionOperator : public RecurseOctreeOperator {
|
||||||
public:
|
public:
|
||||||
virtual bool preRecursion(OctreeElementPointer element);
|
virtual bool preRecursion(OctreeElementPointer element);
|
||||||
virtual bool postRecursion(OctreeElementPointer element) { return true; }
|
virtual bool postRecursion(OctreeElementPointer element) { return true; }
|
||||||
|
glm::vec3 getDimensions() const { return _contentExtents.size(); }
|
||||||
float getLargestDimension() const { return _contentExtents.largestDimension(); }
|
float getLargestDimension() const { return _contentExtents.largestDimension(); }
|
||||||
private:
|
private:
|
||||||
Extents _contentExtents;
|
Extents _contentExtents;
|
||||||
|
@ -1295,6 +1296,12 @@ bool ContentsDimensionOperator::preRecursion(OctreeElementPointer element) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 EntityTree::getContentsDimensions() {
|
||||||
|
ContentsDimensionOperator theOperator;
|
||||||
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
return theOperator.getDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
float EntityTree::getContentsLargestDimension() {
|
float EntityTree::getContentsLargestDimension() {
|
||||||
ContentsDimensionOperator theOperator;
|
ContentsDimensionOperator theOperator;
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
|
|
@ -207,6 +207,7 @@ public:
|
||||||
bool skipThoseWithBadParents) override;
|
bool skipThoseWithBadParents) override;
|
||||||
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
||||||
|
|
||||||
|
glm::vec3 getContentsDimensions();
|
||||||
float getContentsLargestDimension();
|
float getContentsLargestDimension();
|
||||||
|
|
||||||
virtual void resetEditStats() override {
|
virtual void resetEditStats() override {
|
||||||
|
|
Loading…
Reference in a new issue