Announcement

Collapse
No announcement yet.

Storing Maxscript within an Object

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

  • Storing Maxscript within an Object

    So I have a dummy object with custom attribute sliders that are wired to objects in various ways and I also have a slider that activates a script controller for one object. What I'm trying to do next is create a checkbox in that same custom attributes menu that toggles a group of lights on/off in addition to making a selection of objects renderable/not renderable (all via a single checkbox).

    Since On/Off and Renderable are inaccessible through controllers and wiring, I want to link them via maxscript. However to complicate things further, I'm using this entire object as an xref in many other scenes, and I need the maxscript to be stored inside an object or node (like it would be via the position script controller I have already). Is this possible? What alternatives do I have here? Am I stuck because xref objects parameters other than transforms can't be externally referenced in another scene?

    I'm very new to wiring and scripting so there is likely a very simple solution to this, although xref always finds a way to complicate things.

  • #2
    i'm not sure i understood, but yes, you can in fact store scripts and various data as strings into the object custom properties buffer.
    Which used to be quite limited, so watch out for long code.
    Lele
    Trouble Stirrer in RnD @ Chaos
    ----------------------
    emanuele.lecchi@chaos.com

    Disclaimer:
    The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

    Comment


    • #3
      Great, thank you.

      I had figured out a workaround by wiring light multipliers to a checkbox, but storing a script in the properties is much tidier. I'm very new to scripting so I wasn't aware of the user defined properties.

      Comment


      • #4
        You can also store values with objects using CustomAttributes.
        Maxscript made easy....
        davewortley.wordpress.com
        Follow me here:
        facebook.com/MaxMadeEasy

        If you don't MaxScript, then have a look at my blog and learn how easy and powerful it can be.

        Comment


        • #5
          You can probably use custom attributes for that, a parameter that stores a nodeTab, which is an array of nodes, and a rollout with functions to apply to these nodes...
          I would be happy to help in two weeks when I get back from mini honey moon...

          Comment


          • #6
            Originally posted by Dave_Wortley View Post
            You can also store values with objects using CustomAttributes.
            This is what I've been doing. I have a master dummy that all objects are linked to. In this dummy I have a custom attribute menu with sliders that control the various mechanical pieces as well as light intensity, light sets on/off, and I'm working on a slider now that adds turbulent noise to all the animated pieces based on what percentage of extension they're at (noise is 0 at 0 percent extension and turbence slider value at full extension.

            It's my first time ever using max script so it's been a surprisingly fun and rewarding experience. Too bad I didn't know about object properties earlier as that's much more reliable than wiring parameters.

            Thanks for the help guys!

            Comment


            • #7
              You could also write them out to a file and read that file then. I know, not what you wanted exactly, but a way to go, if I understood your question correctly.
              Software:
              Windows 7 Ultimate x64 SP1
              3ds Max 2016 SP4
              V-Ray Adv 3.60.04


              Hardware:
              Intel Core i7-4930K @ 3.40 GHz
              NVIDIA GeForce GTX 780 (4096MB RAM)
              64GB RAM


              DxDiag

              Comment


              • #8
                I'm most likely making a simple mistake but I have this basic script I placed into an object user defined properties:

                Code:
                if ( $'Airplane Animation'.baseObject.Custom_Attributes.'Fog Pass' = on )
                
                then ( $'NavGlass-L'.renderable = false )
                'Fog Pass' is a checkbox. The script doesn't seem to be working/updating when I activate the fog pass checkbox.

                EDIT: I think I misunderstood. User defined isn't actually accessed by 3dsmax but is for user reference only?
                Last edited by White Wizard; 27-06-2016, 10:24 AM.

                Comment


                • #9
                  I'm posting a screenshot of my menu because I think it helps to communicate my process.
                  Click image for larger version

Name:	xref custatr.jpg
Views:	1
Size:	89.3 KB
ID:	862490

                  As you can see I'm using xref objects, which always complicates things. What would be ideal is I would like to add a text box in the custom attributes menu where I could place maxscript that will be run by 3dsmax. This way I can overcome some of the limitations of parameter wiring (not being able to wire the fog checkbox to the .renderable value)

                  Comment


                  • #10
                    if ( $'Airplane Animation'.baseObject.Custom_Attributes.'Fog Pass' = on )

                    ought to read

                    if ( $'Airplane Animation'.baseObject.Custom_Attributes.'Fog Pass' == on )

                    or it's an assignment, not a check.
                    Lele
                    Trouble Stirrer in RnD @ Chaos
                    ----------------------
                    emanuele.lecchi@chaos.com

                    Disclaimer:
                    The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                    Comment


                    • #11
                      Originally posted by ^Lele^ View Post
                      if ( $'Airplane Animation'.baseObject.Custom_Attributes.'Fog Pass' = on )

                      ought to read

                      if ( $'Airplane Animation'.baseObject.Custom_Attributes.'Fog Pass' == on )

                      or it's an assignment, not a check.
                      Thanks for the correction.
                      Last edited by White Wizard; 27-06-2016, 01:47 PM.

                      Comment

                      Working...
                      X