00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "bindAnimRequest.h"
00016 #include "animBundleNode.h"
00017 #include "animControl.h"
00018 #include "partBundle.h"
00019
00020 TypeHandle BindAnimRequest::_type_handle;
00021
00022
00023
00024
00025
00026
00027 BindAnimRequest::
00028 BindAnimRequest(const string &name,
00029 const Filename &filename, const LoaderOptions &options,
00030 Loader *loader,
00031 AnimControl *control, int hierarchy_match_flags,
00032 const PartSubset &subset) :
00033 ModelLoadRequest(name, filename, options, loader),
00034 _control(control),
00035 _hierarchy_match_flags(hierarchy_match_flags),
00036 _subset(subset)
00037 {
00038 }
00039
00040
00041
00042
00043
00044
00045
00046 AsyncTask::DoneStatus BindAnimRequest::
00047 do_task() {
00048 ModelLoadRequest::do_task();
00049
00050 PartBundle *part = _control->get_part();
00051
00052 if (_control->get_ref_count() == 1) {
00053
00054
00055 _control->fail_anim(part);
00056 return DS_done;
00057 }
00058
00059 PT(PandaNode) model = get_model();
00060 if (model == (PandaNode *)NULL) {
00061
00062 _control->fail_anim(part);
00063 return DS_done;
00064 }
00065 _control->set_anim_model(model);
00066
00067 AnimBundle *anim = AnimBundleNode::find_anim_bundle(model);
00068 if (anim == (AnimBundle *)NULL) {
00069
00070 _control->fail_anim(part);
00071 return DS_done;
00072 }
00073
00074 if (!part->do_bind_anim(_control, anim, _hierarchy_match_flags, _subset)) {
00075
00076 _control->fail_anim(part);
00077 return DS_done;
00078 }
00079
00080 return DS_done;
00081 }