algorithmic modeling for Rhino
Hi everyone!
I've attached some persistent data to GrassHopper params (Slider, Number, Integer and Curve) (well in Slider data implicit at knob position).
I need to recovery this data using the SDK IGH_PARAM::VolatileData, but this structure is always empty for all params.
Doing casting to GH_NUmberSlider I can recovery the value without problems
¿any idea?
Thank's!
....
for each (IGH_DocumentObject^ pObject in pObjects)
{
IGH_Param ^pParam = dynamic_cast<IGH_Param^>(pObject);
if (pParam != nullptr)
{
IEnumerator ^allData;
allData = pParam->VolatileData->AllData(true)->GetEnumerator();
allData->Reset();
// Always TRUE!
assert(pParam->VolatileData->IsEmpty == true);
/* Param without data */
if (allData->MoveNext() == false)
{
// Always this branch
i_DEBUG_STR(L"NULL DATA", 0, true);
}
/* Param with data */
else
{
// Never this branch
IGH_Goo ^data;
data = (IGH_Goo^)allData->Current;
// Data treatment
...
}
{
GH_NumberSlider ^slider;
slider = dynamic_cast<GH_NumberSlider^>(pParam);
if (slider != nullptr)
{
// The slider value is correct
double value
value = Decimal::ToDouble(slider->Slider->Value);
}
}
}
}
Tags:
VolatileData isn't assigned until the parameter is asked to solve itself. Could that be the problem?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I'm trying to read the parameter without evaluating
pParam->CollectData();
pParam->ComputeData();
Now that's work perfect for all parameters.
Thank's David
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by