Compare commits

..

1 Commits

Author SHA1 Message Date
verysecrethero 0aedeb61b4 CapturePointSystem now sets all children visible/not visible for each red/blue/spectator 2016-03-11 14:15:46 +01:00
5 changed files with 115 additions and 30 deletions
+1 -1
Submodule assets updated: 007b54bd67...33455a9d10
-1
View File
@@ -47,7 +47,6 @@ private:
// Utility functions
EntityWrapper importEntity(EntityWrapper parent, boost::filesystem::path filePath);
void setWidgetMode(EditorGUI::WidgetMode mode);
bool isAnyParentMissingTransform(EntityID entityID);
// GUI callbacks
void OnEntitySelected(EntityWrapper entity);
@@ -13,6 +13,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0.980392158" G="1" R="1"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="-0.100000001" Y="0" Z="0"/>
@@ -28,6 +29,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
@@ -52,6 +54,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
@@ -67,6 +70,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
@@ -82,6 +86,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
@@ -198,6 +203,7 @@
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="39.2156868" G="0" R="3.13725495"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Scale X="-70" Y="-70" Z="-70"/>
@@ -210,7 +216,7 @@
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Entity name="CapP">
<Components>
<c:AABB/>
<c:CapturePoint>
@@ -254,6 +260,13 @@
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Blue">
@@ -265,7 +278,25 @@
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
</c:Transform>
</Components>
<Children/>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Spectator">
<Components>
@@ -276,7 +307,43 @@
<Scale X="1" Y="5.70000029" Z="1"/>
</c:Transform>
</Components>
<Children/>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -287,11 +354,11 @@
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Entity name="CapP">
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>-15</CaptureTimer>
<CaptureTimer>12</CaptureTimer>
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
@@ -317,7 +384,38 @@
<Scale X="4.4000001" Y="2" Z="3.70000029"/>
</c:Transform>
</Components>
<Children/>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Blue">
<Components>
+3 -20
View File
@@ -4,7 +4,7 @@
#include "Editor/EditorWidgetSystem.h"
#include "Core/EntityFile.h"
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
: System(params)
, m_Renderer(renderer)
, m_RenderFrame(renderFrame)
@@ -14,7 +14,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
m_EditorWorldSystemPipeline->AddSystem<UniformScaleSystem>(0);
m_EditorWorldSystemPipeline->AddSystem<EditorWidgetSystem>(0, m_Renderer);
m_EditorWorldSystemPipeline->AddSystem<EditorRenderSystem>(1, m_Renderer, m_RenderFrame);
m_EditorCamera = importEntity(EntityWrapper(m_EditorWorld, EntityID_Invalid), "Schema/Entities/Empty.xml");
m_ActualCamera = m_EditorCamera;
m_EditorWorld->AttachComponent(m_EditorCamera.ID, "Transform");
@@ -72,9 +72,6 @@ void EditorSystem::Update(double dt)
m_EditorStats->Draw(actualDelta);
if (m_CurrentSelection.Valid() && m_Widget.Valid()) {
if (isAnyParentMissingTransform(m_CurrentSelection.ID)) {
return;
}
(glm::vec3&)m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection);
if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) {
(glm::vec3&)m_Widget["Transform"]["Orientation"] = Transform::AbsoluteOrientationEuler(m_CurrentSelection);
@@ -82,6 +79,7 @@ void EditorSystem::Update(double dt)
(glm::vec3&)m_Widget["Transform"]["Orientation"] = glm::vec3(0, 0, 0);
}
}
m_EditorWorldSystemPipeline->Update(actualDelta);
ComponentWrapper& cameraTransform = m_EditorCamera["Transform"];
@@ -205,9 +203,6 @@ bool EditorSystem::OnMousePress(const Events::MousePress& e)
bool EditorSystem::OnWidgetDelta(const Events::WidgetDelta& e)
{
if (m_CurrentSelection.Valid()) {
if (isAnyParentMissingTransform(m_CurrentSelection.ID)) {
return false;
}
if (m_WidgetSpace == EditorGUI::WidgetSpace::Global) {
glm::quat parentOrientation;
glm::vec3 parentScale(1.f);
@@ -314,15 +309,3 @@ void EditorSystem::setWidgetMode(EditorGUI::WidgetMode mode)
m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection.World, m_CurrentSelection.ID);
}
bool EditorSystem::isAnyParentMissingTransform(EntityID entityID)
{
EntityWrapper entity(m_World, entityID);
while (entity.Parent().Valid()) {
if (!entity.HasComponent("Transform")) {
return true;
}
entity = entity.Parent();
}
return false;
}
+7 -2
View File
@@ -234,9 +234,14 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) {
(bool&)capturePointModels["Model"]["Visible"] = isOwner;
for (auto& capModel : capturePointModels.ChildrenWithComponent("Model"))
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform"))
{
(bool&)capModel["Model"]["Visible"] = isOwner;
if (capModel.HasComponent("Model")) {
(bool&)capModel["Model"]["Visible"] = isOwner;
}
if (capModel.HasComponent("PointLight")) {
(bool&)capModel["PointLight"]["Visible"] = isOwner;
}
}
}