THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:01, xxxxxxxx wrote:
hm.. did you set the parameters? i guess its some trial and error now, since i dont know why it crashes.
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:01, xxxxxxxx wrote:
hm.. did you set the parameters? i guess its some trial and error now, since i dont know why it crashes.
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:03, xxxxxxxx wrote:
this is how I am attempting to subdivide
but it keeps crashing
if (mdat.bc->GetBool(HYPERNURBS_SUBDIVISION, TRUE)) //If HyperNURBS is checked
{
mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, TRUE);
}
else
{
mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, FALSE);
}
mdat.bc->SetLong(MDATA_SUBDIVIDE_SUB, subAmount);
mdat.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, mdat.bc->GetReal(MAX_ANGLE));
//Subdivision Command
SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat);
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:04, xxxxxxxx wrote:
MAX_ANGLE is equal to pi and subAMount is a real that the user can adjust.
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:11, xxxxxxxx wrote:
try catching the crash with
if(SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat))
{
GePrint("done");
}
else
{
GePrint("failed");
}
just to be on the safe side..
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:44, xxxxxxxx wrote:
Here's my subdivision code now...
Still crashing.
//SUBDIVISION
Real subAmount;
subAmount = mcd2.bc->GetLong(SPACEROCK_SUBDIVISIONS);
mcd2.mode = MODIFY_ALL;
mcd2.doc = hh->GetDocument();
if(SendModelingCommand(MCOMMAND_SUBDIVIDE, mcd2))
{
GePrint("done");
mcd2.bc->SetBool(MDATA_SUBDIVIDE_HYPER, TRUE);
mcd2.bc->SetLong(MDATA_SUBDIVIDE_SUB, subAmount);
mcd2.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, pi);
//Subdivision Command
SendModelingCommand(MCOMMAND_SUBDIVIDE, mcd2);
}
else
{
GePrint("failed");
}
Any thoughts?
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 13:55, xxxxxxxx wrote:
hey, dont call SendModelingCommand twice.. its already called in the if condition!
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 14:06, xxxxxxxx wrote:
well.. that was a good thought and a good catch but unfortunately it's still crashing .. this one is a bit of a thorn today. LOL
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 14:14, xxxxxxxx wrote:
another thing could be worth a try, to set the Parameters for an extra BaseContainer like i did it in my example:
BaseContainer bc;
bc.SetReal(MDATA_OPTIMIZE_TOLERANCE, tolerance);
bc.SetReal(MDATA_OPTIMIZE_POINTS, TRUE);
bc.SetReal(MDATA_OPTIMIZE_POLYGONS, TRUE);
bc.SetReal(MDATA_OPTIMIZE_UNUSEDPOINTS, TRUE);
cd.bc = &bc;
and in the if (SendModelingCommand... call "cd.op->Message(MSG_UPDATE, NULL);"
Oh, wait, i didnt see you setting mcd2.op to your object, maybe thats the main problem
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 14:21, xxxxxxxx wrote:
yeah I added that in after I sent the message.. that didn't work.. I'
ll try your other suggestion though. Thanks,
~Shawn
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 14:31, xxxxxxxx wrote:
alternatively, did you try CallCommand(14047); ?? maybe that works... but i dont know how you set the parameters in this case..
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 15:15, xxxxxxxx wrote:
Awesome.. It works. Used your different basecontainer suggestion.
//SUBDIVISION
Real subAmount = bc->GetReal(SPACEROCK_SUBDIVISIONS);
BaseContainer bc2;
bc2.SetBool(MDATA_SUBDIVIDE_HYPER, TRUE);
bc2.SetLong(MDATA_SUBDIVIDE_SUB, subAmount);
bc2.SetReal(MDATA_SUBDIVIDE_ANGLE, pi);
mcd2.bc = &bc2;
mcd2.op = polyCube;
mcd2.mode = MODIFY_ALL;
mcd2.doc = hh->GetDocument();
if(SendModelingCommand(MCOMMAND_SUBDIVIDE, mcd2))
{
GePrint("done");
}
else
{
GePrint("failed");
}
Thanks again. I'm calling it a night. Thanks for your help.
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 15:18, xxxxxxxx wrote:
Hi, i did a quick test on subdividing and it works here.. dont ask me why it needs to create the dependency list twice, but if i dont do it, the plugin is updating everytime something changes in the editor even if you turn the camera and such.. if someone can tell my why, i'd be happy.
anyways, here is what is working for me:
#define pluginID 1000001
#define pluginName "testObject"
#include "c4d.h"
#include "c4d_symbols.h"
class testObject : public ObjectData
{
INSTANCEOF(testObject,ObjectData);
private:
public:
virtual BaseObject* GetVirtualObjects(PluginObject *op, HierarchyHelp *hh);
static NodeData *Alloc(void) { return gNew testObject; }
};
BaseObject *testObject::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)
{
BaseDocument* doc = op->GetDocument();
ModelingCommandData cd;
Bool dirty;
BaseObject* main = BaseObject::Alloc(Onull);
if (!main) goto Error;
BaseObject* child = op->GetDown();
if (!child) goto Error;
op->NewDependenceList();
op->AddDependence(hh,child);
dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_MATRIX|DIRTY_DATA|DIRTY_CHILDREN);
dirty = dirty || !op->CompareDependenceList();
if (!dirty)
{
blDelete(main);
op->TouchDependenceList();
return op->GetCache(hh);
}
BaseObject* clone = op->GetAndCheckHierarchyClone(hh,child,HCLONE_ASPOLY,&dirty,0,false);//static_cast<PolygonObject*>(child->GetClone(0,0));
if (clone)
{
GePrint ("cloned");
if (clone->GetType()==Opolygon)
{
GePrint("polygonobject detected");
cd.doc = doc;
cd.op = clone;
BaseContainer bc;
bc.SetBool(MDATA_SUBDIVIDE_HYPER, true);
bc.SetReal(MDATA_SUBDIVIDE_ANGLE, 90);
bc.SetLong(MDATA_SUBDIVIDE_SUB, 2);
cd.bc = &bc;
if(SendModelingCommand(MCOMMAND_SUBDIVIDE, cd))
{
GePrint("modeling command sent: MCOMMAND_SUBDIVIDE");
}
else
{
GePrint("failed");
}
clone->InsertUnderLast(main);
}
else
{
blDelete(clone);
}
}
op->NewDependenceList();
op->AddDependence(hh,child);
op->TouchDependenceList();
return main;
Error:
if (main) blDelete(main);
return NULL;
}
// be sure to use a unique ID obtained from www.plugincafe.com
Bool Register_testObject(void)
{
GePrint("- testObject");
return RegisterObjectPlugin(pluginID,pluginName,OBJECT_GENERATOR|OBJECT_INPUT,testObject::Alloc,"OtestObject","orgaLine.tif",0);
}
hope this helps