diff --git a/Source/Editor/Surface/Archetypes/Material.cs b/Source/Editor/Surface/Archetypes/Material.cs index 991f7e9d9..4b0e3d71e 100644 --- a/Source/Editor/Surface/Archetypes/Material.cs +++ b/Source/Editor/Surface/Archetypes/Material.cs @@ -25,79 +25,20 @@ namespace FlaxEditor.Surface.Archetypes /// internal enum MaterialNodeBoxes { - /// - /// The layer input. - /// Layer = 0, - - /// - /// The color input. - /// Color = 1, - - /// - /// The mask input. - /// Mask = 2, - - /// - /// The emissive input. - /// Emissive = 3, - - /// - /// The metalness input. - /// Metalness = 4, - - /// - /// The specular input. - /// Specular = 5, - - /// - /// The roughness input. - /// Roughness = 6, - - /// - /// The ambient occlusion input. - /// AmbientOcclusion = 7, - - /// - /// The normal input. - /// Normal = 8, - - /// - /// The opacity input. - /// Opacity = 9, - - /// - /// The refraction input. - /// Refraction = 10, - - /// - /// The position offset input. - /// PositionOffset = 11, - - /// - /// The tessellation multiplier input. - /// TessellationMultiplier = 12, - - /// - /// The world displacement input. - /// WorldDisplacement = 13, - - /// - /// The subsurface color input. - /// SubsurfaceColor = 14, }; @@ -159,7 +100,6 @@ namespace FlaxEditor.Surface.Archetypes case MaterialDomain.Deformable: { bool isNotUnlit = info.ShadingModel != MaterialShadingModel.Unlit; - bool isTransparent = info.BlendMode == MaterialBlendMode.Transparent; bool withTess = info.TessellationMode != TessellationMethod.None; GetBox(MaterialNodeBoxes.Color).Enabled = isNotUnlit; @@ -171,7 +111,7 @@ namespace FlaxEditor.Surface.Archetypes GetBox(MaterialNodeBoxes.AmbientOcclusion).Enabled = isNotUnlit; GetBox(MaterialNodeBoxes.Normal).Enabled = isNotUnlit; GetBox(MaterialNodeBoxes.Opacity).Enabled = info.ShadingModel == MaterialShadingModel.Subsurface || info.ShadingModel == MaterialShadingModel.Foliage || info.BlendMode != MaterialBlendMode.Opaque; - GetBox(MaterialNodeBoxes.Refraction).Enabled = isTransparent; + GetBox(MaterialNodeBoxes.Refraction).Enabled = info.BlendMode != MaterialBlendMode.Opaque; GetBox(MaterialNodeBoxes.PositionOffset).Enabled = true; GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = withTess; GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = withTess; diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index 2a1bbf9f5..0d6c8cd22 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -422,12 +422,19 @@ void AnimatedModel::UpdateLocalBounds() //box = SkinnedModel->GetBox(GraphInstance.RootTransform.GetWorld()); //box = SkinnedModel->GetBox(); - // Per-bone bounds estimated from positions - auto& skeleton = SkinnedModel->Skeleton; - const int32 bonesCount = skeleton.Bones.Count(); - box = BoundingBox(GraphInstance.NodesPose[skeleton.Bones[0].NodeIndex].GetTranslation()); - for (int32 boneIndex = 1; boneIndex < bonesCount; boneIndex++) - box.Merge(GraphInstance.NodesPose[skeleton.Bones[boneIndex].NodeIndex].GetTranslation()); + if (GraphInstance.NodesPose.Count() != 0) + { + // Per-bone bounds estimated from positions + auto& skeleton = SkinnedModel->Skeleton; + const int32 bonesCount = skeleton.Bones.Count(); + box = BoundingBox(GraphInstance.NodesPose[skeleton.Bones[0].NodeIndex].GetTranslation()); + for (int32 boneIndex = 1; boneIndex < bonesCount; boneIndex++) + box.Merge(GraphInstance.NodesPose[skeleton.Bones[boneIndex].NodeIndex].GetTranslation()); + } + else + { + box = SkinnedModel->GetBox(); + } // Apply margin based on model dimensions const Vector3 modelBoxSize = SkinnedModel->GetBox().GetSize();