Skip to content

Commit

Permalink
Traktor: Exposed "Decal Response" to MeshAsset editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Mar 9, 2024
1 parent eac5b48 commit bf0758f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions code/Mesh/Editor/MeshAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class T_DLLCLASS MeshAsset : public editor::Asset
/*! */
bool getGrounded() const { return m_grounded; }

/*! */
void setDecalResponse(bool decalResponse) { m_decalResponse = decalResponse; }

/*! */
bool getDecalResponse() const { return m_decalResponse; }

Expand Down
11 changes: 7 additions & 4 deletions code/Mesh/Editor/MeshAssetEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* TRAKTOR
* Copyright (c) 2022-2023 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -169,6 +169,10 @@ bool MeshAssetEditor::create(ui::Widget* parent, db::Instance* instance, ISerial
if (!m_checkGrounded->create(containerLeft, i18n::Text(L"MESHASSET_EDITOR_GROUNDED")))
return false;

m_checkDecalResponse = new ui::CheckBox();
if (!m_checkDecalResponse->create(containerLeft, i18n::Text(L"MESHASSET_EDITOR_DECAL_RESPONSE")))
return false;

Ref< ui::Container > containerRight = new ui::Container();
containerRight->create(containerOptions, ui::WsNone, new ui::TableLayout(L"*,*", L"*", 0_ut, 4_ut));

Expand Down Expand Up @@ -251,9 +255,7 @@ void MeshAssetEditor::apply()
m_asset->setRenormalize(m_checkRenormalize->isChecked());
m_asset->setCenter(m_checkCenter->isChecked());
m_asset->setGrounded(m_checkGrounded->isChecked());
//m_asset->setLodSteps(m_sliderLodSteps->getValue());
//m_asset->setLodMaxDistance(parseString< float >(m_editLodMaxDistance->getText()));
//m_asset->setLodCullDistance(parseString< float >(m_editLodCullDistance->getText()));
m_asset->setDecalResponse(m_checkDecalResponse->isChecked());
m_asset->setScaleFactor(parseString< float >(m_editScaleFactor->getText()));
m_asset->setPreviewAngle(m_sliderPreviewAngle->getValue() * TWO_PI / 100.0f);

Expand Down Expand Up @@ -325,6 +327,7 @@ void MeshAssetEditor::updateFile()
m_checkRenormalize->setChecked(m_asset->getRenormalize());
m_checkCenter->setChecked(m_asset->getCenter());
m_checkGrounded->setChecked(m_asset->getGrounded());
m_checkDecalResponse->setChecked(m_asset->getDecalResponse());
m_editScaleFactor->setText(toString(m_asset->getScaleFactor()));
m_sliderPreviewAngle->setValue((int32_t)(m_asset->getPreviewAngle() * 100.0f / TWO_PI));
}
Expand Down
7 changes: 2 additions & 5 deletions code/Mesh/Editor/MeshAssetEditor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* TRAKTOR
* Copyright (c) 2022-2023 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -86,10 +86,7 @@ class T_DLLCLASS MeshAssetEditor : public editor::IObjectEditor
Ref< ui::CheckBox > m_checkRenormalize;
Ref< ui::CheckBox > m_checkCenter;
Ref< ui::CheckBox > m_checkGrounded;
//Ref< ui::Static > m_staticLodSteps;
//Ref< ui::Slider > m_sliderLodSteps;
//Ref< ui::Edit > m_editLodMaxDistance;
//Ref< ui::Edit > m_editLodCullDistance;
Ref< ui::CheckBox > m_checkDecalResponse;
Ref< ui::Edit > m_editScaleFactor;
Ref< ui::Slider > m_sliderPreviewAngle;
Ref< ui::Image > m_imagePreview;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@
<first>MESHASSET_EDITOR_GROUNDED</first>
<second>Grounded</second>
</item>
<item>
<first>MESHASSET_EDITOR_DECAL_RESPONSE</first>
<second>Decal Response</second>
</item>
<item>
<first>MESHASSET_EDITOR_EXTRACT_TEXTURE</first>
<second>Extract texture...</second>
Expand Down

0 comments on commit bf0758f

Please sign in to comment.