feat(editor): added buttons for hinge and motor
This commit is contained in:
parent
621ae30464
commit
a1bd6e1bbc
4 changed files with 43 additions and 1 deletions
|
@ -111,7 +111,7 @@ void Workspace::PhysicsStep(float deltaTime) {
|
||||||
if (joint.expired() || !joint.lock()->IsA("RotateV")) continue;
|
if (joint.expired() || !joint.lock()->IsA("RotateV")) continue;
|
||||||
|
|
||||||
std::shared_ptr<JointInstance> motor = joint.lock()->CastTo<JointInstance>().expect();
|
std::shared_ptr<JointInstance> motor = joint.lock()->CastTo<JointInstance>().expect();
|
||||||
float rate = motor->part0.lock()->GetSurfaceParamB(motor->c0.LookVector().Unit()) * 30;
|
float rate = motor->part0.lock()->GetSurfaceParamB(-motor->c0.LookVector().Unit()) * 30;
|
||||||
// part->rigidBody->enableGravity(false);
|
// part->rigidBody->enableGravity(false);
|
||||||
part->rigidBody->setAngularVelocity(-(motor->part0.lock()->cframe * motor->c0).LookVector() * rate);
|
part->rigidBody->setAngularVelocity(-(motor->part0.lock()->cframe * motor->c0).LookVector() * rate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,8 @@ void MainWindow::connectActionHandlers() {
|
||||||
connect(ui->actionToolStuds, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_STUDS : TOOL_SELECT; updateToolbars(); });
|
connect(ui->actionToolStuds, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_STUDS : TOOL_SELECT; updateToolbars(); });
|
||||||
connect(ui->actionToolInlets, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_INLETS : TOOL_SELECT; updateToolbars(); });
|
connect(ui->actionToolInlets, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_INLETS : TOOL_SELECT; updateToolbars(); });
|
||||||
connect(ui->actionToolUniversal, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_UNIVERSAL : TOOL_SELECT; updateToolbars(); });
|
connect(ui->actionToolUniversal, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_UNIVERSAL : TOOL_SELECT; updateToolbars(); });
|
||||||
|
connect(ui->actionToolHinge, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_HINGE : TOOL_SELECT; updateToolbars(); });
|
||||||
|
connect(ui->actionToolMotor, &QAction::triggered, this, [&](bool state) { selectedTool = state ? TOOL_MOTOR : TOOL_SELECT; updateToolbars(); });
|
||||||
ui->actionToolSelect->setChecked(true);
|
ui->actionToolSelect->setChecked(true);
|
||||||
selectedTool = TOOL_SELECT;
|
selectedTool = TOOL_SELECT;
|
||||||
|
|
||||||
|
@ -447,6 +449,8 @@ void MainWindow::updateToolbars() {
|
||||||
ui->actionToolStuds->setChecked(selectedTool == TOOL_STUDS);
|
ui->actionToolStuds->setChecked(selectedTool == TOOL_STUDS);
|
||||||
ui->actionToolInlets->setChecked(selectedTool == TOOL_INLETS);
|
ui->actionToolInlets->setChecked(selectedTool == TOOL_INLETS);
|
||||||
ui->actionToolUniversal->setChecked(selectedTool == TOOL_UNIVERSAL);
|
ui->actionToolUniversal->setChecked(selectedTool == TOOL_UNIVERSAL);
|
||||||
|
ui->actionToolHinge->setChecked(selectedTool == TOOL_HINGE);
|
||||||
|
ui->actionToolMotor->setChecked(selectedTool == TOOL_MOTOR);
|
||||||
|
|
||||||
ui->actionGridSnap1->setChecked(snappingMode == GridSnappingMode::SNAP_1_STUD);
|
ui->actionGridSnap1->setChecked(snappingMode == GridSnappingMode::SNAP_1_STUD);
|
||||||
ui->actionGridSnap05->setChecked(snappingMode == GridSnappingMode::SNAP_05_STUDS);
|
ui->actionGridSnap05->setChecked(snappingMode == GridSnappingMode::SNAP_05_STUDS);
|
||||||
|
|
|
@ -22,6 +22,8 @@ enum SelectedTool {
|
||||||
TOOL_STUDS,
|
TOOL_STUDS,
|
||||||
TOOL_INLETS,
|
TOOL_INLETS,
|
||||||
TOOL_UNIVERSAL,
|
TOOL_UNIVERSAL,
|
||||||
|
TOOL_HINGE,
|
||||||
|
TOOL_MOTOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GridSnappingMode {
|
enum GridSnappingMode {
|
||||||
|
|
|
@ -221,6 +221,8 @@
|
||||||
<addaction name="actionToolStuds"/>
|
<addaction name="actionToolStuds"/>
|
||||||
<addaction name="actionToolInlets"/>
|
<addaction name="actionToolInlets"/>
|
||||||
<addaction name="actionToolUniversal"/>
|
<addaction name="actionToolUniversal"/>
|
||||||
|
<addaction name="actionToolHinge"/>
|
||||||
|
<addaction name="actionToolMotor"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -673,6 +675,40 @@
|
||||||
<enum>QAction::MenuRole::NoRole</enum>
|
<enum>QAction::MenuRole::NoRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionToolHinge">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="surface-weld"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hinge</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Hinge</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::MenuRole::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionToolMotor">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="surface-weld"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Motor</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Motor</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::MenuRole::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="actionToggleEditSounds">
|
<action name="actionToggleEditSounds">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Add table
Reference in a new issue