1 --- Parse interface of ark_scene_editor_edit_menu ---
2 local script
= [[<interface_config>
3 <root id="interface" x="0" y="0" w="800" h="600" active="true"/>
4 <group type="menu" id="ark_scene_editor_edit_menu" extends="base_menu" mouse_pos="true">
7 parseInterfaceFromString(script
)
10 if SceneEditor
== nil then
14 LastEditedGroup
= nil,
20 function SceneEditor
:init(scene_id
, form_url
, translations
, icons_url
)
21 self
.sceneId
= scene_id
22 self
.baseUrl
= form_url
23 self
.iconsUrl
= icons_url
27 function SceneEditor
:reset(no_get_html
)
30 self
.LastEditedGroup
= nil
32 runAH(nil, "remove_shapes", "")
33 if no_get_html
== true then
34 self
:get_html("Reseted")
38 function SceneEditor
:show_menu()
40 SceneEditor
:launch_menu()
45 function SceneEditor
:launch_menu(id
)
46 -- SelectedInstanceId can be set by client application
48 SelectedInstanceId
= id
50 local menu
= getUI("ui:interface:ark_scene_editor_edit_menu")
53 menu
= menu
:getRootMenu()
55 menu
:addLine(ucstring("-- SHAPE EDITION --"), "", "", "shape_header")
56 menu
:addLine(ucstring("Move"), "", "", "shape_move")
58 local subMenu
= menu
:getSubMenu(1)
59 subMenu
:addIconLine(ucstring("Axe X"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_x()')", "shape_move_x", "ark_move_x.tga")
60 subMenu
:addIconLine(ucstring("Axe Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_y()')", "shape_move_y", "ark_move_y.tga")
61 subMenu
:addIconLine(ucstring("Axe Z"), "lua", "x, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_z()')", "shape_move_z", "ark_move_z.tga")
62 subMenu
:addIconLine(ucstring("Axes X & Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_xy()')", "shape_move_xy", "ark_move_xy.tga")
63 subMenu
:addIconLine(ucstring("Axes X & Y Snap to ground"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_xysnap()')", "shape_move_xy_snap", "ark_move_xysnap.tga")
64 subMenu
:addSeparator()
65 subMenu
:addIconLine(ucstring("Move to player"), "lua", "SceneEditor:move_player()", "shape_move_player", "ark_move_player.tga")
67 menu
:addLine(ucstring("Rotate"), "", "", "shape_rotate")
69 subMenu
= menu
:getSubMenu(2)
70 subMenu
:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"x\")')", "shape_rotate_x", "ark_rotate_x.tga")
71 subMenu
:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"y\")')", "shape_rotate_y", "ark_rotate_y.tga")
72 subMenu
:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"z\")')", "shape_rotate_z", "ark_rotate_z.tga")
74 menu
:addLine(ucstring("Scale"), "", "", "shape_scale")
76 subMenu
= menu
:getSubMenu(3)
77 subMenu
:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"x\")')", "shape_scale_x", "ark_scale_x.tga")
78 subMenu
:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"y\")')", "shape_scale_y", "ark_scale_y.tga")
79 subMenu
:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"z\")')", "shape_scale_z", "ark_scale_z.tga")
80 subMenu
:addIconLine(ucstring("Axes X & Y & Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"xyz\")')", "shape_scale_xyz", "ark_scale_xyz.tga")
82 menu
:addLine(ucstring("-- COLLISION EDITION --"), "", "", "col_header")
83 menu
:addLine(ucstring("Move"), "", "", "col_move")
85 subMenu
= menu
:getSubMenu(5)
86 subMenu
:addIconLine(ucstring("Axe X"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_x()')", "col_move_x", "ark_move_x.tga")
87 subMenu
:addIconLine(ucstring("Axe Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_y()')", "col_move_y", "ark_move_y.tga")
88 subMenu
:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_z()')", "col_move_z", "ark_move_xy.tga")
89 subMenu
:addIconLine(ucstring("Axe X & Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_xy()')", "col_move_xy", "ark_move_xy.tga")
90 subMenu
:addSeparator()
91 subMenu
:addIconLine(ucstring("Move to Shape"), "lua", "SceneEditor:col_move_to_shape()", "col_move_to_shape", "ark_move_player.tga")
93 menu
:addIconLine(ucstring("Rotate"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_rotate(SelectedInstanceId, \"x\")')", "col_rotate_x", "ark_rotate_x.tga")
95 menu
:addLine(ucstring("Scale"), "", "", "col_scale")
97 subMenu
= menu
:getSubMenu(7)
98 subMenu
:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"x\")')", "col_scale_x", "ark_scale_x.tga")
99 subMenu
:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"y\")')", "col_scale_y", "ark_scale_y.tga")
100 subMenu
:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"z\")')", "col_scale_z", "ark_scale_z.tga")
102 launchContextMenuInGame("ui:interface:ark_scene_editor_edit_menu")
106 function arcc_tools_check_rclick()
107 root
= getUI("ui:interface")
108 local rx
, ry
= getMousePos()
109 i_id
= getShapeIdAt(rx
, ry
)
111 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
115 function SceneEditor
:move(id
, axe
)
116 local d
, mx
, my
= getMouseDown()
118 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
119 SceneEditor
:set_modified(id
)
120 self
:get_html("Moved")
122 local x
,y
,z
= getGroundAtMouse()
123 if axe
== "x" then moveShape(id
, tostring(x
), "+0", "+0") end
124 if axe
== "y" then moveShape(id
, "+0", tostring(y
), "+0") end
126 mx
, my
= getMousePos()
127 moveShape(id
, "+0", "+0", "+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100))
128 ARK_SHAPE_LATEST_Y
= my
130 if axe
== "xysnap" then moveShape(id
, tostring(x
), tostring(y
), tostring(z
)) end
131 if axe
== "xy" then moveShape(id
, tostring(x
), tostring(y
), "+0") end
132 if axe
== "player" then
133 x
, y
, z
= getPlayerPos()
134 moveShape(id
, tostring(x
), tostring(y
), tostring(z
))
135 SceneEditor
:set_modified(id
)
136 self
:get_html("Moved to player")
142 function SceneEditor
:rotate(id
, axe
)
143 local d
, mx
, my
= getMouseDown()
145 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
146 SceneEditor
:set_modified(id
)
147 self
:get_html("Rotate")
149 mx
, my
= getMousePos()
150 if axe
== "x" then rotateShape(id
, "+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100), "+0", "+0") end
151 if axe
== "y" then rotateShape(id
, "+0", "+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100), "+0") end
152 if axe
== "z" then rotateShape(id
, "+0", "+0", "+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100)) end
153 ARK_SHAPE_LATEST_X
= mx
154 ARK_SHAPE_LATEST_Y
= my
158 function SceneEditor
:scale(id
, axe
)
159 local d
, mx
, my
= getMouseDown()
161 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
162 SceneEditor
:set_modified(id
)
163 self
:get_html("Rotate")
165 mx
, my
= getMousePos()
168 setup
["scale x"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100)
169 setup
["scale y"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100)
170 setup
["scale z"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100)
172 if axe
== "x" then setup
["scale x"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100) end
173 if axe
== "y" then setup
["scale y"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100) end
174 if axe
== "z" then setup
["scale z"]="+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100) end
175 setupShape(id
, setup
)
176 ARK_SHAPE_LATEST_X
= mx
177 ARK_SHAPE_LATEST_Y
= my
182 function SceneEditor
:move_x()
183 self
:move(SelectedInstanceId
, "x")
186 function SceneEditor
:move_y()
187 self
:move(SelectedInstanceId
, "y")
190 function SceneEditor
:move_xy()
191 self
:move(SelectedInstanceId
, "xy")
194 function SceneEditor
:move_xysnap()
195 self
:move(SelectedInstanceId
, "xysnap")
198 function SceneEditor
:move_z()
199 self
:move(SelectedInstanceId
, "z")
202 function SceneEditor
:move_player()
203 self
:move(SelectedInstanceId
, "player")
207 function SceneEditor
:col_move(id
, axe
)
208 local d
, mx
, my
= getMouseDown()
211 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
212 self
:set_modified(id
)
213 self
:get_html("Updated")
215 local x
,y
,z
= getGroundAtMouse()
217 if axe
== "x" then setup
["col pos x"]=tostring(x
) end
218 if axe
== "y" then setup
["col pos y"]=tostring(y
) end
220 mx
, my
= getMousePos()
221 setup
["col pos z"]="+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100)
222 ARK_SHAPE_LATEST_X
= mx
223 ARK_SHAPE_LATEST_Y
= my
225 if axe
== "xy" then setup
["col pos x"]=tostring(x
); setup
["col pos y"]=tostring(y
) end
226 if axe
== "shape" then
227 x
, y
, z
= getShapePos(id
)
228 setup
["col pos x"]=tostring(x
)
229 setup
["col pos y"]=tostring(y
)
230 self
:set_modified(id
)
231 setupShape(id
, setup
)
232 self
:get_html("Updated")
234 setupShape(id
, setup
)
239 function SceneEditor
:col_rotate(id
, axe
)
240 local d
, mx
, my
= getMouseDown()
242 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
243 SceneEditor
:set_modified(id
)
244 self
:get_html("Rotate")
246 mx
, my
= getMousePos()
248 setup
["col orientation"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100)
249 setupShape(id
, setup
)
250 ARK_SHAPE_LATEST_X
= mx
251 ARK_SHAPE_LATEST_Y
= my
257 function SceneEditor
:col_scale(id
, axe
)
258 local d
, mx
, my
= getMouseDown()
260 setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
261 SceneEditor
:set_modified(id
)
262 self
:get_html("Rotate")
264 mx
, my
= getMousePos()
266 if axe
== "x" then setup
["col size x"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100) end
267 if axe
== "y" then setup
["col size y"]="+"..tostring((mx
-ARK_SHAPE_LATEST_X
)/100) end
268 if axe
== "z" then setup
["col size z"]="+"..tostring((my
-ARK_SHAPE_LATEST_Y
)/100) end
269 setupShape(id
, setup
)
270 ARK_SHAPE_LATEST_X
= mx
271 ARK_SHAPE_LATEST_Y
= my
276 function SceneEditor
:set_modified(id
)
277 self
.Groups
[self
.Shapes
[id
].group
].props
.modified
=true
278 self
.Shapes
[id
].modified
= "modified"
279 self
.HaveUpdate
= true
283 function SceneEditor
:col_move_x()
284 self
:col_move(SelectedInstanceId
, "x")
287 function SceneEditor
:col_move_y()
288 self
:col_move(SelectedInstanceId
, "y")
290 function SceneEditor
:col_move_z()
291 self
:col_move(SelectedInstanceId
, "z")
295 function SceneEditor
:col_move_xy()
296 self
:col_move(SelectedInstanceId
, "xy")
300 function SceneEditor
:col_move_to_shape()
301 self
:col_move(SelectedInstanceId
, "shape")
305 function SceneEditor
:setup_shape(shape_id
, setup
)
306 final_setup
= self
.Shapes
[new_shape
.id
].setup
307 if final_setup
== nil then
310 for k
,v
in pairs(setup
) do
313 self
.Shapes
[new_shape
.id
].setup
= final_setup
314 setupShape(shape_id
, setup
)
317 function SceneEditor
:add(shape
)
318 if self
.LastEditedGroup
== nil then
319 self
:get_html('<font color="#aa00000">'..self
.T
["no_selected_group"]..'</font>', '000000')
322 new_shape
.file
= shape
323 new_shape
.group
= self
.LastEditedGroup
324 self
.Groups
[new_shape
.group
].props
.modified
=true
325 new_shape
.db_id
= self
.Groups
[new_shape
.group
].props
.count
+ 1
326 new_shape
.modified
= "added"
327 new_shape_id
= addShape(shape
, 0, 0, 0, "user", 1, true, "", "SceneEditor:show_menu()")
328 table.insert(self
.Groups
[new_shape
.group
], new_shape_id
)
329 self
.Groups
[new_shape
.group
].props
.count
= self
.Groups
[new_shape
.group
].props
.count
+ 1
330 self
.Shapes
[new_shape_id
] = new_shape
331 self
:get_html("Added")
335 function SceneEditor
:removeShape(shape_id
)
336 deleteShape(shape_id
)
337 local group
= self
.Shapes
[shape_id
].group
338 for k
,g_shape_id
in pairs(self
.Groups
[group
]) do
339 if shape_id
== g_shape_id
then
340 self
.Groups
[group
][k
] = nil
343 self
:set_modified(shape_id
)
344 self
.Shapes
[shape_id
] = nil
345 self
:get_html("Removed")
348 function SceneEditor
:addGroup(name
, count
, show
, edit
)
352 if self
.Groups
[name
] == nil then
353 self
.Groups
[name
] = {}
354 self
.Groups
[name
].props
= {}
355 self
.Groups
[name
].props
.count
= count
356 self
.Groups
[name
].props
.show
= show
357 self
.Groups
[name
].props
.edit
= edit
358 self
.Groups
[name
].props
.modified
= false
360 self
.Groups
[name
].props
.show
= show
361 self
.Groups
[name
].props
.edit
= edit
365 function SceneEditor
:editGroup(group
)
366 if self
.LastEditedGroup
then
367 self
:removeGroup(self
.LastEditedGroup
, true)
368 self
:addGroup(self
.LastEditedGroup
, 0, true, false)
370 self
:removeGroup(group
, true);
371 self
:addGroup(group
, 0, true, true)
372 self
.LastEditedGroup
= group
375 function SceneEditor
:addFromDb(group
, db_id
, json_shape
, edit
)
376 shape
= Json
.decode(json_shape
)
382 shape_id
= addShape(shape
.file
, shape
.pos
[1], shape
.pos
[2], shape
.pos
[3], "user", 1, true, "", "SceneEditor:show_menu()")
384 shape_id
= addShape(shape
.file
, shape
.pos
[1], shape
.pos
[2], shape
.pos
[3], "user", 1, true, "", "")
386 rotateShape(shape_id
, tostring(shape
.rot
[1]), tostring(shape
.rot
[2]), tostring(shape
.rot
[3]))
387 setupShape(shape_id
, shape
.setup
)
388 self
.Shapes
[shape_id
] = shape
389 table.insert(self
.Groups
[group
], shape_id
)
390 if db_id
> self
.Groups
[group
].props
.count
then
391 self
.Groups
[group
].props
.count
= db_id
395 function SceneEditor
:spawnShape(shape
, x
, y
, z
, rotx
, roty
, rotz
, setup
)
396 if type(setup
) == "string" then
397 setup
= Json
.decode(setup
)
399 return SceneEditor
:doSpawnShape(shape
, setup
, x
, y
, z
, rotx
, roty
, rotz
, "user", 1, setup
["no collisons"] == nil, setup
["action"], setup
["url"], false, false, setup
["textures"], "", true)
402 function SceneEditor
:doSpawnShape(shape
, setup
, x
, y
, z
, rotx
, roty
, rotz
, angle
, scale
, collisions
, action
, url
, highlight
, transparency
, textures
, skeleton
, igzone
)
404 local id
= addShape(shape
, x
, y
, z
, angle
, scale
, collisions
, misc
:nilToEmpty(action
), misc
:nilToEmpty(url
), highlight
, transparency
, misc
:nilToEmpty(textures
), misc
:nilToEmpty(skeleton
), igzone
)
405 rotateShape(id
, tostring(rotx
), tostring(roty
), tostring(rotz
))
406 setupShape(id
, setup
)
411 function SceneEditor
:removeGroup(group
, no_get_html
)
412 if self
.Groups
[group
] == nil then
416 for k
,shape_id
in pairs(self
.Groups
[group
]) do
418 self
.Shapes
[shape_id
] = nil
419 deleteShape(shape_id
)
423 self
.Groups
[group
] = nil
424 if self
.LastEditedGroup
== group
then
425 self
.LastEditedGroup
= nil
426 local ui
= getUI("ui:interface:ark_list_of_shapes")
431 if no_get_html
== nil then
432 self
:get_html("Group Removed")
436 function SceneEditor
:enc64(data
)
437 local b
='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
438 return ((data
:gsub('.', function(x
)
439 local r
,b
='',x
:byte()
440 for i
=8,1,-1 do r
=r
..(b
%2^i
-b
%2^
(i
-1)>0 and '1' or '0') end
442 end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x
)
443 if (#x
< 6) then return '' end
445 for i
=1,6 do c
=c
+(x
:sub(i
,i
)=='1' and 2^
(6-i
) or 0) end
446 return b
:sub(c
+1,c
+1)
447 end)..({ '', '==', '=' })[#data
%3+1])
450 function SceneEditor
:get_vector(x
, y
, z
)
452 table.insert(vector
, x
)
453 table.insert(vector
, y
)
454 table.insert(vector
, z
)
459 function SceneEditor
:get_random_color()
460 local r
= math
.random(44, 66);
461 local g
= math
.random(44, 66);
462 local b
= math
.random(44, 66);
463 return '#'..tostring(r
)..tostring(g
)..tostring(b
)
467 function pairsByKeys(t
, f
)
469 for n
in pairs(t
) do table.insert(a
, n
) end
471 local i
= 0 -- iterator variable
472 local iter
= function () -- iterator function
483 function SceneEditor
:show_shape_list()
484 local ui
= getUI("ui:interface:ark_list_of_shapes")
485 local need_setup
= ui
== nil
487 WebBrowser
:openWindow("ark_list_of_shapes", self
.baseUrl
..'_ListShapes')
488 ui
= getUI("ui:interface:ark_list_of_shapes")
491 getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_redo").active
=false
492 getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_undo").active
=false
493 getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_refresh").active
=false
494 getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_home").active
=false
500 function SceneEditor
:getShapesByGroups()
502 for shape_id
, shape
in pairs(self
.Shapes
) do
503 if shape
.group
== nil then
507 if groups
[shape
.group
] == nil then
508 groups
[shape
.group
] = {}
510 table.insert(groups
[shape
.group
], shape_id
)
516 function SceneEditor
:get_html_section(message
, color
)
517 return '<table width="100%" cellspacing="0" cellpadding="0"><tr bgcolor="'..color
..'"><td align="center" valign="middle"><font color="#FFFFFF" size="12">'..message
..'</font></td></tr></table>'
520 function SceneEditor
:get_html(message
, message_bg
)
521 debug("get_html :"..message
)
522 local new_group
= ' <a class="ryzom-ui-button" href="'..self
.baseUrl
..'_AddGroup&add_new_group=1&scene_id='..self
.sceneId
..'"><img src="'..self
.iconsUrl
..'/32/chart_organisation_add.png" alt="'..self
.T
["add_new_group"]..'" /></a>'
523 local show_hide_cols
= ' <a class="ryzom-ui-button" href="ah:ark_pacs_borders"><img src="'..self
.iconsUrl
..'/32/show_hide_cols.png" alt="'..self
.T
["show_hide_cols"]..'" /></a>'
524 local reset_scene
= '</td><td align="center" bgcolor="#502020" width="40px"><a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&reset_scene=1&scene_id='..self
.sceneId
..'"><img src="'..self
.iconsUrl
..'/32/bin.png" alt="'..self
.T
["reset_scene"]..'" /></a>'
526 local html
= '<header><title>'..self
.T
["sceno_editor"]..'</title></header>'..self
:get_html_section(message
..'</td><td bgcolor="#202020" align="center" height="40px" width="140px" valign="middle">'..new_group
..show_hide_cols
..reset_scene
, (message_bg
or SceneEditor
:get_random_color()))
528 html
= html
.. '<form action="'..self
.baseUrl
..'_SaveShapes" method="POST"><input type="hidden" name="group" value="'..(self
.LastEditedGroup
or "")..'" /><input type="hidden" name="scene_id" value="'..self
.sceneId
..'" />\
529 <table width="100%" cellspacing="0" cellpadding="0">'
531 local groups
= self
:getShapesByGroups()
533 for group
, shapes
in pairsByKeys(self
.Groups
) do
534 debug("Group : "..group
)
535 local groupname
= group
536 html
= html
.. '<tr bgcolor="#444444"><td height="20px"><table width="100%"><tr><td> '..groupname
..' ('..(self
.Groups
[group
].props
.count
or '0')..') </td><td align="right"><input type="hidden" name="shape[]", value="#"/>'
539 if self
.Groups
[group
].props
.show
then
540 debug("Group : show")
541 if self
.Groups
[group
].props
.edit
then
542 html
= html
.. '<a href="ah:lua:SceneEditor:show_shape_list()"><img src="'..self
.iconsUrl
..'/16/box_add.png" alt="'..self
.T
["add_shape"]..'"/></a></td><td align="right">'
543 if self
.HaveUpdate
then
544 html
= html
.. '<a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&hide_group='..group
..'&edit_group='..group
..'">'..self
.T
["cancel"]..'</a>'
546 html
= html
.. '<a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&hide_group='..group
..'">'..self
.T
["hide"]..'</a>'
549 html
= html
.. '<a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&hide_group='..group
..'">'..self
.T
["hide"]..'</a>'
552 html
= html
.. '<a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&show_group='..group
..'">'..self
.T
["show"]..'</a>'
555 local shapes_html
= ""
556 local shapes_html_dict
= {}
557 local show
= self
.Groups
[group
].props
.show
558 if self
.Groups
[group
].props
.edit
then
559 shapes_id
= groups
[group
]
561 for k
,shape_id
in pairs(shapes_id
) do
563 if self
.Shapes
[shape_id
] then
564 shape
["db_id"] = self
.Shapes
[shape_id
].db_id
565 shape
["file"] = self
.Shapes
[shape_id
].file
566 shape
["pos"] = self
:get_vector(getShapePos(shape_id
))
567 scale_x
, scale_y
, scale_z
= getShapeScale(shape_id
)
568 shape
["rot"] = self
:get_vector(getShapeRot(shape_id
))
569 colpos_x
, colpos_y
, colpos_z
= getShapeColPos(shape_id
)
570 colscale_x
, colscale_y
, colscale_z
= getShapeColScale(shape_id
)
571 colorient
= getShapeColOrient(shape_id
)
573 shape
["setup"]["scale x"] = scale_x
574 shape
["setup"]["scale y"] = scale_y
575 shape
["setup"]["scale z"] = scale_z
576 shape
["setup"]["col pos x"] = shape
["pos"][1]+colpos_x
577 shape
["setup"]["col pos y"] = shape
["pos"][2]+colpos_y
578 shape
["setup"]["col size x"] = colscale_x
579 shape
["setup"]["col size y"] = colscale_y
580 shape
["setup"]["col size z"] = colscale_z
581 shape
["setup"]["col orientation"] = colorient
582 local color
= "202020"
586 local text_color
= "ef9b64"
587 if self
.Shapes
[shape_id
].modified
== "modified" then
588 text_color
= "aa5555"
590 if self
.Shapes
[shape_id
].modified
== "added" then
591 text_color
= "55aa55"
594 table.insert(shapes_html_dict
, {id
=shape
.db_id
, html
="<tr bgcolor='#"..color
.."'><td height='20px'> <input type='hidden' name='shape[]', value='"..SceneEditor
:enc64((shape
.db_id
or '')..":"..Json
.encode(shape
)).."' />"..'#'..(shape
.db_id
or '0').." <a href='ah:lua:SceneEditor:launch_menu("..tostring(shape_id
)..")'><font color='#"..text_color
.."'>"..shape
.file
.."</font></a></td>\
595 <td width='30px'><a href='ah:lua:SceneEditor:editShapeProperties("..tostring(shape_id
)..")'><img src='"..self
.iconsUrl
.."/16/layout_edit.png' /></a></td>\
596 <td width='3px'><a href='ah:lua:SceneEditor:removeShape("..tostring(shape_id
)..")'><img src='"..self
.iconsUrl
.."/16/cross.png' /></a></td>\
601 table.sort(shapes_html_dict
, function (a
, b
) return a
.id
< b
.id
end)
602 for k
,shape
in ipairs(shapes_html_dict
) do
603 shapes_html
= shape
.html
.. shapes_html
607 if self
.HaveUpdate
== nil then
608 html
= html
.. ' <a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&edit_group='..group
..'">'..self
.T
["edit"]..'</a>'
609 html
= html
.. '</td><td align="right"><a class="ryzom-ui-button" href="'..self
.baseUrl
..'_SaveShapes&reset_scene=1&del_group='..group
..'">'..self
.T
["remove"]..'</a>'
613 if self
.Groups
[group
].props
.modified
then
614 html
= html
.. ' <input type="submit" value="'..self
.T
["save"]..'" />'
616 html
= html
.. '</td></tr></table></td><td></td></tr>'..shapes_html
620 html
= html
.. '</table></form>'
621 ui
= getUI("ui:interface:ark_scene_editor:browser:content:html", false)
629 RYZOM_SCENEEDIT_VERSION
= 10469