def on_entity_visuals_modified(self, entid): #print "MediaURLHandler got Visual Modified for:", entid for texture_uuid, mediaurlview in self.texture2mediaurlview.iteritems(): if mediaurlview is None: continue submeshes = r.getSubmeshesWithTexture(entid, texture_uuid) if submeshes: # This doesent work. Seems to be right in theory but some entitys textures are not updated # especially when there are multiple entitys with same mediurl texture """ # Don't reapply if submeshes are the same for this entity try: if mediaurlview.entid_to_submeshes[entid] == submeshes: print "Already have submeshes for ", str(entid) print " >> Present: ", mediaurlview.entid_to_submeshes[entid] print " >> Found : ", submeshes return except KeyError, e: print " Adding new submeshes to ent id to map for ", str(entid) print " >> ", submeshes mediaurlview.entid_to_submeshes[entid] = submeshes """ # Check if we need to create the playback widget if mediaurlview.playback_widget == None: mediaurlview.create_playback_widget() r.applyUICanvasToSubmeshes(entid, submeshes, mediaurlview.playback_widget, mediaurlview.refreshrate) mediaurlview.load_url() else: r.applyUICanvasToSubmeshes(entid, submeshes, mediaurlview.playback_widget, mediaurlview.refreshrate) # Get entity for id and hook to Touchable signals entity = r.getEntity(entid) self.connect_touchable(mediaurlview, entity)
def on_entity_visuals_modified(self, entid): #print "MediaURLHandler got Visual Modified for:", entid #XXX add checks to not re-apply blindly when is already up-to-date! for tx, wc in self.texture2canvas.iteritems(): submeshes = r.getSubmeshesWithTexture(entid, tx) if submeshes: print "Modified entity uses a known mediaurl texture:", entid, tx, submeshes, wc r.applyUICanvasToSubmeshes(entid, submeshes, wc.canvas)
def on_entity_visuals_modified(self, entid): #print "MediaURLHandler got Visual Modified for:", entid for texture_uuid, mediaurlview in self.texture2mediaurlview.iteritems( ): if mediaurlview is None: continue submeshes = r.getSubmeshesWithTexture(entid, texture_uuid) if submeshes: # This doesent work. Seems to be right in theory but some entitys textures are not updated # especially when there are multiple entitys with same mediurl texture """ # Don't reapply if submeshes are the same for this entity try: if mediaurlview.entid_to_submeshes[entid] == submeshes: print "Already have submeshes for ", str(entid) print " >> Present: ", mediaurlview.entid_to_submeshes[entid] print " >> Found : ", submeshes return except KeyError, e: print " Adding new submeshes to ent id to map for ", str(entid) print " >> ", submeshes mediaurlview.entid_to_submeshes[entid] = submeshes """ # Check if we need to create the playback widget if mediaurlview.playback_widget == None: mediaurlview.create_playback_widget() r.applyUICanvasToSubmeshes(entid, submeshes, mediaurlview.playback_widget, mediaurlview.refreshrate) mediaurlview.load_url() else: r.applyUICanvasToSubmeshes(entid, submeshes, mediaurlview.playback_widget, mediaurlview.refreshrate) # Get entity for id and hook to Touchable signals entity = naali.getEntity(entid) self.connect_touchable(mediaurlview, entity)