Package com.j3d.engine.scene.copy


package com.j3d.engine.scene.copy
Package that holds all classes and interfaces related to deep copying GObject references.

Copying

GObjects aren't usually copied but in the event that they do need to this package provides the utilities needed to do so.

Process

If generic copying via selection is needed, rather

  1. Select the GObjects in the scene
  2. Call CopyCmd
  3. Call PasteCmd

Otherwise the setup is as follows:
  1. Collect all GObjects which need to be copied.
  2. Create a new CopyProperties.
  3. Call GObject.copy(CopyProperties).

    Make sure to call on the points first, then the liens then the tris to ensure that all dependencies are copied before their dependents, preventing InvalidCopyException due to missing references.

    This should be wrapped in a try-catch block to catch InvalidCopyException and hence clear all references that got made in the process before the exception occured. Otherwise, this exception will be rethrown by StaticRefs.getErrs().

Classes

  • CanCopy, the interface which enforces that implementing objects provide a CanCopy.copy(CopyProperties) method with their own implementation. This is usually only used by GObjects anyways.
  • CopyProperties, the properties of a copy operation which hold booleans related to the copy operation, the current list of copied objects linked to their original object's UUID and management of fetching and getting. A single CopyProperties instance should be made and passed into the multiple GObjects that would like to be copied in a single operation.
  • Copy, a record that encapsulates an original object's UUID and its corresponding copied GObject instance. It's used internally by CopyProperties to track which original objects have been copied and to what new instances.

    Copy.equals(java.lang.Object) and Copy.hashCode() only use Copy.original() (the original object's UUID).

  • CopyPropertiesBuilder, a builder class for creating CopyProperties instances. It provides an API to configure various properties related to the copying of GObject instances.
  • InvalidCopyException, an exception thrown when an attempt to copy objects fails, typically indicating an issue during the deep copying process or with missing dependencies.
Author:
Lehlogonolo Poole
See Also: