-- TODO Move file - HGL must not do this file. if Platform.cmdline then return end DefineClass.EV_DummyTextItem = { __parents = { "PropertyObject" }, properties = {}, itemtext = "None", parent = false, } DefineClass.EV_Spot = { __parents = { "PropertyObject" }, properties = { { id = "bone", editor = "text" }, { id = "name", editor = "text" }, }, bone = "", name = "", itemtext = "", parent_state = false, } function EV_Spot:OnEditorSelect(selected, ged) local root = ged:ResolveObj("root") if selected then root.obj:Attach( root.spotObj, root.obj:GetSpotBeginIndex( EntitySpots[self.name] )) root.spotText:SetText(self.name) root.obj:Attach( root.spotText, root.obj:GetSpotBeginIndex( EntitySpots[self.name] )) root.spotText:SetEnumFlags(const.efVisible) root.spotObj:SetEnumFlags(const.efVisible) else root.spotText:Detach() root.spotObj:Detach() root.spotText:ClearEnumFlags(const.efVisible) root.spotObj:ClearEnumFlags(const.efVisible) end end DefineClass.EV_Surfaces = { __parents = { "PropertyObject" }, properties = { { id = "surfacetype", editor = "text" }, }, surfacetype = "", es_index = -1, itemtext = "", parent_state = false, } function EV_Surfaces:OnEditorSelect(selected, ged) if selected then hr.ShowSurfaces = 1 hr.ShowSurfacesType = self.surfacetype else hr.ShowSurfaces = 0 end end DefineClass.EV_Moment = { __parents = { "PropertyObject" }, properties = { { id = "type", editor = "text", default = ""}, { id = "time", editor = "number", default = 0}, }, itemtext = "", parent_state = false, Getitemtext = function(self) return self.time .. " | " .. self.type end } function EV_Moment:OnEditorSelect(selected, ged) local root = ged:ResolveObj("root") root.obj:SetAnimSpeed(1,0) root.obj:SetAnimPhase(1, self.time) end local function FileNameFromPath(path) path = string.gsub( path, "\\","/") path = string.gsub(path, "([^/]+)/", "") if path == "" then return false else return path end end function EV_LocateFile(parent_editor, obj, property) local filepath = obj[property] if filepath then OS_LocateFile(filepath) end end function EV_OpenFile(parent_editor, obj, property) local filepath = obj[property] if filepath then OS_OpenFile(filepath) end end local function FindXMLTag(xml, tag, close_tag) local tag_start, _ = string.find(xml, tag) if not tag_start then return end xml = xml:sub(tag_start) if not close_tag then return xml:sub(1, string.find(xml, "/>") + 2) else local tag_end = string.find(xml, close_tag) if not tag_end then return xml end return xml:sub(1, tag_end + close_tag:len()) end end function EV_LoadEntityXML(entity) local file_path = "Entities/".. entity .. ".ent" local err, xml = AsyncFileToString( file_path ) return err and "" or xml end function EV_GetMeshSourceFile(entity_xml, mesh) local mesh_desc = FindXMLTag(entity_xml, '', '') if not mesh_desc then return "" end local src_file = FindXMLTag(mesh_desc, '', '') if not state_desc then return "" end local src_file = FindXMLTag(state_desc, '