def interactive_init(self): InteractiveWithMemory.interactive_init(self) self.victim = context.application.cache.node self.eye_rotation = context.application.camera.object_eye_rotation(self.victim) self.changed = False self.old_transformation = self.victim.transformation
def finish(self): if self.changed: self.parameters.transformation = copy.deepcopy(self.victim.transformation) self.parameters.transformation.apply_inverse_before(self.old_transformation) primitive.SetProperty(self.victim, "transformation", self.old_transformation, done=True) self.victim.invalidate_transformation_list() # make sure that bonds and connectors are updated after transformation InteractiveWithMemory.finish(self)
def interactive_init(self): InteractiveWithMemory.interactive_init(self) self.victim = context.application.cache.node self.eye_rotation = context.application.camera.object_eye_rotation( self.victim) self.changed = False self.old_transformation = self.victim.transformation
def finish(self): if self.changed: self.parameters.transformation = self.old_transformation.inv * self.victim.transformation primitive.SetProperty(self.victim, "transformation", self.old_transformation, done=True) self.victim.invalidate_transformation_list( ) # make sure that bonds and connectors are updated after transformation InteractiveWithMemory.finish(self)
def analyze_selection(parameters=None): if not InteractiveWithMemory.analyze_selection(parameters): return False application = context.application if application is None: return False victim = application.cache.node if victim is None: return False if victim.get_fixed(): return False if not isinstance(victim, GLTransformationMixin): return False if not isinstance(victim.transformation, Translation): return False return True
def interactive_init(self): InteractiveWithMemory.interactive_init(self) cache = context.application.cache if len(cache.nodes) == 1: self.victim = cache.node helper = None else: self.victim = cache.next_to_last helper = cache.last self.rotation_axis = None self.changed = False rotation_center_object = None if helper is not None: # take the information out of the helper nodes if isinstance(helper, Vector): b = helper.children[0].translation_relative_to( self.victim.parent) e = helper.children[1].translation_relative_to( self.victim.parent) if not ((b is None) or (e is None)): rotation_center_object = helper.children[0].target self.rotation_axis = e - b norm = numpy.dot(self.rotation_axis, self.rotation_axis) if norm > 0.0: self.rotation_axis /= norm else: self.rotation_axis = None else: rotation_center_object = helper else: rotation_center_object = self.victim self.rotation_center = Translation( rotation_center_object.get_frame_relative_to(self.victim.parent).t) drawing_area = context.application.main.drawing_area camera = context.application.camera self.screen_rotation_center = drawing_area.camera_to_screen( camera.object_to_camera(rotation_center_object)) self.eye_rotation = camera.object_eye_rotation(self.victim) self.old_transformation = self.victim.transformation
def interactive_init(self): InteractiveWithMemory.interactive_init(self) cache = context.application.cache if len(cache.nodes) == 1: self.victim = cache.node helper = None else: self.victim = cache.next_to_last helper = cache.last self.rotation_axis = None self.changed = False rotation_center_object = None if helper is not None: # take the information out of the helper nodes if isinstance(helper, Vector): b = helper.children[0].translation_relative_to(self.victim.parent) e = helper.children[1].translation_relative_to(self.victim.parent) if not ((b is None) or (e is None)): rotation_center_object = helper.children[0].target self.rotation_axis = e - b norm = numpy.dot(self.rotation_axis, self.rotation_axis) if norm > 0.0: self.rotation_axis /= norm else: self.rotation_axis = None else: rotation_center_object = helper else: rotation_center_object = self.victim self.rotation_center = Translation(rotation_center_object.get_frame_relative_to(self.victim.parent).t) drawing_area = context.application.main.drawing_area camera = context.application.camera self.screen_rotation_center = drawing_area.camera_to_screen(camera.object_to_camera(rotation_center_object)) self.eye_rotation = camera.object_eye_rotation(self.victim) self.old_transformation = self.victim.transformation
def analyze_selection(parameters=None): if not InteractiveWithMemory.analyze_selection(parameters): return False cache = context.application.cache if len(cache.nodes) == 1: if cache.last.get_fixed(): return False if not isinstance(cache.last, GLTransformationMixin): return False if not isinstance(cache.last.transformation, Rotation): return False elif len(cache.nodes) == 2: if cache.next_to_last.get_fixed(): return False if not isinstance(cache.next_to_last, GLTransformationMixin): return False if not isinstance(cache.next_to_last.transformation, Translation): return False if not ( isinstance(cache.last, Vector) or ( isinstance(cache.last, GLTransformationMixin) and isinstance(cache.last.transformation, Translation) ) ): return False else: return False return True
def analyze_selection(parameters=None): if not InteractiveWithMemory.analyze_selection(parameters): return False cache = context.application.cache if len(cache.nodes) == 1: if cache.last.get_fixed(): return False if not isinstance(cache.last, GLTransformationMixin): return False if not isinstance(cache.last.transformation, Rotation): return False elif len(cache.nodes) == 2: if cache.next_to_last.get_fixed(): return False if not isinstance(cache.next_to_last, GLTransformationMixin): return False if not isinstance(cache.next_to_last.transformation, Translation): return False if not (isinstance(cache.last, Vector) or (isinstance(cache.last, GLTransformationMixin) and isinstance(cache.last.transformation, Translation))): return False else: return False return True