On 05/06/2013 at 15:24, xxxxxxxx wrote:
Hey,
I have placed my functions to create objects in another file.
They get called when a button is pressed. In the same Command-method the objects need to be changed, depending on some sliders.
It all worked fine, untill I replaced my functions. The other files loads properly, the function as well, the objects get created. However, when I change the sliders, the objects won't change.
First it gave an Error that global "L_Foot" isn't defined. Then I defined them again in my main file, and the error was gone, but still the objects won't change.
Here's a snippet of my code:
def Command(self, id, msg) : #Commands
if (id == 10002) : #Button Create Character
GENDER = self.GetLong(10001)
print GENDER
doc = c4d.documents.GetActiveDocument()
AddLeftFoot(doc)
AddRightFoot(doc)
AddLeftToes(doc)
AddRightToes(doc)
AddLeftLeg(doc)
AddRightLeg(doc)
AddLeftThigh(doc)
AddRightThigh(doc)
AddHip(doc)
AddBody(doc)
AddLeftArm(doc)
AddRightArm(doc)
AddLeftUpperArm(doc)
AddRightUpperArm(doc)
AddLeftLowerArm(doc)
AddRightLowerArm(doc)
AddLeftWrist(doc)
AddRightWrist(doc)
c4d.CallCommand(17105) # Gouraud Shading (Lines)
c4d.CallCommand(12148) # Frame Geometry
c4d.EventAdd()
#Sliders#
########################################################################################################################################################
### Left_Foot SLiderCode
########################################################################################################################################################
L_Foot = c4d.PolygonObject(8, 6)
if id in (FOOT_X_SLIDER, FOOT_Y_SLIDER, FOOT_Z_SLIDER, FOOT_AXIS_X_SLIDER, LEG_X_SLIDER, LEG_Z_SLIDER) :
FOOT_X = self.GetReal(FOOT_X_SLIDER)
FOOT_Y = self.GetReal(FOOT_Y_SLIDER)
FOOT_Z = self.GetReal(FOOT_Z_SLIDER)
FOOT_AXIS_X = self.GetReal(FOOT_AXIS_X_SLIDER)
LEG_X = self.GetReal(LEG_X_SLIDER)
LEG_Z = self.GetReal(LEG_Z_SLIDER)
L_Foot.SetPoint(0, c4d.Vector((FOOT_AXIS_X -FOOT_X/2.0), (ZERO), (-LEG_Z/2.0 -(FOOT_Z -LEG_Z) +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(1, c4d.Vector((FOOT_AXIS_X -FOOT_X/2.0), (FOOT_Y), (-LEG_Z/2.0 -(FOOT_Z -LEG_Z) +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(2, c4d.Vector((FOOT_AXIS_X +FOOT_X/2.0), (ZERO), (-LEG_Z/2.0 -(FOOT_Z -LEG_Z) +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(3, c4d.Vector((FOOT_AXIS_X +FOOT_X/2.0), (FOOT_Y), (-LEG_Z/2.0 -(FOOT_Z -LEG_Z) +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(4, c4d.Vector((FOOT_AXIS_X +FOOT_X/2.0), (ZERO), (LEG_Z/2.0 +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(5, c4d.Vector((FOOT_AXIS_X +FOOT_X/2.0), (FOOT_Y), (LEG_Z/2.0 +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(6, c4d.Vector((FOOT_AXIS_X -FOOT_X/2.0), (ZERO), (LEG_Z/2.0 +(FOOT_X -LEG_X)/2.0)))
L_Foot.SetPoint(7, c4d.Vector((FOOT_AXIS_X -FOOT_X/2.0), (FOOT_Y), (LEG_Z/2.0 +(FOOT_X -LEG_X)/2.0)))
L_Foot.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
Any ideas how to fix it???
Thanx in advance for any or no answers :)