armory3d/armory

nodes based scripting appears to not respect value of Blender property set in Properties ->Custom Properties

Anniepoo opened this issue · 3 comments

Description
When Krom starts custom Blender object property does not respect set value from properties panel as default

To Reproduce

  1. Start blender 3.6.5 with SDK23.10.0
  2. Follow the tutorial at https://www.youtube.com/watch?v=w0vQTVyGCyM to create a simple 1ps camera controller - I named this trait "OnePSLook"
  3. Create a custom property active_camera, type integer, and value 1 on the 'sphere' object
  4. Add a second trait "CameraSelect" to the 'sphere' object. Add a Keyboard node and Set Object Property that sets active_camera to 1 when the 1 key is pressed (needs an Integer node for the constant 1)
  5. Duplicate these nodes and change so typing "2" key changes active_camera to 2
  6. In OnePSLook add a Gate Node in the output of On Update node that only permits updates if active_camera is equal to 1
  7. Save file and run in Krom

Expected behavior
Expect game to start in 1ps camera follows mouse mode.
Observed: game starts with no camera motion.
type 1 and camera action starts
Behavior is fixed by adding On Init event that sets active_camera to 1

System
Blender: 3.6.5
Armory: 23.10.0
OS: Ubuntu 22.04.1 LTS Gnome 42.5
Graphics card: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] / Mesa Intel® UHD Graphics (CML GT2)

Test File
(drag & drop the zipped .blend file here)
starter.zip

This file includes the 'fix' - to repro bug, delete On Init and connected Set Object Property nodes

Hi, in your file there is a custom property called camera_select on the charactercollision object which is referenced by the CameraSelect trait, but the OnePSLook trait instead references the property active_camera which doesn't exist (thus, Get Object Property returns null). So I think there is no bug here.

Thanks - new user error, and possibly "Get Object Property" being unclear if it means an Armory property or a Blender property.

Added some more documentation at dcda14c and implemented object property display for the debug console at #2965, maybe this helps to prevent issues like this in the future :)