Skip to content

Commit

Permalink
updated plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
TCR-Nick committed Dec 8, 2024
1 parent defb41a commit 70ee48c
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 11 deletions.
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
14 changes: 12 additions & 2 deletions InkpotDemo/Plugins/Inkpot/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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 @@ -13,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 @@ -23,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
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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FInkpotValue MakeBoolInkpotValue(bool bValue);

/**
* IsInkpotValueBool
* Tests if the Value is a boolean.
*
* @param Value - The Inkpot value to test.
* @returns true if the value is a a boolean.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotValueBool(const FInkpotValue &Value);

/**
* InkpotValueAsBool
* Cast an Inkpot value to a boolean.
Expand All @@ -42,6 +52,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool InkpotValueAsBool(const FInkpotValue &Value);

/**
* IsInkpotArrayValueBool
* Tests if the array Value is a boolean.
*
* @param Values - The array of Inkpot values.
* @param Index - The indexed value in the array to test.
* @returns true if the value is a a boolean.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotArrayValueBool(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* InkpotArrayValueAsBool
* Cast an Inkpot array value to a boolean.
Expand All @@ -53,8 +74,7 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool InkpotArrayValueAsBool(const TArray<FInkpotValue> &Values, int Index = 0);

/* Create an Ink Value from an integer */
/**
/*
* MakeIntInkpotValue
* Create an Inkpot Value from an integer.
*
Expand All @@ -64,6 +84,16 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FInkpotValue MakeIntInkpotValue(int32 Value);

/**
* IsInkpotValueInt
* Tests if the Value is an integer.
*
* @param Value - The Inkpot value to test.
* @returns true if the value is an integer.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotValueInt(const FInkpotValue &Value);

/**
* InkpotValueAsInt
* Cast Inkpot value to an integer.
Expand All @@ -74,6 +104,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API int32 InkpotValueAsInt(const FInkpotValue &Value);

/**
* IsInkpotArrayValueInt
* Tests if the array Value is an integer.
*
* @param Values - The array of Inkpot values.
* @param Index - The indexed value in the array to test.
* @returns true if the value is an int.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotArrayValueInt(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* InkpotArrayValueAsInt
* Cast an Inkpot array value to an integer.
Expand All @@ -95,6 +136,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FInkpotValue MakeFloatInkpotValue(float Value);

/**
* IsInkpotValueFloat
* Tests if the Value is a floating point number.
*
* @param Value - The Inkpot value to test.
* @returns true if the value is a float.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotValueFloat(const FInkpotValue &Value);


/**
* InkpotValueAsFloat
* Cast Inkpot value to a floating point number.
Expand All @@ -105,6 +157,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API float InkpotValueAsFloat(const FInkpotValue &Value);

/**
* IsInkpotArrayValueFloat
* Tests if the array Value is a floating point value.
*
* @param Values - The array of Inkpot values.
* @param Index - The indexed value in the array to test.
* @returns true if the value is a float.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotArrayValueFloat(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* InkpotArrayValueAsFloat
* Cast an Inkpot array value to a floating point number.
Expand All @@ -126,6 +189,16 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FInkpotValue MakeStringInkpotValue(const FString &Value);

/**
* IsInkpotValueString
* Tests if the Value is a string.
*
* @param Value - The Inkpot value to test.
* @returns true if the value is a string.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotValueString(const FInkpotValue &Value);

/**
* InkpotValueAsString
* Cast Ink value to a string.
Expand All @@ -136,6 +209,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FString InkpotValueAsString(const FInkpotValue &Value);

/**
* IsInkpotArrayValueString
* Tests if the array Value is a string.
*
* @param Values - The array of Inkpot values.
* @param Index - The indexed value in the array to test.
* @returns true if the value is a string.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotArrayValueString(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* InkpotArrayValueAsString
* Cast an Inkpot array value to a string.
Expand All @@ -147,6 +231,16 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FString InkpotArrayValueAsString(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* IsInkpotValueList
* Tests if the Value is a List.
*
* @param Value - The Inkpot value to test.
* @returns true if the value is a List.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotValueList(const FInkpotValue &Value);

/**
* InkpotValueAsList
* Cast Inkpot value to an InkpotList.
Expand All @@ -157,6 +251,17 @@ class UInkpotValueLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API FInkpotList InkpotValueAsList( const FInkpotValue &Value );

/**
* IsInkpotArrayValueList
* Tests if the array Value is a list.
*
* @param Values - The array of Inkpot values.
* @param Index - The indexed value in the array to test.
* @returns true if the value is a list.
*/
UFUNCTION(BlueprintPure, Category="Inkpot|Value")
static INKPOT_API bool IsInkpotArrayValueList(const TArray<FInkpotValue> &Values, int Index = 0);

/**
* InkpotArrayValueAsList
* Cast Inkpot array value to an InkpotList.
Expand Down

0 comments on commit 70ee48c

Please sign in to comment.