Skip to content

Fix ptAttribLayer being exported incorrectly from Max. #1631

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

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/MaxPlugin/MaxComponent/plAutoUIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void plAutoUIBase::AddPickLayerButton(int16_t id, const ST::string& scriptName,
fDesc->AddParam(id, ST2M(scriptNameNew), TYPE_REFTARG, 0, 0,
p_end,
p_end);
plAutoUIParam* param = new plPickMaterialButtonParam(id, name);
plAutoUIParam* param = new plPickLayerButtonParam(id, name);
param->SetVisInfo(vid, std::move(vstates));
fParams.push_back(param);
}
Expand Down
24 changes: 24 additions & 0 deletions Sources/MaxPlugin/MaxComponent/plAutoUIParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,30 @@ bool plPickMaterialAnimationButtonParam::IsMyMessage(UINT msg, WPARAM wParam, LP
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

plKey plPickLayerButtonParam::GetKey(IParamBlock2 *pb, int idx)
{
// get the plKeys based on the texture map that the Texture map is on
Texmap* texmap = (Texmap* )pb->GetReferenceTarget(fID);
// make sure that there was a texmap set
if (texmap) {
plPlasmaMAXLayer *maxLayer = plPlasmaMAXLayer::GetPlasmaMAXLayer(texmap);
if (maxLayer != nullptr) {
// make sure the index is valid
if (idx >= 0 && idx < maxLayer->GetNumConversionTargets()) {
plLayerInterface* convertedLayer = maxLayer->GetConversionTarget(idx);
if (convertedLayer)
return convertedLayer->GetKey();
}
}
}

// otherwise we didn't find one, because of one of many reasons
return nullptr;
}

///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

plDropDownListParam::plDropDownListParam(ParamID id, ST::string name, std::vector<ST::string> options)
: plAutoUIParam(id, std::move(name)), fhList(), fOptions(std::move(options))
{
Expand Down
11 changes: 11 additions & 0 deletions Sources/MaxPlugin/MaxComponent/plAutoUIParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,17 @@ class plPickMaterialAnimationButtonParam : public plPickButtonParam
void DestroyKeyArray();
};

class plPickLayerButtonParam : public plPickMaterialButtonParam
{
public:
plPickLayerButtonParam(ParamID id, ST::string name)
: plPickMaterialButtonParam(id, std::move(name))
{ }

int GetParamType() override { return kTypeLayer; }
plKey GetKey(IParamBlock2 *pb, int idx = 0) override;
};

class plDropDownListParam : public plAutoUIParam
{
protected:
Expand Down