def updateModel(self):
        """
        Refresh the name_comboBox with the current Maya scene state.
        """
        col = lib_state.get_active_collection()
        if col is None:
            return

        roots_enabled = True
        roots_string = self.getRootFramesValue(col)
        if roots_string is None:
            frame = lib_maya_utils.get_current_frame()
            start, end = utils_time.get_maya_timeline_range_inner()
            int_list = list(set([start, frame, end]))
            roots_string = convert_types.intListToString(int_list)
            self.setRootFramesValue(col, roots_string)
        else:
            int_list = convert_types.stringToIntList(roots_string)
            roots_string = convert_types.intListToString(int_list)
        assert roots_string is not None

        block = self.blockSignals(True)
        self.rootFrames_lineEdit.setEnabled(roots_enabled)
        self.rootFrames_lineEdit.setText(roots_string)
        self.blockSignals(block)
        return
    def rootFramesTextEntered(self):
        """
        Run when the rootFrames_lineEdit text is has been entered (for example
        the user presses the <Enter> key to confirm the field value).
        """
        text = self.rootFrames_lineEdit.text()

        col = lib_state.get_active_collection()
        if col is None:
            return

        # Round-trip conversion will make sure there are no syntax
        # errors given by the user.
        int_list = convert_types.stringToIntList(text)
        frames_string = convert_types.intListToString(int_list)
        if len(int_list) < 2:
            msg = 'Must have at least 2 root frames to solve.'
            LOG.warn(msg)
            msg = 'WARNING: ' + msg
            self.sendWarning.emit(msg)
        else:
            msg = const.STATUS_READY
            self.sendWarning.emit(msg)

        # Save the integer list, but present the user with a string.
        self.rootFrames_lineEdit.setText(frames_string)
        self.setRootFramesValue(col, frames_string)
        self.rootFramesChanged.emit()
        return
 def removeClicked(self):
     col = lib_state.get_active_collection()
     if col is None:
         return
     frame = lib_maya_utils.get_current_frame()
     frames_string = self.getRootFramesValue(col)
     if frames_string is None:
         int_list = [frame]
         frames_string = convert_types.intListToString(int_list)
         self.setRootFramesValue(col, frames_string)
         self.rootFrames_lineEdit.setText(frames_string)
     else:
         int_list = convert_types.stringToIntList(frames_string)
     if frame in int_list:
         int_list.remove(frame)
         frames_string = convert_types.intListToString(int_list)
         self.setRootFramesValue(col, frames_string)
         self.rootFrames_lineEdit.setText(frames_string)
     return
Exemplo n.º 4
0
def set_root_frames_list(col, root_frames_list):
    """
    Set the Root Frames on the currently active Collection.
    """
    if col is None:
        return None
    if root_frames_list is None:
        return None
    assert isinstance(root_frames_list, list)
    root_frames_string = convert_types.intListToString(root_frames_list)
    lib_col_state.set_solver_root_frames_on_collection(col, root_frames_string)
    return None
Exemplo n.º 5
0
    def frames(self):
        # if the option 'override current frame' is on, we ignore the actual
        # value.
        col = self.collectionNode()
        cur_frame = lib_collection.get_override_current_frame_from_collection(
            col)
        if cur_frame is True:
            return 'CURRENT'

        n = self.stepNode()
        int_list = n.get_frame_list()
        string = converttypes.intListToString(int_list)
        return string
 def autoClicked(self):
     col = lib_state.get_active_collection()
     if col is None:
         return
     mkr_list = col.get_marker_list()
     start_frame, end_frame = utils_time.get_maya_timeline_range_inner()
     min_frames_per_marker = 2
     frame_nums = mmapi.get_root_frames_from_markers(
         mkr_list, min_frames_per_marker, start_frame, end_frame)
     if len(frame_nums) < 2:
         LOG.warn(
             'Auto Root Frames failed to calculate - not enough markers.')
         return
     roots_string = convert_types.intListToString(frame_nums)
     self.setRootFramesValue(col, roots_string)
     self.rootFrames_lineEdit.setText(roots_string)
     return
Exemplo n.º 7
0
    def framesTextEntered(self):
        """
        Run when the frames_lineEdit text is has been entered (for example
        the user presses the <Enter> key to confirm the field value).
        """
        text = self.frames_lineEdit.text()

        col = lib_state.get_active_collection()
        if col is None:
            return

        # Round-trip conversion will make sure there are no syntax
        # errors given by the user.
        int_list = converttypes.stringToIntList(text)
        frames_string = converttypes.intListToString(int_list)

        self.frames_lineEdit.setText(frames_string)
        self.setFramesValue(col, frames_string)
        self.framesChanged.emit()
        return