Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SetNum EAllowShrinking (UE 5.5 compatibility) #38

Merged
merged 5 commits into from
Feb 2, 2025

Conversation

ericwomer
Copy link

* Fixes for deprication warnings with update to 5.5.2 (5.5.1 also?) messages
* Changes bool param for allowing shrinking to enum EAllowShrinking

    * Fixes for deprication warnings with update to 5.5.2 (5.5.1 also?) messages
    * Changes bool param for allowing shrinking to enum EAllowShrinking
@jonpas
Copy link
Member

jonpas commented Jan 29, 2025

Is compatibility with 4.27 checked?

@ericwomer
Copy link
Author

Is compatibility with 4.27 checked?

I don't have 4.27 Installed, eventually you will have to have two versions of this plugin one for UE5 and one for UE4, especially when then remove the deprecated features are removed, you could wrap it in #if blocks though.

@jonpas
Copy link
Member

jonpas commented Jan 29, 2025

I am well aware, for now #if declarations will do, we will split when it will become necessary.

@ericwomer
Copy link
Author

ericwomer commented Jan 30, 2025

Would something like this work for you?

ImGuiContextProxy.cpp

		// Setting Allow Shrinking via bool bAllowShrinking is deprecated in engines 5.5 and higher
		#if  ((ENGINE_MAJOR_VERSION > 4) && (ENGINE_MINOR_VERSION > 4))
			DrawLists.SetNum(DrawData->CmdListsCount, EAllowShrinking::No);
		#else
			DrawLists.SetNum(DrawData->CmdListsCount, false);
		#endif

ImGuiDrawData.cpp

	// Setting Allow Shrinking via bool bAllowShrinking is deprecated in engines 5.5 and higher
	#if ((ENGINE_MAJOR_VERSION > 4) && (ENGINE_MINOR_VERSION > 4))
		// Reset buffer.
		OutIndexBuffer.SetNumUninitialized(NumElements, EAllowShrinking::No);
	#else
		// Reset buffer.
		OutIndexBuffer.SetNumUninitialized(NumElements,  false);
	#endif

**EDIT The engine still threw warning about deprecation even though the code was unreachable so I wrapped it in pre-processor blocks

@jonpas
Copy link
Member

jonpas commented Jan 30, 2025

Use the following preprocessor macros:

#define BELOW_ENGINE_VERSION(Major, Minor) (ENGINE_MAJOR_VERSION < (Major) || (ENGINE_MAJOR_VERSION == (Major) && ENGINE_MINOR_VERSION < (Minor)))
#define FROM_ENGINE_VERSION(Major, Minor) !BELOW_ENGINE_VERSION(Major, Minor)

Feel free to even add a definition for this specifically at the end.

@ericwomer
Copy link
Author

I made the last push because the deprecation was introduced in January of 2024 but wasn't pushed to release until 5.4.

@jonpas jonpas added the bug Something isn't working label Jan 31, 2025
@kushagra10025
Copy link

Hey,
Have tested this PR with 4.27, 5.3, 5.4 and 5.5. Looks good to me. Should be safe to merge :)

Thanks 😄

@jonpas
Copy link
Member

jonpas commented Feb 2, 2025

Awesome! Thank you very much!

@jonpas jonpas changed the title [SetNum/SetNumUninitialized] SetNum EAllowShrinking (UE 5.5 compatibility) Feb 2, 2025
@jonpas jonpas changed the title SetNum EAllowShrinking (UE 5.5 compatibility) Use SetNum EAllowShrinking (UE 5.5 compatibility) Feb 2, 2025
@jonpas jonpas merged commit 52b6365 into IDI-Systems:master Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants