src/glcompiler.cpp

changeset 1440
265b2e95a8e8
parent 1436
241d3e452b32
--- a/src/glcompiler.cpp	Fri Dec 28 00:03:47 2018 +0200
+++ b/src/glcompiler.cpp	Thu Jun 20 08:54:35 2019 +0300
@@ -256,7 +256,7 @@
 /*
  * Stages the given object for compilation.
  */
-void gl::Compiler::stageForCompilation(const QModelIndex& index)
+void gl::Compiler::stageForCompilation(const Uuid& index)
 {
 	m_staged.insert(index);
 }
@@ -264,7 +264,7 @@
 /*
  * Removes an object from the set of objects to be compiled.
  */
-void gl::Compiler::unstage(const QModelIndex& index)
+void gl::Compiler::unstage(const Uuid& index)
 {
 	m_staged.remove(index);
 }
@@ -324,7 +324,7 @@
 /*
  * Removes the data related to the given object.
  */
-void gl::Compiler::dropObjectInfo(const QModelIndex& index)
+void gl::Compiler::dropObjectInfo(const Uuid& index)
 {
 	if (m_objectInfo.contains(index))
 	{
@@ -339,7 +339,7 @@
 /*
  * Makes the compiler forget about the given object completely.
  */
-void gl::Compiler::forgetObject(QModelIndex index)
+void gl::Compiler::forgetObject(const Uuid& index)
 {
 	dropObjectInfo(index);
 	unstage(index);
@@ -348,15 +348,15 @@
 /*
  * Compiles a single object.
  */
-void gl::Compiler::compileObject(const QModelIndex& index)
+void gl::Compiler::compileObject(const Uuid& id)
 {
-	LDObject* object = m_renderer->model()->lookup(index);
+	LDObject* object = m_renderer->model()->lookup(id);
 
 	if (object == nullptr)
 		return;
 
 	ObjectVboData info;
-	dropObjectInfo(index);
+	dropObjectInfo(id);
 
 	switch (object->type())
 	{
@@ -497,7 +497,7 @@
 	if (this->needBoundingBoxRebuild)
 	{
 		this->boundingBox = {};
-		QMapIterator<QPersistentModelIndex, ObjectVboData> iterator {m_objectInfo};
+		QMapIterator<Uuid, ObjectVboData> iterator {m_objectInfo};
 
 		while (iterator.hasNext())
 		{
@@ -646,3 +646,8 @@
 	this->setSelectionModel(nullptr);
 	emit sceneChanged();
 }
+
+void gl::Compiler::objectRemoved(const Uuid& id)
+{
+	this->m_objectInfo.remove(id);
+}

mercurial