Skip to content

Commit

Permalink
format all code with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
brakhane committed Jul 25, 2024
1 parent bae5ba4 commit c3390a1
Show file tree
Hide file tree
Showing 243 changed files with 30,483 additions and 30,480 deletions.
52 changes: 26 additions & 26 deletions Editor/AnimationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void AnimationWindow::Create(EditorComponent* _editor)
editor->RecordEntity(archive, entity);

editor->componentsWnd.RefreshEntityTree();
});
});

float x = 80;
float y = 0;
Expand Down Expand Up @@ -64,7 +64,6 @@ void AnimationWindow::Create(EditorComponent* _editor)
sampler.mode = AnimationComponent::AnimationSampler::Mode::LINEAR;
}
}

}
}
});
Expand Down Expand Up @@ -164,7 +163,6 @@ void AnimationWindow::Create(EditorComponent* _editor)
animation->timer = animation->start;
animation->speed = speedSlider.GetValue();
animation->Play();

}
});
AddWidget(&playFromStartButton);
Expand Down Expand Up @@ -241,7 +239,7 @@ void AnimationWindow::Create(EditorComponent* _editor)
{
animation->start = args.fValue;
}
});
});
startInput.SetTooltip("Set the animation start in seconds. This will be the loop's starting point.");
AddWidget(&startInput);

Expand All @@ -255,7 +253,7 @@ void AnimationWindow::Create(EditorComponent* _editor)
{
animation->end = args.fValue;
}
});
});
endInput.SetTooltip("Set the animation end in seconds. This is relative to 0, not the animation start.");
AddWidget(&endInput);

Expand Down Expand Up @@ -941,21 +939,21 @@ void AnimationWindow::Create(EditorComponent* _editor)
animation_data->keyframe_data.erase(animation_data->keyframe_data.begin() + timeIndex * 4, animation_data->keyframe_data.begin() + timeIndex * 4 + 4);
break;
case AnimationComponent::AnimationChannel::PathDataType::Weights:
{
MeshComponent* mesh = scene.meshes.GetComponent(channel.target);
if (mesh == nullptr && scene.objects.Contains(channel.target))
{
MeshComponent* mesh = scene.meshes.GetComponent(channel.target);
if (mesh == nullptr && scene.objects.Contains(channel.target))
{
// Also try query mesh of selected object:
ObjectComponent* object = scene.objects.GetComponent(channel.target);
mesh = scene.meshes.GetComponent(object->meshID);
}
if (mesh != nullptr)
{
animation_data->keyframe_times.erase(animation_data->keyframe_times.begin() + timeIndex);
animation_data->keyframe_data.erase(animation_data->keyframe_data.begin() + timeIndex * mesh->morph_targets.size(), animation_data->keyframe_data.begin() + timeIndex * mesh->morph_targets.size() + mesh->morph_targets.size());
}
// Also try query mesh of selected object:
ObjectComponent* object = scene.objects.GetComponent(channel.target);
mesh = scene.meshes.GetComponent(object->meshID);
}
break;
if (mesh != nullptr)
{
animation_data->keyframe_times.erase(animation_data->keyframe_times.begin() + timeIndex);
animation_data->keyframe_data.erase(animation_data->keyframe_data.begin() + timeIndex * mesh->morph_targets.size(), animation_data->keyframe_data.begin() + timeIndex * mesh->morph_targets.size() + mesh->morph_targets.size());
}
}
break;
default:
break;
}
Expand Down Expand Up @@ -1008,14 +1006,16 @@ void AnimationWindow::Create(EditorComponent* _editor)
AnimationComponent* animation = editor->GetCurrentScene().animations.GetComponent(entity);
if (animation != nullptr)
{
if (args.bValue) {
if (args.bValue)
{
animation->RootMotionOn();
}
else {
else
{
animation->RootMotionOff();
}
}
});
});
rootMotionCheckBox.SetCheckText(ICON_CHECK);
AddWidget(&rootMotionCheckBox);
// Root Bone selector
Expand All @@ -1037,13 +1037,12 @@ void AnimationWindow::Create(EditorComponent* _editor)
animation->rootMotionBone = wi::ecs::INVALID_ENTITY;
}
}
});
});
rootBoneComboBox.SetTooltip("Choose the root bone to evaluate root motion from.");
AddWidget(&rootBoneComboBox);

