From e21c8e5fe9bec33d1737d255c6709d2d12eca2b5 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 22 Jan 2023 18:52:28 -0600 Subject: [PATCH 1/2] Organize physics actors a little better in CM, added wheeled vehicle to list. minor change in CM to not add actors that have a parent with the attribute (more selective). --- Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs | 4 ++-- Source/Engine/Physics/Actors/WheeledVehicle.h | 2 +- Source/Engine/Physics/Colliders/BoxCollider.h | 2 +- Source/Engine/Physics/Colliders/CapsuleCollider.h | 2 +- Source/Engine/Physics/Colliders/MeshCollider.h | 2 +- Source/Engine/Physics/Colliders/SphereCollider.h | 2 +- Source/Engine/Physics/Joints/D6Joint.h | 2 +- Source/Engine/Physics/Joints/DistanceJoint.h | 2 +- Source/Engine/Physics/Joints/FixedJoint.h | 2 +- Source/Engine/Physics/Joints/HingeJoint.h | 2 +- Source/Engine/Physics/Joints/SliderJoint.h | 2 +- Source/Engine/Physics/Joints/SphericalJoint.h | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs index 3a7336bbb..75f31bfd6 100644 --- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs +++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs @@ -152,11 +152,11 @@ namespace FlaxEditor.Windows // go through each actor and add it to the context menu if it has the ActorContextMenu attribute foreach (var actorType in Editor.CodeEditing.Actors.Get()) { - if (actorType.IsAbstract || !actorType.HasAttribute(typeof(ActorContextMenuAttribute), true)) + if (actorType.IsAbstract || !actorType.HasAttribute(typeof(ActorContextMenuAttribute), false)) continue; ActorContextMenuAttribute attribute = null; - foreach (var actorAttribute in actorType.GetAttributes(true)) + foreach (var actorAttribute in actorType.GetAttributes(false)) { if (actorAttribute is ActorContextMenuAttribute actorContextMenuAttribute) { diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.h b/Source/Engine/Physics/Actors/WheeledVehicle.h index 2cc43bdd7..7e046d1a2 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.h +++ b/Source/Engine/Physics/Actors/WheeledVehicle.h @@ -10,7 +10,7 @@ /// Representation of the car vehicle that uses wheels. Built on top of the RigidBody with collider representing its chassis shape and wheels. /// /// -API_CLASS() class FLAXENGINE_API WheeledVehicle : public RigidBody +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Wheeled Vehicle\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API WheeledVehicle : public RigidBody { friend class PhysicsBackend; DECLARE_SCENE_OBJECT(WheeledVehicle); diff --git a/Source/Engine/Physics/Colliders/BoxCollider.h b/Source/Engine/Physics/Colliders/BoxCollider.h index c69a3ee56..c4ee6c2b5 100644 --- a/Source/Engine/Physics/Colliders/BoxCollider.h +++ b/Source/Engine/Physics/Colliders/BoxCollider.h @@ -9,7 +9,7 @@ /// A box-shaped primitive collider. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Box Collider\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Colliders/Box Collider\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API BoxCollider : public Collider { DECLARE_SCENE_OBJECT(BoxCollider); diff --git a/Source/Engine/Physics/Colliders/CapsuleCollider.h b/Source/Engine/Physics/Colliders/CapsuleCollider.h index 2f31e0d3b..5ae53cf53 100644 --- a/Source/Engine/Physics/Colliders/CapsuleCollider.h +++ b/Source/Engine/Physics/Colliders/CapsuleCollider.h @@ -10,7 +10,7 @@ /// /// Capsules are cylinders with a half-sphere at each end centered at the origin and extending along the X axis, and two hemispherical ends. /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Capsule Collider\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Colliders/Capsule Collider\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API CapsuleCollider : public Collider { DECLARE_SCENE_OBJECT(CapsuleCollider); diff --git a/Source/Engine/Physics/Colliders/MeshCollider.h b/Source/Engine/Physics/Colliders/MeshCollider.h index f64dd6dd3..a25f4d9c8 100644 --- a/Source/Engine/Physics/Colliders/MeshCollider.h +++ b/Source/Engine/Physics/Colliders/MeshCollider.h @@ -10,7 +10,7 @@ /// A collider represented by an arbitrary mesh. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Mesh Collider\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Colliders/Mesh Collider\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API MeshCollider : public Collider { DECLARE_SCENE_OBJECT(MeshCollider); diff --git a/Source/Engine/Physics/Colliders/SphereCollider.h b/Source/Engine/Physics/Colliders/SphereCollider.h index a40d22704..39f6fd63c 100644 --- a/Source/Engine/Physics/Colliders/SphereCollider.h +++ b/Source/Engine/Physics/Colliders/SphereCollider.h @@ -8,7 +8,7 @@ /// A sphere-shaped primitive collider. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Sphere Collider\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Colliders/Sphere Collider\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API SphereCollider : public Collider { DECLARE_SCENE_OBJECT(SphereCollider); diff --git a/Source/Engine/Physics/Joints/D6Joint.h b/Source/Engine/Physics/Joints/D6Joint.h index d6f208b33..cd7e194f0 100644 --- a/Source/Engine/Physics/Joints/D6Joint.h +++ b/Source/Engine/Physics/Joints/D6Joint.h @@ -160,7 +160,7 @@ public: /// It also allows you to constrain limits to only specific axes or completely lock specific axes. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/D6 Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Joints/D6 Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API D6Joint : public Joint { DECLARE_SCENE_OBJECT(D6Joint); diff --git a/Source/Engine/Physics/Joints/DistanceJoint.h b/Source/Engine/Physics/Joints/DistanceJoint.h index 7ff522a03..96ddc9538 100644 --- a/Source/Engine/Physics/Joints/DistanceJoint.h +++ b/Source/Engine/Physics/Joints/DistanceJoint.h @@ -37,7 +37,7 @@ DECLARE_ENUM_OPERATORS(DistanceJointFlag); /// Physics joint that maintains an upper or lower (or both) bound on the distance between two bodies. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Distance Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Joints/Distance Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API DistanceJoint : public Joint { DECLARE_SCENE_OBJECT(DistanceJoint); diff --git a/Source/Engine/Physics/Joints/FixedJoint.h b/Source/Engine/Physics/Joints/FixedJoint.h index 8020ea73f..c406b4aa8 100644 --- a/Source/Engine/Physics/Joints/FixedJoint.h +++ b/Source/Engine/Physics/Joints/FixedJoint.h @@ -8,7 +8,7 @@ /// Physics joint that maintains a fixed distance and orientation between its two attached bodies. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Fixed Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Joints/Fixed Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API FixedJoint : public Joint { DECLARE_SCENE_OBJECT(FixedJoint); diff --git a/Source/Engine/Physics/Joints/HingeJoint.h b/Source/Engine/Physics/Joints/HingeJoint.h index 6c7af54de..a14230cd9 100644 --- a/Source/Engine/Physics/Joints/HingeJoint.h +++ b/Source/Engine/Physics/Joints/HingeJoint.h @@ -67,7 +67,7 @@ public: /// Physics joint that removes all but a single rotation degree of freedom from its two attached bodies (for example a door hinge). /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Hinge Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Joints/Hinge Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API HingeJoint : public Joint { DECLARE_SCENE_OBJECT(HingeJoint); diff --git a/Source/Engine/Physics/Joints/SliderJoint.h b/Source/Engine/Physics/Joints/SliderJoint.h index d102c1dd5..51d95f339 100644 --- a/Source/Engine/Physics/Joints/SliderJoint.h +++ b/Source/Engine/Physics/Joints/SliderJoint.h @@ -27,7 +27,7 @@ DECLARE_ENUM_OPERATORS(SliderJointFlag); /// Physics joint that removes all but a single translational degree of freedom. Bodies are allowed to move along a single axis. /// /// -API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Slider Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Joints/Slider Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API SliderJoint : public Joint { DECLARE_SCENE_OBJECT(SliderJoint); diff --git a/Source/Engine/Physics/Joints/SphericalJoint.h b/Source/Engine/Physics/Joints/SphericalJoint.h index 96359d4c5..95f0bae10 100644 --- a/Source/Engine/Physics/Joints/SphericalJoint.h +++ b/Source/Engine/Physics/Joints/SphericalJoint.h @@ -29,7 +29,7 @@ DECLARE_ENUM_OPERATORS(SphericalJointFlag); /// rotate around the anchor points, and their rotation can be limited by an elliptical cone. /// /// -API_CLASS(Attributes = "ActorContextMenu(\"New/Physics/Spherical Joint\"), ActorToolbox(\"Physics\")") +API_CLASS(Attributes = "ActorContextMenu(\"New/Physics/Joints/Spherical Joint\"), ActorToolbox(\"Physics\")") class FLAXENGINE_API SphericalJoint : public Joint { DECLARE_SCENE_OBJECT(SphericalJoint); From ff3277edc7d10e88a8cbd9e6a9aacbd90f10c962 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 22 Jan 2023 21:33:08 -0600 Subject: [PATCH 2/2] Change CM attributes to not check inhereted class. --- Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs | 2 +- Source/Editor/Windows/ContentWindow.ContextMenu.cs | 2 +- Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs | 2 +- Source/Editor/Windows/ToolboxWindow.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs index 71777dea7..7544100e8 100644 --- a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs +++ b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs @@ -253,7 +253,7 @@ namespace FlaxEditor.Windows.Assets if (actorType.IsAbstract) continue; ActorContextMenuAttribute attribute = null; - foreach (var e in actorType.GetAttributes(true)) + foreach (var e in actorType.GetAttributes(false)) { if (e is ActorContextMenuAttribute actorContextMenuAttribute) { diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index b8b289e08..64d9b6d37 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -162,7 +162,7 @@ namespace FlaxEditor.Windows // Get attribute ContentContextMenuAttribute attribute = null; - foreach (var typeAttribute in type.GetAttributes(true)) + foreach (var typeAttribute in type.GetAttributes(false)) { if (typeAttribute is ContentContextMenuAttribute contentContextMenuAttribute) { diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs index 75f31bfd6..e48e59f80 100644 --- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs +++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs @@ -66,7 +66,7 @@ namespace FlaxEditor.Windows if (actorType.IsAbstract) continue; ActorContextMenuAttribute attribute = null; - foreach (var e in actorType.GetAttributes(true)) + foreach (var e in actorType.GetAttributes(false)) { if (e is ActorContextMenuAttribute actorContextMenuAttribute) { diff --git a/Source/Editor/Windows/ToolboxWindow.cs b/Source/Editor/Windows/ToolboxWindow.cs index 434647280..445a7d778 100644 --- a/Source/Editor/Windows/ToolboxWindow.cs +++ b/Source/Editor/Windows/ToolboxWindow.cs @@ -250,7 +250,7 @@ namespace FlaxEditor.Windows foreach (var actorType in Editor.CodeEditing.Actors.Get()) { ActorToolboxAttribute attribute = null; - foreach (var e in actorType.GetAttributes(true)) + foreach (var e in actorType.GetAttributes(false)) { if (e is ActorToolboxAttribute actorToolboxAttribute) {