Actors and Components
Actors in PFM are entities (i.e. game objects) that are part of your animation, not including map entities or other entities that exist independently of your project. An actor can be anything from a camera to a light source, prop or particle system. An articulated actor is an actor with a skeletal rig or morph targets (i.e. flexes/flex controllers).
In the PFM interface you can find a list of all actors in the currently selected film clip in the actor editor window.
Creating an actor
To create a new actor, click the gear icon at the top of the actor editor:
Choosing "New Actor" will create an empty actor without any components, the other options will automatically add the required components for your choice.
Components
Contrary to SFM, there are no concrete actor types in PFM. Instead, every actor has a list of components associated with it which describe/define the behavior/function of that actor. For instance, if you create a camera in SFM, that actor is a camera entity. If you create a camera in PFM, that actor is an entity with a camera component. The key difference is that components in PFM can be freely added or removed to/from an actor. Example:
You create an actor X and add a camera component to it, which turns that actor into a camera. If you add another component to actor X, for instance a light source component, then actor X is both a camera and a light source at the same time. If you then remove the camera component from the actor, it ceases to be a camera, but remains to be a light source.
This allows you to flexibly change the behavior of an actor. Another example: Let's say you
You can also create custom components with Lua, and then add those components to your actors! Custom components can also add new animatable properties.
Components allow you to change the function and behavior of an actor.
You can find a list of components an actor has in the "Actor Editor":
To avoid cluttering the interface, not all of the actor's components are listed by default, and some may be hidden. Right-click on "Components" and choose "Add Component" to see which ones are hidden. By clicking one of the components it will be added to the interface (along with its properties, if it has any). You should only do this if you intend to modify the properties of one of the components.
The option "Create new Component" allows you to add an entirely new component to the actor:
This list includes all components known by the engine, many of which may not be suited for use in PFM!
You can also create entirely new components with Lua, which will also appear in this list.
If you select one or more components from the actor component list, you will get a set of properties on the right-hand side of the editor:
Most of these properties can be animated (with the exception of strings and a few other types).
Creating custom components
To create a new Lua-based component for use in PFM, follow these steps:
- Create a new addon in the "addons" directory
- Within that directory create the path and file "lua/entities/components/<component_name>/client/client.lua"
- "component_name" has to be lower-case and must not contain any special characters (aside from '_') or spaces!
- Open the "client.lua" in a text-editor and paste the following contents into it (and make sure to follow the comments):
-- Replace "CustomComponent" with a name of your choice (make sure it doesn't exist yet)
util.register_class("ents.CustomComponent",BaseEntityComponent)
local Component = ents.CustomComponent -- Also replace the name here
-- Register properties for this component. These will be editable (and animatable) in PFM
Component:RegisterMember(
"ExampleProperty", -- Property name
udm.TYPE_FLOAT, -- Property type
1.0, -- Default value
{
min = 0.0, -- Min value (hint for the UI)
max = 10.0 -- Max value (hint for the UI)
}
)
function Component:Initialize()
BaseEntityComponent.Initialize(self)
print("Initializing component of type '" .. self:GetComponentName() .. "'...")
-- Do something when this component has been added to an entity/actor
end
function Component:OnRemove()
print("Removing component of type '" .. self:GetComponentName() .. "'...")
-- Do some cleanup?
end
-- Register the component. "component_name" has to match the name of the directory in "entities/components/"!
ents.COMPONENT_CUSTOM = ents.register_component("component_name",Component)
The next time you start PFM, your component should appear in the component list automatically and you can add it to your actors.