Improved CallbackEvent inspector
This commit is contained in:
parent
73a85e4aab
commit
3bdc48260f
|
@ -197,7 +197,7 @@ namespace SHADE
|
|||
void Editor::renderScriptInInspector(Entity entity, Script^ script, int index)
|
||||
{
|
||||
// Constants
|
||||
const std::string LABEL = Convert::ToNative(script->GetType()->Name);
|
||||
const std::string LABEL = Convert::ToNative(script->GetType()->Name);
|
||||
|
||||
// Header
|
||||
SHEditorUI::PushID(index);
|
||||
|
@ -302,6 +302,10 @@ namespace SHADE
|
|||
title += ">";
|
||||
if (SHEditorUI::CollapsingHeader(Convert::ToNative(title)))
|
||||
{
|
||||
// Constants
|
||||
const std::string LABEL = Convert::ToNative(field->Name);
|
||||
SHEditorUI::PushID(LABEL);
|
||||
|
||||
ICallbackEvent^ callbackEvent = safe_cast<ICallbackEvent^>(field->GetValue(object));
|
||||
if (callbackEvent == nullptr)
|
||||
{
|
||||
|
@ -313,27 +317,39 @@ namespace SHADE
|
|||
if (action->IsRuntimeAction)
|
||||
continue;
|
||||
|
||||
if (action->TargetObject == nullptr)
|
||||
SHEditorUI::Text("Target Object");
|
||||
else
|
||||
SHEditorUI::Text(Convert::ToNative(action->TargetObject->GetType()->Name));
|
||||
// Attempt to get the object if any
|
||||
int entityId = static_cast<int>(-1);
|
||||
if (action->TargetObject)
|
||||
{
|
||||
Script^ script = safe_cast<Script^>(action->TargetObject);
|
||||
if (script)
|
||||
{
|
||||
entityId = static_cast<int>(script->Owner.GetEntity());
|
||||
}
|
||||
}
|
||||
SHEditorUI::InputInt("", entityId);
|
||||
SHEditorUI::SameLine();
|
||||
|
||||
if (action->TargetMethodName == nullptr)
|
||||
SHEditorUI::Text("Target Method Name");
|
||||
else
|
||||
SHEditorUI::Text(Convert::ToNative(action->TargetMethodName));
|
||||
System::String^ methodName = "";
|
||||
if (action->TargetMethodName != nullptr)
|
||||
{
|
||||
methodName = action->TargetMethodName;
|
||||
}
|
||||
std::string methodNameNative = Convert::ToNative(methodName);
|
||||
SHEditorUI::InputTextField("", methodNameNative);
|
||||
SHEditorUI::SameLine();
|
||||
if (SHEditorUI::Button("-"))
|
||||
{
|
||||
callbackEvent->DeregisterAction(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (SHEditorUI::Button("Add Action"))
|
||||
{
|
||||
callbackEvent->RegisterAction();
|
||||
}
|
||||
|
||||
SHEditorUI::PopID();
|
||||
}
|
||||
// Needs to present
|
||||
// - name and param list
|
||||
// Needs to present for each callbackaction
|
||||
// - object, methodinfo OR action
|
||||
// - Ways to add or remove items
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue