Creating InstanceObjects
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 02:53, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform:
Language(s) : C.O.F.F.E.E ;---------
Hello,I'm trying to create InstanceObjects. The creation is working, but I can't set the Sourceobject. Can anyone please tell me how to do this?
My code looks like that:
newinstance = new(InstanceObject);
newinstance->SetName("blaa");
container = newinstance->GetContainer();
container->SetData(INSTANCEOBJECT_SOURCE, "Sat");
newinstance->SetContainer(container);doc->InsertObject(newinstance,NULL,NULL);
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 04:59, xxxxxxxx wrote:
new_Object = BaseObject::Alloc( Oinstance );
if ( !new_Object ) goto Error;
new_Object->GetDataInstance()->SetLink( INSTANCEOBJECT_LINK, (BaseList2D* ) the_Object );Remember the_Obejct has to be an object already in your scene.
Regards,
darf -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 06:56, xxxxxxxx wrote:
It´s COFFEE Darf.
But I answered also here in the german forum already. I don´t understand why those people are not asking in here in the first place? Weird...
Well, once again you have to use
container->SetObject(INSTANCEOBJECT_SOURCE,obj_pointer); -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 07:08, xxxxxxxx wrote:
I don't even think about COFFEE. Just had the code handy and posted it.
darf
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 07:36, xxxxxxxx wrote:
Sorry,
didn't want to upset you!
Thanks for the code, but I still get empty instance objects. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 07:38, xxxxxxxx wrote:
maybe this helps:
instanzen(obj)
{
while (obj != NULL)
{
println("Objekt:",obj->GetName());
var subobj, objekttyp,newinstance,container;
if (strstr(obj->GetName(), "BODY") == 0)
{
println(strmid(obj->GetName(),10,2));
objekttyp = strmid(obj->GetName(),10,2);switch(objekttyp)
{
case "PL":
{
newinstance = new(InstanceObject);
newinstance->SetName("Payload");
var sat = doc->FindObject("Sat");
println(sat);
println(sat->GetName());
container = newinstance->GetContainer();
container->SetObject(INSTANCEOBJECT_SOURCE,sat);
newinstance->SetContainer(container);newinstance->Message(MSG_UPDATE);
doc->InsertObject(newinstance,NULL,NULL);
}
case "PM":
case "PD":
case "RB":
case "RM":
case "RD":
case "UN":
}}
subobj = obj->GetDown();
if (subobj != NULL)
{
instanzen(subobj);
}
obj = obj->GetNext();
}
println("Fertig!");
GeEventAdd(DOCUMENT_CHANGED);
} -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 07:45, xxxxxxxx wrote:
Try 1001 instead of INSTANCEOBJECT_SOURCE
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2005 at 07:48, xxxxxxxx wrote:
YYYYEAAAHH!!!
Thanks, you saved my day!