Tagged: , ,

Viewing 6 posts
  • #27762
    j.a.b
    Participant
    Posts: 2
    Threads: 3
    Joined: Apr 2020
    Up
    0
    Down
    ::

    Hello!

    I’m very new to Project manager and am loving it so far. Great job!

    I have a very specific layer structure I use for projects, and it would be very handy to be able to select a layer, and then drag-and-drop merge objects and have them automatically be moved to that layer. This could possibly be an option

  • #27764
    Oleksandr Kramer
    Moderator
    Posts: 269
    Threads: 1413
    Joined: Aug 2009

    You can do this using Project Manager API

    Save the next script to file “MovetoCurrentLayer.ms” and place it to the startup scripts directory.

    Restart 3ds max.

    fn MovetoCurrentLayer &PostMergeStruct =
    (
      local layer = layermanager.Current 
      for obj in PostMergeStruct.Nodes where isValidNode obj and not isDeleted obj do
        layer.addNode obj
    )
    
    if (superClassOf PmCallbacks == structDef) do (
      PmCallbacks.removeScripts CallbackID:#MovetoCurrentLayer
      PmCallbacks.addScript #postFileMerge MovetoCurrentLayer CallbackID:#MovetoCurrentLayer
    )

    For details see the example about callback #postFileMerge on the page

    https://3d-kstudio.com/faq-cat/maxscript-api/

    Have a good day!

  • #27765
    j.a.b
    Participant
    Posts: 2
    Threads: 3
    Joined: Apr 2020

    Fantastic! Thank you :)

     

    Is there a spot where your examples such as this are saved? I’m sure there are a lot of handy scripts like this you’ve made…

  • #30854
    KARIM HASSAYOUNE
    Participant
    Posts: 3
    Threads: 5
    Joined: Sep 2014

    Hey,

    Did this script work for you ?

    I saved it to the startup scripts folder as instructed but it does seem to work.

    I tried running this command :

    PmCallbacks.Show()

    and it returns this :

    #postFileMerge:
    CallbackId:#MovetoCurrentLayer, MovetoCurrentLayer()

    So the callback seems to be added properly right ?

  • #30856
    Oleksandr Kramer
    Moderator
    Posts: 269
    Threads: 1413
    Joined: Aug 2009

    Hi
    Yes – it should be work.

    Note that now Project Manager has a related option in the Preferences.

    Move 3d models to the active layer

    [Resolved]

  • #30857
    KARIM HASSAYOUNE
    Participant
    Posts: 3
    Threads: 5
    Joined: Sep 2014

    Ah yes, ok perfect.

    Thank you.

Viewing 6 posts

You must be logged in to reply to this topic.