Skip to content

Only create Prop sometimes, only add physics sometimes#90

Closed
boxrocket6803 wants to merge 140 commits intoFacepunch:masterfrom
boxrocket6803:props-only-sometimes
Closed

Only create Prop sometimes, only add physics sometimes#90
boxrocket6803 wants to merge 140 commits intoFacepunch:masterfrom
boxrocket6803:props-only-sometimes

Conversation

@boxrocket6803
Copy link
Copy Markdown
Contributor

@boxrocket6803 boxrocket6803 commented Dec 3, 2025

fixes #1579

ModelDropObject always spawned Prop if the model had physics (e.g. every model) and made a fairly flimsy attempt to guess if the model should be static. This resulted in entire scenes falling into the void if the user didn't manually disable physics for each prop dragged into the scene or manually set the archetype of every imported model. This code adds a bit more leeway as to which archetypes are allowed and will default to static if archetype isn't set. It also avoids creating the Prop component entirely if the model has no prop data or break pieces and doesn't have its archetype set to a prop related option.

2025-12-03.12-27-17.mp4

sboxbot and others added 30 commits November 24, 2025 09:05
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
…cene.PhysicsWorld (Facepunch#3433)

Resolves Facepunch/sbox-issues#9598 (Fixes issues where traces in the editor can throw NREs after exiting play mode)
* Skip menu editor code outside of the menu project
* Asset Browser: skip menu project assets in Everything and Recents
Add slight delay because windows may still briefly hold a lock on some files even after the process exited
* Refactor sync script

Use single filter repo call
Use globs instead of python madness
Ensure shallow clone is clean before working on it

* Add dry run option to sync script
* Add public gitattributes
* Fix leaky swapchain when resizing on game mode and dispose of handle after usage
VideoRecorder would get a strong handle copy of the swapchain every frame and retain it, causing native to fail to shutdown the copies from it
Made usage of getting native swapchain consistent on managed on other stuff, doing it like this ensures GC properly disposes of the strong handles even not disposing explicitly

Remove now unused ScreenRecorder.def and ScreenshotService.def

There are still optimizations to swapchain I'd like to send on another commit, game is allocating way more swapchains than needed even without the leak, has two completely different paths depending if you are MSAA or not, this can all be much simpler
https://files.facepunch.com/sampavlovic/1b1811b1/EjDyxbTahs.png

* Remove NativeLayerRenderTarget, was unused and fucked

* Keep it as an ITexture/HRenderTextureStrong in managed so we avoid IDisposable, ReadTextureAsync with ITexture
…h#3449)

* Support instanced tint on Blendable and Material::From( i )

Blendable supports vertex tint color, but was initially intended for world geometry so there was no point in working with instance color, now works fine

https://files.facepunch.com/sampavlovic/1b2611b1/sbox-dev_qkWlvBOXW8.png

* Build shaders
* More robust downloading of artifacts

Don't download to a temp file first
Try to retry download up to 3 times, if it fails
Fail Bootstrap if any download fails

* Fix contentbuilder and shadercompiler not forwarding to stdout
…eleted

Move filter implementation to python so we have more flexibility when implementing filters.
Make sure deleted files are properly filtered by evaluating globs in the filter itself not before.
Make sure deleted LFS files are accounted for by scanning the history of the shallow clone for delete/changed lfs files.
Whitelist some additional shaders.
* Fix terrain seams and optimize

Overlap LODs by one step to fix holes in LOD transitions
Reuse vertices that exist on same key when building diamond square

https://files.facepunch.com/sampavlovic/1b2411b1/8mb.video-eW2-tNb22a60.mp4

* Add NoTile class and make terrain use it
https://files.facepunch.com/sampavlovic/1b2411b1/sbox-dev_R1FwUmLhvu.mp4
https://files.facepunch.com/sampavlovic/1b2411b1/sbox-dev_YhKyIwvhve.mp4

* Sure why not Mr. Robot
* SceneEditorSession: make game vs editor scenes more distinct, Scene is whichever is currently active

* Route prefab update, model reload etc events to both scenes if needed

* SceneTree update checking a bit cleaner

* Bring back GameEditorSessions instead, so undo, selection etc can all be linked 1:1 with scenes again

* tweak and tidy
solwllms and others added 12 commits December 3, 2025 14:52
* Fix default %project%/Assets/ location when saving prefabs + scenes
* Display error message box if it's not a valid assets location
* Tweak "File > Save" enabled conditions to match if they'll do something
They are essentially compile time constants, so we shouldn't allocate them
* Make MSAA setting work on editor SceneRenderingWidgets

MSAA settings never worked with editor viewport, only on game tab, now with playmode it always takes highest MSAA value from hardware regardless of what

Two things from this PR:
* Pass current engine MSAA setting when creating SceneRenderingWidget swapchain
* Add callback when video settings are changed, recreate swapchain when so

Replicates fine for all SceneRenderingWidgets, applies instantly

https://files.facepunch.com/sampavlovic/1b0311b1/sbox-dev_bjEMrrYe71.mp4

* Push RenderMultisampleType_t nMSAAAmount on interop
* Fix debug overlay text not rendering

* Moved transform init out of native block and improved comment for clarity

---------

Co-authored-by: Andy <10728824+andy013@users.noreply.github.com>
@garrynewman
Copy link
Copy Markdown
Member

I can see the logic here but I think by trying to guess what is desired we're always going to give someone what they don't want. Maybe we should be doing something like if you hold Ctrl and drag it's a renderer, if not, it's a prop?

wheatleymf and others added 9 commits December 5, 2025 07:52
Terrain_SampleSeamlessUV now additionally returns a 2x2 rotation matrix which can be used to transform vectors and other data if necessary.

This also adds a function overload `Terrain_SampleSeamlessUV( float2 uv )` for cases when you don't need a rotation matrix. This will avoid breaking any shaders that rely on old implementation of this function
Previous implementation of seamless UV was sampling tangent normal map 'as is', without transforming vectors to be inline with the UV rotation angle - which resulted into NdotL shading errors. This is now corrected and tangent vector accounts for UV rotation.
Categorizes PostProcessVolume, Terrain, and MoviePlayer.
…eo changed (Facepunch#3562)

Recreating it works fine on Intel GPU, no issues on validation but didnt work on other cards, there is a better way to do this from native without dangling around

Fixes https://github.com/Facepunch/sbox-issues/issues/9675
- Now supports drawing on a BaseLayer and OverlayLayer
- Terrain Tools displays a material palette in a sidebar
- Added C# API to sample terrain material at a given position
- Can now import multiple splatmaps at once mapping to texture indices ( [0, 3], [4, 7], etc.)

https://files.facepunch.com/antopilo/1b0511b1/sbox-dev_An6nbxpqe3.mp4
…erride model archetype, no physics on models with mesh collision

Dragging a vmdl into the scene will guess based on archetype if a model should be static
Show blue bbox if a model will spawn with physics, normal grey if it will spawn static
Holding shift will invert the archetype based guess
@boxrocket6803
Copy link
Copy Markdown
Contributor Author

Main decision is whether or not the prop should be static, from there we can easily determine whether a Prop component is needed based on if the model isn't static and/or has prop data. Still seemed like since model archetype exists it should be used, for asset libraries where it's consistently set (like all the facepunch assets) the code will reliably determine if a vmdl is intended as a physics prop. In cases where archetype is never set it will assume props to be static. Shift (ctrl enables snapping) key inverts that. I also made the bbox blue to indicate that a model will be created as a prop with physics, maybe needs a better indicator for that?

2025-12-05.13-43-32.mp4

I also tried ignoring archetype completely and just spawning with physics unless the user holds shift but it feels kinda uncomfortable to build levels while holding shift all the time (levels are made out of props with collision, you'd have to hold shift while dragging in every model, if you ever miss one part of your scene falls into the void which was the whole issue to begin with). Feels a lot nicer to me to let a bit of effort setting archetype on custom vmdls make everything easier forever onwards than to require an extra key all the time just in case there's a vmdl that's set up wrong

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.

Prop component should default to static