how do I pick a family instance of a particular object

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Sep 05, 2009 11:05 pm

normally I can do
pRuntime->SelectAll(MyObjectType);
pRuntime->Select(MyObjectPointer);

to select a particular object assuming that MyObjectPointer points to a specific instance of MyObjType

if I want to select MyObjectPointer as a member of a family of type MyFamilyType
would it be
pRuntime->SelectAll(MyFamilyType);
pRuntime->SelectF(MyObjectPointer,MyFamilyType); ??

also, what would happen if I tried to do:
pRuntime->SelectF(MyObjectPointer,ADifferentFamilyType)
assuming that MyObjectPointer was not a member of ADifferentFamilyType, or that ADifferentFamilyType pointed to a different object type

also, is there a way to add an object to a family via a plugin?
either during runtime or edittime
meaning that I have a pointer MyFamilyType, and MyObjectPointer, which is not a member of that family
and I can add the object to the family without the user doing so manually?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Sep 06, 2009 1:42 pm

[quote="lucid":17wwbheq]normally I can do
pRuntime->SelectAll(MyObjectType);
pRuntime->Select(MyObjectPointer);
[/quote:17wwbheq]
No, you should always use the functions that end in F (eg SelectF) because the other ones are deprecated and do not work properly.

[quote:17wwbheq]
pRuntime->SelectAll(MyFamilyType);
pRuntime->SelectF(MyObjectPointer,MyFamilyType); ??
[/quote:17wwbheq]
That's right, it works the same as selecting it for an ordinary object type.

[quote:17wwbheq]
pRuntime->SelectF(MyObjectPointer,ADifferentFamilyType)
[/quote:17wwbheq]
This is only valid if MyObjectPointer is a member of the family "ADifferentFamilyType", you cannot pick objects in types or families they're not a part of. The consequences of this are undefined.

[quote:17wwbheq]also, is there a way to add an object to a family via a plugin?[/quote:17wwbheq]
Sorry, this isn't possible.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests