Making duplicate of objects
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/09/2003 at 03:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.200
Platform:
Language(s) : C++ ;---------
Im trying to make something similar to the Array Tool, where is makes copies of the input object.
How do I go about this?
Im stuck at the actual, making the duplicate of objects in an ObjectData plugin.BaseObject *PluginTest::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh) { BaseObject *orig = op->GetDown(); if (!orig) return NULL; BaseObject *main=NULL; main = BaseObject::Alloc(Onull); Vector v(0,0,0); return main; }
The orig variable represents the input object, but how do I make several orig's and place them into the scene?
Thanks -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/09/2003 at 23:48, xxxxxxxx wrote:
Use GetAndCheckHierarchyClone() to get one copy, then GetClone() on that one to get more. Finally insert them under main.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/09/2003 at 03:26, xxxxxxxx wrote:
Thanks, that worked great.
The only problem is the clones keep dissapearing in the viewport (when i rotate the viewport for example). Im guessing I have to redraw the screen, but dont know how to go about it.
Changing the input objects properties, makes all the clones flicker on and off, and end up with them hidden. Same with chaging properties of my object plugin too.
This is my function
BaseObject *TestPlugin::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)
{
// Get the first Input object
BaseObject *orig = op->GetDown();
if (!orig) return NULL;BaseObject *main=NULL;
main = BaseObject::Alloc(Onull);// Clone the input object
Bool dirty = FALSE;
BaseObject *clone = op->GetAndCheckHierarchyClone(hh,orig,HCLONE_ASIS,&dirty,0,false);
if(!clone) return 0;
// Starting Vector
Vector v(0,0,0);
// Number of Clones needed
BaseContainer *data=op->GetDataInstance();
LONG CloneCount = 10;
// The Size of the Object
Real Size = 500
Real GapDistance = Size/(CloneCount-1);// Add the clone to the null
clone->InsertUnderLast(main);
clone->SetPos(v);
// Add Remaining Clones to null Object
LONG i;
for (i=0; i < (CloneCount-1); i++)
{
v.z+=GapDistance;
BaseObject *nclone = (BaseObject* )clone->GetClone(COPY_NO_HIERARCHY,NULL);
nclone->InsertUnderLast(main);
nclone->SetPos(v);
}
return main;
} -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/09/2003 at 18:43, xxxxxxxx wrote:
Hi Geespot,
I've just written a plugin just like the array plugin, only it creates a grid of clones.
I can post the code for the plugins I've written as soon as I've cleared up a couple of things (attaching GPL, getting a proper plugin id, etc), which shouldn't take more than a day or so (say, by Monday evening). Let me know if you're interested.
In the meantime, you should check the value of dirty after you've tried cloning orig:Bool dirty = FALSE; BaseObject *clone = op->GetAndCheckHierarchyClone(hh, orig, HCLONE_ASIS, &dirty;, 0, false); if (!dirty) return clone; // output cache is clean: use it if (!clone) return 0;
Cheers.
.angus.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/09/2003 at 01:26, xxxxxxxx wrote:
Thanks angus, your code worked, so I wont need to see your plugin code, thanks for offering.
I totally forgot about the dirty variable.