Changeset 653
- Timestamp:
- 04/20/17 21:06:47 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.cpp
r644 r653 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 5Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2017 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 681 681 // attach to part/joint 682 682 if (nu->part_refno >= 0) 683 { 684 nu->attachToPart(nu->part_refno); 685 if (nu->part == NULL) 683 686 { 684 nu->attachToPart(nu->part_refno); 685 if (nu->part==NULL) 686 { error_message = SString::sprintf("Invalid reference to Part #%d", nu->part_refno); delete nu; return -1; } 687 error_message = SString::sprintf("Invalid reference to Part #%d", nu->part_refno); delete nu; return -1; 687 688 } 689 } 688 690 if (nu->joint_refno >= 0) 691 { 692 nu->attachToJoint(nu->joint_refno); 693 if (nu->joint == NULL) 689 694 { 690 nu->attachToJoint(nu->joint_refno); 691 if (nu->joint==NULL) 692 { error_message = SString::sprintf("Invalid reference to Joint #%d", nu->joint_refno); delete nu; return -1; } 695 error_message = SString::sprintf("Invalid reference to Joint #%d", nu->joint_refno); delete nu; return -1; 693 696 } 697 } 694 698 if (srcrange) nu->setMapping(*srcrange); 695 699 // todo: check part/joint ref# … … 1358 1362 p->scale.z = thickness; 1359 1363 } 1364 if (src_ballandstick_shapes.getJointCount() == 0) //single part "ball-and-stick" models are valid so let's make a valid solid shape model 1365 for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++) 1366 { 1367 Part *op = src_ballandstick_shapes.getPart(i); 1368 Part *p = addNewPart(Part::SHAPE_ELLIPSOID); //always using spherical shape regardless of the 'use_shape' parameter - 'use shape' is meant for sticks! 1369 p->p = op->p; 1370 p->rot = op->rot; 1371 p->scale.x = p->scale.y = p->scale.z = thickness; 1372 } 1360 1373 for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++) 1361 1374 {
Note: See TracChangeset
for help on using the changeset viewer.