mirror of
https://github.com/lubosz/overte.git
synced 2025-04-27 20:35:29 +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
interface/src/scripting
libraries/entities/src
|
@ -14,6 +14,10 @@
|
|||
ClipboardScriptingInterface::ClipboardScriptingInterface() {
|
||||
}
|
||||
|
||||
glm::vec3 ClipboardScriptingInterface::getContentsDimensions() {
|
||||
return qApp->getEntityClipboard()->getContentsDimensions();
|
||||
}
|
||||
|
||||
float ClipboardScriptingInterface::getClipboardContentsLargestDimension() {
|
||||
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ signals:
|
|||
void readyToImport();
|
||||
|
||||
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
|
||||
bool importEntities(const QString& filename);
|
||||
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
|
||||
|
|
|
@ -1284,6 +1284,7 @@ class ContentsDimensionOperator : public RecurseOctreeOperator {
|
|||
public:
|
||||
virtual bool preRecursion(OctreeElementPointer element);
|
||||
virtual bool postRecursion(OctreeElementPointer element) { return true; }
|
||||
glm::vec3 getDimensions() const { return _contentExtents.size(); }
|
||||
float getLargestDimension() const { return _contentExtents.largestDimension(); }
|
||||
private:
|
||||
Extents _contentExtents;
|
||||
|
@ -1295,6 +1296,12 @@ bool ContentsDimensionOperator::preRecursion(OctreeElementPointer element) {
|
|||
return true;
|
||||
}
|
||||
|
||||
glm::vec3 EntityTree::getContentsDimensions() {
|
||||
ContentsDimensionOperator theOperator;
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
return theOperator.getDimensions();
|
||||
}
|
||||
|
||||
float EntityTree::getContentsLargestDimension() {
|
||||
ContentsDimensionOperator theOperator;
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
bool skipThoseWithBadParents) override;
|
||||
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
||||
|
||||
glm::vec3 getContentsDimensions();
|
||||
float getContentsLargestDimension();
|
||||
|
||||
virtual void resetEditStats() override {
|
||||
|
|
Loading…
Reference in a new issue