-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Snippet: Virtual functions in c++, Added Snippet: Custom compon…
…ents in Unreal Engine C++, Added Snippet: Exposing Static Constant to Blueprint from Unreal Engine C++, Minor Fixes
- Loading branch information
1 parent
5f0ad1b
commit 2d4772f
Showing
16 changed files
with
117 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { HTMLSkeleton, H1 } from "./global.jsx" | ||
|
||
|
||
export const snippet_title = "Virtual Functions in C++" | ||
export const snippet_category = "C++" | ||
|
||
|
||
<HTMLSkeleton RegisterToSiteGuide={{ category : snippet_category, title : snippet_title }}> | ||
|
||
<H1>{snippet_title}</H1> | ||
|
||
</HTMLSkeleton> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { HTMLSkeleton, H1 } from "./global.jsx" | ||
|
||
export const snippet_title = "Custom components in Unreal Engine C++" | ||
export const snippet_category = "Unreal Engine" | ||
|
||
<HTMLSkeleton RegisterToSiteGuide={{ category : snippet_category, title : snippet_title }} UseLocalGuide={true}> | ||
|
||
<H1>{snippet_title}</H1> | ||
|
||
```cpp | ||
#include "Components/ActorComponent.h" | ||
|
||
UCLASS(meta=(BlueprintSpawnableComponent)) // without this the component will not show in blueprints | ||
class MYPROJECT_API UExampleComponent : public UActorComponent | ||
{ | ||
GENERATED_BODY() | ||
|
||
}; | ||
``` | ||
</HTMLSkeleton> |
43 changes: 43 additions & 0 deletions
43
_mdx/snippets/Unreal Engine/ue-expose-static-constant-to-bp/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { HTMLSkeleton, H1 } from "./global.jsx" | ||
|
||
export const snippet_title = "Exposing Static Constant to Blueprint from C++ in Unreal Engine" | ||
export const snippet_category = "Unreal Engine" | ||
|
||
<HTMLSkeleton RegisterToSiteGuide={{ category : snippet_category, title : snippet_title }} UseLocalGuide={true}> | ||
|
||
<H1>{snippet_title}</H1> | ||
|
||
**Note:** this is more of a workaround | ||
|
||
```cpp | ||
// ExampleObject.h file | ||
|
||
UCLASS() | ||
class MYPROJECT_API UExampleStatic : public UBlueprintFunctionLibrary | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintPure) | ||
static float GetMyConstant(); | ||
}; | ||
|
||
|
||
UCLASS() | ||
class MYPROJECT_API UExampleObject : public UObject { | ||
GENERATED_BODY() | ||
|
||
public: | ||
static const float MY_CONSTANT; // Exposing to blueprints via Function Library | ||
|
||
}; | ||
``` | ||
|
||
```cpp | ||
// ExampleObject.cpp file | ||
|
||
const float UExampleObject::MY_CONSTANT = 10.5f; | ||
|
||
float UExampleStatic::GetMyConstant(){ return UExampleObject::MY_CONSTANT; } | ||
``` | ||
</HTMLSkeleton> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"/snippets/unreal-engine/unreal-engine-udelegates/":{"category":"Unreal Engine","title":"UDelegates in Unreal Engine C++"},"/snippets/unreal-engine/unreal-engine-uenums/":{"category":"Unreal Engine","title":"UEnums in Unreal Engine C++"},"/snippets/unreal-engine/unreal-engine-uinterfaces/":{"category":"Unreal Engine","title":"UInterfaces in Unreal Engine C++"},"/snippets/unreal-engine/unreal-engine-ustructs/":{"category":"Unreal Engine","title":"UStructs in Unreal Engine C++"},"/snippets/cpp/cpp-hello-world/":{"category":"C++","title":"Hello World in C++"}} | ||
{"/snippets/unreal-engine/ue-uinterfaces/":{"category":"Unreal Engine","title":"UInterfaces in Unreal Engine C++"},"/snippets/unreal-engine/ue-udelegates/":{"category":"Unreal Engine","title":"UDelegates in Unreal Engine C++"},"/snippets/unreal-engine/ue-custom-component/":{"category":"Unreal Engine","title":"Custom components in Unreal Engine C++"},"/snippets/unreal-engine/ue-expose-static-constant-to-bp/":{"category":"Unreal Engine","title":"Exposing Static Constant to Blueprint from C++ in Unreal Engine"},"/snippets/unreal-engine/ue-uenums/":{"category":"Unreal Engine","title":"UEnums in Unreal Engine C++"},"/snippets/unreal-engine/ue-ustructs/":{"category":"Unreal Engine","title":"UStructs in Unreal Engine C++"},"/snippets/cpp/virtual-functions-in-cpp/":{"category":"C++","title":"Virtual Functions in C++"},"/snippets/cpp/cpp-hello-world/":{"category":"C++","title":"Hello World in C++"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>SourceSnippet</title></head><body><h1>Welcome to <a href="https://github.com/sourcesnippet/sourcesnippet.github.io" style="color:CanvasText;text-decoration:underline">SourceSnippet</a></h1><div style="opacity:.75"> - Years of experience, Stored in snippets </div><hr><br><h1>Unreal Engine</h1><ol><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/unreal-engine-udelegates/">UDelegates in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/unreal-engine-uenums/">UEnums in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/unreal-engine-uinterfaces/">UInterfaces in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/unreal-engine-ustructs/">UStructs in Unreal Engine C++</a></li></ol><br><h1>C++</h1><ol><li style="margin-top:1rem"><a target="_blank" href="/snippets/cpp/cpp-hello-world/">Hello World in C++</a></li></ol><style>body{background-color:Canvas;color:CanvasText;color-scheme:light dark;font-size:18px;margin:0 auto;max-width:700px;line-height:1.3;padding:40px 1rem}a{text-decoration:none}a:hover{text-decoration:underline}</style></body></html> | ||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>SourceSnippet</title></head><body><h1>Welcome to <a href="https://github.com/sourcesnippet/sourcesnippet.github.io" style="color:CanvasText;text-decoration:underline">SourceSnippet</a></h1><div style="opacity:.75"> - Years of experience, Stored in snippets </div><hr><br><h1>Unreal Engine</h1><ol><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-custom-component/">Custom components in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-expose-static-constant-to-bp/">Exposing Static Constant to Blueprint from C++ in Unreal Engine</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-udelegates/">UDelegates in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-uenums/">UEnums in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-uinterfaces/">UInterfaces in Unreal Engine C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/unreal-engine/ue-ustructs/">UStructs in Unreal Engine C++</a></li></ol><br><h1>C++</h1><ol><li style="margin-top:1rem"><a target="_blank" href="/snippets/cpp/cpp-hello-world/">Hello World in C++</a></li><li style="margin-top:1rem"><a target="_blank" href="/snippets/cpp/virtual-functions-in-cpp/">Virtual Functions in C++</a></li></ol><style>body{background-color:Canvas;color:CanvasText;color-scheme:light dark;font-size:18px;margin:0 auto;max-width:700px;line-height:1.3;padding:40px 1rem}a{text-decoration:none}a:hover{text-decoration:underline}</style></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Virtual Functions in C++ - SourceSnippet</title><link rel="stylesheet" href="/_static/codestyle.css"><style>body{background-color:Canvas;color:CanvasText;color-scheme:light dark;font-size:18px;margin:0 auto;max-width:700px;line-height:1.3;padding:40px 1rem}</style></head><body><h1>Virtual Functions in C++</h1><hr><br></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Custom components in Unreal Engine C++ - SourceSnippet</title><link rel="stylesheet" href="/_static/codestyle.css"><style>body{background-color:Canvas;color:CanvasText;color-scheme:light dark;font-size:18px;margin:0 auto;max-width:700px;line-height:1.3;padding:40px 1rem}</style></head><body><h1>Custom components in Unreal Engine C++</h1><hr><br><pre><code class="hljs language-cpp"><span class="hljs-meta">#<span class="hljs-keyword">include</span> <span class="hljs-string">"Components/ActorComponent.h"</span></span> | ||
|
||
<span class="hljs-built_in">UCLASS</span>(meta=(BlueprintSpawnableComponent)) <span class="hljs-comment">// without this the component will not show in blueprints </span> | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">MYPROJECT_API</span> UExampleComponent : <span class="hljs-keyword">public</span> UActorComponent | ||
{ | ||
<span class="hljs-built_in">GENERATED_BODY</span>() | ||
|
||
}; | ||
</code></pre></body></html> |
27 changes: 27 additions & 0 deletions
27
snippets/unreal-engine/ue-expose-static-constant-to-bp/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Exposing Static Constant to Blueprint from C++ in Unreal Engine - SourceSnippet</title><link rel="stylesheet" href="/_static/codestyle.css"><style>body{background-color:Canvas;color:CanvasText;color-scheme:light dark;font-size:18px;margin:0 auto;max-width:700px;line-height:1.3;padding:40px 1rem}</style></head><body><h1>Exposing Static Constant to Blueprint from C++ in Unreal Engine</h1><hr><br><p><strong>Note:</strong> this is more of a workaround</p><pre><code class="hljs language-cpp"><span class="hljs-comment">// ExampleObject.h file</span> | ||
|
||
<span class="hljs-built_in">UCLASS</span>() | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">MYPROJECT_API</span> UExampleStatic : <span class="hljs-keyword">public</span> UBlueprintFunctionLibrary | ||
{ | ||
<span class="hljs-built_in">GENERATED_BODY</span>() | ||
|
||
<span class="hljs-keyword">public</span>: | ||
<span class="hljs-built_in">UFUNCTION</span>(BlueprintPure) | ||
<span class="hljs-function"><span class="hljs-type">static</span> <span class="hljs-type">float</span> <span class="hljs-title">GetMyConstant</span><span class="hljs-params">()</span></span>; | ||
}; | ||
|
||
|
||
<span class="hljs-built_in">UCLASS</span>() | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">MYPROJECT_API</span> UExampleObject : <span class="hljs-keyword">public</span> UObject { | ||
<span class="hljs-built_in">GENERATED_BODY</span>() | ||
|
||
<span class="hljs-keyword">public</span>: | ||
<span class="hljs-type">static</span> <span class="hljs-type">const</span> <span class="hljs-type">float</span> MY_CONSTANT; <span class="hljs-comment">// Exposing to blueprints via Function Library</span> | ||
|
||
}; | ||
</code></pre><pre><code class="hljs language-cpp"><span class="hljs-comment">// ExampleObject.cpp file</span> | ||
|
||
<span class="hljs-type">const</span> <span class="hljs-type">float</span> UExampleObject::MY_CONSTANT = <span class="hljs-number">10.5f</span>; | ||
|
||
<span class="hljs-function"><span class="hljs-type">float</span> <span class="hljs-title">UExampleStatic::GetMyConstant</span><span class="hljs-params">()</span></span>{ <span class="hljs-keyword">return</span> UExampleObject::MY_CONSTANT; } | ||
</code></pre></body></html> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.