Check the selected particle

  • TPT_PL
    10th Sep 2016 Member 1 Permalink
    How (if) I can check if the chosen element is selected in the menu and eventually change the selected element
  • jacob1
    10th Sep 2016 Developer 0 Permalink
    You can use tpt.selectedl for this (there is also tpt.selectedr, tpt.selectedreplace, and tpt.selecteda).

    tpt.selectedl returns something like "DEFAULT_PT_SPRK". You can do elem.DEFAULT_PT.SPRK or elem[tpt.selectedl] to get the ID from this.

    You can also set tpt.selectedl to anything, like tpt.selectedl = "DEFAULT_PT_GRVT" or tpt.selectedl = elem.property(28, "Identifier")
    Edited once by jacob1. Last: 10th Sep 2016
  • TPT_PL
    10th Sep 2016 Member 1 Permalink
    Oh, thanks.
    But must it be a string?
  • jacob1
    10th Sep 2016 Developer 0 Permalink
    @TPT_PL (View Post)
    Yes, it has to be an identifier string. There are simple ways to convert between that and an ID that I showed in the post.
  • TPT_PL
    11th Sep 2016 Member 1 Permalink
    Ok, thanks dude.