def validId(self, id): if id != 0 and id > 50: #terrain seems to be 3 and scene objects always big numbers, so > 50 should be good, though randomly created local entities can get over 50... if id != r.getUserAvatarId(): #add other avatar id's check if not self.manipulator.compareIds( id): #and id != self.selection_box.id: return True return False
def validId(self, id): if ( id != 0 and id > 50 ): # terrain seems to be 3 and scene objects always big numbers, so > 50 should be good, though randomly created local entities can get over 50... if id != r.getUserAvatarId(): # add other avatar id's check if not self.manipulator.compareIds(id) and id != self.selection_box.id: return True return False
def createObject(self): avatar_id = r.getUserAvatarId() avatar = r.getEntity(avatar_id) pos = avatar.placeable.Position#r.getUserAvatarPos() start_x = pos.x() start_y = pos.y() start_z = pos.z() end_x = start_x end_y = start_y end_z = start_z r.sendObjectAddPacket(start_x, start_y, start_z, end_x, end_y, end_z)
def createObject(self): avatar_id = r.getUserAvatarId() avatar = r.getEntity(avatar_id) pos = avatar.placeable.Position #r.getUserAvatarPos() start_x = pos.x() start_y = pos.y() start_z = pos.z() end_x = start_x end_y = start_y end_z = start_z r.sendObjectAddPacket(start_x, start_y, start_z, end_x, end_y, end_z)
#previous pyglet stuff, was an ncoming chat msg event #m.dispatch_event('on_chat', "input", "testing") #print viewer._event_stack if 0: #create entity #not safe now: """ New entity created:16:39:22 [Foundation] Error: Can't create entity with given i d because it's already used: 9999999 Assertion failed: px != 0, file D:\k2\rex\viewer\trunk\external_libs\include\boo st/shared_ptr.hpp, line 419 """ print "Testing entity creation" meshname = "axes.mesh" avatar = r.getEntity(r.getUserAvatarId()) ent = r.createEntity(meshname) #print "New entity created:", ent, ent.pos ent.pos = avatar.pos ent.scale = 0.0, 0.0, 0.0 #print "new pos", ent.pos, ent.scale if 0: #placeable and text tests print "Testing..." e = r.getEntity(8880005) #~ try: #~ e.pos = 1 #~ except Exception, e: #~ print e