void AnimationControl::loadCharacters(list<Object*>& render_list) { data_manager.addFileSearchPath(AMC_MOTION_FILE_PATH); char* ASF_filename = NULL; char* AMC_filename = NULL; try { ASF_filename = data_manager.findFile(character_ASF.c_str()); if (ASF_filename == NULL) { logout << "AnimationControl::loadCharacters: Unable to find character ASF file <" << character_ASF << ">. Aborting load." << endl; throw BasicException("ABORT"); } AMC_filename = data_manager.findFile(character_AMC.c_str()); if (AMC_filename == NULL) { logout << "AnimationControl::loadCharacters: Unable to find character AMC file <" << character_AMC << ">. Aborting load." << endl; throw BasicException("ABORT"); } pair<Skeleton*, MotionSequence*> read_result; try { read_result = data_manager.readASFAMC(ASF_filename, AMC_filename); } catch (const DataManagementException& dme) { logout << "AnimationControl::loadCharacters: Unable to load character data files. Aborting load." << endl; logout << " Failure due to " << dme.msg << endl; throw BasicException("ABORT"); } Skeleton* skel = read_result.first; MotionSequence* ms = read_result.second; MotionSequenceController* controller = new MotionSequenceController(ms); // create rendering model for the character and put the character's // bone objects in the rendering list Color color(1.0f,0.4f,0.3f); skel->constructRenderObject(render_list, color); // attach motion controller to animated skeleton skel->attachMotionController(controller); // create a character to link all the pieces together. string d1 = string("skeleton: ") + character_ASF; string d2 = string("motion: ") + character_AMC; skel->setDescription1(d1.c_str()); skel->setDescription2(d2.c_str()); character = skel; } catch (BasicException&) { } strDelete(ASF_filename); ASF_filename = NULL; strDelete(AMC_filename); AMC_filename = NULL; ready = true; }
END_TEST START_TEST(test_strDelete) { char *string; string = strCreate(); strCopy(string, "foobar"); strDelete(string, 1, 4); fail_unless(strEquals(string, "fr"), NULL); strCopy(string, "foobar"); strDelete(string, 1, 5); fail_unless(strEquals(string, "f"), NULL); strCopy(string, "foobar"); strDelete(string, 0, 5); fail_unless(strEquals(string, "r"), NULL); strCopy(string, "foobar"); strDelete(string, 0, 6); fail_unless(strEquals(string, ""), NULL); strCopy(string, "foobar"); strDelete(string, 0, 0); fail_unless(strEquals(string, "foobar"), NULL); strCopy(string, "foobar"); strDelete(string, 5, 0); fail_unless(strEquals(string, "foobar"), NULL); }
Bone::~Bone() { strDelete(name); // skeleton will delete children }
void MainWindow::str1Delete() { strDelete(1); }
void MainWindow::str4Delete() { strDelete(4); }
void MainWindow::str3Delete() { strDelete(3); }
void MainWindow::str2Delete() { strDelete(2); }