PDA

View Full Version : skinops.getbonename in command-line renderer


marco1475
04-13-2011, 10:37 PM
Hi,

The following code snippet works fine when run from within 3DS Max 2010 SP1 (on an object that is selected, has the modifier tab open, and the Skin modifier selected), but fails when run from the command-line renderer (3dsmaxcmd.exe) with -- Runtime error: Skin need to be selected and in the modifier panel Skin:Skin

logsystem.quietMode = false
logsystem.logName "extra.log"

logfile="my_log.txt"
openLog logfile

max modify mode
max unhide all

cui.commandPanelOpen = true
SetCommandPanelTaskMode mode:#modify

for n in geometry do
(
select n -- this selects the current object in the array
if n.modifiers != undefined do
(
if n.modifiers[#Skin] != undefined do
(
sk = n.modifiers[#Skin]
modPanel.setCurrentObject sk -- this selects the skin modifier
numBones = skinops.getnumberbones sk

-- Select @n if needed.
if not n.IsSelected do
(
Select n
)

-- Unfreeze @n if needed.
if n.IsFrozen do
(
Unfreeze n DoLayer:true
)

-- Set Modify Panel active if needed.
if GetCommandPanelTaskMode() != #modify do
(
SetCommandPanelTaskMode mode:#modify
)

-- Set @n skin modifier as current object in modpanel if needed.
if ModPanel.GetCurrentObject() != n.skin do
(
ModPanel.SetCurrentObject n.skin
)

for i = 1 to numBones do
(
skinOps.getBonePropFalloff sk i

try
(
bnName = skinops.getbonename sk i 1
)
catch
(
format "*** % ***\n" (getCurrentException())
flushLog()
)
)
)
)
)

closeLog()

As you can see I am trying to explicitly set "max modify mode", unhide all, make sure the command panel is open and its task mode is "#modify," as well as unfreezing and selecting each object I work with. I honestly don't see a way how the Skin modifier and the modifier panel aren't open and selected at this time ...

What's more, both skinOps.getBonePropFalloff (used as a test) and skinops.getnumberbones both work correctly (or at least don't crash). I am calling the command-line renderer like this:

3dsmaxcmd -v:5 -preRenderScript:myScript.ms -frames:2253 -showRFW:1 myFile.max

(I selected the frame number 2253, because I am sure that it is part of an animation and must have Skind assigned.)

What am I missing? Why does this code work when executed from within 3DS Max, but fails when passed to the command-line renderer?

Thanks,
Marek

CGTalk Moderation
04-13-2011, 10:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.