3ds Max Enabled/Disabled buttons, and Spline Divide/Break Question


#1

Hi guys,
for the last couple of months I’ve been working on a script that will speed me up but I’ve run into a couple of problems.

Firstly, I want to enable/disable buttons to avoid crashing script for accidentally clicked buttons.

rollout test “Enable/Disable Test”
(
button ‘btn_espline’ “Edit Spline” enabled:false

  on btn_espline pressed do
  (
  modPanel.addModToSelection (Edit_Spline ()) ui:on
  )
  
) 
createDialog test

The idea was that the button was turned off whenever the selection was not a spline. (Something like buttons on modifier sets). I know that crucial line is missing but im out of idea. I tried everything I found online, but unsuccessfully.

Second question is about dividing segments and breaking vertex of spline.
So I wanted to select spline, use normalize, then add edit spline, select all vertex, change to segments, divide them, return to vertex and break them. But for some reason (I didnt found online why), its not working when I use it from button, only if I Evaluate from script.

modPanel.addModToSelection (Normalize_Spline2 ()) ui:on
$.modifiers[#Normalize_Spline].ShowKnots = on
$.modifiers[#Normalize_Spline].length = 200
modPanel.addModToSelection (Edit_Spline ()) ui:on
subobjectLevel = 1
actionMan.executeAction 0 “40021”
subobjectLevel = 2
actionMan.executeAction 0 “40021”
macros.run “Editable Spline Object” “ESpline_Divide”
subobjectLevel = 1
macros.run “Editable Spline Object” “ESpline_Break”
subobjectLevel = 0

I didn’t find a way to use splineOps.divide or SubdivideSegment on selected segments if if I try to use it on a modifier (EditSpline)not on the base line. It important to keep all modifiers.

Thank you all for your help in advance