Open Zebrazilla opened 9 years ago
+1 We need all this functionality wrapped in a smooth user interface in CEF.
Prefabs are implemented in the meantime.
However, why a) is /saveprefab destroying the lighting? There shouldn't be any geometry updates. b) are prefabs not available in multiplayer?
//cc: @Zebrazilla
Prefabs have been done by @lsalzman, I can look into fixing the lighting on a save. I believe the issue is because it's invalidating the lighting after using blockcopy. In saveprefab:
if(b->copy) freeblock(b->copy);
protectsel(b->copy = blockcopy(block3(sel), sel.grid));
changed(sel);
I'm not sure what the point of "changed(sel)" is since sel hasn't been modified by blockcopy as far as I know (especially since the src block in blockcopy is a const, so it's pretty safe). I guess this isn't an issue in Tesseract since they have real time lighting. I haven't tested multiplayer but if it's like undo I think it was recently enabled in multiplayer. The only thing I did so far was adding the autocomplete for prefabs (the same way it works for maps) and a gui /showprefabs which works like /showcustommaps to show the available list of prefabs. This is done entirely in CubeScript so it might have to change if/when we're changing the scripting language. We could also look into binding showprefabs to a key or adding it in the editing menu to make it more usable. Another issue I have noticed is that the /delprefab only deletes the prefab from memory and not in the filesystem (still useful but maybe we could have both: /delprefab to remove from memory and avoid memory leaks and /removeprefab to effectively remove the prefab from the filesystem).
This looks like the type of feature I would be willing to work on.
I have created a draft on the wiki for a features idea regarding prefabs (see /wiki/Prefabs-and-Hiearchical-Instancing) and what I'd like to call hierarchical instancing. Any feedback on these ideas, any discussion and critique of how these could be improved, would be greatly appreciated. As such I am creating this issue and pasting the draft as it looks upon creation. Don't hesitate to reply to this issue if you have anything to say or make changes as you see fit to the wiki page.
Prefabs and Hierarchical Instancing
This page contains loose specifications on prefabs and hierarchical instancing; Herein you may find a summary of the purposed system and its practical purposes, criteria on what would be needed and thoughts on how it may be implemented. This is a draft and meant to initially pitch the idea.
Summary
The purpose of implementing prefabs and hierarchical instancing is to ease the creation of maps by artists and to make it degrees of magnitude more efficient. So what are prefabs and hierarchical instancing? What follows are short descriptions:
To demonstrate the usage and effectiveness of hierarchical and the whole pipeline of working with prefabs and instaces of prefabs, please picture this:
Proposed Functionality
While there are many ways to accomplish prefabs and hierarchical instancing, one potentially useful way to tackle this is to have prefabs effectively be models within maps, while prefabs actually being world geomatry saved in their own .ogz containers/maps.
Below follows some brief thoughts on how prefabs and instancing may be accomplished and the functionality of different steps needed:
Possibly useful resources: