Skip to content

Creating Items in Database

Rafael Correa edited this page May 12, 2024 · 4 revisions

Create Resource Item Definition

To create new items in a database, select the "New Item" option

image

Here we have two options, one creates the ItemDefinition resource and also adds it to the open database, the other has the option of choosing an ItemDefinition resource that already exists in the project. For this tutorial choose the first option, which creates a new resource and adds it to the database.

image

Choose name of ItemDefinition and your location: image

If created successfully your editor will update to show the item in the "Items" tab image

Setup New Item Definition

Here we can demonstrate a little of the editor. It contains various information about the item:

  • Name: Name to be displayed or used as additional identification (It is your responsibility to use this field)
  • ID: Integer identification of the item, used to get the item based on a list of items easily using the id Note: The base node (NodeInventories) has two methods that use the database field (InventoryDatabase) that use this id to facilitate access to items
# Get id of item
int get_id_from_item(item: ItemDefinition)
# Get resource (ItemDefinition) from id param
ItemDefinition get_item_from_id(id: int)