Announcement

Collapse
No announcement yet.

help with a script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • help with a script

    well in a render forum this will be super-super off-topic...

    I did a tool bar with some maxscript and there's a function I can't accomplish

    I want to be able to create an fstorm light from a button, this is what I'm writing: on execute do StartObjectCreation FStormLight, it works fine, but what I really want is to set an arbitrary shape and power for the light I am creating, instead of the default power value of… 1...yeah, for example to have a button for a rectangular light and another for a spherical light and both with a power value of 50

    but whenever I add $.power=50 and run the script maxscript crashes on me and I have to close the 3dsMax... can you help me with this?

    At this point, if you are still with me you could think I Know Nothing about maxscript, and YES!, you are right haha so any help will be appreciated

  • #2
    fn setPower n = n.power=50
    startObjectCreation FStormLight newNodeCallback:setPower
    Last edited by Sylk; 11-09-2016, 05:06 PM.
    Software: FStormRender: 1.5.0h | Drivers NV: 456.71 | 3dsMax: 2020.3 | Windows: 10 x64
    Hardware: Gpu: GTX1080 Phoenix GLH | Cpu: i7-2600k@4.5GHz | Ram: 16GB | SSD: Samsung 860 Pro

    Comment


    • Iskánder ivp87
      Iskánder ivp87 commented
      Editing a comment
      thank you, that solves the power problem at least, any idea for the shape? I tried to edit it and adapt it but it just take the shape of the last created object instead of the value I'm setting

  • #3
    why would you need to use callbacks and startobjectcreation when every fstorm parameter is exposed?
    make your life easier and do it in a standard maxscript


    try this

    FStormlight enabled: true pos: [0,0,200] isselected: on power: 50 size_x: 50 size_y: 50 visible: false shape: 0


    the shape range goes from 0 to 3

    0 - planar
    1 - disc
    2 - sphere
    3 - ies

    Comment


    • Iskánder ivp87
      Iskánder ivp87 commented
      Editing a comment
      Haha sorry man but why would I want to create a light always with the same dimensions and in the same position?
      Maybe I was not clear enough, excuse my bad English
      What I want is to create an fstorm light as I normally would from the original button in the max interface, but with 2 parameters already settled, one the shape and the other one the power, that’s it
      The position and the size have to be free to get from the mouse the same way as when you are creating anything in 3ds max
      Similar to this pseudo code:
      Create the light -- same process as when you create anything, nothing weird here
      set the shape to 0
      set the power to 50
      I don’t mind the order… the thing is that when I create the light its initial power and shape parameters are predefined

    • cdb
      cdb commented
      Editing a comment
      no, you don't necessarily need to have those values fixed, you can quickly build a ui to get everything you want and how you want and you can even build functions to do wathever you want

      there are many advantages of getting a fixed light instead on a per drag aproach, if you can see them or not is up to you and i don't mind really
      you have all the params exposed, if you want to develop further

      your choice

    • Iskánder ivp87
      Iskánder ivp87 commented
      Editing a comment
      @cdb... OK, and please could you help me to accomplish this one??:
      Create the light -- same process as when you create anything, drop and drag
      set the shape to 0
      set the power to 50

  • #4
    thank you both, I pull it editing the code posted by sylk

    Comment


    • #5
      I don't understand where's the last answer i posted... so repost
      Code:
      fn doPlaneLight n = ( n.shape=0 ; n.power=50 )
      startObjectCreation FStormLight newNodeCallback:doPlaneLight
      Software: FStormRender: 1.5.0h | Drivers NV: 456.71 | 3dsMax: 2020.3 | Windows: 10 x64
      Hardware: Gpu: GTX1080 Phoenix GLH | Cpu: i7-2600k@4.5GHz | Ram: 16GB | SSD: Samsung 860 Pro

      Comment


      • Iskánder ivp87
        Iskánder ivp87 commented
        Editing a comment
        well I kind of get to that myself haha, first it didn't work, but I was writing in the same line without the ; I ended doing the declarations in different lines... now I know I can use ; as separators thank you again!

        this maxscript is incredible easy I went from never had doing a thing with it to do a complete toolbar with all the functions I need in a couple of days!
        if I remember well you told me you hadn't managed to import a new fstorm material, sure you have already done it by now, but anyway if it helps this is how I did it:

        try(
        i= medit.GetActiveMtlSlot()
        )
        catch(i=1)
        meditMaterials[i] = FStorm ()

      • Sylk
        Sylk commented
        Editing a comment
        Thank you but in fact my toolbar is much more advanced and therefore more complicated and long to develop than the basic functions. I do other things at the same time, so sorry for the time it takes.
        I just told you that I was not yet at the point of material management. I don't have any problems with that. Thanks anyway.

      • Sylk
        Sylk commented
        Editing a comment
        And congrats for your progress
    Working...
    X