forked from Mirrors/openclonk
Qt Editor: Move EditorActions from EditorAction_* to a proplist EditorAction.*
parent
656aa303f9
commit
d605bab0be
|
@ -670,7 +670,8 @@ public func Definition(def)
|
|||
} } );
|
||||
UserAction->AddEvaluator("Object", nil, "$NPC$", "npc", [def, def.EvalObj_NPC]);
|
||||
// Clonks can create a dialogue
|
||||
Clonk.EditorAction_Dialogue = { Name="$Dialogue$", Command="SetDialogue(GetName(), true, true)", Select=true };
|
||||
if (!Clonk.EditorActions) Clonk.EditorActions = {};
|
||||
Clonk.EditorActions.Dialogue = { Name="$Dialogue$", Command="SetDialogue(GetName(), true, true)", Select=true };
|
||||
// Dialogue EditorProps
|
||||
if (!def.EditorProps) def.EditorProps = {};
|
||||
def.EditorProps.user_dialogue = { Name="$Dialogue$", Type="enum", OptionKey="Option", Options = [ { Name="$NoDialogue$" }, new UserAction.EvaluatorDefs.sequence { Group=nil } ] };
|
||||
|
|
|
@ -178,8 +178,11 @@ local ActMap = {
|
|||
},
|
||||
};
|
||||
|
||||
local EditorActions = {
|
||||
OpenDoor = { Name = "$DoorUp$", Command = "OpenDoor()" },
|
||||
CloseDoor = { Name = "$DoorDown$", Command = "CloseDoor()" }
|
||||
};
|
||||
|
||||
local Name = "$Name$";
|
||||
local EditorAction_OpenDoor = { Name="$DoorUp$", Command="OpenDoor()" };
|
||||
local EditorAction_CloseDoor = { Name="$DoorDown$", Command="CloseDoor()" };
|
||||
local Plane = 200;
|
||||
local Components = {Rock = 6};
|
||||
|
|
|
@ -942,16 +942,17 @@ void C4ConsoleGUIState::UpdateActionObject(C4Object *new_action_object)
|
|||
ui.objectActionPanel->itemAt(i)->widget()->deleteLater();
|
||||
}
|
||||
// Create new buttons
|
||||
// Actions are defined as locals prefixed EditorAction_ containing proplists
|
||||
// Actions are defined as properties in a local proplist called EditorActions
|
||||
if (!new_action_object) return;
|
||||
const char *editor_action_prefix = "EditorAction_";
|
||||
auto new_properties = new_action_object->GetSortedProperties(editor_action_prefix, &::ScriptEngine);
|
||||
C4PropList *editor_actions_list = new_action_object->GetPropertyPropList(P_EditorActions);
|
||||
if (!editor_actions_list) return;
|
||||
auto new_properties = editor_actions_list->GetSortedProperties(nullptr);
|
||||
int row = 0, column = 0;
|
||||
for (C4String *action_def_id : new_properties)
|
||||
{
|
||||
// Get action definition proplist
|
||||
C4Value action_def_val;
|
||||
if (!new_action_object->GetPropertyByS(action_def_id, &action_def_val))
|
||||
if (!editor_actions_list->GetPropertyByS(action_def_id, &action_def_val))
|
||||
{
|
||||
// property disappeared (cannot happen)
|
||||
continue;
|
||||
|
@ -967,7 +968,7 @@ void C4ConsoleGUIState::UpdateActionObject(C4Object *new_action_object)
|
|||
if (!action_name)
|
||||
{
|
||||
// Fallback to identifier for unnamed actions
|
||||
action_name = ::Strings.RegString(action_def_id->GetCStr() + strlen(editor_action_prefix));
|
||||
action_name = action_def_id;
|
||||
}
|
||||
// Script command to execute
|
||||
C4RefCntPointer<C4String> script_command = action_def->GetPropertyStr(P_Command);
|
||||
|
|
|
@ -273,6 +273,7 @@ C4StringTable::C4StringTable()
|
|||
P[P_EditOnSelection] = "EditOnSelection";
|
||||
P[P_EditorProps] = "EditorProps";
|
||||
P[P_DefaultEditorProp] = "DefaultEditorProp";
|
||||
P[P_EditorActions] = "EditorActions";
|
||||
P[P_CopyDefault] = "CopyDefault";
|
||||
P[P_Display] = "Display";
|
||||
P[P_DefaultValue] = "DefaultValue";
|
||||
|
|
|
@ -497,6 +497,7 @@ enum C4PropertyName
|
|||
P_EditOnSelection,
|
||||
P_EditorProps,
|
||||
P_DefaultEditorProp,
|
||||
P_EditorActions,
|
||||
P_CopyDefault,
|
||||
P_Display,
|
||||
P_DefaultValue,
|
||||
|
|
Loading…
Reference in New Issue