This commit is contained in:
Mikulas Florek 2017-09-21 00:14:45 +02:00
parent c857a8ff21
commit e5f20794a7
7 changed files with 38 additions and 17 deletions

View file

@ -624,13 +624,13 @@ struct AnimationSceneImpl LUMIX_FINAL : public AnimationScene
Entity getSharedControllerParent(ComponentHandle cmp) override { return m_shared_controllers[{cmp.index}].parent; }
float getTimeScale(ComponentHandle cmp) { return m_animables[{cmp.index}].time_scale; }
void setTimeScale(ComponentHandle cmp, float time_scale) { m_animables[{cmp.index}].time_scale = time_scale; }
float getStartTime(ComponentHandle cmp) { return m_animables[{cmp.index}].start_time; }
void setStartTime(ComponentHandle cmp, float time) { m_animables[{cmp.index}].start_time = time; }
float getAnimableTimeScale(ComponentHandle cmp) { return m_animables[{cmp.index}].time_scale; }
void setAnimableTimeScale(ComponentHandle cmp, float time_scale) { m_animables[{cmp.index}].time_scale = time_scale; }
float getAnimableStartTime(ComponentHandle cmp) { return m_animables[{cmp.index}].start_time; }
void setAnimableStartTime(ComponentHandle cmp, float time) { m_animables[{cmp.index}].start_time = time; }
void setControllerSource(ComponentHandle cmp, const Path& path)
void setControllerSource(ComponentHandle cmp, const Path& path) override
{
auto& controller = m_controllers.get({cmp.index});
unloadController(controller.resource);
@ -1148,10 +1148,10 @@ AnimationSystemImpl::AnimationSystemImpl(Engine& engine)
ANIMATION_TYPE));
PropertyRegister::add("animable",
LUMIX_NEW(m_allocator, DecimalPropertyDescriptor<AnimationSceneImpl>)(
"Start time", &AnimationSceneImpl::getStartTime, &AnimationSceneImpl::setStartTime, 0, FLT_MAX, 0.1f));
"Start time", &AnimationSceneImpl::getAnimableStartTime, &AnimationSceneImpl::setAnimableStartTime, 0, FLT_MAX, 0.1f));
PropertyRegister::add("animable",
LUMIX_NEW(m_allocator, DecimalPropertyDescriptor<AnimationSceneImpl>)(
"Time scale", &AnimationSceneImpl::getTimeScale, &AnimationSceneImpl::setTimeScale, 0, FLT_MAX, 0.1f));
"Time scale", &AnimationSceneImpl::getAnimableTimeScale, &AnimationSceneImpl::setAnimableTimeScale, 0, FLT_MAX, 0.1f));
PropertyRegister::add("shared_anim_controller",
LUMIX_NEW(m_allocator, EntityPropertyDescriptor<AnimationSceneImpl>)(

View file

@ -29,10 +29,15 @@ struct AnimationScene : public IScene
virtual void updateAnimable(ComponentHandle cmp, float time_delta) = 0;
virtual void updateController(ComponentHandle cmp, float time_delta) = 0;
virtual Entity getControllerEntity(ComponentHandle cmp) = 0;
virtual float getAnimableTimeScale(ComponentHandle cmp) = 0;
virtual void setAnimableTimeScale(ComponentHandle cmp, float time_scale) = 0;
virtual float getAnimableStartTime(ComponentHandle cmp) = 0;
virtual void setAnimableStartTime(ComponentHandle cmp, float time) = 0;
virtual u8* getControllerInput(ComponentHandle cmp) = 0;
virtual void setControllerInput(ComponentHandle cmp, int input_idx, float value) = 0;
virtual void setControllerInput(ComponentHandle cmp, int input_idx, bool value) = 0;
virtual struct RigidTransform getControllerRootMotion(ComponentHandle cmp) = 0;
virtual void setControllerSource(ComponentHandle cmp, const Path& path) = 0;
virtual class Path getControllerSource(ComponentHandle cmp) = 0;
virtual Anim::ComponentInstance* getControllerRoot(ComponentHandle cmp) = 0;
virtual int getControllerInputIndex(ComponentHandle cmp, const char* name) const = 0;

View file

@ -405,6 +405,7 @@ public:
bool hasFocus() override { return m_is_focused; }
private:
void checkShortcuts();
void beginCommandGroup(u32 type);
void endCommandGroup();
void newController();
@ -886,8 +887,15 @@ void AnimationEditor::clearUndoStack()
}
void AnimationEditor::checkShortcuts()
{
}
void AnimationEditor::update(float time_delta)
{
checkShortcuts();
if (!m_is_playing) return;
auto& entities = m_app.getWorldEditor()->getSelectedEntities();
if (entities.empty()) return;

View file

@ -1522,14 +1522,14 @@ struct NavigationSceneImpl LUMIX_FINAL : public NavigationScene
}
bool isGettingRootMotionFromAnim(ComponentHandle cmp)
bool isGettingRootMotionFromAnim(ComponentHandle cmp) override
{
Entity entity = {cmp.index};
return (m_agents[entity].flags & Agent::GET_ROOT_MOTION_FROM_ANIM_CONTROLLER) != 0;
}
void setIsGettingRootMotionFromAnim(ComponentHandle cmp, bool is)
void setIsGettingRootMotionFromAnim(ComponentHandle cmp, bool is) override
{
Entity entity = {cmp.index};
if (is)
@ -1539,14 +1539,14 @@ struct NavigationSceneImpl LUMIX_FINAL : public NavigationScene
}
bool useAgentRootMotion(ComponentHandle cmp)
bool useAgentRootMotion(ComponentHandle cmp) override
{
Entity entity = {cmp.index};
return (m_agents[entity].flags & Agent::USE_ROOT_MOTION) != 0;
}
void setUseAgentRootMotion(ComponentHandle cmp, bool use_root_motion)
void setUseAgentRootMotion(ComponentHandle cmp, bool use_root_motion) override
{
Entity entity = {cmp.index};
if (use_root_motion)
@ -1556,28 +1556,28 @@ struct NavigationSceneImpl LUMIX_FINAL : public NavigationScene
}
void setAgentRadius(ComponentHandle cmp, float radius)
void setAgentRadius(ComponentHandle cmp, float radius) override
{
Entity entity = {cmp.index};
m_agents[entity].radius = radius;
}
float getAgentRadius(ComponentHandle cmp)
float getAgentRadius(ComponentHandle cmp) override
{
Entity entity = { cmp.index };
return m_agents[entity].radius;
}
void setAgentHeight(ComponentHandle cmp, float height)
void setAgentHeight(ComponentHandle cmp, float height) override
{
Entity entity = { cmp.index };
m_agents[entity].height = height;
}
float getAgentHeight(ComponentHandle cmp)
float getAgentHeight(ComponentHandle cmp) override
{
Entity entity = {cmp.index};
return m_agents[entity].height;

View file

@ -21,7 +21,15 @@ public:
virtual void setActorActive(Entity entity, bool active) = 0;
virtual float getAgentSpeed(Entity entity) = 0;
virtual float getAgentYawDiff(Entity entity) = 0;
virtual void setAgentRadius(ComponentHandle cmp, float radius) = 0;
virtual float getAgentRadius(ComponentHandle cmp) = 0;
virtual void setAgentHeight(ComponentHandle cmp, float height) = 0;
virtual float getAgentHeight(ComponentHandle cmp) = 0;
virtual void setAgentRootMotion(Entity, const Vec3& root_motion) = 0;
virtual bool useAgentRootMotion(ComponentHandle cmp) = 0;
virtual void setUseAgentRootMotion(ComponentHandle cmp, bool use_root_motion) = 0;
virtual bool isGettingRootMotionFromAnim(ComponentHandle cmp) = 0;
virtual void setIsGettingRootMotionFromAnim(ComponentHandle cmp, bool is) = 0;
virtual bool generateNavmesh() = 0;
virtual bool generateTile(int x, int z, bool keep_data) = 0;
virtual bool generateTileAt(const Vec3& pos, bool keep_data) = 0;

View file

@ -2481,7 +2481,7 @@ struct ShaderEditorPlugin LUMIX_FINAL : public StudioApp::IPlugin
void update(float) override { m_compiler->update(); }
void onAction() { m_shader_editor.m_is_open = !m_shader_editor.m_is_open; }
void onWindowGUI() override { m_shader_editor.onGUI(*m_compiler); }
bool hasFocus() override { return m_shader_editor.isFocused(); }
bool hasFocus() override { return m_shader_editor.hasFocus(); }
bool isOpened() const { return m_shader_editor.m_is_open; }
StudioApp& m_app;

View file

@ -86,7 +86,7 @@ public:
void loadNodeConnections(InputBlob& blob, Node& node);
void saveNode(OutputBlob& blob, Node& node);
void saveNodeConnections(OutputBlob& blob, Node& node);
bool isFocused() const { return m_is_focused; }
bool hasFocus() const { return m_is_focused; }
void undo();
void redo();