View Full Version : Creating new layer in MaxScript

12 December 2010, 07:50 PM
I'm fairly new to MaxScript, and having some issues doing something that should be pretty simple. I want to look for a layer based on it's name. If it doesn't exist, then I want to create it. Then when I create new nodes I try and assign them to this layer. Here's what I currently have in code:

global layerNameBones="bones"
--Setup Layer for Rig controls
if LayerManager.getLayerFromName layerNameBones == undefined
bonesLayer=LayerManager.newLayerFromName layerNameBones
bonesLayer=LayerManager.getLayerFromName layerNameBones
bonesLayer=LayerManager.getLayerFromName layerNameBones
-- Turn viewport update and undo off to speed up script
with redraw off
undo off
-- Hips
boneHips = BoneSys.createBone $Hips.position $Waist.position boneOrient = "BoneHips"
bonesLayer.addnode boneHips
-- Waist

This sometimes works, and other times does not. Am I going about this the wrong way?

12 December 2010, 02:35 PM
answered you here

CGTalk Moderation
12 December 2010, 02:35 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.