-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[al] Add support for default rgba values and color threshold for exporting #2250
[al] Add support for default rgba values and color threshold for exporting #2250
Conversation
MString& code, | ||
float value, | ||
int precision, | ||
const std::string& controller, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be nicer to pass as MString, other parameters are passed using that type (except prefix for some reason). It gets converted to a MString in the function anwyay. Other wise the parameters would now take all three of: const char*, MString and std::string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
float value, | ||
int precision, | ||
const char* controller, | ||
bool state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below, in generateFloatGlobals, you receive this as enableState, which I think is a better name that "state". It makes the purpose of the parameter clearer. I would change it here to be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
const float& defVal, | ||
int defPre, | ||
const char* defController, | ||
bool defState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I'd rename defState to enableState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@@ -387,6 +410,9 @@ class PluginTranslatorOptions | |||
MString defString; ///< default string value | |||
std::vector<MString> enumStrings; ///< the text values for the enums | |||
OptionType type; ///< the type of the option | |||
int precision { 1 }; | |||
std::string controller {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: I'd use a MString instead of std::string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
} | ||
} | ||
|
||
/// \brief Test exporting mesh with color threshold value and compaction 1 (basic level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment does not match: claims test uses compaction 1 (basic level), but the test uses 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
static constexpr const char* const kMeshDefaultColourRGB = "Default RGB"; ///< default rgb values | ||
static constexpr const char* const kMeshDefaultColourA = "Default Alpha"; ///< default alpha values | ||
static constexpr const char* const kCustomColourThreshold | ||
= "Custom Colour Threshold"; ///< default alpha values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment here and on the next does not corresponds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
// check for per-vertex assignment | ||
std::vector<uint32_t> indicesMap; | ||
indicesMap.resize(numPoints, -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using -1 here but 0xFFFFFFFF below. I would be clearfer if they were both the same. (Also, passing a negative value to initialize an unsigned integer without a cast might trigger a warning on some compilers and we generally have the warning-as-error compiler option turned on.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the code to check against the visited index, it is less memory friendly but more robust, let me know if that looks better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the AL plugin, if you feel the change would impact performance, you can revert it. The callers are from data you control, if you feel confident the index are always valid by construction, feel free to remove the check, but I'd advise to do profiling first to verify if it really is a bottleneck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted the changes in DiffPrimVar.cpp
.
I have to admit that it was a copy-n-paste from guessColourSetInterpolationTypeExtensive()
and the code has been used in production for a long time, I would keep it untouched in that case.
indicesMap.resize(numPoints, -1); | ||
for (uint32_t pntInx = 0, n = pointIndices.length(); pntInx < n; ++pntInx) { | ||
auto index = pointIndices[pntInx]; | ||
auto lastIndex = indicesMap[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For robustness reason, I would suggest verifying that the index is within the indicesMap size, in case of data corruption. Just resize the indicesMap to the new-found size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few small improvements suggested.
This PR mainly contains two features for exporting: