Giter Site home page Giter Site logo

Comments (1)

drwhut avatar drwhut commented on May 10, 2024

After a few hours of debugging, I have finally found the culprit lurking in ObjectDialog.gd:

# Set the asset database contents, based on the asset database given.
# assets: The database from the AssetDB.
func set_piece_db(assets: Dictionary) -> void:
	_piece_db = assets
	_update_object_packs()
	
	# The object previews take some time to instance (this is mostly due to the
	# rendering engine creating the buffers needed to render the object), so
	# we'll instance all of the previews now while the user is loading in, so
	# we can just add them to the scene tree when needed.
	var max_needed = 0
	for pack in assets:
		var pack_num = 0
		for type in assets[pack]:
			pack_num += assets[pack][type].size()
		if pack_num > max_needed:
			max_needed = pack_num
	
	while _available_previews.size() < max_needed:
		_available_previews.push_back(_object_preview.instance())

When the asset database gets fed into this function, the function wants to try and make as many object previews as there are objects in a pack (so it can display them in the objects dialog) - the problem is that this code doesn't distinguish between objects and other kinds of assets, like skyboxes.

However, I don't think adding the workaround of making this function only count objects would work in the long run, because it ignores the actual underlying issue I found: as soon as about 130 object previews are instanced, the physics engine stops working (I'm assuming its something to do with the fact that object previews contain viewports, which take up a lot of memory). But at the same time, I want players to be able to import more than 130 objects in an asset pack, so clearly, the current way that objects are displayed in the objects dialog has to change.

Side note: This behaviour could very well be a bug in Godot that could be fixed, but I still think changing the objects dialog is the right decision because I've noticed that when you import a large number of assets, the time it takes to create the object previews is noticeably long (which is why it can take a while for the room scene to load).

This actually coincides with another issue, #41, because I was planning to revisit the object dialog anyway via that issue. So during that issue, I will change how the objects are previewed such that there can never be more than a set amount of previews, no matter how many assets have been imported from a given pack. Doing it that way should fix this issue as well.

from tabletop-club.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.