Hi, sorry for this stupid question,
I have a question about the description.SetParameter() Method:
I do not provide the complete code because it is not necessary for this example.
First I checked the language the user is using, and depending on that I changed the description parameter c4d.DESC_NAME of c4d.PY_1BARS_LEFTHOR
I have to change the name dynamically because, I want to use the parameter for more functionalities and have to rename it depending on what method the user is choosing.
So my question is: Do I have to use the line below, when I am just changing the DESC_NAME ?
because it also works without this line or do I just need it, when I inserted a new one
It's probably better programming style to cover all eventualities and always add this method, isn't it?
if not description.SetParameter(sub_d, db, c4d.DESCID_ROOT):
return False
Here is the code-snippet from the "def GetDDescription(self, op, description, flags)" :
def GetDDescription(self, op, description, flags):
if not description.LoadDescription(op.GetType()):
return False
german = False
index = 0
while True:
lang = c4d.GeGetLanguage(index)
if lang["default_language"]:
break
if lang is None:
break
index += 1
if c4d.GeGetLanguage(index)["name"] != "Deutsch":
german = False
else:
german = True
single_id = description.GetSingleDescID()
sub_d = c4d.DescID(c4d.PY_1BARS_LEFTHOR)
if single_id is None or sub_d.IsPartOf(single_id)[0]:
db = description.GetParameterI(sub_d)
if op[c4d.PY_1BARS_LEFT] == 3:
if not german:
db.SetString(c4d.DESC_NAME, "Segments")
else:
db.SetString(c4d.DESC_NAME, "Segmente")
else:
if not german:
db.SetString(c4d.DESC_NAME, "horizontal")
else:
db.SetString(c4d.DESC_NAME, "horizontal")
# Do I need this line in this case ==========
if not description.SetParameter(sub_d, db, c4d.DESCID_ROOT):
return False
Here the entry in the res-file of the PY_1BARS_LEFTHOR:
GROUP
{
DEFAULT 1;
COLUMNS 2;
LONG PY_1BARS_LEFT {CYCLE {PY_1BARS_LEFTDEACTIVATED~1060829; PY_1BARS_LEFTMETHOD1~1061024; PY_1BARS_LEFTMETHOD2~1061025;PY_1BARS_LEFTMETHOD3~1061026;}}
REAL PY_1BARS_LEFTMETHOD2DISTANCE {MIN 0; MAXSLIDER 100; STEP 0.1; UNIT METER; CUSTOMGUI REALSLIDER;}
LONG PY_1BARS_LEFTVERT {MIN 0; STEP 1; MAX 10;}
LONG PY_1BARS_LEFTHOR {MIN 0; STEP 1; MAX 10;}
}
Here the entry in the german .str file:
PY_1BARS_LEFTHOR "";
Here the entry in the englisch .str file:
PY_1BARS_LEFTHOR "";