ResortObjects

Category: Objects / Position
Since engine version: 4.9.1.0 GWE

Description

Resorts all objects or all objects of a given category internally. This is done through a simple sort algorithm which calls the specified function to determine the relation of two objects being compared. The two object references are passed in Par(0) and Par(1). If the first object is to be sorted before the second, the function should return a value less than zero. Otherwise, the function should return a value greater than or equal to zero.

Syntax

bool ResortObjects (string szResortFunc, int iCategory);

Parameters

szResortFunc:
Name of the function to be called for sorting.
iCategory:
[opt] Object category to be resorted (e.g. C4D_StaticBack). 0 resorts all objects.

Remark

Internal sorting is not done immediately but at the end of the frame in which the function was called.

Example

  ResortObjects("ResortProc", C4D_StaticBack());

protected ResortProc: return(GetMass(Par(0))-GetMass(Par(1)));
Sorts all C4D_StaticBack objects by weight (lighter objects in front).
See also: Resort, SetObjectOrder
Sven2, November 2001