diff --git a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp index 493833d0..50ce1975 100644 --- a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp +++ b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp @@ -85,7 +85,11 @@ namespace SHADE currClip = newClip; secsPerTick = 1.0f / currClip->GetTicksPerSecond(); - updatePoseWithClip(0.0f); + + if (!rig) + { + updatePoseWithClip(0.0f); + } } /*-----------------------------------------------------------------------------------*/ @@ -94,7 +98,7 @@ namespace SHADE void SHAnimatorComponent::Update(float dt) { // Nothing to animate - if (!currClip || !isPlaying) + if (!currClip || !isPlaying || !rig) return; // Update time on the playback diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 782f5636..d3329585 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -597,7 +597,7 @@ namespace SHADE }, [component](AssetID const& id) { - if (SHAssetManager::GetType(id) != AssetType::MESH) + if (SHAssetManager::GetType(id) != AssetType::MODEL) { SHLOG_WARNING("Attempted to assign non mesh asset to Renderable Mesh property!") return; @@ -608,7 +608,7 @@ namespace SHADE Handle const& clip = component->GetCurrentClip(); const auto CLIP_NAME = rig ? SHResourceManager::GetAssetName(clip).value_or("") : ""; - SHEditorWidgets::DragDropReadOnlyField("Material", CLIP_NAME, + SHEditorWidgets::DragDropReadOnlyField("Clip", CLIP_NAME, [component]() { Handle const& clip = component->GetCurrentClip(); @@ -616,7 +616,7 @@ namespace SHADE }, [component](AssetID const& id) { - if (SHAssetManager::GetType(id) != AssetType::MESH) + if (SHAssetManager::GetType(id) != AssetType::MODEL) { SHLOG_WARNING("Attempted to assign non mesh asset to Renderable Mesh property!") return; diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp index 50fce74e..33a51cbb 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp @@ -648,15 +648,19 @@ namespace SHADE using PreDefDescLayoutType = SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes; static constexpr uint32_t MATERIAL_DESC_SET_INDEX = 0; - // Flags - bool descSetUpdateRequired = false; - /* Create Descriptor Sets if Needed */ + std::vector varDescCounts; PreDefDescLayoutType layoutTypes = {}; if (matPropsData) + { layoutTypes |= PreDefDescLayoutType::MATERIALS; + varDescCounts.push_back(0); + } if (!boneMatrixData.empty()) + { layoutTypes |= PreDefDescLayoutType::BONES; + varDescCounts.push_back(0); + } if (matPropsData || !boneMatrixData.empty()) { @@ -666,7 +670,7 @@ namespace SHADE instanceDataDescSet[frameIndex] = descPool->Allocate ( SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(layoutTypes), - { 0 } + varDescCounts ); #ifdef _DEBUG const auto& DESC_SETS = instanceDataDescSet[frameIndex]->GetVkHandle(); @@ -699,7 +703,12 @@ namespace SHADE 0, static_cast(matPropsDataSize) ); - descSetUpdateRequired = true; + // Update the descriptor set buffer + instanceDataDescSet[frameIndex]->UpdateDescriptorSetBuffer + ( + MATERIAL_DESC_SET_INDEX, + SHGraphicsConstants::DescriptorSetBindings::PER_INST_MATERIAL_DATA + ); } /* Animation Bone Data */ @@ -713,7 +722,7 @@ namespace SHADE BuffUsage::eVertexBuffer, "Batch Bone Indices Buffer" ); - const uint32_t BONE_MTX_DATA_BYTES = static_cast(boneMatrixData.size() * sizeof(uint32_t)); + const uint32_t BONE_MTX_DATA_BYTES = static_cast(boneMatrixData.size() * sizeof(SHMatrix)); SHVkUtil::EnsureBufferAndCopyHostVisibleData ( device, boneMatrixBuffer[frameIndex], boneMatrixData.data(), BONE_MTX_DATA_BYTES, @@ -728,21 +737,15 @@ namespace SHADE MATERIAL_DESC_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::PER_INST_BONE_DATA, bufferList, - static_cast(matPropsDataSize), + 0, static_cast(boneMatrixData.size() * sizeof(SHMatrix)) ); - descSetUpdateRequired = true; - } - - // Build and prepare the descriptor set if necessary - if (descSetUpdateRequired) - { // Update the descriptor set buffer instanceDataDescSet[frameIndex]->UpdateDescriptorSetBuffer ( MATERIAL_DESC_SET_INDEX, - SHGraphicsConstants::DescriptorSetBindings::PER_INST_MATERIAL_DATA + SHGraphicsConstants::DescriptorSetBindings::PER_INST_BONE_DATA ); } }