Example #1
0
    def btn_play_clicked(self, checked):
        # normal play, play from the start
        if not self.btn_play_state:
            # custom play (range is selected), we play the range in loop mode
            if self.clip_ctrl.frame_cursor_start != self.clip_ctrl.frame_cursor_end:
                self.preview_frame = self.clip_ctrl.frame_cursor_start
                self.preview_clip = {'start': self.clip_ctrl.frame_cursor_start,
                    'end': self.clip_ctrl.frame_cursor_end,
                    'looped': True}
                self.tm_preview.start()
            else:
                dheng.cmp_anim_play(self.anim_cmp)
                self.tm_play.start()
            self.btn_play.setIcon(self.icn_pause)
        else:
            if self.clip_ctrl.frame_cursor_start != self.clip_ctrl.frame_cursor_end:
                self.tm_preview.stop()
                self.preview_frame = self.clip_ctrl.frame_cursor_start
            else:
                self.tm_play.stop()
                dheng.cmp_anim_stop(self.anim_cmp)

            self.btn_play.setIcon(self.icn_play)

        self.btn_play_state = not self.btn_play_state
        self.btn_play_state_prev = self.btn_play_state
Example #2
0
    def btn_play_clicked(self, checked):
        # normal play, play from the start
        if not self.btn_play_state:
            # custom play (range is selected), we play the range in loop mode
            if self.clip_ctrl.frame_cursor_start != self.clip_ctrl.frame_cursor_end:
                self.preview_frame = self.clip_ctrl.frame_cursor_start
                self.preview_clip = {
                    'start': self.clip_ctrl.frame_cursor_start,
                    'end': self.clip_ctrl.frame_cursor_end,
                    'looped': True
                }
                self.tm_preview.start()
            else:
                dheng.cmp_anim_play(self.anim_cmp)
                self.tm_play.start()
            self.btn_play.setIcon(self.icn_pause)
        else:
            if self.clip_ctrl.frame_cursor_start != self.clip_ctrl.frame_cursor_end:
                self.tm_preview.stop()
                self.preview_frame = self.clip_ctrl.frame_cursor_start
            else:
                self.tm_play.stop()
                dheng.cmp_anim_stop(self.anim_cmp)

            self.btn_play.setIcon(self.icn_play)

        self.btn_play_state = not self.btn_play_state
        self.btn_play_state_prev = self.btn_play_state
Example #3
0
    def load_props(self, model_file, anim_file, clips_jsonfile):
        # initialize camera
        if self.camera == None:
            self.camera = dheng.camera()
            pos = dheng.vec4f()
            lookat = dheng.vec4f()
            pos.y = 2
            pos.z = -5
            dheng.cam_init(self.camera, pos, lookat, 0.2, 300,
                           dheng.math_torad(50))

        dheng.cam_update(self.camera)
        self.eng_view.set_cam(self.camera)

        # ground
        ground = dheng.scn_create_obj(dheng.scn_getactive(), 'ground',
                                      dheng.CMP_OBJTYPE_MODEL)
        dheng.cmp_value_sets(dheng.cmp_findinstance_inobj(ground, 'model'),
                             'filepath', 'plane.h3dm')
        ##
        obj = dheng.scn_create_obj(dheng.scn_getactive(), 'test',
                                   dheng.CMP_OBJTYPE_MODEL)
        model_cmp = dheng.cmp_findinstance_inobj(obj, 'model')
        dheng.cmp_value_sets(model_cmp, 'filepath', model_file)

        anim_cmp = dheng.cmp_create_instance_forobj('anim', obj)
        dheng.cmp_value_sets(anim_cmp, 'filepath', anim_file)
        dheng.cmp_anim_stop(anim_cmp)

        frame_cnt = dheng.cmp_anim_getframecnt(anim_cmp)
        self.clip_ctrl.set_framecnt(frame_cnt)
        self.clip_ctrl.anim_cmp = anim_cmp
        self.wnd_clips.set_framecnt(frame_cnt)

        self.obj = obj
        self.ground = ground
        self.anim_cmp = anim_cmp

        self.wnd_clips.load_clips(clips_jsonfile)
        self.tm_preview.setInterval(1000 / dheng.cmp_anim_getfps(anim_cmp))
        self.clips_jsonfile = clips_jsonfile
Example #4
0
    def load_props(self, model_file, anim_file, clips_jsonfile):
        # initialize camera
        if self.camera == None:
            self.camera = dheng.camera()
            pos = dheng.vec4f()
            lookat = dheng.vec4f()
            pos.y = 2
            pos.z = -5
            dheng.cam_init(self.camera, pos, lookat, 0.2, 300, dheng.math_torad(50))

        dheng.cam_update(self.camera)
        self.eng_view.set_cam(self.camera)

        # ground
        ground = dheng.scn_create_obj(dheng.scn_getactive(), 'ground', dheng.CMP_OBJTYPE_MODEL)
        dheng.cmp_value_sets(dheng.cmp_findinstance_inobj(ground, 'model'), 'filepath',
            'plane.h3dm')
        ##
        obj = dheng.scn_create_obj(dheng.scn_getactive(), 'test', dheng.CMP_OBJTYPE_MODEL)
        model_cmp = dheng.cmp_findinstance_inobj(obj, 'model')
        dheng.cmp_value_sets(model_cmp, 'filepath', model_file)

        anim_cmp = dheng.cmp_create_instance_forobj('anim', obj)
        dheng.cmp_value_sets(anim_cmp, 'filepath', anim_file)
        dheng.cmp_anim_stop(anim_cmp)

        frame_cnt = dheng.cmp_anim_getframecnt(anim_cmp)
        self.clip_ctrl.set_framecnt(frame_cnt)
        self.clip_ctrl.anim_cmp = anim_cmp
        self.wnd_clips.set_framecnt(frame_cnt)

        self.obj = obj
        self.ground = ground
        self.anim_cmp = anim_cmp

        self.wnd_clips.load_clips(clips_jsonfile)
        self.tm_preview.setInterval(1000/dheng.cmp_anim_getfps(anim_cmp))
        self.clips_jsonfile = clips_jsonfile
Example #5
0
 def play_stop(self):
     self.btn_play.setIcon(self.icn_play)
     self.tm_play.stop()
     self.tm_preview.stop()
     dheng.cmp_anim_stop(self.anim_cmp)
Example #6
0
 def play_stop(self):
     self.btn_play.setIcon(self.icn_play)
     self.tm_play.stop()
     self.tm_preview.stop()
     dheng.cmp_anim_stop(self.anim_cmp)