Is there a way to access object properties or any other properties from the material node editor? Can a value assigned in Material Node editor be changed using python while the game is running?

  • 1
    $\begingroup$ Object color can be changed using python and accessed in the node editor. $\endgroup$ – sdfgeoff Jul 11 '17 at 6:17
  • $\begingroup$ Thank you very much! I will have to test the possibilities of this. $\endgroup$ – Josip Kladarić Jul 11 '17 at 13:30
  • $\begingroup$ There are many possibilities, but I wish there were more per-object values. 3 floats isn't very many, and packing data in there is not much fun. $\endgroup$ – sdfgeoff Jul 11 '17 at 15:17
  • $\begingroup$ Oh man, that's the fun part for me :) $\endgroup$ – Josip Kladarić Jul 11 '17 at 18:18
  • $\begingroup$ I just started testing this and can't find a way to access object color in the Node Editor. $\endgroup$ – Josip Kladarić Jul 11 '17 at 18:24

The easiest solution is to use Object Color. This can be accessed both by python and by the node editor, and gives you access to three per-object values.

In UPBGE you can access object color using the ObjectData node: enter image description here

In normal BGE you have to create a shadeless white material with object color enabled. Remember to make the diffuse color white, otherwise the color is multiplied (by default) by 0.8!

enter image description here

Slightly unclear from the image is that there are two materials: the shadeless object color one, and the node one.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.