I’m working on an editor to automate a few things when setting up objects for my current project.
Especially when setting up damage zones for relativley complex shapes, its supposed to reduce workload.
For my filling operation I set a collider that traces the object’s model and saves the collision coordinates.
It works pretty accurate, but some objects might get relatively big coordinate systems and polygon counts.
In most cases I’ll be able to work on something else while the process is running. I just thought I could ask, if there are ways to optimise this operation without loosing (at least not too much) accuracy, just in case.
Here is my current code of that process for reference. I put it into a task, so I still can aboard the process, without closing the entire editor.
def taskPainterFill(self, solid, maxPos, iterations): for i in range(iterations): #currently 50 iterations pos = solid.getPos() self.raster.traverse(render) if self.queueRaster.getNumEntries() > 0: #self.queueRaster.sortEntries() #Translate point of collsion into the current coordiante system cpos = self.queueRaster.getEntry(0).getSurfacePoint(self.dictModels[self.currentMod]) cpos = (int(cpos),int(cpos),int(cpos)) #save point with associated Subsystem into a temporary dictionary self.RecordSub[str(cpos)] = [self.currentSub, cpos] #check grid bounds and set new position if pos < maxPos: solid.setX(pos+1) #print("setting X") else: solid.setX(0) if pos < maxPos: solid.setY(pos+1) #print("setting Y") else: solid.setY(0) if pos < maxPos: solid.setZ(pos+1) self.CounterFillLayer["text"] = "Layer "+str(solid.getZ()) #print("setting Z") else: self.pasteDictSub() #add temporary dictionary into data base self.exitPainterFill() #return to main process break #print("Made it to End") return Task.cont