mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 190929. jointctrl cab control animation tweak, vehicle attachment support fixes, axle clatter fix, python module error logging fix
This commit is contained in:
34
DynObj.cpp
34
DynObj.cpp
@@ -3163,12 +3163,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
if( MyTrack->fSoundDistance != dRailLength ) {
|
||||
if( dRailLength > 0.0 ) {
|
||||
for( auto &axle : m_axlesounds ) {
|
||||
axle.distance =
|
||||
clamp_circular<double>(
|
||||
axle.distance - dRailLength
|
||||
+ axle.offset
|
||||
/* - 0.5 * MoverParameters->Dim.L */,
|
||||
MyTrack->fSoundDistance );
|
||||
axle.distance = axle.offset;
|
||||
}
|
||||
}
|
||||
dRailLength = MyTrack->fSoundDistance;
|
||||
@@ -3197,8 +3192,14 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
}
|
||||
if( dRailLength > 0.0 ) {
|
||||
auto axleindex { 0 };
|
||||
auto const directioninconsist { (
|
||||
ctOwner == nullptr ?
|
||||
1 :
|
||||
( ctOwner->Vehicle()->DirectionGet() == DirectionGet() ?
|
||||
1 :
|
||||
-1 ) ) };
|
||||
for( auto &axle : m_axlesounds ) {
|
||||
axle.distance += dDOMoveLen * DirectionGet();
|
||||
axle.distance += dDOMoveLen * directioninconsist;
|
||||
if( ( axle.distance < 0 )
|
||||
|| ( axle.distance > dRailLength ) ) {
|
||||
axle.distance = clamp_circular( axle.distance, dRailLength );
|
||||
@@ -4470,15 +4471,15 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
// each value is a name of additional 3d model
|
||||
// value can be optionally set of values enclosed in "[]" in which case one value will be picked randomly
|
||||
// TBD: reconsider something more yaml-compliant and/or ability to define offset and rotation
|
||||
while( ( ( token = parser.getToken<std::string>() ) != "" )
|
||||
while( ( ( token = deserialize_random_set( parser ) ) != "" )
|
||||
&& ( token != "}" ) ) {
|
||||
auto attachmentmodelname { deserialize_random_set( parser ) };
|
||||
replace_slashes( attachmentmodelname );
|
||||
Global.asCurrentTexturePath = asBaseDir; // biezaca sciezka do tekstur to dynamic/...
|
||||
auto *attachmentmodel { TModelsManager::GetModel( asBaseDir + attachmentmodelname, true ) };
|
||||
if( attachmentmodel != nullptr ) {
|
||||
mdAttachments.emplace_back( attachmentmodel );
|
||||
}
|
||||
if( token == "{" ) { continue; }
|
||||
replace_slashes( token );
|
||||
Global.asCurrentTexturePath = asBaseDir; // biezaca sciezka do tekstur to dynamic/...
|
||||
auto *attachmentmodel { TModelsManager::GetModel( asBaseDir + token, true ) };
|
||||
if( attachmentmodel != nullptr ) {
|
||||
mdAttachments.emplace_back( attachmentmodel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5770,6 +5771,9 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
mdLoad->Init();
|
||||
if (mdLowPolyInt)
|
||||
mdLowPolyInt->Init();
|
||||
for( auto *attachment : mdAttachments ) {
|
||||
attachment->Init();
|
||||
}
|
||||
|
||||
Global.asCurrentTexturePath = szTexturePath; // kiedyś uproszczone wnętrze mieszało tekstury nieba
|
||||
Global.asCurrentDynamicPath = "";
|
||||
|
||||
11
PyInt.cpp
11
PyInt.cpp
@@ -192,8 +192,7 @@ auto python_taskqueue::run_file( std::string const &File, std::string const &Pat
|
||||
if( lookup.first.empty() ) { return false; }
|
||||
|
||||
std::ifstream inputfile { lookup.first + lookup.second };
|
||||
std::string input;
|
||||
input.assign( std::istreambuf_iterator<char>( inputfile ), std::istreambuf_iterator<char>() );
|
||||
std::string const input { std::istreambuf_iterator<char>( inputfile ), std::istreambuf_iterator<char>() };
|
||||
|
||||
if( PyRun_SimpleString( input.c_str() ) != 0 ) {
|
||||
error();
|
||||
@@ -215,7 +214,7 @@ void python_taskqueue::release_lock() {
|
||||
PyEval_SaveThread();
|
||||
}
|
||||
|
||||
auto python_taskqueue::fetch_renderer( std::string const Renderer ) ->PyObject * {
|
||||
auto python_taskqueue::fetch_renderer( std::string const Renderer ) -> PyObject * {
|
||||
|
||||
auto const lookup { m_renderers.find( Renderer ) };
|
||||
if( lookup != std::end( m_renderers ) ) {
|
||||
@@ -296,7 +295,9 @@ void python_taskqueue::run( GLFWwindow *Context, rendertask_sequence &Tasks, thr
|
||||
{
|
||||
// execute python code
|
||||
task->run();
|
||||
error();
|
||||
if( PyErr_Occurred() != nullptr ) {
|
||||
error();
|
||||
}
|
||||
}
|
||||
// clear the thread state
|
||||
PyEval_SaveThread();
|
||||
@@ -318,8 +319,6 @@ void python_taskqueue::run( GLFWwindow *Context, rendertask_sequence &Tasks, thr
|
||||
void
|
||||
python_taskqueue::error() {
|
||||
|
||||
if( PyErr_Occurred() == nullptr ) { return; }
|
||||
|
||||
if( m_stderr != nullptr ) {
|
||||
// std err pythona jest buforowane
|
||||
PyErr_Print();
|
||||
|
||||
@@ -6244,10 +6244,13 @@ bool TTrain::Update( double const Deltatime )
|
||||
if( ggJointCtrl.SubModel != nullptr ) {
|
||||
// joint master controller moves forward to adjust power and backward to adjust brakes
|
||||
auto const brakerangemultiplier {
|
||||
/* NOTE: scaling disabled as it was conflicting with associating sounds with control positions
|
||||
( mvControlled->CoupledCtrl ?
|
||||
mvControlled->MainCtrlPosNo + mvControlled->ScndCtrlPosNo :
|
||||
mvControlled->MainCtrlPosNo )
|
||||
/ static_cast<double>(LocalBrakePosNo) };
|
||||
/ static_cast<double>(LocalBrakePosNo)
|
||||
*/
|
||||
1 };
|
||||
ggJointCtrl.UpdateValue(
|
||||
( mvOccupied->LocalBrakePosA > 0.0 ? mvOccupied->LocalBrakePosA * LocalBrakePosNo * -1 * brakerangemultiplier :
|
||||
mvControlled->CoupledCtrl ? double( mvControlled->MainCtrlPos + mvControlled->ScndCtrlPos ) :
|
||||
|
||||
Reference in New Issue
Block a user