[Closed] "Skin need to be selected and in the modifier panel Skin:Skin"
Hello all!
So as just a quick preamble, I work in 3dsMax 2011 64-bit (such an old version for compatibility with tools vital to my workflow), and I have been developing Maxscript tools for at least 3 years now, with about 10 years experience programming, so I am not a total newb to programming or Maxscript.
That being said, I have a really simple setup, and a really rather interesting conundrum:
THE SETUP:
I have an EditableMesh, with a single Skin modifier, and various Bones throughout. The EditableMesh is rigged to the Bones through the Skin modifier, hand-painted with Paint Weights. There are absolutely no problems with this setup in and of itself, everything behaves as it should be.
This object is selected, with the Skin active and highlighted.
THE CONUNDRUM:
If I select this object and run the following Maxscript:
print (skinOps.GetVertexWeightCount selection[1].skin 1)
Then I am greeted with this beautiful, lovely error:
“Runtime error: Skin need to be selected and in the modifier panel Skin:Skin”
However, if I run this code in the Maxscript listener, without modifying my selection at all (observe it is identically the same code):
print (skinOps.GetVertexWeightCount selection[1].skin 1)
Then the Maxscript listener correctly prints out the value of “2”.
I’ve looked up this error, but have found nothing that helps me. I have used the “prepare” function described in this page, but to no avail.
Would anyone happen to know what exactly the problem is, and more precisely, how to remedy it? I need this (and other skinOps) to operate correctly to be able to correct a problem I am having, and the sooner I can get it rectified, the better.
Thank you in advance, everyone!
I have solved this particular problem.
The problem was that, before this call to skinOps in the script, I made a call to progressStart.
Specifically, this was the code:
mSkin = obj.skin
numVerts = skinOps.GetNumberVertices mSkin
progressStart "Weight Culling: "
print (skinOps.GetVertexWeightCount mSkin 1)
That caused the error. Note that the first skinOps call, which does not error, is before the progressStart.
However, if I remove the progressStart, and instead run this:
mSkin = obj.skin
numVerts = skinOps.GetNumberVertices mSkin
print (skinOps.GetVertexWeightCount mSkin 1)
Then it runs perfectly fine.
I don’t know why progressStart makes the skinOps call error, but it does.
So, yeah, I guess the lesson is that if you’re working with 3dsMax 2011, don’t use progressStart when doing calls to skinOps.
The following methods require that the Skin modifier be the displayed modifier in the Modify panel, and that the Modify panel is active.
skinOps and other “Ops” requested active Modify panel. So you must be sure before call it that Modify panel is active.