def load_props(self, model_file): # 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) self.obj = obj self.ground = ground
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
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