archetype-technical-guide-chs

浏览 UDN 的时候发现 Archetypes Technical Guide 页面的中国翻译为红色链接 ( 如截图所示 ),也就是说必须要授权用户方能访问 ,不知道具体是什么原因 …

这里我自行翻译了一份供大家参考 : ( 注意 :中文翻译仅供参考,其准确性没有任何保证;中文翻译部分之版权归 HFUN 所有,转载时需同本站其他内容一样遵循署名-非商业性使用-禁止演绎协议 )


Overview 概览

Archetypes allow designers to take a snapshot of an existing Actor (including property values, components, object references), and save that snapshot as a placeable content resource, or template. 

原型允许设计人员针对一个已有的 Actor 创建一个快照 ( 包括属性值 , 组件 , 对象参考 ), 保存的快照作为可放置的内容资源 , 或者模版 .

Archetypes are stored in normal Unreal package files which are managed by designers, and allow the designer to place instances of the Archetype in maps, sequences, and UI scenes without requiring any programmer involvement.

原型由设计人员管理并存储在普通虚幻包文件中 , 同时允许设计人员放置原型实例到地图、序列和 UI 场景不需要任何程序人员的参与 .

If a designer changes the default value of a property in an Archetype, that value is automatically propagated to all instances of that Archetype in existing levels and content except those instances which have had that property value customized.

如果设计人员改变了一个原型属性的默认值 , 这个值会自动传递到在当前关卡中此原型的所有实例 , 除非某个实例有自定义属性值 .

Changes to Archetype properties are propagated immediately to instances in the currently open level, and propagated to instances in other packages the next time those packages are loaded.

改变原型属性会立刻传递到当前打开关卡中的实例 , 并且会传递到其它包中的实例当这些包下次被加载时 .


Archetypes in Unreal Editor 原型在虚幻编辑器中

Archetypes are represented in the editor as placeable resources, in the same way that Classes are placeable resources. 

原型在编辑器中表示为可放置资源 , 同样的 , 类也是可放置资源 .

In fact, it helps to think of Archetypes as “script-less classes”, where the purpose of the Archetype is to provide a way for designers to place an Actor that using a set of default property values which are different from the Actor’s class defaults. Archetypes appear in the Content Browser, and provide the same behaviors and functionality as any other resource type, in they can be filtered so that only packages which contain Archetypes appear in the Content Browsers list of packages, etc.

事实上 , 把原型想象成一个 “轻脚本类” 是很有帮助的 , 原型的目的是向设计人员提供一种方法来放置拥有一组默认属性值的 Actor , 不同于 Actor 的类属性 . 原型呈现在内容浏览器中 , 支持同其它资源类型一样的行为和功能 , 原型可以被筛选 , 因此可以在内容浏览器包列表中只显示包含原型的包 .

Even though Archetypes can be considered to be “script-less classes” , they are not located in the Actor Class Browser at this time.

尽管原型可以被认为是 “轻脚本类” , 但它们目前并不存在于 Actor 类浏览器 中 .


Instancing Archetypes 原型实例

In Unreal Editor 在虚幻编辑器中

Once you’ve created an Archetype, it’s time to start using them in your levels. The procedure for placing instances of Archetypes is very similar to the procedure for placing normal Actors. See the Using Archetypes page for more details on how to do this.

一旦你创建了一个原型 , 就可以开始在你的关卡中使用它们 . 放置原型实例的步骤与放置一般 Actors 是非常相似的 . 请参阅 使用原型 页面来了解更多详情 .

In Unrealscript 在虚幻脚本中

There are two ways to create an instance of an Archetype from code.

这里有两种方式可以通过代码来创建原型实例 .

In UnrealScript, objects are created using the new operator. The UnrealScript new operator takes five parameters; the last parameter is the template to use for the new object. To instance an Archetype in Unrealscript, pass a reference to an existing Archetype as the value for the template parameter.

在虚幻脚本中 , 对象通过使用 new 操作符创建 . 虚幻脚本 new 操作符需要 5 个参数 ; 最后一个参数是新对象要使用的模版 . 对于在虚幻脚本中的原型实例来说 , 是通过一个已有原型的引用作为模版参数值 .

var StaticMesh MeshArchetype;
var StaticMeshActor MeshActorTemplate;
// Object archetype instancing example 对象原型实例示例 
function CreateObjectArchetype() { local StaticMesh MeshInstance;
// create a new StaticMesh object in the transient package using the value of MeshArchetype as the template
// 创建一个新的 StaticMesh 对象在暂态包 , 使用 MeshArchetype 作为模版值
MeshInstance = new Class'Object'(MeshArchetype); }
// Actor archetype instancing example . Actor 原型实例示例
function CreateActorArchetype() { local StaticMeshActor MeshActorInstance;
// now spawn the Actor, passing in the Archetype reference as the template
// 现在生成这个 Actor , 通过将原型引用作为模版
MeshActorInstance = Spawn(class'StaticMeshActor', None, 'None', Location, Rotation, MeshActorTemplate);
}
defaultproperties {
MeshArchetype=Object'SomeArchetypePackge.MyArchetype'
MeshActorTemplate=StaticMeshActor'SomeArchetypePackage.SMArchetype'
}

How Archetypes differ from prefabs 原型和预制有哪些不同

  1. Prefabs are composed of archetypes
  2. Prefabs can contain sequences (Kismet)
  3. Prefabs preserve and translate object references within the prefab
  1. 预制由原型组成
  2. 预制可以包含序列 (Kismet)
  3. 预制内部保存和转换对象引用

For more information on Prefabs, see the Using Prefabs page.
要了解预制的更多信息 , 请参阅 使用预制 页面