5 static const int POPUP_ID_SCENE_MANAGER = 0;
6 static const int POPUP_ID_SCENE_SETTINGS = 1;
7 static const int POPUP_ID_SCENE_NEW = 2;
8 static const int POPUP_ID_SCENE_RENAME = 3;
9 static const int POPUP_ID_SCENE_DELETE = 4;
10 static const int POPUP_ID_NOTIFY = 5;
11 static const int POPUP_ID_EDITOR_SETTINGS = 6;
12 static const int POPUP_ID_INIT_SCRIPT = 7;
13 static const int POPUP_ID_POSITION_MANAGER = 8;
14 static const int POPUP_ID_PRESET_NEW = 9;
15 static const int POPUP_ID_PRESET_RENAME = 10;
16 static const int POPUP_ID_CONFIGS = 11;
17 const string CONST_DEFAULT_PRESET_PREFIX =
"[Default]";
22 m_PresetsTextListbox.ClearItems();
28 TStringArray presets_array = m_ConfigDebugProfileFixed.GetPresets();
29 for ( i = 0; i < presets_array.Count(); i++ )
31 m_PresetsTextListbox.AddItem(
"["+presets_array.Get(i)+
"]",
new PresetParams ( presets_array.Get(i),
true,
false), 0);
36 for ( i = 0; i < custom_presets_array.Count(); i++ )
38 m_PresetsTextListbox.AddItem( custom_presets_array.Get(i),
new PresetParams ( custom_presets_array.Get(i),
false,
false), 0);
42 if ( default_preset !=
"" )
45 int index = GetPresetIndexByName( default_preset );
46 if ( IsPresetFixed( default_preset) )
48 default_preset =
"[" + default_preset +
"]";
51 if( index > -1 && index < m_PresetsTextListbox.GetNumItems() )
53 m_PresetsTextListbox.GetItemData( index, 0, preset_params_array );
54 m_PresetsTextListbox.SetItem( index, default_preset + CONST_DEFAULT_PRESET_PREFIX, preset_params_array, 0 );
59 bool IsPresetFixed(
string preset_name )
61 int preset_index = GetPresetIndexByName( preset_name);
63 if ( preset_index > -1 && preset_index < m_PresetsTextListbox.GetNumItems() )
65 m_PresetsTextListbox.GetItemData( preset_index, 0, item_params_array );
66 return item_params_array.param2;
71 int GetPresetIndexByName(
string preset_name )
74 for ( i = 0; i < m_PresetsTextListbox.GetNumItems(); i++ )
77 m_PresetsTextListbox.GetItemData( i, 0, item_params_array );
79 if ( item_params_array.param1 == preset_name )
87 void NewPreset(
string preset_name )
95 if ( GetCurrentPresetIndex() != -1 )
102 void SetDefaultPreset(
int preset_index )
106 if ( default_preset !=
"" )
108 int index = GetPresetIndexByName( default_preset );
110 if ( IsPresetFixed( default_preset) )
112 default_preset =
"[" + default_preset +
"]";
115 if( index > -1 && index < m_PresetsTextListbox.GetNumItems() )
117 m_PresetsTextListbox.GetItemData( index, 0, prev_preset_params_array );
118 prev_preset_params_array.param3 =
false;
119 m_PresetsTextListbox.SetItem( index, default_preset, prev_preset_params_array, 0 );
125 string preset_name = GetCurrentPresetName();
126 if ( IsPresetFixed( preset_name) )
128 preset_name =
"[" + preset_name +
"]";
132 index = GetCurrentPresetIndex();
133 if ( index > -1 && index < m_PresetsTextListbox.GetNumItems() )
135 m_PresetsTextListbox.GetItemData( index, 0, preset_params_array );
136 preset_params_array.param3 =
true;
137 m_PresetsTextListbox.SetItem( index, preset_name + CONST_DEFAULT_PRESET_PREFIX, preset_params_array, 0 );
149 void RenamePreset(
string new_preset_name )
151 if ( GetCurrentPresetIndex() != -1 )
159 void RenderPresetItems()
163 m_PresetItemsTextListbox.ClearItems();
164 if ( GetCurrentPresetIndex() != -1 )
166 bool isFixed = IsCurrentPresetFixed();
171 m_ConfigDebugProfileFixed.GetPresetItems( GetCurrentPresetName(), preset_array );
180 for ( i = 0; i < preset_array.Count(); i++)
182 m_PresetItemsTextListbox.AddItem( preset_array.Get(i), NULL, 0);
188 string GetCurrentPresetName()
190 int index = GetCurrentPresetIndex();
192 if ( index > -1 && index < m_PresetsTextListbox.GetNumItems() )
195 m_PresetsTextListbox.GetItemData( index, 0, item_params_array );
196 return item_params_array.param1;
201 string GetCurrentItemName()
203 if ( GetCurrentItemIndex() != -1 )
206 m_PresetItemsTextListbox.GetItemText( GetCurrentItemIndex(), 0, item_name );
212 string GetCurrentObjectName()
214 int selected_row_index = m_ClWgtLbxClassesList.GetSelectedRow();
215 if ( selected_row_index != -1 )
218 m_ClWgtLbxClassesList.GetItemText( selected_row_index, 0, item_name );
224 int GetCurrentPresetIndex()
226 return m_PresetsTextListbox.GetSelectedRow();
229 int GetCurrentItemIndex()
231 return m_PresetItemsTextListbox.GetSelectedRow();
234 bool IsCurrentPresetFixed()
236 int index = GetCurrentPresetIndex();
237 if ( index > -1 && index < m_PresetsTextListbox.GetNumItems() )
240 m_PresetsTextListbox.GetItemData( index, 0, item_params_array );
241 return item_params_array.param2;
246 void AddItemToPreset()
248 int selected_row_index = m_ClWgtLbxClassesList.GetSelectedRow();
249 if ( selected_row_index != -1 && GetCurrentPresetIndex() != -1 )
252 m_ClWgtLbxClassesList.GetItemText( selected_row_index, 0, item_name );
258 void RemoveItemFromPreset()
260 if ( GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1 )
268 void SetPreset(
bool clear_inventory,
string preset_name)
271 if ( GetCurrentPresetIndex() != -1 )
273 bool is_preset_fixed = IsCurrentPresetFixed();
276 if ( is_preset_fixed )
278 m_ConfigDebugProfileFixed.GetPresetItems( preset_name, preset_array );
286 if ( clear_inventory )
288 m_Developer.ClearInventory(player);
291 for ( i = 0; i < preset_array.Count(); i++)
295 if ( is_preset_fixed )
297 health = m_ConfigDebugProfileFixed.GetItemHealth( preset_name, i );
298 quantity = m_ConfigDebugProfileFixed.GetItemQuantity( preset_name, i );
306 m_Developer.SpawnEntityInPlayerInventory(player, preset_array.Get(i), health, quantity);
313 int new_index = GetCurrentItemIndex() - 1;
314 if ( GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1 && new_index > -1)
318 m_PresetItemsTextListbox.SelectRow (new_index);
324 int new_index = GetCurrentItemIndex() + 1;
325 if ( GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1 && new_index < m_PresetItemsTextListbox.GetNumItems() )
329 m_PresetItemsTextListbox.SelectRow (new_index);
333 void SaveProfileSpawnDistance()
345 override bool UseMouse()
353 override bool UseKeyboard()
362 void SceneEditorMenu()
364 m_ModuleSceneManager = PluginSceneManager.Cast(
GetPlugin(PluginSceneManager) );
365 m_ModuleSceneManager.OnUIEditorOpened();
376 void ~SceneEditorMenu()
382 m_ModuleSceneManager.OnUIEditorClosed();
383 m_ModuleSceneManager = NULL;
386 m_NotifyFadeTimer.Stop();
395 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/scene_editor/day_z_scene_editor.layout");
396 m_WgtPnlWrapper = layoutRoot.FindAnyWidget(
"pnl_presets_wrapper_outer");
397 m_SlWgtLoadedScene =
TextWidget.Cast( layoutRoot.FindAnyWidget(
"txt_left_label_loaded_scene") );
399 m_SlWgtLbxObjectsList = TextListboxWidget.Cast(layoutRoot.FindAnyWidget(
"txtlist_left_items") );
401 m_SlWgtEbxFilter =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"edit_left_search_item") );
403 m_SlWgtSelect = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_left_select") );
404 m_SlWgtFocus = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_left_focus") );
406 m_WgtPopupsMain = layoutRoot.FindAnyWidget(
"pnl_popups");
408 m_WgtPopupsBg = layoutRoot.FindAnyWidget(
"pnl_popup_bg");
410 m_ClWgtEbxFilter =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"edit_left_search_class") );
412 m_ClWgtLbxClassesList = TextListboxWidget.Cast(layoutRoot.FindAnyWidget(
"txtlist_left_classes") );
414 m_WgtBtnSceneManager = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_top_scene_manager") );
415 m_WgtBtnPositionManager = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_top_position_manager") );
416 m_WgtBtnSceneSettings = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_top_settings") );
417 m_ClWgtButtonAddAtt = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_left_cl_add_attachment") );
418 m_WgtBtnSceneSave = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_top_save_scene") );
419 m_WgtBtnEditorSettings = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_top_editor_settings") );
420 m_WgtBtnEditInitScript = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_right_prop_pos_iscr_value") );
421 m_WgtBtnDeleteRuler = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_delete_ruler") );
422 m_WgtBtnLeftPresets = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btn_left_presets") );
425 m_PrWgtClassName =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"txt_right_prop_class_value") );
426 m_PrWgtPoxX =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"ebx_right_prop_pos_x_value") );
427 m_PrWgtPoxY =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"ebx_right_prop_pos_y_value") );
428 m_PrWgtPoxZ =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"ebx_right_prop_pos_z_value") );
429 m_PrWgtDir =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"ebx_right_prop_pos_dir_value") );
430 m_PrWgtDmg =
EditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"ebx_right_prop_pos_hlt_value") );
431 m_PrWgtAttRoot = layoutRoot.FindAnyWidget(
"pnl_right_inspector_attachments");
432 m_PrWgtAttTitle = layoutRoot.FindAnyWidget(
"pnl_att_title");
436 m_NotifyWgtPanel = layoutRoot.FindAnyWidget(
"pnl_notify");
437 m_NotifyWgtPanel.SetAlpha(0.0);
438 m_NotifyFadeTimer =
new WidgetFadeTimer;
441 m_Popups.Insert(POPUP_ID_SCENE_MANAGER,
new UIPopupScriptSceneManager(layoutRoot.FindAnyWidget(
"pnl_popup_scene_manager")));
442 m_Popups.Insert(POPUP_ID_POSITION_MANAGER,
new UIPopupScriptPositionManager(layoutRoot.FindAnyWidget(
"pnl_popup_position_manager")));
443 m_Popups.Insert(POPUP_ID_SCENE_SETTINGS,
new UIPopupScriptSceneSettings(layoutRoot.FindAnyWidget(
"pnl_popup_settings")) );
444 m_Popups.Insert(POPUP_ID_SCENE_NEW,
new UIPopupScriptSceneNew(layoutRoot.FindAnyWidget(
"pnl_popup_scene_new")) );
445 m_Popups.Insert(POPUP_ID_SCENE_RENAME,
new UIPopupScriptSceneRename(layoutRoot.FindAnyWidget(
"pnl_popup_scene_rename")) );
446 m_Popups.Insert(POPUP_ID_SCENE_DELETE,
new UIPopupScriptSceneDelete(layoutRoot.FindAnyWidget(
"pnl_popup_scene_delete")) );
447 m_Popups.Insert(POPUP_ID_NOTIFY,
new UIPopupScriptNotify(layoutRoot.FindAnyWidget(
"pnl_popup_notify")) );
448 m_Popups.Insert(POPUP_ID_EDITOR_SETTINGS,
new UIPopupScriptEditorSettings(layoutRoot.FindAnyWidget(
"pnl_popup_editor_settings")));
449 m_Popups.Insert(POPUP_ID_INIT_SCRIPT,
new UIPopupScriptInitScript(layoutRoot.FindAnyWidget(
"pnl_popup_init_script")));
450 m_Popups.Insert(POPUP_ID_PRESET_NEW,
new UIPopupScriptPresetNew(layoutRoot.FindAnyWidget(
"pnl_popup_preset_new")));
451 m_Popups.Insert(POPUP_ID_PRESET_RENAME,
new UIPopupScriptPresetRename(layoutRoot.FindAnyWidget(
"pnl_popup_preset_rename")));
452 m_Popups.Insert(POPUP_ID_CONFIGS,
new UIPopupScriptConfigs(layoutRoot.FindAnyWidget(
"pnl_popup_configs")));
454 m_PresetsTextListbox = TextListboxWidget.Cast( layoutRoot.FindAnyWidget(
"pnl_presets") );
455 m_PresetItemsTextListbox = TextListboxWidget.Cast( layoutRoot.FindAnyWidget(
"pnl_preset_items") );
456 m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(
GetPlugin(PluginConfigDebugProfileFixed) );
458 m_PresetAddItemtButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_add_to_preset") );
459 m_PresetRemoveItemButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_remove_from_preset") );
460 m_SpawnOnGroundButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_spawn_on_ground") );
461 m_SpawnInInventoryButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_spawn_in_inventory") );
462 m_SpawnAsAttachmentButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_spawn_as_attachment") );
463 m_UpButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_up") );
464 m_DownButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_down") );
465 m_Developer = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper) );
466 m_QuantityEditBox =
EditBoxWidget.Cast( layoutRoot.FindAnyWidget(
"txt_quantity_value") );
467 m_DamageEditBox =
EditBoxWidget.Cast( layoutRoot.FindAnyWidget(
"txt_damage_value") );
468 m_SpawnDistanceEditBox =
EditBoxWidget.Cast( layoutRoot.FindAnyWidget(
"txt_distance_value") );
469 m_PresetNewButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_new") );
470 m_PresetDeleteButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_delete") );
471 m_PresetRenameButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_rename") );
472 m_PresetSetDefaultButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_default") );
473 m_CopyToClipboardButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"btn_copy_to_clipboard") );
474 m_ConfigsButton =
EditBoxWidget.Cast( layoutRoot.FindAnyWidget(
"btn_top_configs") );
489 if( w == m_PresetItemsTextListbox || w == m_PresetsTextListbox || w == m_ClWgtLbxClassesList )
491 SaveProfileSpawnDistance();
494 if ( m_SelectedObjectIsPreset )
503 if(GetCurrentItemIndex() != -1)
506 quantity =
m_ConfigDebugProfile.GetItemQuantity( GetCurrentPresetName(), GetCurrentItemIndex() );
519 super.OnClick(w,
x,
y, button);
523 if ( w == m_WgtBtnSceneManager )
525 PopupOpen(POPUP_ID_SCENE_MANAGER,
Param.Cast( NULL ) );
529 else if( w == m_ConfigsButton )
531 PopupOpen( POPUP_ID_CONFIGS, NULL );
534 else if( w == m_PresetsTextListbox )
537 m_SelectedObjectIsPreset =
true;
541 else if ( w == m_PresetSetDefaultButton )
543 if ( GetCurrentPresetName() !=
"" )
545 SetDefaultPreset( GetCurrentPresetIndex() );
549 else if ( w == m_PresetNewButton )
551 PopupOpen( POPUP_ID_PRESET_NEW, NULL );
555 else if ( w == m_PresetRenameButton )
557 PopupOpen( POPUP_ID_PRESET_RENAME, NULL );
560 else if( w == m_CopyToClipboardButton )
565 else if ( w == m_PresetDeleteButton )
567 if ( GetCurrentPresetName() !=
"" )
573 else if( w == m_SpawnOnGroundButton || w == m_SpawnAsAttachmentButton || w == m_SpawnInInventoryButton )
575 SaveProfileSpawnDistance();
577 float distance = m_SpawnDistanceEditBox.GetText().ToFloat();
580 if( GetCurrentItemIndex() != -1 )
583 quantity =
m_ConfigDebugProfile.GetItemQuantity( GetCurrentPresetName(), GetCurrentItemIndex() );
588 case m_SpawnOnGroundButton:
590 if ( m_SelectedObjectIsPreset )
600 case m_SpawnAsAttachmentButton:
602 Man player =
GetGame().GetPlayer();
605 vector rayEnd = rayStart +
GetGame().GetCurrentCameraDirection() * 1.5;
608 int hitComponentIndex;
609 ref set<Object> hitObjects =
new set<Object>;
610 DayZPhysics.RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player);
613 if( hitObjects.Count() )
614 target = hitObjects.Get(0);
616 if ( target != NULL && target.IsInherited(
EntityAI) )
628 case m_SpawnInInventoryButton:
636 else if( w == m_PresetItemsTextListbox )
638 m_SelectedObjectIsPreset =
false;
641 if( GetCurrentItemIndex() != -1 )
643 float item_health =
m_ConfigDebugProfile.GetItemHealth( GetCurrentPresetName(), GetCurrentItemIndex() );
644 int item_quantity =
m_ConfigDebugProfile.GetItemQuantity( GetCurrentPresetName(), GetCurrentItemIndex() );
646 m_DamageEditBox.SetText( item_health.ToString() );
647 m_QuantityEditBox.SetText( item_quantity.ToString() );
652 else if( w == m_UpButton )
657 else if( w == m_DownButton )
662 else if( w == m_WgtBtnLeftPresets )
664 if( m_WgtPnlWrapper.IsVisible() )
666 m_WgtPnlWrapper.Show(
false);
667 m_WgtBtnLeftPresets.SetText(
"Presets >>");
671 m_WgtPnlWrapper.Show(
true);
672 m_WgtBtnLeftPresets.SetText(
"Presets <<");
677 else if ( w == m_PresetAddItemtButton )
682 else if ( w == m_PresetRemoveItemButton )
684 RemoveItemFromPreset();
687 else if ( w == m_WgtBtnPositionManager )
689 m_PopupScriptPositionManager = UIPopupScriptPositionManager.Cast( PopupOpen( POPUP_ID_POSITION_MANAGER,
Param.Cast( NULL ) ) );
692 else if ( w == m_WgtBtnSceneSettings )
694 PopupOpen(POPUP_ID_SCENE_SETTINGS, NULL);
697 else if ( w == m_SlWgtSelect )
699 row_index = m_SlWgtLbxObjectsList.GetSelectedRow();
701 if ( m_SlObjectsList.Count() > 0 && m_SlObjectsList.Count() > row_index )
703 m_ModuleSceneManager.SelectObject(m_SlObjectsList.GetElement(row_index));
708 else if ( w == m_SlWgtFocus )
710 m_ModuleSceneManager.SelectedObjectFocus();
714 else if ( w == m_WgtBtnSceneSave )
716 m_ModuleSceneManager.SceneSave();
720 else if ( w == m_WgtBtnEditorSettings )
722 PopupOpen(POPUP_ID_EDITOR_SETTINGS, NULL);
726 else if ( w == m_WgtBtnEditInitScript )
729 PopupOpen(POPUP_ID_INIT_SCRIPT, param);
733 else if ( w == m_WgtBtnDeleteRuler )
735 m_ModuleSceneManager.RulerDelete();
740 bool ret = ComponentsOnClick(w,
x,
y, button);
750 super.OnChange(w,
x,
y, finished);
752 if (w == m_ClWgtEbxFilter)
757 else if (w == m_SlWgtEbxFilter)
762 else if ( w == m_PrWgtPoxX && finished )
764 m_ModuleSceneManager.SelectedObjectSetPosX(m_PrWgtPoxX.GetText().ToFloat());
766 else if ( w == m_PrWgtPoxY && finished )
768 m_ModuleSceneManager.SelectedObjectSetPosY(m_PrWgtPoxY.GetText().ToFloat());
770 else if ( w == m_PrWgtPoxZ && finished )
772 m_ModuleSceneManager.SelectedObjectSetPosZ(m_PrWgtPoxZ.GetText().ToFloat());
774 else if ( w == m_PrWgtDir && finished )
776 m_ModuleSceneManager.SelectedObjectSetRot(m_PrWgtDir.GetText().ToFloat());
779 else if ( w == m_PrWgtDmg && finished )
781 m_ModuleSceneManager.SelectedObjectSetDamage(m_PrWgtDmg.GetText().ToFloat());
784 else if ( w == m_QuantityEditBox )
786 m_ConfigDebugProfile.SetItemQuantity( GetCurrentPresetName(), GetCurrentItemIndex(), m_QuantityEditBox.GetText().ToInt() );
789 else if ( w == m_DamageEditBox )
791 m_ConfigDebugProfile.SetItemHealth( GetCurrentPresetName(), GetCurrentItemIndex(), m_DamageEditBox.GetText().ToFloat() );
795 bool ret = ComponentsOnChange(w,
x,
y, finished);
802 GetGame().GetMission().AddActiveInputExcludes({
"menu"});
807 GetGame().GetMission().RemoveActiveInputExcludes({
"menu"},
true);
813 override bool OnMouseWheel(
Widget w,
int x,
int y,
int wheel)
815 super.OnMouseWheel(w,
x,
y, wheel);
817 m_ModuleSceneManager.OnMouseWheel(wheel);
824 override bool OnItemSelected(
Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn)
827 super.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
829 if ( w == m_ClWgtLbxClassesList )
831 string selected_class_name;
832 m_ClWgtLbxClassesList.GetItemText( m_ClWgtLbxClassesList.GetSelectedRow(), 0, selected_class_name );
833 m_ModuleSceneManager.SelectClassName(selected_class_name);
835 SceneObject obj_selected = m_ModuleSceneManager.GetSelectedSceneObject();
837 m_SelectedObjectIsPreset =
false;
839 else if ( w == m_SlWgtLbxObjectsList )
841 int row_index = m_SlWgtLbxObjectsList.GetSelectedRow();
843 if ( m_SlObjectsList && row_index > -1 && m_SlObjectsList.Count() > 0 && m_SlObjectsList.Count() > row_index )
845 m_ModuleSceneManager.SelectObject(m_SlObjectsList.GetElement(row_index));
849 if( m_PopupScriptPositionManager != NULL )
851 m_PopupScriptPositionManager.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
864 if ( m_OpenedPopups.Count() == 0 )
866 m_WgtPopupsMain.Show(
true);
867 m_WgtPopupsBg.Show(
true);
871 int popup_curr_id = m_OpenedPopups.Get(m_OpenedPopups.Count() - 1);
872 m_Popups.Get(popup_curr_id).Show(
false);
875 m_OpenedPopups.Insert(popup_id);
890 if ( m_OpenedPopups.Count() > 0 )
892 int popup_curr_id = m_OpenedPopups.Get(m_OpenedPopups.Count() - 1);
894 m_Popups.Get(popup_curr_id).Show(
false);
895 m_Popups.Get(popup_curr_id).OnClose();
897 m_OpenedPopups.Remove(m_OpenedPopups.Count() - 1);
899 if ( m_OpenedPopups.Count() > 0 )
901 int ppp_id = m_OpenedPopups.Get(m_OpenedPopups.Count() - 1);
902 m_Popups.Get(ppp_id).Show(
true);
903 m_Popups.Get(ppp_id).OnOpen(NULL);
905 return m_Popups.Get(ppp_id);
909 m_WgtPopupsMain.Show(
false);
910 m_WgtPopupsBg.Show(
false);
920 if ( m_OpenedPopups.Count() > 0 )
922 int popup_curr_id = m_OpenedPopups.Get(m_OpenedPopups.Count() - 1);
924 m_Popups.Get(popup_curr_id).Show(
false);
925 m_Popups.Get(popup_curr_id).OnClose();
927 m_OpenedPopups.Clear();
936 void ToggleVisibility()
938 m_WgtRoot.Show( m_ModuleSceneManager.IsOpened() );
949 string pos_x =
"n/a";
950 string pos_y =
"n/a";
951 string pos_z =
"n/a";
956 for (
int i = 0; i < m_PrWidgetsAttachments.Count(); ++i )
958 m_PrWidgetsAttachments.Get(i).Hide();
961 if ( m_ModuleSceneManager.GetSelectedSceneObject() )
963 SceneObject obj = m_ModuleSceneManager.GetSelectedSceneObject();
964 vector v = obj.GetPosition();
967 pos_x = v[0].ToString();
968 pos_y = v[1].ToString();
969 pos_z = v[2].ToString();
970 rot = obj.GetRotation().ToString();
971 hlt = obj.GetHealth().ToString();
973 ref
TStringArray attachments_slots = obj.GetConfigAttachments();
976 float prop_count = attachments_slots.Count();
977 float prop_root_h = prop_h * (prop_count + 1);
978 float line_h = 1.0 / (prop_count + 1);
980 m_PrWgtAttRoot.SetSize(1, prop_root_h);
981 m_PrWgtAttTitle.SetSize(1, line_h);
984 EntityAI e = m_ModuleSceneManager.GetSelectedSceneObject().GetObject();
989 for (
int j = 0; j < attachments_in_slots.Count(); ++j )
991 TStringArray attachments_in_slot = attachments_in_slots.GetElement(j);
995 ui_prop.Show(m_ModuleSceneManager.GetSelectedSceneObject().GetObject(), attachments_in_slots.GetKey(j), attachments_in_slot);
996 ui_prop.SetPos( 0, (1 + j) * line_h );
997 ui_prop.SetSize( 1, line_h );
1000 m_WgtBtnEditInitScript.Enable(
true );
1004 m_WgtBtnEditInitScript.Enable(
false );
1008 m_PrWgtPoxX.SetText(pos_x);
1009 m_PrWgtPoxY.SetText(pos_y);
1010 m_PrWgtPoxZ.SetText(pos_z);
1011 m_PrWgtDir.SetText(rot);
1012 m_PrWgtDmg.SetText(hlt);
1014 m_SlWgtLoadedScene.SetText(
"Loaded Scene: "+m_ModuleSceneManager.SceneGetName());
1017 if ( m_ModuleSceneManager.IsRulerActivated() )
1019 m_WgtBtnDeleteRuler.SetColor( 0xFF5DE028 );
1023 m_WgtBtnDeleteRuler.SetColor( 0xFFFFFFFF );
1028 void SceneEditorCommand(
Param params )
1031 int cmd_id = p.param1;
1035 case PluginSceneManager.SCENE_EDITOR_CMD_REFRESH:
1039 case PluginSceneManager.SCENE_EDITOR_CMD_SAVE:
1040 m_NotifyWgtPanel.SetAlpha(1.0);
1041 m_NotifyFadeTimer.FadeOut(m_NotifyWgtPanel, 2,
true);
1050 protected PluginSceneManager m_ModuleSceneManager;
1056 protected ButtonWidget m_WgtBtnSceneManager;
1057 protected ButtonWidget m_WgtBtnSceneSettings;
1058 protected ButtonWidget m_WgtBtnSceneSave;
1059 protected ButtonWidget m_WgtBtnEditorSettings;
1060 protected ButtonWidget m_WgtBtnDeleteRuler;
1063 protected Widget m_WgtPopupsMain;
1064 protected Widget m_WgtPopupsBg;
1070 protected string m_SlSelectedClass;
1072 protected TextListboxWidget m_SlWgtLbxObjectsList;
1074 protected ButtonWidget m_SlWgtSelect;
1075 protected ButtonWidget m_SlWgtFocus;
1078 protected string m_ClSelectedClass;
1081 protected TextListboxWidget m_ClWgtLbxClassesList;
1082 protected ButtonWidget m_ClWgtButtonAddAtt;
1091 protected ButtonWidget m_WgtBtnEditInitScript;
1092 protected Widget m_PrWgtAttRoot;
1093 protected Widget m_PrWgtAttTitle;
1098 protected ref WidgetFadeTimer m_NotifyFadeTimer;
1099 protected Widget m_NotifyWgtPanel;
1102 protected TextListboxWidget m_PresetsTextListbox;
1103 protected TextListboxWidget m_PresetItemsTextListbox;
1104 protected ButtonWidget m_PresetAddItemtButton;
1105 protected ButtonWidget m_PresetRemoveItemButton;
1106 protected ButtonWidget m_SpawnOnGroundButton;
1107 protected ButtonWidget m_SpawnInInventoryButton;
1108 protected ButtonWidget m_SpawnAsAttachmentButton;
1109 protected ButtonWidget m_UpButton;
1110 protected ButtonWidget m_DownButton;
1111 protected ButtonWidget m_PresetNewButton;
1112 protected ButtonWidget m_PresetDeleteButton;
1113 protected ButtonWidget m_PresetRenameButton;
1114 protected ButtonWidget m_PresetSetDefaultButton;
1115 protected ButtonWidget m_CopyToClipboardButton;
1120 protected Widget m_WgtPnlWrapper;
1121 protected ButtonWidget m_WgtBtnLeftPresets;
1122 protected ButtonWidget m_WgtBtnPositionManager;
1125 protected bool m_SelectedObjectIsPreset;
1126 protected PluginDeveloper m_Developer;
1127 protected UIPopupScriptPositionManager m_PopupScriptPositionManager;
1128 protected PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed;
1137 private void UpdateListObjects()
1139 m_SlObjectsList = GetFiltredSceneObjects(m_SlWgtEbxFilter.GetText(), m_SlObjectsList);
1141 m_SlWgtLbxObjectsList.ClearItems();
1144 SceneObject selected_object = m_ModuleSceneManager.GetSelectedSceneObject();
1146 for (
int i = 0; i < m_SlObjectsList.Count(); ++i )
1148 SceneObject scene_obj = m_SlObjectsList.GetElement(i);
1150 if ( selected_object != NULL && selected_object == scene_obj )
1155 m_SlWgtLbxObjectsList.AddItem(scene_obj.GetTypeName(), NULL, 0);
1158 m_SlWgtLbxObjectsList.SelectRow(row);
1164 protected void UpdateListClasses()
1166 m_ClClassesList = GetFiltredConfigClasses(m_ClWgtEbxFilter.GetText(), m_ClClassesList);
1168 m_ClWgtLbxClassesList.ClearItems();
1170 for (
int i = 0; i < m_ClClassesList.Count(); ++i )
1172 m_ClWgtLbxClassesList.AddItem(m_ClClassesList.Get(i), NULL, 0);
1183 search_string.ToLower();
1187 if( scene_objects != NULL )
1189 for (
int i=0; i < scene_objects.Count(); ++i )
1193 string obj_name = sc_obj.GetTypeName();
1197 if ( obj_name.Contains(search_string))
1199 array_ret.Insert(i, sc_obj);
1219 search_string.ToLower();
1221 for (
int s = 0; s < searching_in.Count(); ++s )
1223 string config_path = searching_in.Get(s);
1225 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
1226 for (
int i = 0; i < objects_count; i++)
1229 g_Game.ConfigGetChildName(config_path, i, childName);
1231 int scope =
g_Game.ConfigGetInt(config_path +
" " + childName +
" scope");
1237 string nchName = childName;
1240 if ( nchName.Contains(search_string))
1242 array_ret.Insert(childName);
1253 private void PopupClose(
int popup_id)
1260 private void PopupHideAll()
1262 for (
int i = 0; i < m_Popups.Count(); ++i )
1264 m_Popups.Get(i).Show(
false);
1267 m_WgtPopupsMain.Show(
false);
1268 m_WgtPopupsBg.Show(
false);
1274 private bool ComponentsOnClick(
Widget w,
int x,
int y,
int button)
1276 for (
int i = 0; i < m_Popups.Count(); ++i )
1278 if ( m_Popups.Get(i).OnClick(w,
x,
y, button) )
1284 for (
int j = 0; j < m_PrWidgetsAttachments.Count(); ++j )
1286 if ( m_PrWidgetsAttachments.Get(j).OnClick(w,
x,
y, button) )
1298 private bool ComponentsOnChange(
Widget w,
int x,
int y,
bool finished)
1300 for (
int i = 0; i < m_Popups.Count(); ++i )
1302 if ( m_Popups.Get(i).OnChange(w,
x,
y, finished) )
1316 for (
int i = 0; i < m_PrWidgetsAttachments.Count(); ++i )
1320 if ( !ui_comp.IsVisible() )
1327 m_PrWidgetsAttachments.Insert(ui_prop);
1344 for (
int m = 0; m < slots.Count(); ++m )
1353 for (
int s = 0; s < searching_in.Count(); ++s )
1355 string config_path = searching_in.Get(s);
1357 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
1358 for (
int i = 0; i < objects_count; i++)
1360 g_Game.ConfigGetChildName(config_path, i, childName);
1362 g_Game.ConfigGetTextArray(config_path +
" " + childName +
" inventorySlot", inv_slots);
1364 if ( inv_slots.Count() > 0 )
1366 for (
int j = 0; j < inv_slots.Count(); ++j )
1369 inv_slot = inv_slots.Get(j);
1371 for (
int k = 0; k < slots.Count(); ++k )
1373 string finding_slot_type = slots.Get(k);
1375 if ( inv_slot == finding_slot_type )
1377 array_ret.Get(finding_slot_type).Insert(childName);
1385 g_Game.ConfigGetText(config_path +
" " + childName +
" inventorySlot", inv_slot);
1387 if ( inv_slot !=
"" )
1389 for (
int l = 0; l < slots.Count(); ++l )
1391 string finding_slot_type_2 = slots.Get(l);
1393 if ( inv_slot == finding_slot_type_2 )
1395 array_ret.Get(finding_slot_type_2).Insert(childName);