From c43627159cb444b458e402a1ac006605ab54af5d Mon Sep 17 00:00:00 2001 From: "ulukyn@gmail.com" Date: Wed, 11 Jan 2017 16:27:25 +0100 Subject: [PATCH] Fixed: Scenographic Editor lua issues --HG-- branch : compatibility-develop --- .../data/gamedev/interfaces_v3/sceneedit.lua | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/sceneedit.lua b/code/ryzom/client/data/gamedev/interfaces_v3/sceneedit.lua index e0285da86..71777d8a1 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/sceneedit.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/sceneedit.lua @@ -32,13 +32,15 @@ function SceneEditor:init(scene_id, form_url, translations, icons_url) self.T = translations end -function SceneEditor:reset() +function SceneEditor:reset(no_get_html) self.Shapes = {} self.Groups = {} self.LastEditedGroup = nil self.HaveUpdate = nil runAH(nil, "remove_shapes", "") - self:get_html("Reseted") + if no_get_html == true then + self:get_html("Reseted") + end end function SceneEditor:show_menu() @@ -364,24 +366,24 @@ end function SceneEditor:editGroup(group) if self.LastEditedGroup then - self:removeGroup(self.LastEditedGroup) + self:removeGroup(self.LastEditedGroup, true) self:addGroup(self.LastEditedGroup, 0, true, false) end - self:removeGroup(group); + self:removeGroup(group, true); self:addGroup(group, 0, true, true) self.LastEditedGroup = group end -function SceneEditor:addFromDb(group, db_id, json_shape) +function SceneEditor:addFromDb(group, db_id, json_shape, edit) shape = Json.decode(json_shape) shape.db_id = db_id shape.group = group shape.modified = "" - if hide then - shape_id = addShape(shape.file, shape.pos[1], shape.pos[2], shape.pos[3], "user", 1, false, "", "") - else + if edit then shape_id = addShape(shape.file, shape.pos[1], shape.pos[2], shape.pos[3], "user", 1, true, "", "SceneEditor:show_menu()") + else + shape_id = addShape(shape.file, shape.pos[1], shape.pos[2], shape.pos[3], "user", 1, true, "", "") end rotateShape(shape_id, tostring(shape.rot[1]), tostring(shape.rot[2]), tostring(shape.rot[3])) setupShape(shape_id, shape.setup) @@ -393,7 +395,7 @@ function SceneEditor:addFromDb(group, db_id, json_shape) end -function SceneEditor:removeGroup(group) +function SceneEditor:removeGroup(group, no_get_html) if self.Groups[group] == nil then return end @@ -404,6 +406,7 @@ function SceneEditor:removeGroup(group) deleteShape(shape_id) end end + self.Groups[group] = nil if self.LastEditedGroup == group then self.LastEditedGroup = nil @@ -412,7 +415,9 @@ function SceneEditor:removeGroup(group) ui.active=false end end - self:get_html("Group Removed") + if no_get_html == nil then + self:get_html("Group Removed") + end end function SceneEditor:enc64(data) @@ -479,20 +484,7 @@ function SceneEditor:show_shape_list() end end - -function SceneEditor:get_html_section(message, color) - return '
'..message..'
' -end - -function SceneEditor:get_html(message, message_bg) - local new_group = '  '..self.T[' - local show_hide_cols = '  '..self.T[' - local reset_scene = ''..self.T[' - - local html = '
'..self.T["sceno_editor"]..'
'..self:get_html_section(message..''..new_group..show_hide_cols..reset_scene, (message_bg or SceneEditor:get_random_color())) - - html = html .. '
\ - ' +function SceneEditor:getShapesByGroups() local groups = {} for shape_id, shape in pairs(self.Shapes) do if shape.group == nil then @@ -504,13 +496,35 @@ function SceneEditor:get_html(message, message_bg) end table.insert(groups[shape.group], shape_id) end + return groups +end + + +function SceneEditor:get_html_section(message, color) + return '
'..message..'
' +end + +function SceneEditor:get_html(message, message_bg) + debug("get_html :"..message) + local new_group = '  '..self.T[' + local show_hide_cols = '  '..self.T[' + local reset_scene = ''..self.T[' + + local html = '
'..self.T["sceno_editor"]..'
'..self:get_html_section(message..''..new_group..show_hide_cols..reset_scene, (message_bg or SceneEditor:get_random_color())) + + html = html .. '\ + ' + + local groups = self:getShapesByGroups() for group, shapes in pairsByKeys(self.Groups) do + debug("Group : "..group) local groupname = group html = html .. '
 '..groupname..' ('..(self.Groups[group].props.count or '0')..') ' if self.Groups[group].props.show then + debug("Group : show") if self.Groups[group].props.edit then html = html .. ''..self.T[' if self.HaveUpdate then