SetMinimized(true);
SetVisible(false);

}
// Example function to check if an entity already exists in the list
static bool EntityExistsInList(Entity entity, const wi::vector<Entity>& entityList)
Expand Down Expand Up @@ -1083,7 +1082,8 @@ void AnimationWindow::SetEntity(Entity entity)
for (const AnimationComponent::AnimationChannel& channel : animation->channels)
{
if (channel.path == AnimationComponent::AnimationChannel::Path::TRANSLATION ||
channel.path == AnimationComponent::AnimationChannel::Path::ROTATION) {
channel.path == AnimationComponent::AnimationChannel::Path::ROTATION)
{

if (!EntityExistsInList(channel.target, bone_list))
{
Expand Down Expand Up @@ -1145,7 +1145,7 @@ void AnimationWindow::Update()
loopTypeButton.SetTooltip("No loop. The animation will play once.");
}

if(!animation.samplers.empty())
if (!animation.samplers.empty())
{
modeComboBox.SetSelectedByUserdataWithoutCallback(animation.samplers[0].mode);
}
Expand Down Expand Up @@ -1369,7 +1369,7 @@ void AnimationWindow::ResizeLayout()
const float l = loopTypeButton.GetPos().x + loopTypeButton.GetSize().x + padding;
const float r = width - margin_right - padding * 4;
const float diff = r - l;
backwardsButton.SetSize(XMFLOAT2(diff/5, backwardsButton.GetSize().y));
backwardsButton.SetSize(XMFLOAT2(diff / 5, backwardsButton.GetSize().y));
backwardsFromEndButton.SetSize(backwardsButton.GetSize());
stopButton.SetSize(backwardsButton.GetSize());
playFromStartButton.SetSize(backwardsButton.GetSize());
Expand Down
16 changes: 8 additions & 8 deletions Editor/AnimationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ class AnimationWindow : public wi::gui::Window
wi::gui::Label infoLabel;
wi::gui::ComboBox modeComboBox;
wi::gui::Button loopTypeButton;
wi::gui::Button playButton;
wi::gui::Button playFromStartButton;
wi::gui::Button backwardsButton;
wi::gui::Button backwardsFromEndButton;
wi::gui::Button stopButton;
wi::gui::Slider timerSlider;
wi::gui::Slider amountSlider;
wi::gui::Slider speedSlider;
wi::gui::Button playButton;
wi::gui::Button playFromStartButton;
wi::gui::Button backwardsButton;
wi::gui::Button backwardsFromEndButton;
wi::gui::Button stopButton;
wi::gui::Slider timerSlider;
wi::gui::Slider amountSlider;
wi::gui::Slider speedSlider;
wi::gui::TextInputField startInput;
wi::gui::TextInputField endInput;

Expand Down
126 changes: 61 additions & 65 deletions Editor/ArmatureWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ void ArmatureWindow::Create(EditorComponent* _editor)

closeButton.SetTooltip("Delete ArmatureComponent");
OnClose([=](wi::gui::EventArgs args) {

wi::Archive& archive = editor->AdvanceHistory();
archive << EditorComponent::HISTORYOP_COMPONENT_DATA;
editor->RecordEntity(archive, entity);
Expand All @@ -23,7 +22,7 @@ void ArmatureWindow::Create(EditorComponent* _editor)
editor->RecordEntity(archive, entity);

editor->componentsWnd.RefreshEntityTree();
});
});

float x = 60;
float y = 4;
Expand Down Expand Up @@ -61,65 +60,65 @@ void ArmatureWindow::Create(EditorComponent* _editor)
return;

