THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/08/2009 at 08:41, xxxxxxxx wrote:
Cinema 4D Version:
Here's the code I am using.
I am trying to get the MDATA_SUBDIVIDE_SUB to pull the number that is entered in to the NUM_SUBDIVISIONS text box to set the number of subdivisions.
I keep getting this error.
subdivisiontool.cpp(80) : error C2664: 'String::StringToLong' : cannot convert parameter 1 from 'String' to 'LONG *'
Anyone have any thoughts?
\> LONG amount;
\> String subAmount;
\> subAmount = mdat.bc->GetString(NUM_SUBDIVISIONS);
\> amount = String::StringToLong (subAmount);
\> //Determine Attributes
\> if (mdat.bc->GetBool(HYPERNURBS_SUBDIVISION, TRUE)) //If HyperNURBS is checked
\> mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, TRUE);
\> mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, FALSE);
\> mdat.bc->SetLong(MDATA_SUBDIVIDE_SUB, subAmount);
\> mdat.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, pi);
\> //Subdivision Command
\> SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat);
\> return true;
On 29/08/2009 at 10:22, xxxxxxxx wrote:
Need more information/code. What is NUM_SUBDIVISIONS defined as in the description resource file (.res)? It would be easier to define it as LONG and then simply get LONG amount = mdat.bc->GetLong(NUM_SUBDIVISIONS).
I'm not sure why you are getting this value from a ModelingCommandData. Wouldn't it be something entered by the user into the dialog associated with the tool plugin?
On 29/08/2009 at 20:11, xxxxxxxx wrote:
okay I ended up just using a LONG instead of a string. so that worked well. Now I'd like to set the default value of a LONG field to contain the number of polygons in the object.
This is the code I am using to set my default values.
\> void SubdivisionTool::InitDefaultSettings(BaseDocument *doc, BaseContainer &data;)
\> //This function sets the default perameters for the Subdivision Options.
\> PolygonObject* objPoly;
\> objPoly=(PolygonObject* )doc;
\> data.SetLong(NUM_SUBDIVISIONS, 1);
\> data.SetLong(HYPERNURBS_SUBDIVISION, TRUE);
\> data.SetReal(MAX_ANGLE, 180);
\> data.SetLong(POLYGON_COUNT, objPoly->GetPolygonCount());
Setting the polygon count is not working.. What am I doing wrong. This learning curve is killing me. LOL
On 29/08/2009 at 21:02, xxxxxxxx wrote:
Solved it thanks,