okey...it is happening again.
IMPORTANT...the errors show only in eclipse. If I execute the code directly
in maya´s interpreter, I don´t get any error. ( have eclipse connect to
maya, and I get the error when I exceute the code in eclipse only
I also notice this happens when I duplicate a code and change some
variables. For example, here I am programing spine that could be bipedal or
quadruped. So I did the code for bipedal,
and then duplicated the code and changed the variables bipedal to quadruped.
I get the following errors :
// Error: ...python("#!/usr/bin/env python\n# -*- coding: utf-8
-*-\n\"\"\"------------------------------------------------------------------
//
// Error: Line 1.5842: Unterminated string. //
// Error: ...python("#!/usr/bin/env python\n# -*- coding: utf-8
-*-\n\"\"\"------------------------------------------------------------------
//
// Error: Line 1.5842: Unterminated string. //
the errors above happen randomly. Sometimes it work, some time it doesn´t
and give the errors shown
and here is the code. Justin, I used pastebin to clone the code and paste
here. Is this okey?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""---------------------------------------------------------------------------[
REQUISITOS
]-----------------------------------------------------------------------------"""
# modules
import maya.cmds as cmds
import coreUtilities.globalUtilities as gu
import coreUtilities.mathUtilities as mu
import setupTools.riggingTools as rt
import sys
# class objects
mathUtilities = mu.MathUtilities()
getUtilities = gu.GetUtilities()
genericRiggingTools = rt.GenericRiggingTools()
"""---------------------------------------------------------------------------[
CLASSES
]-----------------------------------------------------------------------------"""
class CreaturePoints(object):
# static variables
axis = ["x","y","z"]
def bipedalChestPoint(self,chestParent="",intermediateChest=False):
"""--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
description: crea puntos torso, y debuggea cualquier error. Puede
ser uno o varios torsos bipedos
Los puntos se emparentan a lo declarado o seleccionado. Si se
crea mas de un torso, se renombar automaticamente
# arg1-chestParent : el seleccionado o el declarado
# arg3-intermediateChest : crea joint intermedia en
chest
use: ejecutar con declaraciones o seleccino
status: final
author: rudi hammad
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"""
#--[DEBUGGING]--#
# 1.si no existi hip
if cmds.objExists("c_hip_loc")!=True:
cmds.warning( "no c_hip_loc found in the scene. Please create a
hip locator before running the script" )
sys.exit()
# 2.chestParent debe ser declarado o elegido
if not chestParent:
selection = cmds.ls(sl=True)
# seleccionar un objeto solo para emparentar
if len(selection) > 1 or len(selection) == 0 :
cmds.warning(" none or more than on object selected. Please
select only one ")
sys.exit()
else:
chestParent = selection[0]
else:
chestParent = chestParent
# si el input declarado no existe
if cmds.objExists(chestParent)!=True :
cmds.warning( "chestParent input not valid, please insert
an existing object as argument" )
sys.exit()
#--[MAIN CODE]--#
#--[if chest exists]--#
if cmds.objExists("c_bipedChest_loc")==True:
# si ya existe un extra
try:
cmds.select( "c_bipedExtra*Chest_loc", r=True)
chests = cmds.ls( sl=True )
numberOfChest = len(chests)
extraLetter = chr(ord("A")+(numberOfChest))
toAdd = "Extra" + extraLetter
newChest = "c_biped" + toAdd + "Chest"
# si no exist extra
except:
" no extra chests found..."
newChest = "c_bipedExtraAChest"
# chest locator
pos = cmds.xform( chestParent, q=True, t=True, ws=True )
cmds.spaceLocator( n=newChest + "_loc"); cmds.xform(
t=(pos[0],pos[1]*1.5,pos[2]) ); cmds.setAttr( ".overrideEnabled",1 );
cmds.setAttr( ".overrideColor",20 )
cmds.spaceLocator( n=newChest + "End_loc" ); cmds.xform(
t=(pos[0],pos[1]*2,pos[2]) )
# properties
for elem in self.axis:
cmds.setAttr( newChest + "_loc" + " Shape.localScale" +
elem.upper(), 5 )
cmds.setAttr( newChest + "End_loc" + " Shape.localScale" +
elem.upper(), 5 )
# parenting
cmds.parent( newChest + "End_loc", newChest + "_loc")
cmds.parent( newChest + "_loc", chestParent )
# lineas
genericRiggingTools.lineBetweenTwoObjects(newChest +
"_loc",chestParent)
genericRiggingTools.lineBetweenTwoObjects(newChest +
"_loc",newChest + "End_loc")
# extraChest
if intermediateChest == True:
cmds.spaceLocator( n=newChest + "Inter_loc" ); cmds.xform(
t=(pos[0],pos[1]*1.85,pos[2]) )
cmds.parent( newChest + "Inter_loc", newChest + "End_loc")
for elem in self.axis:
cmds.setAttr( newChest + "Inter_loc" +
"Shape.localScale" + elem.upper(), 2.5 )
#--[end]--#
cmds.select( cl=True )
def quadrupedChestPoint(self,chestParent="",intermediateChest=False):
"""--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
description: crea puntos torso, y debuggea cualquier error. Puede
ser uno o varios torsos quadrupedos
Los puntos se emparentan a lo declarado o seleccionado. Si se
crea mas de un torso, se renombar automaticamente
# arg1-chestParent : el seleccionado o el declarado
# arg3-intermediateChest : crea joint intermedia en
chest
use: ejecutar con declaraciones o seleccino
status: final
author: rudi hammad
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"""
#--[DEBUGGING]--#
# 1.si ni existi hip
if cmds.objExists("c_hip_loc")!=True:
cmds.warning( "no c_hip_loc found in the scene. Please create a
hip locator before running the script" )
sys.exit()
# 2.chestParent should be declared o selected
if not chestParent:
selection = cmds.ls(sl=True)
# select only one object to parent
if len(selection) > 1 or len(selection) == 0 :
cmds.warning(" none or more than on object selected. Please
select only one ")
sys.exit()
else:
chestParent = selection[0]
else:
chestParent = chestParent
# si el input declarado no existe
if cmds.objExists(chestParent)!=True :
cmds.warning( "chestParent input not valid, please insert
an existing object as argument" )
sys.exit()
#--[MAIN CODE]--#
#--[if chest exists]--#
if cmds.objExists("c_quadChest_loc")==True:
# si ya existe un extra
try:
cmds.select( "c_quadExtra*Chest_loc", r=True)
chests = cmds.ls( sl=True )
numberOfChest = len(chests)
extraLetter = chr(ord("A")+(numberOfChest))
toAdd = "Extra" + extraLetter
newChest = "c_quad" + toAdd + "Chest"
# si no exist extra
except:
" no extra chests found..."
newChest = "c_quadExtraAChest"
# chest locator
pos = cmds.xform( chestParent, q=True, t=True, ws=True )
cmds.spaceLocator( n=newChest + "_loc"); cmds.xform(
t=(pos[0],pos[1],(pos[2] + pos[1]*0.75)) ); cmds.setAttr(
".overrideEnabled",1 ); cmds.setAttr( ".overrideColor",20 )
cmds.spaceLocator( n=newChest + "End_loc" ); cmds.xform(
t=(pos[0],pos[1],(pos[2] + pos[1]*1.5)) )
# properties
for elem in self.axis:
cmds.setAttr( newChest + "_loc" + " Shape.localScale" +
elem.upper(), 5 )
cmds.setAttr( newChest + "End_loc" + " Shape.localScale" +
elem.upper(), 5 )
# parenting
cmds.parent( newChest + "End_loc", newChest + "_loc")
cmds.parent( newChest + "_loc", chestParent )
# lineas
genericRiggingTools.lineBetweenTwoObjects(newChest +
"_loc",chestParent)
genericRiggingTools.lineBetweenTwoObjects(newChest +
"_loc",newChest + "End_loc")
# extraChest
if intermediateChest == True:
cmds.spaceLocator( n=newChest + "Inter_loc" ); cmds.xform(
t=(pos[0],pos[1],(pos[2] + pos[1]*1.15)) )
cmds.parent( newChest + "Inter_loc", newChest + "End_loc")
for elem in self.axis:
cmds.setAttr( newChest + "Inter_loc" +
"Shape.localScale" + elem.upper(), 2.5 )
#--[end]--#
cmds.select( cl=True )
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/20914bd8-540c-4839-a5e3-51c2ce6fc1f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.