Home Technical Talk

Global 'Ignore Backfacing'-toggle in max?

I'm looking for a global toggle for Ignore Backfacing, meaning that I want one shortcut/ui button to toggle it on and off on all objects in the scene. Does anyone know of a script that does this? It would be handy if it provided a UI button that displayed the current state, but I could certainly live without

Is this even possible?

Replies

  • Mark Dygert
    As far as I know there isn't a global toggle for all objects unless someone scripts it (which shouldn't be too hard to do). Shift-Ctrl-i will toggle it on/off in edit poly with keyboard shortcut override on. But that's per object which should be a pretty good work around since you can only work on one object at a time.

    Or I guess you could select everything apply edit poly so its instanced and toggle it on/off.
  • Michael Knubben
    Vig: yeah, I know about that, but it's just that I'd love to close some of the headers in the Command Panel, and if only there was somewhere else I could check the state of the backfacing-toggle, I could get rid of the Selection-section.
    Preferably someone'd just program a custom panel where you could choose what's visible and what isn't, but that seems unlikely.
    I also just prefer backfacing to be a global option I can toggle. Or better still, seperated 'select through' and 'select visible'-commands, so I could set them to different buttons. ANd it wouldn't be all that bad if I could actually trust backfacing to work perfectly. Oh, and if I could set things from different selection-modes (edge, vert, etc...) to the same shortcut, so I could set --for instance-- set connect and cap to the same shortcut.
    But hey, we've got a Ribbon-bar now, so that's great.
    [/end bitterness]
  • Michael Knubben
    Actually, the default rmb-quads work for just toggling it for the selected object. Still not the global toggle I'd like, but at least this saves me some space in my Command Panel, so yay! Now If I could only get it down to one strip, rather than the two I find myself using to minimise scrolling.
  • SyncViewS
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi MightyPea,
    here are two scripts to activate and deactivate IgnoreBackfacing in every Editable Poly object, Editable Mesh object and Edit Poly modifier in the scene. Unfortunately Edit Mesh modifier doesn't seem to expose this setting. There are two macroscripts and not a single toggle because you cannot determine what's the initial status of a "global" set since some elements could be enabled and other disabled, in which case a simple toggle wouldn't know what to do. I hope they're what you need. Execute the code and find them in the Customization panel under Category: "IgnoreBackfacing Tools".
    macroScript IgnoreBackfacingON
    category:"IgnoreBackfacing Tools"
    buttonText:"IgnoreBackfacingON"
    tooltip:"Ignore Backfacing ON"
    (
        on execute do
        (
            local anSelection = selection as Array
            local nTaskMode = getCommandPanelTaskMode()
            local currEditObj = undefined
    
            if (selection.count == 1) do
                currEditObj = modPanel.getCurrentObject()
    
            with redraw off
            (
                for o in objects do
                    if ((classOf o.baseObject) == Editable_Poly) then
                        o.ignoreBackfacing = true
                    else if ((classOf o.baseObject) == Editable_Mesh) then
                    (
                        clearSelection()
                        select o
                        setCommandPanelTaskMode #modify
                        modPanel.setCurrentObject(o.baseObject)
                        meshOp.setUIParam o #IgBack true
                    )
                    else
                        for m in o.modifiers do
                            if ((classOf m) == Edit_Poly) do
                                m.ignoreBackfacing = true
    
                clearSelection()
                select anSelection
                setCommandPanelTaskMode nTaskMode
    
                if (currEditObj != undefined) do
                    modPanel.setCurrentObject(currEditObj)
            )
        )
    )
    
    macroScript IgnoreBackfacingOFF
    category:"IgnoreBackfacing Tools"
    buttonText:"IgnoreBackfacingOFF"
    tooltip:"Ignore Backfacing OFF"
    (
        on execute do
        (
            local anSelection = selection as Array
            local nTaskMode = getCommandPanelTaskMode()
            local currEditObj = undefined
    
            if (selection.count == 1) do
                currEditObj = modPanel.getCurrentObject()
    
            with redraw off
            (
                for o in objects do
                    if ((classOf o.baseObject) == Editable_Poly) then
                        o.ignoreBackfacing = false
                    else if ((classOf o.baseObject) == Editable_Mesh) then
                    (
                        clearSelection()
                        select o
                        setCommandPanelTaskMode #modify
                        modPanel.setCurrentObject(o.baseObject)
                        meshOp.setUIParam o #IgBack false
                    )
                    else
                        for m in o.modifiers do
                            if ((classOf m) == Edit_Poly) do
                                m.ignoreBackfacing = false
    
                clearSelection()
                select anSelection
                setCommandPanelTaskMode nTaskMode
    
                if (currEditObj != undefined) do
                    modPanel.setCurrentObject(currEditObj)
            )
        )
    )
    
  • Michael Knubben
    Hey Sync, thanks for that! I have no need for it to toggle Edit Mesh anyway, so yay. And having two scripts is no problem at all, either.
    Thanks :)
Sign In or Register to comment.