Skip to content

Commit

Permalink
Merge pull request #92 from The-Chinese-Room/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
TCR-Nick authored Dec 8, 2024
2 parents 9029a13 + 70ee48c commit 4e5fc56
Show file tree
Hide file tree
Showing 27 changed files with 582 additions and 83 deletions.
Binary file not shown.
24 changes: 14 additions & 10 deletions InkpotDemo/InkpotDemo.uproject
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"EngineAssociation": "5.4",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "InkpotDemo",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Inkpot"
]
}
],
"Modules": [
{
"Name": "InkpotDemo",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Inkpot"
]
}
],
"Plugins": [
{
"Name": "ModelingToolsEditorMode",
Expand All @@ -28,6 +28,10 @@
{
"Name": "Text3D",
"Enabled": true
},
{
"Name": "CustomizableSequencerTracks",
"Enabled": true
}
]
}
Binary file modified InkpotDemo/Plugins/Inkpot/Content/Inkpot/InkpotDebug.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion InkpotDemo/Plugins/Inkpot/Inkpot.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 1,
"Version": 1,
"VersionName": "1.10.21",
"VersionName": "1.11.21",
"FriendlyName": "Inkpot",
"Description": "A container for Ink in Unreal.",
"Category": "Scripting",
Expand Down
15 changes: 13 additions & 2 deletions InkpotDemo/Plugins/Inkpot/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Inkpot
**Inkpot** - A container for **Ink** within the Unreal Engine developed by [The Chinese Room](https://www.thechineseroom.co.uk/).<br><br>
This is a plugin for Unreal Engine 5.4 or later.<br>
This is version **1.10.21** of the plugin.</br>
This is version **1.11.21** of the plugin.</br>
The head revision contains work in progress towards the upcoming release.<br>

Inkpot is a wrapper for the wonderful narrative scripting language **Ink** developed by [Inkle Studios](https://www.inklestudios.com/ink/).<br>

Expand All @@ -12,6 +13,16 @@ For general support and chat with other users, check out [Inkle's discord](https

## Changelog

### Changes in 1.11.21
Added tools menu section for inkpot, for easier launching of the blotter.<br>
Blotter QoL, list value update in blotter now more streamlined, items now have check box entries.<br>
Exposed VisitCountAtPathString to Inkpot Story.<br>
Added library functions to test the type of an Inkpot value.<br>
Added delegate to allow notify when a line has finished being displayed.<br>
Fixed bad plugin declarations, no more dependency warnings.<br>
Refined blotter update, list values are now updated rather than being replaced for each update.<br>
Set is now SetText on blotter strings.<br>

### Changes in 1.10.21
Introducing the Blotter! or Inkpot Debugger, an Unreal editor utility widget that allows the viewing of and setting of Ink variables at runtime.<br>
Full support for Ink List creation & manipulation in blueprints.<br>
Expand All @@ -22,7 +33,7 @@ Fixed crash when calling begin story with a null asset.<br>
Fixed crash when calling function with empty variable declarations.<br>

### Changes in 1.03.21
Added new abstract factory creation for stories, youclass UInkpotStory can now be subclassed on a per project basis.<br>
Added new abstract factory creation for stories, class UInkpotStory can now be subclassed on a per project basis.<br>
Switched settings back to regular UDeveloperSettings as backed by CVAR version did not seem to work.<br>
Fixed for 5.4 compilation error, template instantiation context error in InkPlusPlusTest.cpp(738).<br>
Fixed compiler warnings in 5.4.<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ void UInkpotStory::ChoosePathString( const FString &InPath, const TArray<FInkpot
ChoosePathStringInternal( InPath, InValues );
}

int UInkpotStory::VisitCountAtPathString( const FString &Path )
{
int count = StoryInternal->GetStoryState()->VisitCountAtPathString(Path);
return count;
}

TSharedPtr<Ink::FListDefinition> UInkpotStory::GetListOrigin(const FString& InOriginName, const FString& InItemName)
{
TSharedPtr<Ink::FListDefinitionsOrigin> definitions = StoryInternal->GetListDefinitions();
Expand Down Expand Up @@ -890,6 +896,12 @@ FOnStoryContinue& UInkpotStory::OnDebugRefresh()
}
#endif

void UInkpotStory::NotifyLineCompletetd(const FString& Context)
{
if (!EventOnLineComplete.IsBound())
return;
EventOnLineComplete.Broadcast(this, Context);
}



Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ FInkpotValue UInkpotValueLibrary::MakeBoolInkpotValue(bool bInValue)
return FInkpotValue( MakeShared<Ink::FValueType>(bInValue) );
}

bool UInkpotValueLibrary::IsInkpotValueBool(const FInkpotValue &InValue)
{
return (*InValue)->HasSubtype<bool>();
}

bool UInkpotValueLibrary::InkpotValueAsBool(const FInkpotValue &InValue)
{
if( (*InValue)->HasSubtype<bool>() )
if( IsInkpotValueBool(InValue) )
return (*InValue)->GetSubtype<bool>();
INKPOT_ERROR( "Value is not a bool, returning default (false)");
return false;
}

bool UInkpotValueLibrary::IsInkpotArrayValueBool(const TArray<FInkpotValue> &InValues, int InIndex )
{
return IsInkpotValueBool( InValues[InIndex] );
}

bool UInkpotValueLibrary::InkpotArrayValueAsBool(const TArray<FInkpotValue> &InValues, int InIndex )
{
return InkpotValueAsBool( InValues[InIndex] );
Expand All @@ -24,14 +34,24 @@ FInkpotValue UInkpotValueLibrary::MakeIntInkpotValue(int32 InValue)
return FInkpotValue( MakeShared<Ink::FValueType>(InValue) );
}

bool UInkpotValueLibrary::IsInkpotValueInt(const FInkpotValue &InValue)
{
return (*InValue)->HasSubtype<int32>();
}

int32 UInkpotValueLibrary::InkpotValueAsInt(const FInkpotValue & InValue)
{
if( (*InValue)->HasSubtype<int32>() )
if( IsInkpotValueInt(InValue) )
return (*InValue)->GetSubtype<int32>();
INKPOT_ERROR( "Value is not a int, returing default (0)");
return 0;
}

bool UInkpotValueLibrary::IsInkpotArrayValueInt(const TArray<FInkpotValue> &InValues, int InIndex)
{
return IsInkpotValueInt( InValues[InIndex] );
}

int32 UInkpotValueLibrary::InkpotArrayValueAsInt(const TArray<FInkpotValue> &InValues, int InIndex )
{
return InkpotValueAsInt( InValues[InIndex] );
Expand All @@ -42,16 +62,26 @@ FInkpotValue UInkpotValueLibrary::MakeFloatInkpotValue(float InValue)
return FInkpotValue( MakeShared<Ink::FValueType>(InValue) );
}

bool UInkpotValueLibrary::IsInkpotValueFloat(const FInkpotValue &InValue)
{
return (*InValue)->HasSubtype<float>();
}

float UInkpotValueLibrary::InkpotValueAsFloat(const FInkpotValue &InValue)
{
if( (*InValue)->HasSubtype<float>() )
if( IsInkpotValueFloat(InValue) )
return (*InValue)->GetSubtype<float>();
else if( (*InValue)->HasSubtype<int32>() )
else if( IsInkpotValueInt(InValue) )
return (float)((*InValue)->GetSubtype<int32>());
INKPOT_ERROR( "Value is not a float, returing default (0.0f)");
return 0.0f;
}

bool UInkpotValueLibrary::IsInkpotArrayValueFloat(const TArray<FInkpotValue> &InValues, int InIndex)
{
return IsInkpotValueFloat( InValues[InIndex] );
}

float UInkpotValueLibrary::InkpotArrayValueAsFloat(const TArray<FInkpotValue> &InValues, int InIndex )
{
return InkpotValueAsFloat( InValues[InIndex] );
Expand All @@ -62,29 +92,49 @@ FInkpotValue UInkpotValueLibrary::MakeStringInkpotValue(const FString &InValue)
return FInkpotValue( MakeShared<Ink::FValueType>(InValue) );
}

bool UInkpotValueLibrary::IsInkpotValueString(const FInkpotValue &InValue)
{
return (*InValue)->HasSubtype<FString>();
}

FString UInkpotValueLibrary::InkpotValueAsString(const FInkpotValue &InValue)
{
if( (*InValue)->HasSubtype<FString>() )
if( IsInkpotValueString(InValue) )
return (*InValue)->GetSubtype<FString>();
INKPOT_ERROR( "Value is not a string, returing default (\"\")" );
return FString();
}

bool UInkpotValueLibrary::IsInkpotArrayValueString(const TArray<FInkpotValue> &InValues, int InIndex)
{
return IsInkpotValueString( InValues[InIndex] );
}

FString UInkpotValueLibrary::InkpotArrayValueAsString(const TArray<FInkpotValue> &InValues, int InIndex )
{
return InkpotValueAsString( InValues[InIndex] );
}

bool UInkpotValueLibrary::IsInkpotValueList(const FInkpotValue &InValue )
{
return (*InValue)->HasSubtype<Ink::FInkList>();
}

FInkpotList UInkpotValueLibrary::InkpotValueAsList( const FInkpotValue &InValue )
{
FInkpotList list;
if( (*InValue)->HasSubtype<Ink::FInkList>() )
if( IsInkpotValueList(InValue) )
list = *InValue;
else
INKPOT_ERROR( "Value is not an ink list, returing default ()" );
return list;
}

bool UInkpotValueLibrary::IsInkpotArrayValueList(const TArray<FInkpotValue> &InValues, int InIndex)
{
return IsInkpotValueList( InValues[InIndex] );
}

FInkpotList UInkpotValueLibrary::InkpotArrayValueAsList( const TArray<FInkpotValue> &InValues, int InIndex )
{
return InkpotValueAsList( InValues[InIndex] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSwitchFlow, UInkpotStory*, Story
DECLARE_DYNAMIC_DELEGATE_ThreeParams(FOnInkpotVariableChange, UInkpotStory*, Story, const FString &, Variable, const FInkpotValue &, NewValue );
DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(FInkpotValue, FInkpotExternalFunction, const TArray<FInkpotValue> & , Values );
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnStoryLoadJSON, UInkpotStory*, Story );
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLineComplete, UInkpotStory*, Story, const FString&, Context);

// macro for binding functions in your derived story classes
#define BindInkFunction( NameInk, NameCPP ) \
Expand All @@ -29,7 +30,6 @@ UCLASS(BlueprintType)
class INKPOT_API UInkpotStory : public UObject
{
GENERATED_BODY()

public:
virtual void Initialise( TSharedPtr<FInkpotStoryInternal> InInkpotStory );

Expand Down Expand Up @@ -237,6 +237,15 @@ class INKPOT_API UInkpotStory : public UObject
UFUNCTION(BlueprintCallable, Category="Inkpot|Story")
void ChoosePathString( const FString &Path, const TArray<FInkpotValue> &Values );

/**
* VisitCountAtPathString
* Returns the number of times the content at the given path has bee visited
*
* @returns Visit Count.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Story")
int VisitCountAtPathString( const FString &Path );

/**
* SetValue
* Sets the value of a variable in the story.
Expand Down Expand Up @@ -472,6 +481,13 @@ class INKPOT_API UInkpotStory : public UObject
*/
UFUNCTION(BlueprintCallable, Category = "Inkpot|Story")
void EvaluateFunction(const FString& FunctionName, const TArray<FInkpotValue>& InValues, FInkpotValue &ReturnValue, FString &CapturedText);

/**
* NotifyLineCompletetd
* Invokes OnLineCompleted delegate, allows many different systems to co-ordinate when they have finished
*/
UFUNCTION(BlueprintCallable, Category = "Inkpot|Story")
void NotifyLineCompletetd(const FString& Context);

/**
* ToJSON
Expand Down Expand Up @@ -614,6 +630,9 @@ class INKPOT_API UInkpotStory : public UObject
UPROPERTY(BlueprintAssignable, Category="Inkpot|Story", meta=(DisplayName="OnStoryLoadJSON") )
FOnStoryLoadJSON EventOnStoryLoadJSON;

UPROPERTY(BlueprintAssignable, Category = "Inkpot|Story", meta = (DisplayName = "OnLineComplete"))
FOnLineComplete EventOnLineComplete;

#if WITH_EDITORONLY_DATA
UPROPERTY(BlueprintAssignable, Category = "Inkpot|Story", meta = (DisplayName = "OnDebugRefresh"))
FOnStoryContinue EventOnDebugRefresh;
Expand Down Expand Up @@ -652,4 +671,3 @@ bool UInkpotStory::GetVariable( const FString& InVariable, Ink::EValueType InTyp
return success;
}


Loading

0 comments on commit 4e5fc56

Please sign in to comment.