Grasshopper

algorithmic modeling for Rhino

Would it be possible to have the various calls such as...

GH_Component.GH_OutputParamManager pManager.Register_DoubleParam(...) etc. 

...return the integer index of the parameter registered?  It would make keeping track of registration ordering a little cleaner and robust.  Shouldn't cause any reverse pain as older code would just ignore the returned result.  

    - B -

Views: 469

Replies to This Discussion

Hi Brian,

probably a good idea. Out of curiosity, why are you keeping track of output parameter indices,is it just so you can write:

  DA.SetData(idxCurveParam, theCurve)

?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Agreed. I always use integer constants in DA.GetXXXX and DA.SetXXXX, but having variables that clearly identify specific parameters is probably better practice.

Indeed, using the names is both slower and less secure, as names can be changed by those who know how.

I'll add the return codes (after I establish it doesn't break the SDK) when I feel my brain could do with some repetitive coding for an hour or so.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ok, so it turns out to be a breaking change (http://stackoverflow.com/questions/9178533/why-adding-a-return-type...) after all.

I can still change it by picking a different name for the new methods and marking the existing ones obsolete though. At least gives me a change to redesign the method names and signatures.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

The old methods will still work, they're just Obsolete as of 0.9.0009. All the new methods have been renamed AddXXXXParameter instead of Register_XXXXParam

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service