en:toolworks:docs:apparatus:detail

This is an old revision of the document!


Detail

Details are the main building data blocks in Apparatus. They are high-level entities (unlike Traits), which support some additional ECS+ functionality like multi-iterating and inheritance.

Details do derive from UObject and are subject to garbage collecting and Unreal’s general memory model.

In order to create a Detail visible in your C++ source code you have to do the following:

- Open the main UE File menu and choose the “New C++ Class…” option:

  1. In the opened window mark the “Show All Classes” checkbox:
  2. Now you can select any of the base classes available including the Apparatus ones. Choose the Detail as a base class:
  3. Click “Next” and you should see a name choosing dialog. Adjust the name of the class as needed and proceed by pressing the green “Create Class” button at the bottom:
  4. The new class gets created as a combo of its header (.h) and a source file (.cpp). All in the Source (sub)folder of your project. You should now see them in the IDE of your choice:
  5. Note that you may have to recompile the project and/or restart the Editor after that. Don’t be scared by some possible errors here, regenerate the IDE project, rebuild and start again.
  6. The corresponding file contents should be as:
    • MyDetail.h:
      // Fill out your copyright notice in the Description page of Project Settings.
      
      #pragma once
      
      #include "CoreMinimal.h"
      #include "Detail.h"
      #include "MyDetail.generated.h"
      
      /**
       * 
       */
      UCLASS()
      class APPARATUSMARK_API UMyDetail : public UDetail
      {
      	GENERATED_BODY()
      	
      };
      
    • MyMechanicalActor.cpp:
      // Fill out your copyright notice in the Description page of Project Settings.
      
      
      #include "MyDetail.h"
      
      
  7. Now you can add some data fields to the class as usually in, right in the C++ header:
    float X = 0;
    float Y = 0;
    
  8. Perhaps you would also like to expose those fields as properties in order to access them from BPs and even change their initial values through the UI (for more info, please see Properties):
    UPROPERTY(BlueprintReadWrite, EditAnywhere)
    float X = 0;
    
    UPROPERTY(BlueprintReadWrite, EditAnywhere)
    float Y = 0;
    
  9. Your C++-friendly Detail should be ready to use now. Please, refer to API Reference for additional information.
  • en/toolworks/docs/apparatus/detail.1623409058.txt.gz
  • Last modified: 2021/06/11 13:57
  • by vladius