├── Documentation ├── Gifs │ ├── 1_51-OpenAsset.gif │ ├── 1_61-ExcludeAsset.gif │ └── Downsized │ │ ├── 1_51-OpenAsset.gif │ │ └── 1_61-ExcludeAsset.gif ├── Images │ ├── 1_11-ShowPluginContent.png │ ├── 1_12-ShowEngineContent.png │ ├── 1_13-RunEditorUtilityWidget.png │ ├── 1_14-RunEWBP.png │ ├── 1_21-Display.png │ ├── 1_22-DisplayDependencies.png │ ├── 1_42-BlueprintFunctionLibrarySearch.png │ ├── 1_71-ContextualMenu.png │ ├── 1_81-ShowPlugins.png │ ├── 2-Configuration.png │ ├── 3_1-B.png │ ├── 3_11-B_Interface.png │ ├── 3_12-BimplmentingInterface.png │ ├── 3_13-AcallingB_Interface.png │ ├── 3_14-InterfaceDependencies.png │ ├── 3_15-B_InterfaceWithBref.png │ ├── 3_16-AwithBref.png │ ├── 3_2-AcallingB.png │ ├── 3_21-BusingEvent.png │ ├── 3_22-AusingEvent.png │ ├── 3_23-EventDependencies.png │ ├── 3_24-AwithAref.png │ ├── 3_25-BmultipleBehaviours.png │ ├── 3_26-AmultipleBehaviours.png │ ├── 3_3-CurrentDependencies.png │ ├── 3_31-LibraryCurrentDependencies.png │ └── 3_32-LibraryDependencies.png └── Videos │ ├── 1_41-OpenAsset.mp4 │ └── 1_41-OpenAsset_downsized.mp4 ├── Others ├── Demo_v1.0.1.mp4 ├── FeaturedImage.png ├── Gallery │ ├── 1_Explanation.png │ ├── 2_Created.png │ ├── 3_Run Editor.png │ ├── 4_Window EWBP.png │ └── 5_Location display.png └── Thumbnail.png ├── README.md └── Template_e_mail.md /Documentation/Gifs/1_51-OpenAsset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Gifs/1_51-OpenAsset.gif -------------------------------------------------------------------------------- /Documentation/Gifs/1_61-ExcludeAsset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Gifs/1_61-ExcludeAsset.gif -------------------------------------------------------------------------------- /Documentation/Gifs/Downsized/1_51-OpenAsset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Gifs/Downsized/1_51-OpenAsset.gif -------------------------------------------------------------------------------- /Documentation/Gifs/Downsized/1_61-ExcludeAsset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Gifs/Downsized/1_61-ExcludeAsset.gif -------------------------------------------------------------------------------- /Documentation/Images/1_11-ShowPluginContent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_11-ShowPluginContent.png -------------------------------------------------------------------------------- /Documentation/Images/1_12-ShowEngineContent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_12-ShowEngineContent.png -------------------------------------------------------------------------------- /Documentation/Images/1_13-RunEditorUtilityWidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_13-RunEditorUtilityWidget.png -------------------------------------------------------------------------------- /Documentation/Images/1_14-RunEWBP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_14-RunEWBP.png -------------------------------------------------------------------------------- /Documentation/Images/1_21-Display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_21-Display.png -------------------------------------------------------------------------------- /Documentation/Images/1_22-DisplayDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_22-DisplayDependencies.png -------------------------------------------------------------------------------- /Documentation/Images/1_42-BlueprintFunctionLibrarySearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_42-BlueprintFunctionLibrarySearch.png -------------------------------------------------------------------------------- /Documentation/Images/1_71-ContextualMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_71-ContextualMenu.png -------------------------------------------------------------------------------- /Documentation/Images/1_81-ShowPlugins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/1_81-ShowPlugins.png -------------------------------------------------------------------------------- /Documentation/Images/2-Configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/2-Configuration.png -------------------------------------------------------------------------------- /Documentation/Images/3_1-B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_1-B.png -------------------------------------------------------------------------------- /Documentation/Images/3_11-B_Interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_11-B_Interface.png -------------------------------------------------------------------------------- /Documentation/Images/3_12-BimplmentingInterface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_12-BimplmentingInterface.png -------------------------------------------------------------------------------- /Documentation/Images/3_13-AcallingB_Interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_13-AcallingB_Interface.png -------------------------------------------------------------------------------- /Documentation/Images/3_14-InterfaceDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_14-InterfaceDependencies.png -------------------------------------------------------------------------------- /Documentation/Images/3_15-B_InterfaceWithBref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_15-B_InterfaceWithBref.png -------------------------------------------------------------------------------- /Documentation/Images/3_16-AwithBref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_16-AwithBref.png -------------------------------------------------------------------------------- /Documentation/Images/3_2-AcallingB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_2-AcallingB.png -------------------------------------------------------------------------------- /Documentation/Images/3_21-BusingEvent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_21-BusingEvent.png -------------------------------------------------------------------------------- /Documentation/Images/3_22-AusingEvent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_22-AusingEvent.png -------------------------------------------------------------------------------- /Documentation/Images/3_23-EventDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_23-EventDependencies.png -------------------------------------------------------------------------------- /Documentation/Images/3_24-AwithAref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_24-AwithAref.png -------------------------------------------------------------------------------- /Documentation/Images/3_25-BmultipleBehaviours.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_25-BmultipleBehaviours.png -------------------------------------------------------------------------------- /Documentation/Images/3_26-AmultipleBehaviours.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_26-AmultipleBehaviours.png -------------------------------------------------------------------------------- /Documentation/Images/3_3-CurrentDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_3-CurrentDependencies.png -------------------------------------------------------------------------------- /Documentation/Images/3_31-LibraryCurrentDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_31-LibraryCurrentDependencies.png -------------------------------------------------------------------------------- /Documentation/Images/3_32-LibraryDependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Images/3_32-LibraryDependencies.png -------------------------------------------------------------------------------- /Documentation/Videos/1_41-OpenAsset.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Videos/1_41-OpenAsset.mp4 -------------------------------------------------------------------------------- /Documentation/Videos/1_41-OpenAsset_downsized.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Documentation/Videos/1_41-OpenAsset_downsized.mp4 -------------------------------------------------------------------------------- /Others/Demo_v1.0.1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Demo_v1.0.1.mp4 -------------------------------------------------------------------------------- /Others/FeaturedImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/FeaturedImage.png -------------------------------------------------------------------------------- /Others/Gallery/1_Explanation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Gallery/1_Explanation.png -------------------------------------------------------------------------------- /Others/Gallery/2_Created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Gallery/2_Created.png -------------------------------------------------------------------------------- /Others/Gallery/3_Run Editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Gallery/3_Run Editor.png -------------------------------------------------------------------------------- /Others/Gallery/4_Window EWBP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Gallery/4_Window EWBP.png -------------------------------------------------------------------------------- /Others/Gallery/5_Location display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Gallery/5_Location display.png -------------------------------------------------------------------------------- /Others/Thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstt/CircularDependenciesDetector/06a5fc82b24d4a4cd4262e694e305f2c16087eb4/Others/Thumbnail.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Circular Dependencies Detector 2 | 3 | ## Presentation: 4 | 5 | ### Demo Video : https://youtu.be/8ZBd1RLFG3M 6 | 7 | **Marketplace link :** https://www.unrealengine.com/marketplace/en-US/slug/circular-dependencies-detector 8 | 9 | With the Circular Dependencies Detector plugin, you can quickly detect in your project all circular dependencies, dependencies in both ways. The detection is done in compile and save time. You can place the Editor Widget wherever you want. 10 | 11 | Send by mail any suggestion for the plugin. It will always be considered. 12 | Please report any unexpected behaviours. It will be fixed as soon as possible. 13 | 14 | **Support e-mail :** bstt.ue4@gmail.com 15 | 16 | ## Sources 17 | 18 | You can get the lastest source code of the plugin on this [link](https://github.com/bstt/CircularDependenciesDetector/tree/sources). 19 | 20 | You can freely **get the plugin via the Unreal Engine marketplace** in order to automatically get the updates. 21 | 22 | ## Documentation: 23 | 24 | ### Table of contents 25 | 26 | #### 1. [Use Circular Dependencies Detector](#1-Use-Circular-Dependencies-Detector-1) 27 | 28 | ##### 1.1. [Run the Editor Widget](#11-Run-the-Editor-Widget-1) 29 | 30 | ##### 1.2. [Display](#12-Display-1) 31 | 32 | ##### 1.3. [Refresh all button](#13-Refresh-all-button-1) 33 | 34 | ##### 1.4. [Refresh already detected button](#14-Refresh-already-detected-button-1) 35 | 36 | ##### 1.5. [Open asset](#15-Open-asset-1) 37 | 38 | ##### 1.6. [Exclude button](#16-Exclude-button-1) 39 | 40 | ##### 1.7. [Contextual menu](#17-Contextual-menu-1) 41 | 42 | ##### 1.8. [Show plugins](#18-Show-plugins-1) 43 | 44 | #### 2. [Configuration](#2-Configuration-1) 45 | 46 | ##### 2.1. [Show On Startup](#21-Show-On-Startup-1) 47 | 48 | ##### 2.2. [Max Detection Count](#22-Max-Detection-Count-1) 49 | 50 | ##### 2.3. [Max Dependency Depth](#23-Max-Dependency-Depth-1) 51 | 52 | ##### 2.4. [Automatic Refresh Delay](#24-Automatic-Refresh-Delay-1) 53 | 54 | #### 3. [Solve circular dependencies](#3-Solve-circular-dependencies-1) 55 | 56 | ##### 3.1. [Use interfaces](#31-Use-interfaces-1) 57 | 58 | ##### 3.2. [Use Event Dispatcher](#32-Use-Event-Dispatcher-1) 59 | 60 | ##### 3.3. [Split Blueprint Function Library](#33-Split-Blueprint-Function-Library-1) 61 | 62 | ##### 3.4. [Redo the design](#34-Redo-the-design-1) 63 | 64 | #### 4. [Contact me](#4-Contact-me-1) 65 | 66 | ### 1. Use Circular Dependencies Detector 67 | 68 | Circular Dependencies Detector is a tool that **only detect** all circular dependencies in a project. You need to **manually solve these circular dependencies**. Some ways to fix them are explained in the section : [Solve circular dependencies](#3-Solve-circular-dependencies-1). 69 | 70 | #### 1.1. Run the Editor Widget 71 | 72 |
73 | Show steps in case of Editor Widget not automatically opened 74 | 75 | - In Content Browser, enable **Show Plugin Content**, 76 | - Enable **Show Engine Content** (It is recommanded to **_disable Show C++ Classes_**) 77 | - Go to the **Circular Dependencies Detector plugin folder,** 78 | - **Right click** on the CircularDependencies_EWBP (**do not double-click**), 79 | - Select **Run Editor Utility Widget**. 80 | 81 | ![Show Plugin Content](Documentation/Images/1_11-ShowPluginContent.png) 82 | ![Show Engine Content](Documentation/Images/1_12-ShowEngineContent.png) 83 | 84 | ![Run Editor Utility Widget](Documentation/Images/1_13-RunEditorUtilityWidget.png) 85 |
86 | 87 | If you opened and closed the EWBP, you can re-open it by going to the **Edit Menu -> Editor Widget -> Run EWBP**. 88 | 89 | ![Run EWBP](Documentation/Images/1_14-RunEWBP.png) 90 | 91 | [Table of contents](#Table-of-contents) 92 | 93 | #### 1.2. Display 94 | 95 | ![Display](Documentation/Images/1_21-Display.png) 96 | 97 | Displayed by the plugin : 98 | 99 | - number of excluded assets 100 | - all excluded assets 101 | - number of circular dependencies 102 | - search bar 103 | - all assets involved in circular dependencies grouped by block. 104 | 105 | The current display means this : 106 | 107 | ![Display](Documentation/Images/1_22-DisplayDependencies.png) 108 | 109 | _(A -> B means A depends on B)_ 110 | 111 | If an asset is displayed in 2 blocks it means that it is involved in 2 different circular dependencies. 112 | 113 | All diplayed circular dependencies don't contain the excluded assets. 114 | 115 | [Table of contents](#Table-of-contents) 116 | 117 | #### 1.3. Refresh all button 118 | 119 | This button start the detection of circular dependencies on all files. 120 | 121 | On **compile and save**, Unreal Engine compute the dependencies. Sometimes it is not immediately computed. After a short amount of time (30 seconds maximum), you can press the button refresh to check if the dependencies are still present. Sometimes it is wrongly computed especially when dependencies were contained in a node group. Close and open again the blueprint to fix the computation of dependencies. 122 | 123 | You can check the current dependencies by opening the Reference viewer (Right click on the asset -> Reference viewer). 124 | 125 | The plugin is using **only hard referencies**. 126 | 127 | [Table of contents](#Table-of-contents) 128 | 129 | #### 1.4. Refresh already detected button 130 | 131 | This button only refresh the circular dependencies already detected. 132 | 133 | By default the automatic refresh is only done on the files involved in circular dependencies already detected. If there is none, this is done on all files. 134 | 135 | #### 1.5. Open asset 136 | 137 | Press the button of a displayed asset in order to open it. The next asset in the circular dependency is **automatically search**. You just need **to manually make the search result empty** in order to break the circular dependency. 138 | 139 | [![Open asset](Documentation/Gifs/Downsized/1_51-OpenAsset.gif)](Documentation/Gifs/1_51-OpenAsset.gif) 140 | 141 | **A specific search is done for Blueprint Function Library.** 142 | 143 | ![Blueprint Function Library Search](Documentation/Images/1_42-BlueprintFunctionLibrarySearch.png) 144 | 145 | [Table of contents](#Table-of-contents) 146 | 147 | #### 1.6. Exclude button 148 | 149 | For each asset involved in a circular dependencies, you can press the **Exclude button** in order to exclude the asset from the search of all circular dependencies. 150 | For each excluded asset, you can press the **Include button** in order to include the asset in the search of all circular dependencies. 151 | 152 | [![Exclude asset](Documentation/Gifs/Downsized/1_61-ExcludeAsset.gif)](Documentation/Gifs/1_61-ExcludeAsset.gif) 153 | 154 | [Table of contents](#Table-of-contents) 155 | 156 | #### 1.7. Contextual menu 157 | 158 | In content browser, you can right-click on an asset or a folder and select **Circular Dependencies Detector -> Detect For selected** in order to detect circular dependencies for the selected assets. 159 | The search bar is automatically filled with the selected assets. 160 | 161 | ![Contextual menu](Documentation/Images/1_71-ContextualMenu.png) 162 | 163 | [Table of contents](#Table-of-contents) 164 | 165 | #### 1.8. Show plugins 166 | 167 | By default, the plugin is only searching circular dependencies in the project. You can click on the **Show plugins** button and select the plugins you want to include in the search. 168 | 169 | ![Show plugins](Documentation/Images/1_81-ShowPlugins.png) 170 | 171 | [Table of contents](#Table-of-contents) 172 | 173 | ### 2. Configuration 174 | 175 | You can change CDD option in ***Editor Preferences/Plugins/Circular Dependencies Detector.*** 176 | 177 | ![Configuration](Documentation/Images/2-Configuration.png) 178 | 179 | #### 2.1. Show On Startup 180 | 181 | Enable this option to spawn the CDD Editor Widget on startup. 182 | 183 | #### 2.2. Max Detection Count 184 | 185 | This is the number of circular dependencies detected from which detection is interrupted. 186 | 187 | #### 2.3. Max Dependency Depth 188 | 189 | This is the length of depenency path from which dependencies are ignored. 190 | 191 | #### 2.4. Automatic Refresh Delay 192 | 193 | This is the delay in seconds before an automatic refresh, put a negative value to disable the automatic refresh. 194 | 195 | ### 3. Solve circular dependencies 196 | 197 | In Unreal Engine, it is really simple to generate circular dependencies with Blueprint since all blueprints are in the same scope. 198 | In C++, you must use forward declaration to have circular dependencies, it means that if you have ones, it's intentional. 199 | 200 | [Circular dependencies](https://en.wikipedia.org/wiki/Circular_dependency) are considered as an anti-pattern because of their negative effects : tight coupling, memory leaks... 201 | They can be avoid by using [desing patterns](https://refactoring.guru/design-patterns/catalog). 202 | 203 | **Problem :** 204 | You have 2 classes A and B, **you are forced to make B depends on A** and your class A call some functions funcB1 and funcB2 from class B (and then A depends on B). 205 | 206 | ![Class B](Documentation/Images/3_1-B.png) 207 | ![Class A calling class B](Documentation/Images/3_2-AcallingB.png) 208 | 209 | **Current dependencies :** 210 | ![Current dependencies](Documentation/Images/3_3-CurrentDependencies.png) 211 | 212 | _(A -> B means A depends on B)_ 213 | 214 | [Table of contents](#Table-of-contents) 215 | 216 | #### 3.1. Use interfaces 217 | 218 | [Dependency inversion principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle#Implementations) is a simple way to resolve dependencies problem. 219 | 220 | **Solution :** 221 | Move the functions funcB1 and funcB2 in an interface B_Interface and call the functions from the interface instead of the class B. 222 | 223 | ![B_Interface](Documentation/Images/3_11-B_Interface.png) 224 | ![Class B implementing interface](Documentation/Images/3_12-BimplmentingInterface.png) 225 | ![Class A calling B_Interface](Documentation/Images/3_13-AcallingB_Interface.png) 226 | 227 | **New dependencies :** 228 | ![Interface dependencies](Documentation/Images/3_14-InterfaceDependencies.png) 229 | 230 | **Warning :** You must not directely put a reference of class B or any type that depends on class B. You'll need to put a reference of type B_interface or of a type that depends on B_interface. 231 | 232 | ![B_Interface with B_Interface ref](Documentation/Images/3_15-B_InterfaceWithBref.png) 233 | ![A with B_Interface ref](Documentation/Images/3_16-AwithBref.png) 234 | 235 | [Table of contents](#Table-of-contents) 236 | 237 | #### 3.2. Use Event Dispatcher 238 | 239 | [Observer design pattern](https://refactoring.guru/design-patterns/observer) is another simple way to resolve dependencies problem. 240 | 241 | **Solution :** 242 | Declare 2 events dispatcher within the class A, one of type funcB1, one of type funcB2, subscribe the class B to these dispatcher and call the dispatcher in your class A. 243 | 244 | If you need a return value for your 2 functions, you need to create 2 other functions return_funcB1, return_funcB2 within the class A and call them in class B instead of returning values. 245 | 246 | ![Class B using Event](Documentation/Images/3_21-BusingEvent.png) 247 | ![Class A using Event](Documentation/Images/3_22-AusingEvent.png) 248 | 249 | **New dependencies :** 250 | ![Event dependencies](Documentation/Images/3_23-EventDependencies.png) 251 | 252 | You can even put the object of class A as parameter in order to get the caller (especially needed if there are several callers). 253 | 254 | ![A with A ref](Documentation/Images/3_24-AwithAref.png) 255 | 256 | If you have several behaviours after a return value, you can use an enum parameter in order to switch to the behaviour you want to get. 257 | 258 | ![Class B with multiple behaviours](Documentation/Images/3_25-BmultipleBehaviours.png) 259 | ![Class A with multiple behaviours](Documentation/Images/3_26-AmultipleBehaviours.png) 260 | 261 | **Warning :** You can't put a reference of class B or any type that depends on class B. 262 | 263 | [Table of contents](#Table-of-contents) 264 | 265 | #### 3.3. Split Blueprint Function Library 266 | 267 | **Problem :** _(explained with a schema to improve clarity)_ 268 | 269 | ![Library Current Dependencies](Documentation/Images/3_31-LibraryCurrentDependencies.png) 270 | 271 | - **MyBlueprint** is a class. 272 | - **MyLib** is a Blueprint Function Library. 273 | - **FuncOfMyBP** is a function of MyLib that depends on MyBlueprint. 274 | - **FuncNotOfMyBP** is a function of MyLib that does **NOT** depend on MyBlueprint. 275 | - MyBlueprint use the function FuncNotOfMyBP. 276 | - MyBlueprint do **NOT** use the function FuncOfMyBP. 277 | 278 | _By the way, a function of MyLib that depends on MyBlueprint and that is used by MyBlueprint uses should be inside of MyBlueprint (cf. [Redo the design](#34-Redo-the-design-1))._ 279 | _If you can't move the function inside MyBlueprint, you can still [use interfaces](#31-Use-interfaces-1)._ 280 | 281 | **Solution :** 282 | Place the function **FuncNotOfMyBP** in another Blueprint Function Library MyOtherLib. 283 | 284 | **New dependencies :** 285 | ![Event dependencies](Documentation/Images/3_32-LibraryDependencies.png) 286 | 287 | **Note :** All functions that depends on MyBlueprint must be in a library that is **NOT** used by MyBlueprint or inside MyBlueprint. 288 | 289 | [Table of contents](#Table-of-contents) 290 | 291 | #### 3.4. Redo the design 292 | 293 | If you have circular dependencies, it is certainly a design problem. 294 | This method is the hardest way to solve this but it is also the best. 295 | 296 | There is no specific rule or magic trick to solve it : you'll need to use your brain to fix it. 297 | 298 | But here are some tips that can help you to make a good design. 299 | Generally all design problem come from a bad data structure, and not from a bad implementation. 300 | 301 | You need to wonder : 302 | 303 | - Do I really need this ? (Can I get this from another way ?) 304 | - How will I use this ? (Is it displayed ? used for computation ? Is it a storage of a computation ?) 305 | - Do I really need this here ? (Who owns who ?) 306 | 307 | It is pretty hard to objectively answer to these questions but it is necessary to improve your data structures. 308 | 309 | When you reach the point that you can't improve your data structures anymore, you need to wonder : 310 | 311 | - Which object must call this function ? (who interacts with who ?) 312 | 313 | [Table of contents](#Table-of-contents) 314 | 315 | ### 4. Contact me 316 | 317 | When you got an error or a crash : 318 | 319 | - Save your project. 320 | - Try to reproduce the error. 321 | - Fill this [template e-mail](Template_e_mail.md) 322 | - Send it at this e-mail address : bstt.ue4@gmail.com 323 | 324 | Until a valid fix is found, try right-click on content browser and then **Fix up Redirectors in Folder**. 325 | Please **send the project before** trying this. 326 | 327 | [Table of contents](#Table-of-contents) 328 | -------------------------------------------------------------------------------- /Template_e_mail.md: -------------------------------------------------------------------------------- 1 | # Template e-mail 2 | 3 | Below e-mail templates, you must **replace the content of the brackets**. 4 | 5 | Please, try to send your project or at least a sufficient part to reproduce the error, I will do nothing more than fix the error. Thanks. 6 | 7 | _Send at this e-mail address : bstt.ue4@gmail.com_ 8 | 9 | ## Reproductible error 10 | 11 | E-mail title : CDD reproductible error on Open Widget 12 | 13 | ```email 14 | Hello bstt, 15 | 16 | I'm working on [4.26, 4.27, ...]. 17 | I got an error with CDD on the action [Open Widget, Compile code, ...]. 18 | The error is [always, randomly] reproductible. 19 | To reproduce it, you have to : 20 | ... 21 | Here is the link where you can get [all, a part of] my project : [wetransfer, google drive] 22 | 23 | Best regards. 24 | ``` 25 | 26 | ## Not reproductible error 27 | 28 | E-mail title : CDD not reproductible error on [Open Widget, Compile code, ...]. 29 | 30 | ```email 31 | Hello bstt, 32 | 33 | I'm working on [4.26, 4.27, ...]. 34 | I got an error with CDD on the action [Open Widget, Compile code, ...]. 35 | The error is not reproductible. 36 | As unusual actions I have done before there are : 37 | ... 38 | Here is the link where you can get [all, a part of] my project : [wetransfer, google drive] 39 | 40 | Best regards. 41 | ``` 42 | --------------------------------------------------------------------------------