PDA

View Full Version : Set.Instance for Macs?


moka.studio
04-02-2007, 05:10 PM
is there a version of the Set.Instance plugin for Mac that runs under version 10?
Thanks,

Per-Anders
04-02-2007, 06:00 PM
It's functionality should be covered by the instance object itself (since R9), just make a new instance object and it will be put in the correct place. If you need to instance multiple objects at once then you can use a basic COFFEE script like this one:


op = doc->GetFirstObject();
var instance = op;
var mynull = AllocObject(Onull);
while (op)
{
if (op->GetBit(BIT_ACTIVE))
{
instance = AllocObject(Oinstance);
instance#INSTANCEOBJECT_LINK = op;
instance->InsertUnder(mynull);
instance->SetMg(op->GetMg());
op->DelBit(BIT_ACTIVE);
}

if (op->GetDown())
{
op = op->GetDown();
}
else
{
while (!op->GetNext() && op->GetUp())
{
op = op->GetUp();
}
op = op->GetNext();
}
}

op = mynull->GetDown();

while(op)
{
instance = op;
op = op->GetNext();
instance->Remove();
doc->InsertObject(instance, NULL, NULL);
instance->SetBit(BIT_ACTIVE);
}

moka.studio
04-02-2007, 08:04 PM
yes, the reason why I still use SetInstance is that it can clone multiple objects at once... very essential.
Thanks a lot for cooking up this script Per, I will try it out.

Jean-Pierre

moka.studio
04-02-2007, 08:06 PM
one thing,
can each individual instance be inserted right below the respective original object, instead of at the top?
This would make it perfect-

Per-Anders
04-02-2007, 08:11 PM
sure, though i'm sure you could work out how to do that yourself from the script.


op = doc->GetFirstObject();
var instance = op;
while (op)
{
if (op->GetBit(BIT_ACTIVE))
{
instance = AllocObject(Oinstance);
instance#INSTANCEOBJECT_LINK = op;
instance->InsertUnder(op);
instance->SetMg(op->GetMg());
op->DelBit(BIT_ACTIVE);
instance->SetBit(BIT_ACTIVE);
op = instance;
}

if (op->GetDown())
{
op = op->GetDown();
}
else
{
while (!op->GetNext() && op->GetUp())
{
op = op->GetUp();
}
op = op->GetNext();
}
}

moka.studio
04-02-2007, 08:47 PM
that could very well be (and at some point perhaps it would be good to delve into scripting for these kinds of things)....
I appreciate you taking the time for helping out with this though, thanks!

sketchbook
04-05-2007, 08:30 PM
how did i miss this thread? i have been asking for this for ages! god bless you per!

sketchbook
06-11-2007, 01:30 AM
hey per,

this last script placed the instance under the object (as in inside the object group). is there a way to get it to place the instance just beneath the instanced object in the OM?

thanks! life saver a tell you.

Matariki
06-11-2007, 04:30 AM
hey per,

this last script placed the instance under the object (as in inside the object group). is there a way to get it to place the instance just beneath the instanced object in the OM?

thanks! life saver a tell you.

replace the line

instance->insertUnder(op);

with

instance->insertAfter(op);

sketchbook
06-11-2007, 04:38 PM
sweet!

anyone know why when i hit undo, it doesn't actually undo in the typical way?

thanks again

Matariki
06-12-2007, 08:46 AM
sweet!

anyone know why when i hit undo, it doesn't actually undo in the typical way?

thanks again

The commands to fill the undo buffer of the document are not included. You can however add them ;-) The commands you need to use are the following. See the Coffee SDK doc for an explanation.

doc->StartUndo();
doc->AddUndo(_,_);
doc->EndUndo();

klueck
06-12-2007, 05:47 PM
Would someone please upload an example scene.
I am in architectural viz and instances are really a must have! Though it's not c4d best side (I love formZ for it's symbols).
But I can't figure it out correctly how exactly you use multiple instances. Maybe a scene would help.

klueck

CGTalk Moderation
06-12-2007, 05:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.