bugfix(worldbuilder): Fix optimized trees not being shown in object placer preview window#2312
Open
ViTeXFTW wants to merge 3 commits intoTheSuperHackers:mainfrom
Open
bugfix(worldbuilder): Fix optimized trees not being shown in object placer preview window#2312ViTeXFTW wants to merge 3 commits intoTheSuperHackers:mainfrom
ViTeXFTW wants to merge 3 commits intoTheSuperHackers:mainfrom
Conversation
…lacer preview window
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp | Adds W3DTreeDraw.h include and a fallback tree data lookup in getBestModelName() to display tree object previews in WorldBuilder. Clean, minimal change following existing codebase patterns. |
Flowchart
flowchart TD
A["getBestModelName(tt, c)"] --> B{tt != nullptr?}
B -- No --> G["return TheEmptyString"]
B -- Yes --> C["Get draw module info\nmdd = mi.getNthData(0)"]
C --> D{"mdd->getAsW3DModelDrawModuleData()\nreturns non-null?"}
D -- Yes --> E["return md->getBestModelNameForWB(c)"]
D -- No --> F{"mdd->getAsW3DTreeDrawModuleData()\nreturns non-null?"}
F -- Yes --> H["return treeData->m_modelName"]
F -- No --> G
style F fill:#2d6,stroke:#1a4,color:#fff
style H fill:#2d6,stroke:#1a4,color:#fff
Last reviewed commit: d91a333
xezon
approved these changes
Feb 15, 2026
xezon
left a comment
There was a problem hiding this comment.
Fix makes sense.
Code style can be polished.
Author
This is not an issue in Generals as it didn't have the optimized treee - only zero hour issue |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When making Zero Hour the devs created an optimized module (W3DTreeDraw) for drawing trees. They forgot to add the preview handling in WorldBuilder to handle this new draw type, which results in the preview not showing anything when having an object of the W3DTreeDraw module selected.
Root Cause
WorldBuilder attempts to get the module data for getting the model name of the object. However the format of the
W3DModelDrawmodule data andW3DTreeDrawmodule data are different and there is not an exposed and generic way to get the information without explicitly casting the data to the expected type (W3DModelDrawModuleDataorW3DTreeDrawModuleData).Fix
Added a fallback function call to get the
W3DTreeDrawModuleDataif the normalW3DModelDrawfails which preserves the original behavior and also enables preview of tree types.Old:

New:

TODO