def _manipulate(self, ent, amountx, amounty, lengthx, lengthy): if self.grabbed and self.grabbed_axis is not None: rightvec = Vector3(r.getCameraRight()) upvec = Vector3(r.getCameraUp()) ort = ent.placeable.Orientation euler = list((0, 0, 0)) if self.grabbed_axis == self.AXIS_GREEN: # rotate z-axis # print "green axis", self.grabbed_axis mov = amountx * 30 euler[2] += mov elif self.grabbed_axis == self.AXIS_BLUE: # rotate x-axis # print "blue axis", self.grabbed_axis mov = amountx * 30 euler[1] += mov elif self.grabbed_axis == self.AXIS_RED: # rotate y-axis # print "red axis", self.grabbed_axis mov = amounty * 30 euler[0] -= mov rotationQuat = list(euler_to_quat(euler)) ort.__imul__(Quat(rotationQuat[3], rotationQuat[0], rotationQuat[1], rotationQuat[2])) ent.placeable.Orientation = ort ent.network.Orientation = ort
def _manipulate(self, ent, amountx, amounty, lengthx, lengthy): if self.grabbed and self.grabbed_axis is not None: rightvec = Vector3(r.getCameraRight()) upvec = Vector3(r.getCameraUp()) ort = ent.placeable.Orientation euler = list((0, 0, 0)) if self.grabbed_axis == self.AXIS_GREEN: #rotate z-axis #print "green axis", self.grabbed_axis mov = amountx * 30 euler[2] += mov elif self.grabbed_axis == self.AXIS_BLUE: #rotate x-axis #print "blue axis", self.grabbed_axis mov = amountx * 30 euler[1] += mov elif self.grabbed_axis == self.AXIS_RED: #rotate y-axis #print "red axis", self.grabbed_axis mov = amounty * 30 euler[0] -= mov rotationQuat = list(euler_to_quat(euler)) ort.__imul__( Quat(rotationQuat[3], rotationQuat[0], rotationQuat[1], rotationQuat[2])) ent.placeable.Orientation = ort ent.network.Orientation = ort
def changerot(self, i, v): #XXX NOTE / API TODO: exceptions in qt slots (like this) are now eaten silently #.. apparently they get shown upon viewer exit. must add some qt exc thing somewhere #print "pos index %i changed to: %f" % (i, v[i]) ent = self.active if ent is not None and not self.usingManipulator: quat = conv.euler_to_quat(v) # convert between conversions.Quat tuple (x,y,z,w) format and QQuaternion (w,x,y,z) # TODO: it seems that visualisation compared to what we give/understand on ob edit # level is shifted. For now leave this 'shift' in, but need to investigate later. At # least visual changes triggered through ob edit window widgets seem to correspond # better to what one expects. ort = Quat(quat[3], quat[1], quat[2], quat[0]) ent.placeable.Orientation = ort ent.network.Orientation = ort if not self.dragging: r.networkUpdate(ent.id) self.modified = True
def changerot(self, i, v): #XXX NOTE / API TODO: exceptions in qt slots (like this) are now eaten silently #.. apparently they get shown upon viewer exit. must add some qt exc thing somewhere #print "pos index %i changed to: %f" % (i, v) ent = self.active if ent is not None: qquat = ent.placeable.Orientation euler = list(quat_to_euler((qquat.x(), qquat.y(), qquat.z(), qquat.scalar()))) if not self.float_equal(euler[i],v): euler[i] = v ort = euler_to_quat(euler) #print euler, ort #print euler, ort ort = Quat(ort[3], ort[0], ort[1], ort[2]) ent.placeable.Orientation = ort ent.network.Orientation = ort if not self.dragging: r.networkUpdate(ent.id) self.modified = True
def changerot(self, i, v): #XXX NOTE / API TODO: exceptions in qt slots (like this) are now eaten silently #.. apparently they get shown upon viewer exit. must add some qt exc thing somewhere #print "pos index %i changed to: %f" % (i, v) ent = self.active if ent is not None: qquat = ent.placeable.Orientation euler = list( quat_to_euler( (qquat.x(), qquat.y(), qquat.z(), qquat.scalar()))) if not self.float_equal(euler[i], v): euler[i] = v ort = euler_to_quat(euler) #print euler, ort #print euler, ort ort = Quat(ort[3], ort[0], ort[1], ort[2]) ent.placeable.Orientation = ort ent.network.Orientation = ort if not self.dragging: r.networkUpdate(ent.id) self.modified = True
def _manipulate(self, ent, amountx, amounty, lengthx, lengthy): if self.grabbed and self.grabbed_axis is not None: rightvec = Vector3(r.getCameraRight()) upvec = Vector3(r.getCameraUp()) ort = ent.placeable.Orientation euler = list((0, 0, 0)) if self.grabbed_axis == self.AXIS_GREEN: #rotate z-axis #print "green axis", self.grabbed_axis mov = amountx * 30 euler[2] += mov elif self.grabbed_axis == self.AXIS_BLUE: #rotate x-axis #print "blue axis", self.grabbed_axis mov = amountx * 30 euler[1] += mov elif self.grabbed_axis == self.AXIS_RED: #rotate y-axis #print "red axis", self.grabbed_axis mov = amounty * 30 euler[0] -= mov rotationQuat = list(euler_to_quat(euler)) ort.__imul__(Quat(rotationQuat[3], rotationQuat[0], rotationQuat[1], rotationQuat[2])) ent.placeable.Orientation = ort ent.network.Orientation = ort #~ def _manipulate(self, ent, amountx, amounty, lengthx, lengthy): #~ if self.grabbed and self.grabbed_axis is not None: #~ #print "rotating...", self.grabbed_axis #~ #print "amounts: ", amountx, amounty #~ #print "lengths: ", lengthx, lengthy #~ rightvec = Vector3(r.getCameraRight()) #~ upvec = Vector3(r.getCameraUp()) #~ x, y, z, w = ent.orientation #~ ort = Quat(w, x, y, z) #~ euler = list((0, 0, 0)) #~ if self.grabbed_axis == self.AXIS_GREEN: #rotate z-axis #~ #print "green axis", self.grabbed_axis #~ mov = amountx * 30 #~ euler[2] += mov #~ elif self.grabbed_axis == self.AXIS_BLUE: #rotate x-axis #~ #print "blue axis", self.grabbed_axis #~ mov = amountx * 30 #~ euler[1] += mov #~ elif self.grabbed_axis == self.AXIS_RED: #rotate y-axis #~ #print "red axis", self.grabbed_axis #~ mov = amounty * 30 #~ euler[0] -= mov #~ rotationQuat = list(euler_to_quat(euler)) #~ ort.__imul__(Quat(rotationQuat[3], rotationQuat[0], rotationQuat[1], rotationQuat[2])) #~ ent.orientation = ort.x(), ort.y(), ort.z(), ort.scalar()