Hi, thank you so much for your quick answer!
I corrected the code formatting. I also uploaded a MRP here : https://github.com/Gromnax/Godot-MRP-Bug---Viewports
My sincere apologizes for not doing so in my first message.
To reproduce, simply open the project. You can also reproduce at will by clearing the output logs and opening the PlayerInventory scene.
The addon you linked looks exactly like what I am trying to achieve, I will definitely check it out, thank you. I am still wondering where the issue I am facing is coming from, though. Even forcing a check on wether the viewport actually exists before accessing it, as well as forcing the update mode to always through code, do not seem to correct the issue :
extends Button
class_name InventorySlot
@export var max_size : Enums.SIZE = Enums.SIZE.XL
@export var inventory_type : Enums.CLOTHING :
set(new_value) :
#print(Enums.CLOTHING_ICON[new_value])
%EmptyTexture.texture = load(Enums.CLOTHING_ICON[new_value])
inventory_type = new_value
@onready var full_texture : TextureRect = %FullTexture
@export var inventory_item : InventoryItem :
set(new_value):
if not %ObjectViewer3D.is_node_ready():
pass
if new_value == null:
%EmptyTexture.visible = true
%FullTexture.visible = false
%RenderedMesh.mesh = null
inventory_item = null
else:
%EmptyTexture.visible = false
%FullTexture.visible = true
%RenderedMesh.mesh = new_value.mesh
inventory_item = new_value
new_value.on_mesh_changed.connect(_on_inventory_item_mesh_changed)
# Called when the node enters the scene tree for the first time.
func _on_inventory_item_mesh_changed(new_mesh : Mesh) -> void:
if %ObjectViewer3D.is_node_ready():
%RenderedMesh.mesh = new_mesh
func _ready() -> void:
%ObjectViewer3D.render_target_update_mode = %ObjectViewer3D.UPDATE_ALWAYS
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass