x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Using UE c macros in own macros

I wanted to use templates with UCLASS and came to realization that it is not possible to use templates with macros so i came to the conclusion to replicate that bevahiour with macros themself. As i know it is possible to call macros in other macros, but i am not able to see anything in blueprint.

 #pragma once
 
 #include "CoreMinimal.h"
 
 /*
 *Needs
 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FClampLimitHit, float, spillover); once in class body
 */
 
 #define CLAMPED_VALUE(var_name) \
 \
 public: \
  \
 UPROPERTY(EditAnywhere, Category = Interactable, BlueprintSetter = Set##var_name##Min, BlueprintGetter = Get##var_name##Min) \
 float var_name##Min=0; \
  \
 UPROPERTY(EditAnywhere, Category = Interactable, BlueprintSetter = Set##var_name##Max, BlueprintGetter = Get##var_name##Max) \
 float var_name##Max=2; \
  \
 UPROPERTY(EditAnywhere, Category = Interactable, BlueprintSetter = Set##var_name##Value, BlueprintGetter = Get##var_name##Value) \
 float var_name##Value=1; \
 \
 public: \
 UFUNCTION(BlueprintGetter) \
 float Get##var_name##Min() { \
 return var_name##Min; \
 } \
 UFUNCTION(BlueprintGetter) \
 float Get##var_name##Max() { \
     return var_name##Max; \
 } \
 UFUNCTION(BlueprintGetter) \
 float Get##var_name##Value() { \
     return var_name##Value; \
 } \
 \
 \
 UFUNCTION(BlueprintSetter) \
 void Set##var_name##Min(float value) { \
     var_name##Min = value; \
     if (var_name##Value < var_name##Min) { \
         var_name##Value = var_name##Min; \
     } \
 } \
 UFUNCTION(BlueprintSetter) \
 void Set##var_name##Max(float value) { \
     var_name##Max = value; \
     if (var_name##Value > var_name##Max) { \
         var_name##Value = var_name##Max; \
     } \
 } \
 UFUNCTION(BlueprintSetter) \
 void Set##var_name##Value(float value) { \
     var_name##Value = value; \
     if (var_name##Value < var_name##Min) { \
         On##var_name##LowerLimitPassed.Broadcast(var_name##Value); \
         var_name##Value = var_name##Min; \
     } \
     else if (var_name##Value > var_name##Max) { \
         On##var_name##UpperLimitPassed.Broadcast(var_name##Value); \
         var_name##Value = var_name##Max; \
     } \
 } \
 UFUNCTION(BlueprintCallable) \
 void Add##var_name##Value(float addition) { \
     Set##var_name##Value(var_name##Value + addition); \
 } \
 UPROPERTY(BlueprintAssignable) \
 FClampLimitHit On##var_name##UpperLimitPassed; \
 UPROPERTY(BlueprintAssignable) \
 FClampLimitHit On##var_name##LowerLimitPassed; \
 \
 
 
Product Version: UE 4.20
Tags:
more ▼

asked Jul 28 '18 at 09:28 PM in C++ Programming

avatar image

Hagorath
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question