The LinkLib 1.13!
With simulated “Instance properties”.
Easier access to the Pivot and Base via Instance class.
(still full 2.49, 2.5+, 2.6+ compatible)
As an side effect of the MouseOrbiter the former Group Scripts were renamed to LinkLib and can now be used as Python modules.
[Edit] Added three VideoTutorials at the end of this post [/edit]
There are some Python-Module-Controller-ready functions in the module:
LinkLib.linkPivotAndBase: This module (applied to the base object of the group) will look for the pivot object that added the group. The pivot must have a property with the name that is defined in the base object’s property baseType. (See picture: Base object property baseType=“GroupID”, Pivot property GroupID exist. Recommended baseType is the name of the group).
LinkLib.linkSceneObjects: Links all objects in a scene
LinkLib.parent:This module parents the base object the pivot.
LinkLib.reparent:This module parents the base object to the parent of the pivot. This allows the pivot to perform other transformations (rotation, position etc.).
LinkLib.copyProps: This module copies the properties of the pivot object to the base object.
LinkLib.copyPropsToBase: Copies the existing properties from this pivot object to the base object.
LinkLib.copyPropsFromPivot: Copies the existing properties from the pivot object to the this base object.
LinkLib.copyPropsAnd: Copies the existing properties from the pivot object to
the base object of the group instance if all sensors are positive
LinkLib.copyPropsOr: Copies the existing properties from the pivot object to
the base object of the group instance if at least one sensor is positive
LinkLib.copyPropertyToPivot: copies properties from base to pivot (from base only)
LinkLib.parentPivotToOwner: Parent the pivot to the controller’s owner
LinkLib.parentPivotsChildrenToOwner: Parent the pivot’s children to the controller’s owner
[LIST]
if the property mustHave with a list of property names exists only objects with at least one of the properties will be parented.
LinkLib.printLinks: prints pivot and base information
LibLink.printAll: prints all information
[/LIST]
History
1.13
replaced cache wich instance. The instance can be applied to all instance objects with addObjTreeToInstance
addObjTreeToInstance() applies all parented objects to the instance of this object.
setInstanceProperty() distributes the properties of the connected PropertySensors to all instance objects of this instance. This simulates “instance properties”.
API change! only properties that are defined at the base are copied!
1.10 - removed “baseName” property
introduced LinkLibCache
1.8 - compatible with 2.5
1.7 - bugfix: parented pivots might get different position when the parent is rotated
1.6 - enhanced parentPivotsChildrenToOwner to look for children with specific properties listed in property “mustHave”.
1.5 - added getPivotInTree, parentPivotsChildrenToOwner
BugFix copyProps does not copy the property Pivot, or baseType anymore
1.3 - added copyPropsAnd, copyPropsOr
1.2 - refactored the variables for property names,
Monster,
Could you make a tarball or a zip of the scripts as pure .py files with some indication as to how to layout a directory structure such that they can be used as independent modules? (IOW, without having to Add them into a blend file.)
Thanks for this very cool script. IMHO the Game Engine is suffering a disconnect with the way ‘normal’ Blender handles dupligroups and your script is the only way around it as of 2.49b.
How about a simple all-covering explanation on What this is and What it does?
Does this allow me to copy objects from one scene to another in real time, or does this allow me to refer to them…
I read but somhow i cant get it >.<
(also the relationship with the MouseOrbiter isnt clear to me, btw, why its called MOUSEorbiter, when objects should orbit… me confuse a bit)
The mouseOrbiter is just an example and demonstrate the usage of LinkLib. It is called MouseOrbiter because if you move the MOUSE - the ORBITER and all its children circles around a center. E.g. you move the mouse left, the orbiter moves left on the orbit.
If you use addObject or Groups you might have discovered that the object (pivot) that adds the object (instance) has no further relationship to the added object.
Especially the objects of a group are not accessable in the Editor anymore. So you can’t parent anything to them or parent them to some other object.
That means if you move the pivot the objects of the instance do not move. (Keep in mind that instances can consists og more than one object.)
To solve this problem the LinkLib provides function for it (see the first post). So you can
parent instance objects to the pivot
copy properties from pivot to a instance object
parent the pivot to any object of the instance
parent the children of the pivot to any object of the instance