Improve Cloth usage
This commit is contained in:
@@ -225,8 +225,15 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
_actor = actor;
|
||||
|
||||
var showActorPicker = actor == null || ParentEditor.Values.All(x => x is not Cloth);
|
||||
if (showActorPicker)
|
||||
if (ParentEditor.Values.Any(x => x is Cloth))
|
||||
{
|
||||
// Cloth always picks the parent model mesh
|
||||
if (actor == null)
|
||||
{
|
||||
layout.Label("Cloth needs to be added as a child to model actor.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Actor reference picker
|
||||
_actorPicker = layout.Custom<FlaxObjectRefPickerControl>();
|
||||
@@ -242,7 +249,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
var model = staticModel.Model;
|
||||
if (model == null || model.WaitForLoaded())
|
||||
{
|
||||
layout.Label("No model.");
|
||||
return;
|
||||
}
|
||||
var materials = model.MaterialSlots;
|
||||
var lods = model.LODs;
|
||||
meshNames = new string[lods.Length][];
|
||||
@@ -267,7 +277,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
var skinnedModel = animatedModel.SkinnedModel;
|
||||
if (skinnedModel == null || skinnedModel.WaitForLoaded())
|
||||
{
|
||||
layout.Label("No model.");
|
||||
return;
|
||||
}
|
||||
var materials = skinnedModel.MaterialSlots;
|
||||
var lods = skinnedModel.LODs;
|
||||
meshNames = new string[lods.Length][];
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace FlaxEngine.Tools
|
||||
var cloth = _cloth;
|
||||
if (cloth == null)
|
||||
return;
|
||||
var hasPaintInput = Owner.IsLeftMouseButtonDown && !Owner.IsAltKeyDown;
|
||||
|
||||
// Perform detailed tracing to find cursor location for the brush
|
||||
var ray = Owner.MouseRay;
|
||||
@@ -240,7 +241,7 @@ namespace FlaxEngine.Tools
|
||||
// Cursor hit other object or nothing
|
||||
PaintEnd();
|
||||
|
||||
if (Owner.IsLeftMouseButtonDown)
|
||||
if (hasPaintInput)
|
||||
{
|
||||
// Select something else
|
||||
var view = new Ray(Owner.ViewPosition, Owner.ViewDirection);
|
||||
@@ -253,7 +254,7 @@ namespace FlaxEngine.Tools
|
||||
}
|
||||
|
||||
// Handle painting
|
||||
if (Owner.IsLeftMouseButtonDown)
|
||||
if (hasPaintInput)
|
||||
PaintStart();
|
||||
else
|
||||
PaintEnd();
|
||||
|
||||
@@ -232,13 +232,13 @@ private:
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets the mesh to use for the cloth simulation (single mesh from specific LOD).
|
||||
/// Gets the mesh to use for the cloth simulation (single mesh from specific LOD). Always from the parent static or animated model actor.
|
||||
/// </summary>
|
||||
API_PROPERTY(Attributes="EditorOrder(0), EditorDisplay(\"Cloth\")")
|
||||
ModelInstanceActor::MeshReference GetMesh() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the mesh to use for the cloth simulation (single mesh from specific LOD).
|
||||
/// Sets the mesh to use for the cloth simulation (single mesh from specific LOD). Always from the parent static or animated model actor.
|
||||
/// </summary>
|
||||
API_PROPERTY() void SetMesh(const ModelInstanceActor::MeshReference& value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user