载入中...
搜索中...
未找到
Avatar.cpp
浏览该文件的文档.
257 av.addFunc("loadVroidModel", [vm = table.getHandle()](AvatarInstance* avatar, const std::string& path) {
260 av.addFunc("setHumanoidBoneRotation", [vm = table.getHandle()](AvatarInstance* avatar, const std::string& semantic,
262 return eve::script::projectResult(vm, avatar->setHumanoidBoneRotation(semantic, yaw, pitch, roll));
282 av.addFunc("setAnimConstraintStack", [](AvatarInstance* a, animation::AnimConstraintStack* stack) -> void {
290 av.addFunc("setDynamicBoneSolver", [](AvatarInstance* a, animation::DynamicBoneSolver* solver) -> void {
The single Squirrel projection for common Result, Status and Value.
Keyframed skeletal animation clip (local TRS tracks per bone). Script type: AnimClip.
Definition AnimClip.h:145
Unified avatar instance. Kind is a string: "image" | "live2d" | "vroid". Script-facing API avoids ove...
Definition AvatarInstance.h:112
bool bindAnimStateMachine(animation::AnimStateMachine *machine)
Bind an animation state machine that the avatar advances each update.
Definition AvatarInstance.cpp:548
bool setLayerColor(const std::string &name, float r, float g, float b, float a)
Sets the layer color.
Definition AvatarInstance.cpp:745
void setApplyRootMotion(bool enabled)
Apply root-bone X/Z deltas to the Avatar transform while animating.
Definition AvatarInstance.cpp:679
bool setLayerOffset(const std::string &name, float ox, float oy)
Sets the layer offset.
Definition AvatarInstance.cpp:737
float getParameterDefault(const std::string &name) const
Return a reflected parameter default, or zero for an unknown parameter.
Definition Avatar.cpp:46
std::string getAnimationEventLayer(int index) const
Source layer for an animation event ("base" for the base player).
Definition AvatarSkeletal.cpp:239
std::string getHumanoidBoneName(const std::string &semantic) const
Return the mapped skeleton bone name, or an empty string.
Definition AvatarSkeletal.cpp:78
float getParameter(const std::string &name) const
Returns the parameter.
Definition AvatarInstance.cpp:503
bool registerMotion(const std::string &name, animation::AnimClip *clip)
Register a motion name for setMotion(); the clip is not owned.
Definition AvatarInstance.cpp:671
int autoMapHumanoidBones()
Auto-map common VRM humanoid semantics from the currently bound skeleton.
Definition AvatarSkeletal.cpp:43
bool bindAnimPlayer(animation::AnimPlayer *player)
Bind a clip player that the avatar advances and skins each update.
Definition AvatarInstance.cpp:534
bool mapViseme(const std::string &viseme, const std::string &morphName)
Map a VRM viseme/expression semantic to an existing mesh morph.
Definition AvatarSkeletal.cpp:83
bool detachAttachment(const std::string &name)
Remove an attachment without destroying its Renderable3D.
Definition AvatarSkeletal.cpp:137
std::string getAnimationEventPayload(int index) const
Animation event payload, or empty for an invalid index.
Definition AvatarSkeletal.cpp:249
void bindTween(animation::Tween *tween)
Drive x/y/sx/sy and matching parameters from a Tween each update().
Definition AvatarSkeletal.cpp:446
animation::DynamicBoneSolver * getDynamicBoneSolver() const
Return the Avatar-owned solver, or null. @ownership Borrowed from this Avatar. @lifetime Valid until ...
Definition AvatarInstance.h:336
bool attachToBone(const std::string &name, const std::string &boneSemanticOrName, graphics::Renderable3D *renderable, float ox=0.f, float oy=0.f, float oz=0.f)
Attach a non-owned Renderable3D to a mapped humanoid semantic or bone name.
Definition AvatarSkeletal.cpp:121
animation::AnimConstraintStack * getAnimConstraintStack() const
Return the Avatar-owned constraint stack, or null. @ownership Borrowed from this Avatar....
Definition AvatarInstance.h:316
std::string getParameterName(int index) const
Returns the parameter name.
Definition AvatarInstance.cpp:518
graphics::Renderable2D * getLayerRenderable(const std::string &name)
Return the native Renderable2D owned by a named image layer.
Definition AvatarInstance.cpp:776
std::string getEquipmentRenderStackItem(int index) const
Active item id at a render-stack index, or empty text.
Definition AvatarInstance.cpp:421
bool bindAnimLayerMixer(animation::AnimLayerMixer *mixer)
Bind an override/additive layer mixer that the avatar advances each update.
Definition AvatarInstance.cpp:562
graphics::Mesh * getBoundMesh() const
Borrow the first imported mesh, or the manually bound mesh.
Definition AvatarVroid.cpp:173
bool getApplyRootMotion() const
Return whether root motion is applied to the Avatar transform.
Definition AvatarInstance.h:366
bool linkSceneNode(scene::Scene *scene, const std::string &nodeId)
Link this avatar to a node in Scene's current host.
Definition AvatarSkeletal.cpp:410
int getEquipmentRenderStackCount() const
Number of active visuals in canonical back-to-front render order.
Definition AvatarInstance.cpp:417
bool loadVroidModelPath(const std::string &path)
Compatibility-only bool projection of loadVroidModel; performs the real import.
Definition AvatarVroid.cpp:104
std::string getVroidVersion() const
Imported VRM specification version, or empty before import.
Definition AvatarVroid.cpp:107
bool bindVroidModelData(model3d::ModelData *data)
Binds vroid model data.
Definition AvatarVroid.cpp:114
int getExpressionCount() const
Return the number of imported and project-defined expressions.
Definition Avatar.cpp:65
bool defineParameter(const std::string &name, float defaultValue, float minimum, float maximum)
Define reflected Avatar parameter metadata for project-built inspectors.
Definition Avatar.cpp:38
bool bindAnimSkin(animation::AnimSkin *skin)
Bind CPU skin data used to deform the avatar mesh from the active pose.
Definition AvatarInstance.cpp:607
std::string getExpressionName(int index) const
Return a stable sorted expression name, or empty text.
Definition Avatar.cpp:73
animation::AnimClip * getMotionClip(const std::string &name) const
Return a registered non-owned motion clip, or nullptr.
Definition Avatar.cpp:97
int loadMorphNamesFromModel(int meshIndex=0)
Register morph target names from ModelData as parameters (weights default 0).
Definition AvatarVroid.cpp:121
void setParameter(const std::string &name, float value)
Sets the parameter.
Definition AvatarInstance.cpp:482
bool transitionExpression(const std::string &name, float duration)
Blend numeric/bool expression channels over duration seconds.
Definition AvatarInstance.cpp:855
std::string getAnimationEventName(int index) const
Animation event name, or empty for an invalid index.
Definition AvatarSkeletal.cpp:244
bool bakeMorphs()
Push parameter weights onto Mesh morphs and bake GPU verts when possible.
Definition AvatarVroid.cpp:186
bool setLookAtTarget(float x, float y, float z)
Set a world-space target tracked by the mapped humanoid head bone.
Definition AvatarSkeletal.cpp:108
bool setViseme(const std::string &viseme, float weight)
Set a mapped viseme weight and clear the previously active viseme.
Definition AvatarSkeletal.cpp:90
std::string getEquipmentVisualItem(const std::string &equipmentSlot) const
Return the currently projected item for a slot, or empty text when none is shown.
Definition AvatarInstance.cpp:412
std::string getEquipmentRenderStackLayer(int index) const
Wear-layer name at a render-stack index, or empty text.
Definition AvatarInstance.cpp:427
bool mapHumanoidBone(const std::string &semantic, const std::string &boneName)
Map a VRM humanoid semantic (for example "head") to a skeleton bone.
Definition AvatarSkeletal.cpp:36
void setRotation3D(float yaw, float pitch, float roll)
Sets the rotation 3 d.
Definition AvatarVroid.cpp:161
bool setLayerZ(const std::string &name, int zIndex)
Sets the layer z.
Definition AvatarInstance.cpp:752
void setMotionBlendTime(float seconds)
Set the cross-fade duration used when switching registered motions.
Definition AvatarInstance.cpp:677
bool isSceneLinked() const
Return whether this avatar is currently scene-driven.
Definition AvatarInstance.h:424
bool removeExpression(const std::string &name)
Remove a project-defined expression.
Definition Avatar.cpp:61
bool unregisterMotion(const std::string &name)
Remove a registered motion without destroying its clip.
Definition Avatar.cpp:83
animation::FootIKSolver * getFootIKSolver() const
Return the Avatar-owned paired-foot IK solver, or null. @ownership Borrowed from this Avatar....
Definition AvatarInstance.h:324
std::string getMotionName(int index) const
Return a stable sorted motion name, or empty text.
Definition Avatar.cpp:91
std::string getLive2DBackendName() const
Returns the live 2 d backend name.
Definition AvatarInstance.cpp:969
bool setLayerSize(const std::string &name, float w, float h)
Sets the layer size.
Definition AvatarInstance.cpp:759
int getAttachmentCount() const
Return the number of active bone attachments.
Definition AvatarInstance.h:417
int getVroidMeshCount() const
Number of imported mesh primitives; zero before successful import.
Definition AvatarVroid.cpp:105
float getParameterMinimum(const std::string &name) const
Return a reflected parameter minimum, or zero for an unknown parameter.
Definition Avatar.cpp:51
bool setLayerVisible(const std::string &name, bool visible)
Sets the layer visible.
Definition AvatarInstance.cpp:729
void setLookAtWeight(float weight)
Set VRM-style head look-at influence in the range 0..1.
Definition AvatarSkeletal.cpp:117
float getParameterMaximum(const std::string &name) const
Return a reflected parameter maximum, or one for an unknown parameter.
Definition Avatar.cpp:56
bool hasParameter(const std::string &name) const
True when parameter.
Definition AvatarInstance.cpp:509
bool defineExpression(const std::string &name, const std::string &spec)
Spec: "eyes=1;mouth=smile;blush=0" (semicolon-separated name=value).
Definition AvatarInstance.cpp:781
graphics::Renderable3D * getRenderable3D() const
Borrow the first imported render projection, or the manual projection.
Definition AvatarVroid.cpp:108
int getAnimationEventCount() const
Number of animation events emitted by the latest update.
Definition AvatarSkeletal.cpp:223
Avatar module — layered character rendering for VN / portrait use. Script: avatar <- eve....
Definition Avatar.h:25
static void registerLive2DBackend(Live2DBackendFactory factory)
C++ / plugin: replace Live2D backend factory. Pass nullptr to restore the built-in NullLive2DBackend ...
Definition Avatar.cpp:159
static Live2DBackendFactory live2DBackendFactory()
Live 2 d backend factory.
Definition Avatar.cpp:163
void render(graphics::Graphics *gfx)
Sync then draw Image/Live2D avatars via the shared 2D sprite queue (does not present)....
Definition Avatar.cpp:146
AvatarInstance * newLive2DAvatar()
Creates a live 2 d avatar. @ownership Caller deletes unless documented otherwise.
Definition Avatar.cpp:128
static bool hasLive2DBackend()
True when the active backend is a real rendering runtime, not the null stub.
Definition Avatar.cpp:178
AvatarInstance * newImageAvatar()
Creates a image avatar. @ownership Caller deletes unless documented otherwise.
Definition Avatar.cpp:126
static std::string getLive2DBackendName()
Backend name currently in effect ("null" when using the built-in stub).
Definition Avatar.cpp:170
AvatarInstance * newVroidAvatar()
Creates a vroid avatar. @ownership Caller deletes unless documented otherwise.
Definition Avatar.cpp:130
static ILive2DBackend * createLive2DBackend()
Always returns a backend: custom factory, else NullLive2DBackend.
Definition Avatar.cpp:165
Optional Live2D runtime backend (Cubism etc.). Registered from C++ / plugins.
Definition AvatarInstance.h:75
virtual bool isRuntimeAvailable() const
True only for a backend that can render a real Live2D model.
Definition AvatarInstance.h:82
Definition Graphics.h:125
static void collectSprites(std::vector< DrawItem2D > &out)
Append visible Renderable2D sprites into a shared queue.
Definition RenderSystem.cpp:319
static void drawItems(Graphics &gfx, std::vector< DrawItem2D > &items, bool present)
Sort and draw items. If present=true, calls gfx.present() at the end. Map::render uses present=false ...
Definition RenderSystem.cpp:389
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
Definition Avatar.cpp:12
ILive2DBackend *(*)() Live2DBackendFactory
Definition AvatarInstance.h:105
ILive2DBackend * createNullLive2DBackend()
Creates null live 2 d backend.
Definition Live2DNullBackend.h:70
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470