static const wi::unordered_map<HumanoidComponent::HumanoidBone, wi::vector<std::string>> mapping = {
{HumanoidComponent::HumanoidBone::Hips, {"Hips"}},
{HumanoidComponent::HumanoidBone::Spine, {"Spine"}},
{HumanoidComponent::HumanoidBone::Chest, {"Chest", "Spine1"}},
{HumanoidComponent::HumanoidBone::UpperChest, {"UpperChest", "Spine2"}},
{HumanoidComponent::HumanoidBone::Neck, {"Neck"}},

{HumanoidComponent::HumanoidBone::Head, {"Head"}},
{HumanoidComponent::HumanoidBone::LeftEye, {"LeftEye"}},
{HumanoidComponent::HumanoidBone::RightEye, {"RightEye"}},
{HumanoidComponent::HumanoidBone::Jaw, {"Jaw"}},

{HumanoidComponent::HumanoidBone::LeftUpperLeg, {"LeftUpperLeg", "LeftUpLeg"}},
{HumanoidComponent::HumanoidBone::LeftLowerLeg, {"LeftLowerLeg", "LeftLeg"}},
{HumanoidComponent::HumanoidBone::LeftFoot, {"LeftFoot"}},
{HumanoidComponent::HumanoidBone::LeftToes, {"LeftToe"}},
{HumanoidComponent::HumanoidBone::RightUpperLeg, {"RightUpperLeg", "RightUpLeg"}},
{HumanoidComponent::HumanoidBone::RightLowerLeg, {"RightLowerLeg", "RightLeg"}},
{HumanoidComponent::HumanoidBone::RightFoot, {"RightFoot"}},
{HumanoidComponent::HumanoidBone::RightToes, {"RightToe"}},

{HumanoidComponent::HumanoidBone::LeftShoulder, {"LeftShoulder"}},
{HumanoidComponent::HumanoidBone::LeftUpperArm, {"LeftUpperArm", "LeftArm"}},
{HumanoidComponent::HumanoidBone::LeftLowerArm, {"LeftLowerArm", "LeftForeArm"}},
{HumanoidComponent::HumanoidBone::LeftHand, {"LeftHand"}},
{HumanoidComponent::HumanoidBone::RightShoulder, {"RightShoulder"}},
{HumanoidComponent::HumanoidBone::RightUpperArm, {"RightUpperArm", "RightArm"}},
{HumanoidComponent::HumanoidBone::RightLowerArm, {"RightLowerArm", "RightForeArm"}},
{HumanoidComponent::HumanoidBone::RightHand, {"RightHand"}},

{HumanoidComponent::HumanoidBone::LeftThumbMetacarpal, {"LeftThumbMetacarpal", "LeftHandThumb1"}},
{HumanoidComponent::HumanoidBone::LeftThumbProximal, {"LeftThumbProximal", "LeftHandThumb2"}},
{HumanoidComponent::HumanoidBone::LeftThumbDistal, {"LeftThumbDistal", "LeftHandThumb3"}},
{HumanoidComponent::HumanoidBone::LeftIndexProximal, {"LeftIndexProximal", "LeftHandIndex1"}},
{HumanoidComponent::HumanoidBone::LeftIndexIntermediate, {"LeftIndexIntermediate", "LeftHandIndex2"}},
{HumanoidComponent::HumanoidBone::LeftIndexDistal, {"LeftIndexDistal", "LeftHandIndex3"}},
{HumanoidComponent::HumanoidBone::LeftMiddleProximal, {"LeftMiddleProximal", "LeftHandMiddle1"}},
{HumanoidComponent::HumanoidBone::LeftMiddleIntermediate, {"LeftMiddleIntermediate", "LeftHandMiddle2"}},
{HumanoidComponent::HumanoidBone::LeftMiddleDistal, {"LeftMiddleDistal", "LeftHandMiddle3"}},
{HumanoidComponent::HumanoidBone::LeftRingProximal, {"LeftRingProximal", "LeftHandRing1"}},
{HumanoidComponent::HumanoidBone::LeftRingIntermediate, {"LeftRingIntermediate", "LeftHandRing2"}},
{HumanoidComponent::HumanoidBone::LeftRingDistal, {"LeftRingDistal", "LeftHandRing3"}},
{HumanoidComponent::HumanoidBone::LeftLittleProximal, {"LeftLittleProximal", "LeftHandPinky1"}},
{HumanoidComponent::HumanoidBone::LeftLittleIntermediate, {"LeftLittleIntermediate", "LeftHandPinky2"}},
{HumanoidComponent::HumanoidBone::LeftLittleDistal, {"LeftLittleDistal", "LeftHandPinky3"}},
{HumanoidComponent::HumanoidBone::RightThumbMetacarpal, {"RightThumbMetacarpal", "RightHandThumb1"}},
{HumanoidComponent::HumanoidBone::RightThumbProximal, {"RightThumbProximal", "RightHandThumb2"}},
{HumanoidComponent::HumanoidBone::RightThumbDistal, {"RightThumbDistal", "RightHandThumb3"}},
{HumanoidComponent::HumanoidBone::RightIndexIntermediate, {"RightIndexIntermediate", "RightHandIndex2"}},
{HumanoidComponent::HumanoidBone::RightIndexDistal, {"RightIndexDistal", "RightHandIndex3"}},
{HumanoidComponent::HumanoidBone::RightIndexProximal, {"RightIndexProximal", "RightHandIndex1"}},
{HumanoidComponent::HumanoidBone::RightMiddleProximal, {"RightMiddleProximal", "RightHandMiddle1"}},
{HumanoidComponent::HumanoidBone::RightMiddleIntermediate, {"RightMiddleIntermediate", "RightHandMiddle2"}},
{HumanoidComponent::HumanoidBone::RightMiddleDistal, {"RightMiddleDistal", "RightHandMiddle3"}},
{HumanoidComponent::HumanoidBone::RightRingProximal, {"RightRingProximal", "RightHandRing1"}},
{HumanoidComponent::HumanoidBone::RightRingIntermediate, {"RightRingIntermediate", "RightHandRing2"}},
{HumanoidComponent::HumanoidBone::RightRingDistal, {"RightRingDistal", "RightHandRing3"}},
{HumanoidComponent::HumanoidBone::RightLittleProximal, {"RightLittleProximal", "RightHandPinky1"}},
{HumanoidComponent::HumanoidBone::RightLittleIntermediate, {"RightLittleIntermediate", "RightHandPinky2"}},
{HumanoidComponent::HumanoidBone::RightLittleDistal, {"RightLittleDistal", "RightHandPinky3"}},
{ HumanoidComponent::HumanoidBone::Hips, { "Hips" } },
{ HumanoidComponent::HumanoidBone::Spine, { "Spine" } },
{ HumanoidComponent::HumanoidBone::Chest, { "Chest", "Spine1" } },
{ HumanoidComponent::HumanoidBone::UpperChest, { "UpperChest", "Spine2" } },
{ HumanoidComponent::HumanoidBone::Neck, { "Neck" } },

{ HumanoidComponent::HumanoidBone::Head, { "Head" } },
{ HumanoidComponent::HumanoidBone::LeftEye, { "LeftEye" } },
{ HumanoidComponent::HumanoidBone::RightEye, { "RightEye" } },
{ HumanoidComponent::HumanoidBone::Jaw, { "Jaw" } },

{ HumanoidComponent::HumanoidBone::LeftUpperLeg, { "LeftUpperLeg", "LeftUpLeg" } },
{ HumanoidComponent::HumanoidBone::LeftLowerLeg, { "LeftLowerLeg", "LeftLeg" } },
{ HumanoidComponent::HumanoidBone::LeftFoot, { "LeftFoot" } },
{ HumanoidComponent::HumanoidBone::LeftToes, { "LeftToe" } },
{ HumanoidComponent::HumanoidBone::RightUpperLeg, { "RightUpperLeg", "RightUpLeg" } },
{ HumanoidComponent::HumanoidBone::RightLowerLeg, { "RightLowerLeg", "RightLeg" } },
{ HumanoidComponent::HumanoidBone::RightFoot, { "RightFoot" } },
{ HumanoidComponent::HumanoidBone::RightToes, { "RightToe" } },

{ HumanoidComponent::HumanoidBone::LeftShoulder, { "LeftShoulder" } },
{ HumanoidComponent::HumanoidBone::LeftUpperArm, { "LeftUpperArm", "LeftArm" } },
{ HumanoidComponent::HumanoidBone::LeftLowerArm, { "LeftLowerArm", "LeftForeArm" } },
{ HumanoidComponent::HumanoidBone::LeftHand, { "LeftHand" } },
{ HumanoidComponent::HumanoidBone::RightShoulder, { "RightShoulder" } },
{ HumanoidComponent::HumanoidBone::RightUpperArm, { "RightUpperArm", "RightArm" } },
{ HumanoidComponent::HumanoidBone::RightLowerArm, { "RightLowerArm", "RightForeArm" } },
{ HumanoidComponent::HumanoidBone::RightHand, { "RightHand" } },

{ HumanoidComponent::HumanoidBone::LeftThumbMetacarpal, { "LeftThumbMetacarpal", "LeftHandThumb1" } },
{ HumanoidComponent::HumanoidBone::LeftThumbProximal, { "LeftThumbProximal", "LeftHandThumb2" } },
{ HumanoidComponent::HumanoidBone::LeftThumbDistal, { "LeftThumbDistal", "LeftHandThumb3" } },
{ HumanoidComponent::HumanoidBone::LeftIndexProximal, { "LeftIndexProximal", "LeftHandIndex1" } },
{ HumanoidComponent::HumanoidBone::LeftIndexIntermediate, { "LeftIndexIntermediate", "LeftHandIndex2" } },
{ HumanoidComponent::HumanoidBone::LeftIndexDistal, { "LeftIndexDistal", "LeftHandIndex3" } },
{ HumanoidComponent::HumanoidBone::LeftMiddleProximal, { "LeftMiddleProximal", "LeftHandMiddle1" } },
{ HumanoidComponent::HumanoidBone::LeftMiddleIntermediate, { "LeftMiddleIntermediate", "LeftHandMiddle2" } },
{ HumanoidComponent::HumanoidBone::LeftMiddleDistal, { "LeftMiddleDistal", "LeftHandMiddle3" } },
{ HumanoidComponent::HumanoidBone::LeftRingProximal, { "LeftRingProximal", "LeftHandRing1" } },
{ HumanoidComponent::HumanoidBone::LeftRingIntermediate, { "LeftRingIntermediate", "LeftHandRing2" } },
{ HumanoidComponent::HumanoidBone::LeftRingDistal, { "LeftRingDistal", "LeftHandRing3" } },
{ HumanoidComponent::HumanoidBone::LeftLittleProximal, { "LeftLittleProximal", "LeftHandPinky1" } },
{ HumanoidComponent::HumanoidBone::LeftLittleIntermediate, { "LeftLittleIntermediate", "LeftHandPinky2" } },
{ HumanoidComponent::HumanoidBone::LeftLittleDistal, { "LeftLittleDistal", "LeftHandPinky3" } },
{ HumanoidComponent::HumanoidBone::RightThumbMetacarpal, { "RightThumbMetacarpal", "RightHandThumb1" } },
{ HumanoidComponent::HumanoidBone::RightThumbProximal, { "RightThumbProximal", "RightHandThumb2" } },
{ HumanoidComponent::HumanoidBone::RightThumbDistal, { "RightThumbDistal", "RightHandThumb3" } },
{ HumanoidComponent::HumanoidBone::RightIndexIntermediate, { "RightIndexIntermediate", "RightHandIndex2" } },
{ HumanoidComponent::HumanoidBone::RightIndexDistal, { "RightIndexDistal", "RightHandIndex3" } },
{ HumanoidComponent::HumanoidBone::RightIndexProximal, { "RightIndexProximal", "RightHandIndex1" } },
{ HumanoidComponent::HumanoidBone::RightMiddleProximal, { "RightMiddleProximal", "RightHandMiddle1" } },
{ HumanoidComponent::HumanoidBone::RightMiddleIntermediate, { "RightMiddleIntermediate", "RightHandMiddle2" } },
{ HumanoidComponent::HumanoidBone::RightMiddleDistal, { "RightMiddleDistal", "RightHandMiddle3" } },
{ HumanoidComponent::HumanoidBone::RightRingProximal, { "RightRingProximal", "RightHandRing1" } },
{ HumanoidComponent::HumanoidBone::RightRingIntermediate, { "RightRingIntermediate", "RightHandRing2" } },
{ HumanoidComponent::HumanoidBone::RightRingDistal, { "RightRingDistal", "RightHandRing3" } },
{ HumanoidComponent::HumanoidBone::RightLittleProximal, { "RightLittleProximal", "RightHandPinky1" } },
{ HumanoidComponent::HumanoidBone::RightLittleIntermediate, { "RightLittleIntermediate", "RightHandPinky2" } },
{ HumanoidComponent::HumanoidBone::RightLittleDistal, { "RightLittleDistal", "RightHandPinky3" } },
};

