Assign default name of import group based on name of imported file.
[git-p4: depot-paths = "//depot/solvespace/": change = 2133]
This commit is contained in:
parent
01ecb986f4
commit
7bd871ad28
24
group.cpp
24
group.cpp
@ -237,7 +237,31 @@ void Group::MenuGroup(int id) {
|
||||
if(strlen(g.impFile) == 0) {
|
||||
if(!GetOpenFile(g.impFile, SLVS_EXT, SLVS_PATTERN)) return;
|
||||
}
|
||||
|
||||
// Assign the default name of the group based on the name of
|
||||
// the imported file.
|
||||
char groupName[MAX_PATH];
|
||||
strcpy(groupName, g.impFile);
|
||||
char *dot = strrchr(groupName, '.');
|
||||
if(dot) *dot = '\0';
|
||||
|
||||
char *s, *start = groupName;
|
||||
for(s = groupName; *s; s++) {
|
||||
if(*s == '/' || *s == '\\') {
|
||||
start = s + 1;
|
||||
} else if(isalnum(*s)) {
|
||||
// do nothing, valid character
|
||||
} else {
|
||||
// convert invalid characters (like spaces) to dashes
|
||||
*s = '-';
|
||||
}
|
||||
}
|
||||
if(strlen(start) > 0) {
|
||||
g.name.strcpy(start);
|
||||
} else {
|
||||
g.name.strcpy("import");
|
||||
}
|
||||
|
||||
g.meshCombine = COMBINE_AS_ASSEMBLE;
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ add checked/unchecked checkbox and radio button
|
||||
fix bug with rotation in plane where green line stays displayed
|
||||
lock point where dragged constraint
|
||||
expose transformed point stuff in library, and email McNeel
|
||||
assign default name for import groups based on filename
|
||||
|
||||
-----
|
||||
rounding, as a special group
|
||||
|
Loading…
Reference in New Issue
Block a user