Scott Ayers
06-25-2010, 09:38 PM
Hey guys,
This is probably going to sound like a strange question. But I was practicing making classes and custom methods(functions). And I ran into something strange.
You know how the C4D script manager turns certain things a gray color?
I thought that happened whenever you created a class and some members for it. And then used them in the main section of the script. But I'm running into situations where it doesn't happen.
Here's an example: class MyClass
{
public:
var a,b,obj,value;
Add(a,b);
brightness(obj,value);
}
MyClass::Add(v1,v2) // A method to add two variables
{
return v1 + v2;
}
MyClass::brightness(obj,value)// A method to set the brightness value of a light
{
obj#LIGHT_BRIGHTNESS = value;// Sets the light's intensity slider to "value"
value = 0;
return value;
}
main(doc,op)
{
var cls = new(MyClass);
cls->obj = doc->FindObject("Light");//MyClass member obj
cls->value = .5;//MyClass member value-->Sets the light's brightness amount
cls->brightness(cls->obj,cls->value);// executes the brightness method with the member values
cls->a = 4;//MyClass member a
cls->b = 5;//MyClass member b
var result = cls->Add(cls->a, cls->b);//executes the Add method with the member values
println(result);
}
Everything works fine. And the members for the Add method turn gray as I expected.
But the members for my brightness method don't.
So I was just curious about that gray color behavior. And why it happens on some things, but not others?
-ScottA
This is probably going to sound like a strange question. But I was practicing making classes and custom methods(functions). And I ran into something strange.
You know how the C4D script manager turns certain things a gray color?
I thought that happened whenever you created a class and some members for it. And then used them in the main section of the script. But I'm running into situations where it doesn't happen.
Here's an example: class MyClass
{
public:
var a,b,obj,value;
Add(a,b);
brightness(obj,value);
}
MyClass::Add(v1,v2) // A method to add two variables
{
return v1 + v2;
}
MyClass::brightness(obj,value)// A method to set the brightness value of a light
{
obj#LIGHT_BRIGHTNESS = value;// Sets the light's intensity slider to "value"
value = 0;
return value;
}
main(doc,op)
{
var cls = new(MyClass);
cls->obj = doc->FindObject("Light");//MyClass member obj
cls->value = .5;//MyClass member value-->Sets the light's brightness amount
cls->brightness(cls->obj,cls->value);// executes the brightness method with the member values
cls->a = 4;//MyClass member a
cls->b = 5;//MyClass member b
var result = cls->Add(cls->a, cls->b);//executes the Add method with the member values
println(result);
}
Everything works fine. And the members for the Add method turn gray as I expected.
But the members for my brightness method don't.
So I was just curious about that gray color behavior. And why it happens on some things, but not others?
-ScottA
