Skip to content

Fix for DvScene Editor#35

Merged
angryzor merged 16 commits intoHE2-SDK:mainfrom
Ashrindy:main
Oct 27, 2025
Merged

Fix for DvScene Editor#35
angryzor merged 16 commits intoHE2-SDK:mainfrom
Ashrindy:main

Conversation

@Ashrindy
Copy link
Copy Markdown
Contributor

@Ashrindy Ashrindy commented Aug 2, 2025

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Aug 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Ashrindy Ashrindy changed the title Fix for DvScene Editor 3D Previewer, Fix for DvScene Editor Sep 18, 2025
Copy link
Copy Markdown
Collaborator

@angryzor angryzor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comments:

  • Please fix the memory leak. I will not greenlight a merge unless the code is memory leak free.
  • I think you're making the Previewer / PreviewCamera separation too complex. I'd suggest to do away with the GetTextureID() function and instead just have a Render() function on Previewer so that it's a proper ImGui component, and then instead of PreviewCamera just have an InteractiblePreview class that creates a Previewer itself and in its own Render() function calls the Previewers Render function and also renders the camera controls. Now you have this SetPreviewer() thing and then make assumptions about the environment in which Render is called (it assumes it can take all available space). I understand what you are trying to do by decoupling but I feel like it's not gaining you much and it's more useful for consumers to just be able to do interactiblePreview.Render() and not have to worry about texture ids and connecting the camera manipulation separately.
  • I'd also just rename Previewer to Preview.
  • It's ok since the CEMT editor is still in development, but please use human friendly labels for Editor() calls. Just a single sentence, in normal sentence capitalization (don't capitalize each word).
  • Please don't put opening braces on a new line. I know there's some instances of that in the codebase because VS keeps injecting them, but I'm trying to move away from that style, and they will be removed when the linter is added.
  • Please use initializer syntax more. You don't have to change this in this code, but just in the future.

edited |= Editor("startDelay", emitter.startDelay);
edited |= Editor("fadeSpeed", emitter.fadeSpeed);
edited |= Editor("lifeEndTime", emitter.lifeEndTime);
edited |= Editor("accelarationMultiplier", emitter.accelarationMultiplier);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

acceleration

Comment thread src/utilities/math/MathUtils.h Outdated
const size_t resNameLen = strlen(resName);

const size_t nameLen = resNameLen + nameTemplateLen + 1;
char* nameRaw = static_cast<char*>(pAllocator->Alloc(nameLen, 4));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't directly call Alloc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're also leaking memory

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just use a VariableString for the name in the class)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would use variablestring, but i have no idea on how to use a dynamic sized snprintf with it. for now ill just replace static_cast<char*>(pAllocator->Alloc(nameLen, 4)); with new (GetAllocator()) char[nameLen];

Comment thread src/ui/resources/editors/ResModelEditor.cpp Outdated
Comment thread src/ui/resources/editors/ResModelEditor.cpp Outdated
Comment thread src/ui/common/previewer/PreviewerCamera.cpp Outdated
Comment thread src/debug-rendering/renderables/PhysicalAnimation.cpp Outdated
Comment thread src/debug-rendering/renderables/PhysicalAnimation.cpp Outdated
Comment thread src/ui/common/previewer/Previewer.h Outdated
@Ashrindy Ashrindy changed the title 3D Previewer, Fix for DvScene Editor Fix for DvScene Editor Oct 13, 2025
@Ashrindy
Copy link
Copy Markdown
Contributor Author

I have decided to move the viewport to a separate branch, so that some fixes and other content can be merged and released.

@angryzor angryzor merged commit 44c5947 into HE2-SDK:main Oct 27, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants