RigsofRods
2023.09
Soft-body Physics Simulation
Go to the documentation of this file.
49 bool keep_open =
true ;
50 ImGui::Begin(
_LC (
"NodeBeamUtils" ,
"Node/Beam Utils" ), &keep_open, flags);
93 ImGui::PushItemWidth(500.f);
96 if (ImGui::SliderFloat(
"Spring##Beams" , &actor->
ar_nb_beams_scale .first, 0.1f, 10.0f,
"%.5f" ))
100 if (ImGui::SliderFloat(
"Damping##Beams" , &actor->
ar_nb_beams_scale .second, 0.1f, 10.0f,
"%.5f" ))
106 if (ImGui::SliderFloat(
"Spring##Shocks" , &actor->
ar_nb_shocks_scale .first, 0.1f, 10.0f,
"%.5f" ))
110 if (ImGui::SliderFloat(
"Damping##Shocks" , &actor->
ar_nb_shocks_scale .second, 0.1f, 10.0f,
"%.5f" ))
117 const float WBASE_WIDTH = 125.f;
118 const float WSCALE_WIDTH = 225.f;
119 const float WLABEL_GAP = 20.f;
123 ImGui::SetNextItemWidth(WBASE_WIDTH);
129 ImGui::SetNextItemWidth(WSCALE_WIDTH);
130 if (ImGui::SliderFloat(
"Scale##Wheels-spring" , &actor->
ar_nb_wheels_scale .first, 0.1f, 10.0f,
"%.5f" ))
135 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + WLABEL_GAP);
139 ImGui::SetNextItemWidth(WBASE_WIDTH);
145 ImGui::SetNextItemWidth(WSCALE_WIDTH);
146 if (ImGui::SliderFloat(
"Scale##Wheels-damping" , &actor->
ar_nb_wheels_scale .second, 0.1f, 10.0f,
"%.5f" ))
151 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + WLABEL_GAP);
156 if (ImGui::Button(
_LC (
"NodeBeamUtils" ,
"Reset to default settings" ), ImVec2(280.f, 25.f)))
164 if (ImGui::Button(
_LC (
"NodeBeamUtils" ,
"Update initial node positions" ), ImVec2(280.f, 25.f)))
168 ImGui::PopItemWidth();
170 ImGui::PushItemWidth(235.f);
171 ImGui::TextColored(
GRAY_HINT_TEXT ,
"%s" ,
_LC (
"NodeBeamUtils" ,
"Physics steps:" ));
175 ImGui::PopItemWidth();
176 ImGui::PushItemWidth(138.f);
178 ImGui::TextColored(
GRAY_HINT_TEXT ,
"%s" ,
_LC (
"NodeBeamUtils" ,
"Beams (spring & damping search interval):" ));
186 ImGui::TextColored(
GRAY_HINT_TEXT ,
"%s" ,
_LC (
"NodeBeamUtils" ,
"Shocks (spring & damping search interval):" ));
194 ImGui::TextColored(
GRAY_HINT_TEXT ,
"%s" ,
_LC (
"NodeBeamUtils" ,
"Wheels (spring & damping search interval):" ));
202 ImGui::PopItemWidth();
206 ImVec2(280.f, 25.f)))
215 if (ImGui::Button(
_LC (
"NodeBeamUtils" ,
"Reset search" ), ImVec2(280.f, 25.f)))
226 ImGui::Text(
"%s" ,
_LC (
"NodeBeamUtils" ,
"Reference" ));
228 ImGui::Text(
"%s" ,
_LC (
"NodeBeamUtils" ,
"Optimum" ));
261 const ImVec2 PAD(3, 3);
262 ImVec2 cursor = ImGui::GetCursorScreenPos();
263 ImVec2 rect_min = cursor - PAD;
264 ImVec2 rect_max = cursor + PAD + ImVec2(ImGui::GetWindowContentRegionMax().
x , ImGui::GetTextLineHeightWithSpacing());
265 ImGui::GetWindowDrawList()->AddRectFilled(rect_min, rect_max, ImColor(theme.
tip_panel_bg_color ));
266 ImGui::AlignTextToFramePadding();
267 ImGui::Text(
_LC (
"NodeBeamUtils" ,
"This mod is read only (ZIP archive)" ));
269 if (ImGui::Button(
_LC (
"NodeBeamUtils" ,
"Create writable project (if not existing)" )))
282 box->
mbc_title =
_LC (
"NodeBeamUtils" ,
"Project created" );
283 box->
mbc_text =
fmt::format (
_LC (
"NodeBeamUtils" ,
"Project created successfully as \n\"{}\"\n\nPlease load it and open the N/B utility again" ), req->
cpr_name );
292 ImGui::Dummy(ImVec2(1.f, 6.f));
299 ImGui::TextDisabled(
_LC (
"NodeBeamUtils" ,
"Project:" ));
303 if (ImGui::SmallButton(
_LC (
"NodeBeamUtils" ,
"Save and reload" )))
318 ImGui::TextDisabled(
_LC (
"NodeBeamUtils" ,
"User-defined values:" ));
319 if (ImGui::SliderFloat(
_LC (
"NodeBeamUtils" ,
"Dry mass" ), &actor->
ar_dry_mass ,
325 if (ImGui::SmallButton(
_LC (
"NodeBeamUtils" ,
"Reset" )))
333 if (ImGui::SliderFloat(
_LC (
"NodeBeamUtils" ,
"Load mass" ), &actor->
ar_load_mass ,
339 if (ImGui::SmallButton(
_LC (
"NodeBeamUtils" ,
"Reset" )))
347 if (ImGui::SliderFloat(
_LC (
"NodeBeamUtils" ,
"Minimum node mass scale" ), &actor->
ar_nb_minimass_scale , 0.4, 1.6))
356 if (ImGui::SmallButton(
_LC (
"NodeBeamUtils" ,
"Reset" )))
368 ImGui::TextDisabled(
_LC (
"NodeBeamUtils" ,
"Calculated values:" ));
369 ImGui::Text(
"%s: %f" ,
_LC (
"NodeBeamUtils" ,
"Total mass" ), actor->
ar_total_mass );
370 ImGui::Text(
"%s: %d" ,
_LC (
"NodeBeamUtils" ,
"Total nodes" ), actor->
ar_num_nodes );
371 ImGui::Text(
"%s: %d" ,
_LC (
"NodeBeamUtils" ,
"Loaded nodes" ), actor->
ar_masscount );
@ MSG_EDI_MODIFY_PROJECT_REQUESTED
Payload = RoR::UpdateProjectRequest* (owner)
Game state manager and message-queue provider.
void Columns(int=1, const string &in=string(), bool=true)
std::string resource_bundle_type
Archive type recognized by OGRE resource system: 'FileSystem' or 'Zip'.
void searchBeamDefaults()
Searches for more stable beam defaults.
@ MSG_GUI_SHOW_MESSAGE_BOX_REQUESTED
Payload = MessageBoxConfig* (owner)
Ogre::String dname
name parsed from the file
float ar_nb_minimass_scale
scale of 'set_default_minimass' (affects all nodes the same way)
std::vector< float > ar_nb_optimum
Temporary storage of the optimum search result.
std::string cpr_description
Optional, implemented for tuneups.
std::vector< float > ar_nb_reference
Temporary storage of the reference search result.
GUIManager * GetGuiManager()
@ MSG_EDI_CREATE_PROJECT_REQUESTED
Payload = RoR::CreateProjectRequest* (owner)
const ImVec4 GRAY_HINT_TEXT
enum Script2Game::ImGuiStyleVar ImGuiWindowFlags_NoCollapse
Disable user collapsing window by double-clicking on it.
Truck file format(technical spec)
std::pair< float, float > ar_nb_shocks_k_interval
Search interval for springiness & damping of shock beams.
CreateProjectRequestType cpr_type
float ar_dry_mass
User-defined (editable via NBUtil); from 'globals' arg#1 - default for all nodes.
enum Script2Game::ImGuiStyleVar ImGuiWindowFlags_MenuBar
Has a menu-bar.
bool BeginTabBar(const string &in, int=0)
@ ACTOR_UPDATE_DEF_DOCUMENT
'subject' is empty; 'target_actor' is the actual subject. Propagates modifications from the live acto...
void DrawMenubar(ActorPtr actor)
std::pair< float, float > ar_nb_shocks_scale
Scales for springiness & damping of shock beams.
int ar_nb_measure_steps
Amount of physics steps to be measured.
float wh_arg_simple_spring
Whole wheel or just tire, depending on type.
std::pair< float, float > ar_nb_wheels_scale
Scales for springiness & damping of wheel / rim beams.
CacheEntryPtr cpr_source_entry
The original mod to copy files from.
std::string cpr_name
Directory and also the mod file (without extension).
@ ACTOR_PROJECT
Like DEFAULT but fixes up name + category in the truckfile.
void ChainMessage(Message m)
Add to last pushed message's chain.
std::pair< float, float > ar_nb_beams_d_interval
Search interval for springiness & damping of regular beams.
enum Script2Game::ImGuiStyleVar ImGuiCond_FirstUseEver
Set the variable if the object/window has no persistently saved data (no entry in ....
float ar_load_mass
User-defined (editable via NBUtil); from 'globals' arg#2 - only applies to nodes with 'l' flag.
ImVec4 tip_panel_bg_color
float ar_total_mass
Calculated; total mass in Kg.
void PushID(const string &in)
std::pair< float, float > ar_nb_shocks_d_interval
Search interval for springiness & damping of shock beams.
bool BeginTabItem(const string &in, int=0)
BeginTabItem() without X close button.
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
std::pair< float, float > ar_nb_beams_k_interval
Search interval for springiness & damping of regular beams.
void DrawSpringDampTab(ActorPtr actor)
void SyncReset(bool reset_position)
this one should be called only synchronously (without physics running in background)
ActorPtr mpr_target_actor
std::vector< float > ar_minimass
minimum node mass in Kg - can be scaled in-game via NBUtil
Central state/object manager and communications hub.
GameContext * GetGameContext()
void RequestGuiCaptureKeyboard(bool val)
Pass true during frame to prevent input passing to application.
CacheEntryPtr & getUsedActorEntry()
The actor entry itself.
float ar_original_load_mass
Un-edited value from 'globals' arg#2.
float wh_arg_simple_damping
Whole wheel or just tire, depending on type.
std::pair< float, float > ar_nb_wheels_k_interval
Search interval for springiness & damping of wheel / rim beams.
Creates subdirectory in 'My Games\Rigs of Rods\projects', pre-populates it with files and adds modcac...
std::pair< float, float > ar_nb_wheels_d_interval
Search interval for springiness & damping of wheel / rim beams.
void SetColumnOffset(int, float)
std::vector< float > ar_orig_minimass
minimum node mass in Kg - original unscaled values
void DrawCreateProjectBanner(ActorPtr actor, bool &window_open)
Unified game event system - all requests and state changes are reported using a message.
std::pair< float, float > ar_nb_beams_scale
Scales for springiness & damping of regular beams.
void recalculateNodeMasses()
int ar_masscount
Calculated; Number of nodes loaded with l option.
void SetVisible(bool visible)
RefCountingObjectPtr< Actor > ActorPtr
@ MSG_SIM_DELETE_ACTOR_REQUESTED
Payload = RoR::ActorPtr* (owner)
float ar_original_dry_mass
Un-edited value from 'globals' arg#1.
bool IsWindowHovered(int=0)
int ar_nb_skip_steps
Amount of physics steps to be skipped before measuring.
wheel_t ar_wheels[MAX_WHEELS]
ModifyProjectRequestType mpr_type
bool mbc_allow_close
Show close handle even if dbc_close_handle isn't set.
const ActorPtr & GetPlayerActor()
void updateInitPosition()
void DrawMassTab(ActorPtr actor)
void applyNodeBeamScales()
For GUI::NodeBeamUtils.
Ogre::String fname_without_uid
filename