Ignore:
Timestamp:
09/05/16 03:39:14 (8 years ago)
Author:
Maciej Komosinski
Message:
  • Introduced levels of checking the validity of a Model
  • If a Joint is too long, print how much it exceeds the maximum allowed length
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/model.cpp

    r546 r610  
    511511}
    512512
    513 int Model::close()
     513int Model::close(bool building_live_model)
    514514{
    515515        if (buildstatus != building)
    516516                logPrintf("Model", "close", LOG_WARN, "Unexpected close() - no open()");
    517         if (internalcheck(1) > 0)
     517        if (internalcheck(building_live_model ? LIVE_CHECK : FINAL_CHECK) > 0)
    518518        {
    519519                buildstatus = valid;
     
    543543int Model::validate()
    544544{
    545         return internalcheck(0);
     545        return internalcheck(EDITING_CHECK);
    546546}
    547547
     
    899899}
    900900
    901 int Model::internalcheck(int final)
     901int Model::internalcheck(CheckType check)
    902902{
    903903        Part *p;
     
    997997                                else
    998998                                { // abs.positioning -> calc. delta
    999                                         if (final)
     999                                        if (check!=EDITING_CHECK)
    10001000                                        {
    10011001                                                // calc orient delta
     
    10121012                                        }
    10131013                                }
    1014                                 if (final)
     1014                                if (check!=LIVE_CHECK)
    10151015                                {
    10161016                                        if (j->shape != Joint::SHAPE_FIXED)
     
    10191019                                                {
    10201020                                                        ret = 0;
    1021                                                         logPrintf("Model", "internalCheck", LOG_ERROR, "Joint #%d too long%s", i, nameForErrors().c_str());
     1021                                                        logPrintf("Model", "internalCheck", LOG_ERROR, "Joint #%d too long (its length %g exceeds allowed %g)%s", i, j->d(), getMaxJoint().d.x, nameForErrors().c_str());
    10221022                                                }
    10231023                                        }
Note: See TracChangeset for help on using the changeset viewer.