diff options
| -rw-r--r-- | indra/llinventory/llsettingsbase.h | 1 | ||||
| -rw-r--r-- | indra/newview/llenvironment.cpp | 77 | ||||
| -rw-r--r-- | indra/newview/llenvironment.h | 5 | 
3 files changed, 70 insertions, 13 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 1d118f0789..f7a9d5b7cd 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -359,7 +359,6 @@ protected:      virtual parammapping_t getParameterMap() const { return parammapping_t(); }      LLSD        mSettings; -    bool        mIsValid;      LLSD        cloneSettings() const; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 7264fe1385..7cf3cd5df1 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -806,6 +806,25 @@ const F32 LLEnvironment::SUN_DELTA_YAW(F_PI);   // 180deg  const U32 LLEnvironment::DayInstance::NO_ANIMATE_SKY(0x01);  const U32 LLEnvironment::DayInstance::NO_ANIMATE_WATER(0x02); +std::string env_selection_to_string(LLEnvironment::EnvSelection_t sel) +{ +#define RTNENUM(E) case LLEnvironment::E: return #E +    switch (sel){ +        RTNENUM(ENV_EDIT); +        RTNENUM(ENV_LOCAL); +        RTNENUM(ENV_PUSH); +        RTNENUM(ENV_PARCEL); +        RTNENUM(ENV_REGION); +        RTNENUM(ENV_DEFAULT); +        RTNENUM(ENV_END); +        RTNENUM(ENV_CURRENT); +        RTNENUM(ENV_NONE); +    default: +        return llformat("Unknown(%d)", sel); +    } +#undef RTNENUM +} +  //-------------------------------------------------------------------------  LLEnvironment::LLEnvironment(): @@ -1059,6 +1078,7 @@ void LLEnvironment::setSelectedEnvironment(LLEnvironment::EnvSelection_t env, LL  {      mSelectedEnvironment = env;      updateEnvironment(transition, forced); +    LL_DEBUGS("ENVIRONMENT") << "Setting environment " << env_selection_to_string(env) << " with transition: " << transition << LL_ENDL;  }  bool LLEnvironment::hasEnvironment(LLEnvironment::EnvSelection_t env) @@ -1095,11 +1115,13 @@ LLEnvironment::DayInstance::ptr_t LLEnvironment::getEnvironmentInstance(LLEnviro  void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset, S32 env_version)  {      if ((env < ENV_EDIT) || (env >= ENV_DEFAULT)) -    {    -        LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection." << LL_ENDL; +    { +        LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return;      } +    logEnvironment(env, pday, env_version); +      DayInstance::ptr_t environment = getEnvironmentInstance(env, true);      environment->clear(); @@ -1116,7 +1138,7 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm  {      if ((env < ENV_EDIT) || (env >= ENV_DEFAULT))      { -        LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection." << LL_ENDL; +        LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return;      } @@ -1125,30 +1147,32 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm      if (fixed.first)      { +        logEnvironment(env, fixed.first, env_version);          environment->setSky(fixed.first);          environment->setFlags(DayInstance::NO_ANIMATE_SKY);      }      else if (!environment->getSky())      { +        LL_DEBUGS("ENVIRONMENT") << "Blank sky for " << env_selection_to_string(env) << ". Reusing environment for sky." << LL_ENDL;          environment->setSky(mCurrentEnvironment->getSky());          environment->setFlags(DayInstance::NO_ANIMATE_SKY);      }      if (fixed.second)      { +        logEnvironment(env, fixed.second, env_version);          environment->setWater(fixed.second);          environment->setFlags(DayInstance::NO_ANIMATE_WATER);      }      else if (!environment->getWater())      { +        LL_DEBUGS("ENVIRONMENT") << "Blank water for " << env_selection_to_string(env) << ". Reusing environment for water." << LL_ENDL;          environment->setWater(mCurrentEnvironment->getWater());          environment->setFlags(DayInstance::NO_ANIMATE_WATER);      }      if (!mSignalEnvChanged.empty())          mSignalEnvChanged(env, env_version); - -    /*TODO: readjust environment*/  }  void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSettingsBase::ptr_t &settings, S32 env_version) @@ -1223,8 +1247,10 @@ void LLEnvironment::onSetEnvAssetLoaded(EnvSelection_t env,          LLSD args;          args["NAME"] = asset_id.asString();          LLNotificationsUtil::add("FailedToFindSettings", args); +        LL_DEBUGS("ENVIRONMENT") << "Failed to find settings for " << env_selection_to_string(env) << ", asset_id: " << asset_id << LL_ENDL;          return;      } +    LL_DEBUGS("ENVIRONMENT") << "Loaded asset: " << asset_id << LL_ENDL;      setEnvironment(env, settings);      updateEnvironment(transition); @@ -1238,19 +1264,48 @@ void LLEnvironment::clearEnvironment(LLEnvironment::EnvSelection_t env)          return;      } +    LL_DEBUGS("ENVIRONMENT") << "Cleaning environment " << env_selection_to_string(env) << LL_ENDL; +      mEnvironments[env].reset();      if (!mSignalEnvChanged.empty())          mSignalEnvChanged(env, VERSION_CLEANUP); +} -    /*TODO: readjust environment*/ +void LLEnvironment::logEnvironment(EnvSelection_t env, const LLSettingsBase::ptr_t &settings, S32 env_version) +{ +    LL_DEBUGS("ENVIRONMENT") << "Setting Day environment " << env_selection_to_string(env) << " with version(update type): " << env_version << LL_NEWLINE; +    // code between LL_DEBUGS and LL_ENDL won't execute unless log is enabled +    if (settings) +    { +        LLUUID asset_id = settings->getAssetId(); +        if (asset_id.notNull()) +        { +            LL_CONT << "Asset id: " << asset_id << LL_NEWLINE; +        } + +        LLUUID id = settings->getId(); // Not in use? +        if (id.notNull()) +        { +            LL_CONT << "Settings id: " << id << LL_NEWLINE; +        } + +        LL_CONT << "Name: " << settings->getName() << LL_NEWLINE +            << "Type: " << settings->getSettingsType() << LL_NEWLINE +            << "Flags: " << settings->getFlags(); // Not in use? +    } +    else +    { +        LL_CONT << "Empty settings!"; +    } +    LL_CONT << LL_ENDL;  }  LLSettingsDay::ptr_t LLEnvironment::getEnvironmentDay(LLEnvironment::EnvSelection_t env)  {      if ((env < ENV_EDIT) || (env > ENV_DEFAULT))      { -        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; +        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return LLSettingsDay::ptr_t();      } @@ -1266,7 +1321,7 @@ LLSettingsDay::Seconds LLEnvironment::getEnvironmentDayLength(EnvSelection_t env  {      if ((env < ENV_EDIT) || (env > ENV_DEFAULT))      { -        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; +        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return LLSettingsDay::Seconds(0);      } @@ -1282,7 +1337,7 @@ LLSettingsDay::Seconds LLEnvironment::getEnvironmentDayOffset(EnvSelection_t env  {      if ((env < ENV_EDIT) || (env > ENV_DEFAULT))      { -        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; +        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return LLSettingsDay::Seconds(0);      } @@ -1325,7 +1380,7 @@ LLEnvironment::fixedEnvironment_t LLEnvironment::getEnvironmentFixed(LLEnvironme      if ((env < ENV_EDIT) || (env > ENV_DEFAULT))      { -        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; +        LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection (" << env_selection_to_string(env) << ")." << LL_ENDL;          return fixedEnvironment_t();      } @@ -3332,7 +3387,7 @@ namespace                  return;              } -            LL_WARNS("PUSHENV") << "Underlying environment has changed (" << env << ")! Base env is type " << base_env << LL_ENDL; +            LL_WARNS("PUSHENV", "ENVIRONMENT") << "Underlying environment has changed (" << env << ")! Base env is type " << base_env << LL_ENDL;              LLEnvironment::DayInstance::ptr_t trans = std::make_shared<InjectedTransition>(std::static_pointer_cast<DayInjection>(shared_from_this()),                  mBaseDayInstance->getSky(), mBaseDayInstance->getWater(), nextbase, LLEnvironment::TRANSITION_DEFAULT); diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 91c4b85135..6ab0db7501 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -148,8 +148,11 @@ public:      void                        setEnvironment(EnvSelection_t env, const LLUUID &assetId, S32 env_version = NO_VERSION);      void                        setSharedEnvironment(); -      void                        clearEnvironment(EnvSelection_t env); + +    static void                 logEnvironment(EnvSelection_t env, const LLSettingsBase::ptr_t &settings, S32 env_version = NO_VERSION); + +      LLSettingsDay::ptr_t        getEnvironmentDay(EnvSelection_t env);      LLSettingsDay::Seconds      getEnvironmentDayLength(EnvSelection_t env);      LLSettingsDay::Seconds      getEnvironmentDayOffset(EnvSelection_t env);  | 
