Notifications
Clear all

[Closed] pFLow get selected operator

 JHN

Hi all,

I wonder if it’s possible to get a reference to a selected operator in pFlow?
I looked throughout the manual and couldn’t find anything that looks like what I need. I know I can skim all subanims and I probably will, but even then there’s no selected flag or something… Anyone got any pointers, or know for sure it’s not possible…

Thanks,
-Johan

10 Replies

pView = particleFlow.OpenParticleView()
pView.selected
$Particle_View:Particle View 01 @ [0.000000,0.000000,0.000000]
#($Rotation:Rotation 0Z @ [0.000000,0.000000,0.000000])

 JHN

Excellent! Thanks, did you find it in the manual, because I still can’t find it

pview = particleFlow.openParticleView()
show pview

Displays more properties than I can find in the manual and the name property is missing, or am I reading it wrong? (max2009 sp1)

-Johan

1 Reply
(@bobo)
Joined: 1 year ago

Posts: 0

No, you are not missing anything, I am pretty sure when this was written back in Max 5.5, the .selected property was not there while the .name was, otherwise it would have been documented that way.

Thanks for the (indirect) bug report, will update it for the next build.
You know where to submit bug reports, right?

I am guessing it is one of those things that didn’t get documented for whatever reason.

-Eric

yeah, I don’t go by the manual too often Used the manual to figure out how on earth to access a particle view (it’s an actual scene node… of sorts… theheck), went with that ( can just use ($Particle_View*)[i] as well), and used the usual set of showProperties / showInterfaces / etc.

 JHN

Yeah, maybe I just got to comfy with the manual…
On a (at least for me) related note, can you get the text that is in a opened maxscript editor tab?

like (pseudo code)
mxsEditor.currentTab.text

I would like to be able to copy paste text using the mxs editor… and now that I can’t trust my mxs manual anymore :rolleyes: , maybe some of you may know…

I know I could do it with the old “script editor” window, but that one is useless without the color coding…

-Johan

I don’t even know how to do it with the legacy editor / older max versions, short of those directly created by myself via newScript(). Sure would be nice if you could get a windowStream or stringStream out of what you mentioned… but alas… not seeing nor finding anything.
I suppose you could, maybe, get very hacky on it… very, very hacky, as tabbedDialogs doesn’t include the new maxscript editor. Yeah, forget it… here’s to hoping we’re both just missing it (though I have no use for it myself, it always saddens me when there’s potential being missed out on).

2 Replies
 JHN
(@jhn)
Joined: 1 year ago

Posts: 0

I want to write a tool that can get the selected script node and copy paste it’s script into a new editor tab… edit there, hit a button on my tool and plunge the code back into the script node… why oh why syntax color coding is missing is beyond me… pflow used to be the particle tool.

@Bobo, I will submit it!

(@bobo)
Joined: 1 year ago

Posts: 0

It is fixed now.

Btw, .name is a valid property because Particle_View is a Helper class (most of PFlow is implemented as helpers), so all node properties are available, including .name, .pos etc.
Of course, they should not be listed as properties of the object itself.

well, there’s nothing stopping you from doing this per se… although via a slightly different workflow…

  1. get the selected node
  2. check if it’s a script operator at all %)
  3. get its script if it is, e.g. with .proceed_script
  4. format it all to a file
  5. edit “<filespec>” to place the file into a tabbed editor tab so you get the nice highlighting
  6. start a timer to watch the file
  7. if the file changes (user ‘saved’ the script), read the file back in
  8. assign the read-in string to the operator

So the only difference is that you don’t press a button to get it back into pflow… you just let the user determine that by whether or not they save the thing.

That does leave the problem of “what if the user never saves it and just closes the window?”. Well, that’s a toughie… maybe just let the timer expire after N minutes and deem the script as having been discarded, or just happily keep monitoring it (use 1 timer that simply checks multiple items stored in an array or so).