Changeset 899 for cpp/frams/model/modelparts.cpp
- Timestamp:
- 11/30/19 02:13:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/modelparts.cpp
r844 r899 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 7Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2019 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 74 74 } 75 75 76 void PartBase::setInfo(const SString & name, const SString&value)76 void PartBase::setInfo(const SString &name, const SString &value) 77 77 { 78 78 strSetField(info, name, value); 79 79 } 80 80 81 void PartBase::setInfo(const SString &name, int value)81 void PartBase::setInfo(const SString &name, int value) 82 82 { 83 83 setInfo(name, SString::valueOf(value)); 84 84 } 85 85 86 void PartBase::setInfo(const SString &name, double value)86 void PartBase::setInfo(const SString &name, double value) 87 87 { 88 88 setInfo(name, SString::valueOf(value)); 89 89 } 90 90 91 SString PartBase::getInfo(const SString &name)91 SString PartBase::getInfo(const SString &name) 92 92 { 93 93 return strGetField(info, name); … … 134 134 } 135 135 136 void NeuroClass::setGenActive(const char *genactive_classes[])137 { 138 for (const char **n = genactive_classes; *n; n++)139 { 140 NeuroClass *cls = Neuro::getClass(*n);136 void NeuroClass::setGenActive(const char *genactive_classes[]) 137 { 138 for (const char **n = genactive_classes; *n; n++) 139 { 140 NeuroClass *cls = Neuro::getClass(*n); 141 141 if (cls) cls->genactive = 1; 142 142 } … … 223 223 } 224 224 225 SString **Neuro::inputInfo(int i)225 SString **Neuro::inputInfo(int i) 226 226 { 227 227 if (i >= getInputCount()) return 0; … … 229 229 } 230 230 231 void Neuro::setInputInfo(int i, const SString &name, const SString &value)231 void Neuro::setInputInfo(int i, const SString &name, const SString &value) 232 232 { 233 233 SString **s = inputInfo(i); … … 237 237 } 238 238 239 void Neuro::setInputInfo(int i, const SString &name, int value)239 void Neuro::setInputInfo(int i, const SString &name, int value) 240 240 { 241 241 setInputInfo(i, name, SString::valueOf(value)); 242 242 } 243 243 244 void Neuro::setInputInfo(int i, const SString &name, double value)244 void Neuro::setInputInfo(int i, const SString &name, double value) 245 245 { 246 246 setInputInfo(i, name, SString::valueOf(value)); … … 255 255 } 256 256 257 SString Neuro::getInputInfo(int i, const SString &name)257 SString Neuro::getInputInfo(int i, const SString &name) 258 258 { 259 259 SString **s = inputInfo(i); … … 263 263 } 264 264 265 void Neuro::operator=(const Neuro &src)265 void Neuro::operator=(const Neuro &src) 266 266 { 267 267 refno = src.refno; … … 294 294 } 295 295 296 NeuroClass *Neuro::getClass(int classindex)296 NeuroClass *Neuro::getClass(int classindex) 297 297 { 298 298 return NeuroLibrary::staticlibrary.getClass(classindex); 299 299 } 300 300 301 NeuroClass * Neuro::getClass(const SString&classname)301 NeuroClass *Neuro::getClass(const SString &classname) 302 302 { 303 303 return NeuroLibrary::staticlibrary.findClass(classname); 304 304 } 305 305 306 int Neuro::getClassIndex(const NeuroClass *nc)307 { 308 return NeuroLibrary::staticlibrary.classes.find((void *)nc);309 } 310 311 NeuroClass *Neuro::getClass()306 int Neuro::getClassIndex(const NeuroClass *nc) 307 { 308 return NeuroLibrary::staticlibrary.classes.find((void *)nc); 309 } 310 311 NeuroClass *Neuro::getClass() 312 312 { 313 313 checkClass(); … … 315 315 } 316 316 317 void Neuro::setClass(NeuroClass *cl)317 void Neuro::setClass(NeuroClass *cl) 318 318 { 319 319 myclass = cl; … … 328 328 } 329 329 330 void Neuro::setDetails(const SString &details)330 void Neuro::setDetails(const SString &details) 331 331 { 332 332 int colon = details.indexOf(':'); … … 362 362 } 363 363 364 void Neuro::setClassName(const SString &clazz)364 void Neuro::setClassName(const SString &clazz) 365 365 { 366 366 myclassname = clazz; … … 368 368 } 369 369 370 int Neuro::addInput(Neuro *child, double weight, const SString *info)370 int Neuro::addInput(Neuro *child, double weight, const SString *info) 371 371 { 372 372 inputs += NInput(child, weight, (info && (info->len())) ? new SString(*info) : 0); … … 376 376 } 377 377 378 int Neuro::findInput(Neuro *child) const378 int Neuro::findInput(Neuro *child) const 379 379 { 380 380 for (int i = 0; i < inputs.size(); i++) … … 383 383 } 384 384 385 Neuro *Neuro::getInput(int i, double &weight) const385 Neuro *Neuro::getInput(int i, double &weight) const 386 386 { 387 387 if (i >= getInputCount()) return 0; … … 401 401 } 402 402 403 void Neuro::setInput(int i, Neuro *n)403 void Neuro::setInput(int i, Neuro *n) 404 404 { 405 405 NInput &inp = inputs(i); … … 407 407 } 408 408 409 void Neuro::setInput(int i, Neuro *n, double w)409 void Neuro::setInput(int i, Neuro *n, double w) 410 410 { 411 411 NInput &inp = inputs(i); … … 424 424 } 425 425 426 int Neuro::removeInput(Neuro *child)426 int Neuro::removeInput(Neuro *child) 427 427 { 428 428 int i = findInput(child); … … 463 463 } 464 464 465 int Neuro::findInputs(SList & result, const char* classname, const Part* part, const Joint*joint) const465 int Neuro::findInputs(SList &result, const char *classname, const Part *part, const Joint *joint) const 466 466 { 467 467 Neuro *nu; … … 476 476 if (classname) 477 477 if (nu->getClassName() != cn) continue; 478 result += (void *)nu;478 result += (void *)nu; 479 479 } 480 480 return result.size() - n0; 481 481 } 482 482 483 int Neuro::findOutputs(SList & result, const char* classname, const Part* part, const Joint*joint) const483 int Neuro::findOutputs(SList &result, const char *classname, const Part *part, const Joint *joint) const 484 484 { // not very efficient... 485 485 Neuro *nu, *inp; … … 498 498 if (inp == this) 499 499 { 500 result += (void*)nu;501 break;500 result += (void *)nu; 501 break; 502 502 } 503 503 } … … 576 576 } 577 577 578 void Part::operator=(const Part &src)578 void Part::operator=(const Part &src) 579 579 { 580 580 p = src.p; o = src.o; … … 612 612 Pt3D x = p2 - p1; 613 613 Pt3D dir(x.y, x.z, x.x); 614 p = p1 + x *0.5;614 p = p1 + x * 0.5; 615 615 rot.getAngles(x, dir); 616 616 } 617 617 618 Param &Part::getStaticParam()618 Param &Part::getStaticParam() 619 619 { 620 620 static Param p(f0_part_paramtab, 0, "Part"); … … 637 637 } 638 638 639 void Joint::operator=(const Joint &src)639 void Joint::operator=(const Joint &src) 640 640 { 641 641 rot = src.rot; … … 652 652 } 653 653 654 void Joint::attachToParts(Part * p1, Part*p2)654 void Joint::attachToParts(Part *p1, Part *p2) 655 655 { 656 656 part1 = p1; … … 695 695 } 696 696 697 Param &Joint::getStaticParam()697 Param &Joint::getStaticParam() 698 698 { 699 699 static Param p(f0_joint_paramtab, 0, "Joint"); … … 760 760 }; 761 761 762 Param &Neuro::getStaticParam()762 Param &Neuro::getStaticParam() 763 763 { 764 764 static Param p(f0_neuro_paramtab, 0, "NeuroDef");
Note: See TracChangeset
for help on using the changeset viewer.