HumanoidComponent humanoid;
Expand Down Expand Up @@ -173,7 +172,6 @@ void ArmatureWindow::Create(EditorComponent* _editor)
boneList.SetSize(XMFLOAT2(wid, 200));
boneList.SetPos(XMFLOAT2(4, y += step));
boneList.OnSelect([=](wi::gui::EventArgs args) {

if (args.iValue < 0)
return;

Expand All @@ -199,8 +197,7 @@ void ArmatureWindow::Create(EditorComponent* _editor)
editor->RecordSelection(archive);

editor->componentsWnd.RefreshEntityTree();

});
});
AddWidget(&boneList);


Expand Down Expand Up @@ -302,5 +299,4 @@ void ArmatureWindow::ResizeLayout()
y += jump;

add_fullwidth(boneList);

}
1 change: 0 additions & 1 deletion Editor/ArmatureWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ class ArmatureWindow : public wi::gui::Window

void ResizeLayout() override;
};

4 changes: 1 addition & 3 deletions Editor/CameraComponentWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void CameraPreview::RenderPreview()
{
renderpath.camera = camera;
scale_local.y = scale_local.x * renderpath.camera->height / renderpath.camera->width;
renderpath.setSceneUpdateEnabled(false); // we just view our scene with this that's updated by the main rernderpath
renderpath.setSceneUpdateEnabled(false); // we just view our scene with this that's updated by the main rernderpath
renderpath.setOcclusionCullingEnabled(false); // occlusion culling only works for one camera
renderpath.PreUpdate();
renderpath.Update(0);
Expand Down Expand Up @@ -72,7 +72,6 @@ void CameraComponentWindow::Create(EditorComponent* _editor)

closeButton.SetTooltip("Delete CameraComponent");
OnClose([=](wi::gui::EventArgs args) {

wi::Archive& archive = editor->AdvanceHistory();
archive << EditorComponent::HISTORYOP_COMPONENT_DATA;
editor->RecordEntity(archive, entity);
Expand Down Expand Up @@ -300,5 +299,4 @@ void CameraComponentWindow::ResizeLayout()
add(apertureShapeXSlider);
add(apertureShapeYSlider);
add_fullwidth(preview);

}
1 change: 0 additions & 1 deletion Editor/CameraComponentWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ class CameraComponentWindow : public wi::gui::Window

void ResizeLayout() override;
};

Loading

0 comments on commit c3390a1

Please sign in to comment.