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: ort = mu.euler_to_quat(v) 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[i]) ent = self.active if ent is not None and not self.usingManipulator: ort = mu.euler_to_quat(v) ent.placeable.Orientation = ort ent.network.Orientation = ort if not self.dragging: r.networkUpdate(ent.id) self.modified = True
def _rotateEachEntWithQuaternion(self, q, ents, angle): for ent in ents: ort = ent.placeable.orientation euler = mu.quat_to_euler(ort) if self.grabbed_axis == self.AXIS_RED: #rotate around x-axis #print euler[0] #print math.radians(angle) euler[0] += math.radians(angle) elif self.grabbed_axis == self.AXIS_GREEN: #rotate around y-axis #print euler[1] #print math.radians(angle) euler[1] += math.radians(angle) elif self.grabbed_axis == self.AXIS_BLUE: #rotate around z-axis #print euler[2] #print math.radians(angle) euler[2] += math.radians(angle) ort = mu.euler_to_quat(euler) ent.placeable.orientation = ort #ent.network.Orientation = ort pass
def _manipulate(self, ent, amountx, amounty, changevec): if self.grabbed and self.grabbed_axis is not None: local = self.controller.useLocalTransform mov = changevec.length() * 30 ort = ent.placeable.Orientation if amountx < 0 and amounty < 0: dir = -1 elif amountx < 0 and amounty >= 0: dir = 1 if not local and self.grabbed_axis == self.AXIS_BLUE: dir *= -1 elif amountx >= 0 and amounty < 0: dir = -1 elif amountx >= 0 and amounty >= 0: dir = 1 mov *= dir if local: if self.grabbed_axis == self.AXIS_RED: axis = QVector3D(1, 0, 0) elif self.grabbed_axis == self.AXIS_GREEN: axis = QVector3D(0, 1, 0) elif self.grabbed_axis == self.AXIS_BLUE: axis = QVector3D(0, 0, 1) ort = ort * QQuaternion.fromAxisAndAngle(axis, mov) else: euler = mu.quat_to_euler(ort) if self.grabbed_axis == self.AXIS_RED: #rotate around x-axis euler[0] -= math.radians(mov) elif self.grabbed_axis == self.AXIS_GREEN: #rotate around y-axis euler[1] += math.radians(mov) elif self.grabbed_axis == self.AXIS_BLUE: #rotate around z-axis euler[2] += math.radians(mov) ort = mu.euler_to_quat(euler) ent.placeable.Orientation = ort ent.network.Orientation = ort