You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <Ult...@us...> - 2009-03-30 18:18:47
|
Revision: 1126 http://opengate.svn.sourceforge.net/opengate/?rev=1126&view=rev Author: Ultrasick Date: 2009-03-30 18:18:36 +0000 (Mon, 30 Mar 2009) Log Message: ----------- removing unnecessary code Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-30 18:15:23 UTC (rev 1125) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-30 18:18:36 UTC (rev 1126) @@ -12,10 +12,9 @@ #from os import path as check #from os import system #from os import urandom -#from string import replace #import urllib -from warnings import simplefilter as ignore_warnings +from warnings import simplefilter class array: def parse(self, Array, prefix = '', create = true): @@ -354,8 +353,6 @@ geometry = geometry() -ignore_warnings('ignore', DeprecationWarning) - def isfloat(number): legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e'] @@ -738,6 +735,8 @@ raw_file = raw_file() +simplefilter('ignore', DeprecationWarning) + def update_ui(): while gtk.events_pending(): gtk.main_iteration(false) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-30 18:15:33
|
Revision: 1125 http://opengate.svn.sourceforge.net/opengate/?rev=1125&view=rev Author: Ultrasick Date: 2009-03-30 18:15:23 +0000 (Mon, 30 Mar 2009) Log Message: ----------- removing an unnecessary preview frame Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-29 16:28:18 UTC (rev 1124) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-30 18:15:23 UTC (rev 1125) @@ -12,21 +12,6 @@ frame.add(table) table.show() -class mask_preview: - def __init__(self, parent): - # show the frame - frame = gtk.Frame('preview the mask:') - parent.attach(frame, 0, 1, 3, 4, xpadding = 3) - frame.show() - - # show the preview image - self.preview = gtk.Image() - self.preview.set_size_request(150, 150) - frame.add(self.preview) - self.preview.show() - -screen.mask_preview = mask_preview(table) - class masks_available: def __init__(self, parent): # create a TreeStore with one string column to use as the model @@ -65,7 +50,7 @@ # update the list self.update(select = (window.mask_number)) - # update the images + # update the image screen.canvas.update() def remove(self, treeview, row_path, column): @@ -78,7 +63,7 @@ # update the list self.update() - # update the images + # update the image screen.canvas.update() def update(self, select = none): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 16:28:18 UTC (rev 1124) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-30 18:15:23 UTC (rev 1125) @@ -147,7 +147,7 @@ # make the preview image reload again, if the window is closed screen.canvas.preview.handler_unblock(screen.canvas.refresh_id) - # update the images + # update the image screen.canvas.update() def remove(self, treeview, row_path, column): @@ -157,7 +157,7 @@ # remove the texture del(model['masks'][window.mask_number][row_index[0]]) - # update the images and the triangle list + # update the image and the triangle list screen.canvas.update() def save(self, widget): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-29 16:28:18 UTC (rev 1124) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-30 18:15:23 UTC (rev 1125) @@ -201,18 +201,12 @@ # update the mask number window.mask_number = none - # clear the preview image - screen.mask_preview.preview.clear() - # clear the canvas image screen.canvas.drawing_area.clear() else: # update the mask number window.mask_number = row_index[0] - # update the preview image - #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') - # update the canvas image self.draw() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 16:28:21
|
Revision: 1124 http://opengate.svn.sourceforge.net/opengate/?rev=1124&view=rev Author: Ultrasick Date: 2009-03-29 16:28:18 +0000 (Sun, 29 Mar 2009) Log Message: ----------- removeing an unnecessary line Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 16:24:21 UTC (rev 1123) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 16:28:18 UTC (rev 1124) @@ -80,7 +80,6 @@ self.edit_window.show() # make the preview image reload again, if the window is closed - #self.edit_window.connect('delete_event', lambda x: screen.canvas.preview.handler_unblock(screen.canvas.refresh_id)) self.edit_window.connect('destroy', self.reactivate) # show the frame This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 16:24:25
|
Revision: 1123 http://opengate.svn.sourceforge.net/opengate/?rev=1123&view=rev Author: Ultrasick Date: 2009-03-29 16:24:21 +0000 (Sun, 29 Mar 2009) Log Message: ----------- bug fixes Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-03-29 12:35:08 UTC (rev 1122) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-03-29 16:24:21 UTC (rev 1123) @@ -18,7 +18,7 @@ window.set_title('ogEditor - texturizer') window.show() -# exit program, if window is closed +# exit program, if the window is closed window.connect('delete_event', gtk.main_quit) # show global widgets Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 12:35:08 UTC (rev 1122) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 16:24:21 UTC (rev 1123) @@ -25,7 +25,6 @@ self.treeview.show() # connect the functions - #self.treeview.connect('cursor-changed', screen.preview.update) self.treeview.connect('row-activated', self.remove) # show "available triangles:" @@ -46,7 +45,7 @@ triangle_number = len(model['masks'][window.mask_number]) # create the new triangle - model['masks'][window.mask_number].append([(0, 0, 0), (0, 0, 0), (0, 0, 0)]) + model['masks'][window.mask_number].append([('0', '0', '0'), ('0', '0', '0'), ('0', '0', '0')]) # update the list self.update(select = (triangle_number)) @@ -55,6 +54,9 @@ self.edit() def edit(self, widget = none): + # don't reload the preview image for now + screen.canvas.preview.handler_block(screen.canvas.refresh_id) + # destroy the edit window if it still exists try: self.edit_window.destroy() @@ -77,6 +79,10 @@ self.edit_window.set_title('ogEditor - texturizer - edit the triangle') self.edit_window.show() + # make the preview image reload again, if the window is closed + #self.edit_window.connect('delete_event', lambda x: screen.canvas.preview.handler_unblock(screen.canvas.refresh_id)) + self.edit_window.connect('destroy', self.reactivate) + # show the frame frame = gtk.Frame('edit the coordinates:') self.edit_window.add(frame) @@ -138,6 +144,13 @@ # connect a function to the button button.connect('clicked', self.save) + def reactivate(self, widget): + # make the preview image reload again, if the window is closed + screen.canvas.preview.handler_unblock(screen.canvas.refresh_id) + + # update the images + screen.canvas.update() + def remove(self, treeview, row_path, column): # get the row index of the triangle list row_index = treeview.get_cursor()[0] Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-29 12:35:08 UTC (rev 1122) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-29 16:24:21 UTC (rev 1123) @@ -44,38 +44,17 @@ # get the border self.get_border() - # get the triangles - #self.triangles = geometry.get_triangles(self.face['vertices']) + def center_position(self, x, y): + # center the coordinates + x += self.x_center + y += self.y_center - # get the planes of the triangles - #self.get_planes() + # round the coordinates + x = int(round(x)) + y = int(round(y)) - def update(self, treeview = none): - # get the row index of the mask list - row_index = screen.masks_available.treeview.get_cursor()[0] + return (x, y) - if row_index==none: - # update the mask number - window.mask_number = none - - # clear the preview image - screen.mask_preview.preview.clear() - - # clear the canvas image - screen.canvas.drawing_area.clear() - else: - # update the mask number - window.mask_number = row_index[0] - - # update the preview image - #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') - - # update the canvas image - self.draw() - - # update the triangle list - screen.triangles_available.update() - def draw(self, widget = none, event = none): # clear the drawing area self.drawing_area.clear() @@ -84,12 +63,12 @@ # draw the pink border self.draw_border() - # grab the mask - self.mask = model['masks'][window.mask_number] + # get the triangles + triangles = model['masks'][window.mask_number] - # insert the textures - '''for texture in self.face['textures']: - self.draw_texture(texture)''' + # draw the triangles + for triangle in triangles: + self.draw_triangle(triangle) def draw_border(self): # create an array for the points of the polygon @@ -102,52 +81,24 @@ # draw the highlighted face self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) - def draw_texture(self, texture): - texture = texture.split(' - ') + def draw_triangle(self, triangle): + # create an array for the points of the polygon + points = [] - texture_category = texture[0] - texture_name = texture[1] + for vertice in triangle: + # solve the equations + x = self.solve(vertice[0]) + y = self.solve(vertice[1]) - for plane in self.planes: - # define a safety factor (otherwise some pixels stay transparent) - safety_factor = 1.5 + # center the coordinates + x, y = self.center_position(x, y) - # calculate the end values - x_end = int(round(geometry.get_distance(plane['vectors'][0]) * 100 * resolution_texture_map * safety_factor)) - y_end = int(round(geometry.get_distance(plane['vectors'][1]) * 100 * resolution_texture_map * safety_factor)) + # store the coordinates + points.append((x, y)) - for x_pixel_number in range(0, x_end): - # get the relative x coordinate - x_relative = x_pixel_number/x_end + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['black'], true, points) - for y_pixel_number in range(0, y_end): - # get the relative y coordinate - y_relative = (y_pixel_number * 1.01)/y_end - - if (x_relative + y_relative)>1.01: - break - - # create/reset the array for the absolute position - absolute = [] - - # get the absolute position in the room - absolute.append(plane['offset'][0] + plane['vectors'][0][0] * x_relative + plane['vectors'][1][0] * y_relative) - absolute.append(plane['offset'][1] + plane['vectors'][0][1] * x_relative + plane['vectors'][1][1] * y_relative) - absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) - - if absolute==self.offset: - x = 0 - y = 0 - else: - # get the relative position on the drawing area - x, y = self.get_relative_position(absolute) - - # center the position on the drawing area - x, y = self.center_position(x, y) - - # draw the pixel - self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute, self.face), x, y) - def get_border(self): # define arrays for the coordinates self.border_x = [] @@ -185,63 +136,89 @@ self.y_center /= 2 self.y_center -= min(self.border_y) - def get_planes(self): - # create an array for the planes of the triangles - self.planes = [] + def solve(self, equation): + if '%' in equation: + percent_end_index = equation.index('%') - # define planes for the triangles - for triangle in self.triangles: - # get the offset - offset = triangle[0] + # get the start index of the percent value + percent_start_index = percent_end_index - 1 + while percent_start_index>=0 and equation[percent_start_index] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']: + percent_start_index -= 1 - # calculate the vectors - vector_1 = geometry.get_vector(offset, triangle[1]) - vector_2 = geometry.get_vector(offset, triangle[2]) + percent_start_index += 1 - # get the plane - plane = geometry.get_plane(offset, vector_1, vector_2) + # get the percent value + percent_value = equation[percent_start_index : percent_end_index] - # store the plane - self.planes.append(plane) + # divide through 100 + percent_value = float(percent_value) / 100 - def get_relative_position(self, vertice): - if vertice==self.offset: - return (0, 0) + # multiply with the view_size + percent_value *= view_size - # get the vector - vector = geometry.get_vector(self.offset, vertice) + # throw the percent info out of the equation + equation = equation[:percent_start_index] + equation[percent_end_index + 1:] - # get the angle of the vector - angle = geometry.get_angle(self.base_line, vector) + if '+' in equation: + # throw out the "+" + equation = equation.replace('+', '') - # get the length of the vector - length = geometry.get_distance(vector) + # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) + equation = float(equation) * view_size - # calculate the x- and y-coordinate of the vector - vector_x = cos(angle) * length - vector_y = sin(angle) * length + # add the percent value + equation += percent_value + elif '-' in equation: + # get the index of the "-" + minus_index = equation.index('-') - # multiply the coordinates with 100 to get the coordinates in meters (because 0.01 blender units are 1 meter) - vector_x *= 100 - vector_y *= 100 + # throw out the "-" + equation = equation.replace('-', '') - # multiply the coordinates with the amount of pixels per meter - vector_x *= resolution_texture_map - vector_y *= resolution_texture_map + # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) + equation = float(equation) * view_size - return (vector_x, vector_y) + if minus_index==0: + equation = percent_value - equation + else: + equation = equation - percent_value + else: + try: + percent_value - def center_position(self, x, y): - # center the coordinates - x += self.x_center - y += self.y_center + equation = percent_value + except: + # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) + equation = float(equation) * view_size - # round the coordinates - x = int(round(x)) - y = int(round(y)) + return equation - return (x, y) + def update(self, treeview = none): + # get the row index of the mask list + row_index = screen.masks_available.treeview.get_cursor()[0] + if row_index==none: + # update the mask number + window.mask_number = none + + # clear the preview image + screen.mask_preview.preview.clear() + + # clear the canvas image + screen.canvas.drawing_area.clear() + else: + # update the mask number + window.mask_number = row_index[0] + + # update the preview image + #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + + # update the canvas image + self.draw() + + # update the triangle list + screen.triangles_available.update() + screen.canvas = canvas(table) class tools: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 12:35:14
|
Revision: 1122 http://opengate.svn.sourceforge.net/opengate/?rev=1122&view=rev Author: Ultrasick Date: 2009-03-29 12:35:08 +0000 (Sun, 29 Mar 2009) Log Message: ----------- adding a button to edit the coordinates of a triangle Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 10:44:06 UTC (rev 1121) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 12:35:08 UTC (rev 1122) @@ -46,11 +46,98 @@ triangle_number = len(model['masks'][window.mask_number]) # create the new triangle - model['masks'][window.mask_number].append([]) + model['masks'][window.mask_number].append([(0, 0, 0), (0, 0, 0), (0, 0, 0)]) # update the list self.update(select = (triangle_number)) + # edit the new created triangle + self.edit() + + def edit(self, widget = none): + # destroy the edit window if it still exists + try: + self.edit_window.destroy() + except: + pass + + # get the row index of the triangle list + row_index = self.treeview.get_cursor()[0] + + # check if an triangle has beend selected, otherwise return + if row_index==none: + return + + # get the triangle + triangle = model['masks'][window.mask_number][row_index[0]] + + # show a new window + self.edit_window = gtk.Window() + self.edit_window.set_border_width(3) + self.edit_window.set_title('ogEditor - texturizer - edit the triangle') + self.edit_window.show() + + # show the frame + frame = gtk.Frame('edit the coordinates:') + self.edit_window.add(frame) + frame.show() + + # show a table + table = gtk.Table() + table.set_col_spacings(3) + table.set_row_spacings(3) + frame.add(table) + table.show() + + # show "enter values in ..." + text = gtk.Label('enter values in percent (e.g. "20%"),\nin meters (e.g. "0.2" for 20 cm)\nor a combination (e.g. "100%-0.2")') + table.attach(text, 0, 2, 0, 1, xpadding = 3, ypadding = 3) + text.show() + + # create arrays for the input fields + self.input_x = [] + self.input_y = [] + + for vertice_index, vertice_content in enumerate(triangle): + # show "vertice number: xxx" + text = gtk.Label() + text.set_markup('<b>vertice number: ' + str(vertice_index) + '</b>') + text.set_alignment(0, 0.5) + table.attach(text, 0, 2, (4 * vertice_index) + 1, (4 * vertice_index) + 2, xpadding = 3) + text.show() + + # show "x:" + text = gtk.Label('x:') + table.attach(text, 0, 1, (4 * vertice_index) + 2, (4 * vertice_index) + 3, xpadding = 3) + text.show() + + # show input field + input = gtk.Entry() + input.set_text(str(vertice_content[0])) + table.attach(input, 1, 2, (4 * vertice_index) + 2, (4 * vertice_index) + 3, xpadding = 3) + self.input_x.append(input.get_text) + input.show() + + # show "y:" + text = gtk.Label('y:') + table.attach(text, 0, 1, (4 * vertice_index) + 3, (4 * vertice_index) + 4, xpadding = 3) + text.show() + + # show input field + input = gtk.Entry() + input.set_text(str(vertice_content[1])) + table.attach(input, 1, 2, (4 * vertice_index) + 3, (4 * vertice_index) + 4, xpadding = 3) + self.input_y.append(input.get_text) + input.show() + + # show "save" button + button = gtk.Button('save') + table.attach(button, 0, 2, 12, 13, xpadding = 3, ypadding = 3) + button.show() + + # connect a function to the button + button.connect('clicked', self.save) + def remove(self, treeview, row_path, column): # get the row index of the triangle list row_index = treeview.get_cursor()[0] @@ -61,6 +148,21 @@ # update the images and the triangle list screen.canvas.update() + def save(self, widget): + # get the row index of the triangle list + row_index = self.treeview.get_cursor()[0] + + # get the triangle + triangle = model['masks'][window.mask_number][row_index[0]] + + # store the vertices + triangle[0] = (self.input_x[0](), self.input_y[0](), 0) + triangle[1] = (self.input_x[1](), self.input_y[1](), 0) + triangle[2] = (self.input_x[2](), self.input_y[2](), 0) + + # close the edit window + self.edit_window.destroy() + def update(self, select = none): # clear the list self.treestore.clear() @@ -94,4 +196,11 @@ # add the "create triangle" button self.bar.append_item('create triangle', 'create a new triangle', '', image, screen.triangles_available.create) + # create the "edit triangle" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/mask_editor/edit_triangle.png') + + # add the "edit triangle" button + self.bar.append_item('edit triangle', 'edit the selected triangle', '', image, screen.triangles_available.edit) + tools(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/edit_triangle.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 10:44:10
|
Revision: 1121 http://opengate.svn.sourceforge.net/opengate/?rev=1121&view=rev Author: Ultrasick Date: 2009-03-29 10:44:06 +0000 (Sun, 29 Mar 2009) Log Message: ----------- forgot this file Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-29 10:44:06 UTC (rev 1121) @@ -0,0 +1,97 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('triangles:') +screen.frame_table.attach(frame, 1, 2, 1, 2, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class triangles_available: + def __init__(self, parent): + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # create the TreeView + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) + self.treeview.set_reorderable(true) + self.treeview.show() + + # connect the functions + #self.treeview.connect('cursor-changed', screen.preview.update) + self.treeview.connect('row-activated', self.remove) + + # show "available triangles:" + self.column = gtk.TreeViewColumn('available triangles:') + self.treeview.append_column(self.column) + + # create a CellRendererText to render the data + self.cell = gtk.CellRendererText() + self.column.pack_start(self.cell, true) + self.column.add_attribute(self.cell, 'text', 0) + + # update the list + self.update() + + def create(self, widget): + if window.mask_number!=none: + # get the new triangle number + triangle_number = len(model['masks'][window.mask_number]) + + # create the new triangle + model['masks'][window.mask_number].append([]) + + # update the list + self.update(select = (triangle_number)) + + def remove(self, treeview, row_path, column): + # get the row index of the triangle list + row_index = treeview.get_cursor()[0] + + # remove the texture + del(model['masks'][window.mask_number][row_index[0]]) + + # update the images and the triangle list + screen.canvas.update() + + def update(self, select = none): + # clear the list + self.treestore.clear() + + if window.mask_number!=none: + # add the triangles to the treestore + for triangle_index in range(0, len(model['masks'][window.mask_number])): + self.treestore.append(none, ['triangle #' + str(triangle_index)]) + + if select!=none: + self.treeview.set_cursor(select) + +screen.triangles_available = triangles_available(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 1, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "create triangle" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/mask_editor/create_triangle.png') + + # add the "create triangle" button + self.bar.append_item('create triangle', 'create a new triangle', '', image, screen.triangles_available.create) + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 10:42:37
|
Revision: 1120 http://opengate.svn.sourceforge.net/opengate/?rev=1120&view=rev Author: Ultrasick Date: 2009-03-29 10:42:30 +0000 (Sun, 29 Mar 2009) Log Message: ----------- adding functionality to create and remove triangles for the mask Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-29 08:43:58 UTC (rev 1119) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-29 10:42:30 UTC (rev 1120) @@ -12,7 +12,7 @@ frame.add(table) table.show() -class preview: +class mask_preview: def __init__(self, parent): # show the frame frame = gtk.Frame('preview the mask:') @@ -25,21 +25,8 @@ frame.add(self.preview) self.preview.show() - def refresh(self, source): - # get the row index - row_index = source.get_cursor()[0] +screen.mask_preview = mask_preview(table) - # update the mask number - window.mask_number = row_index[0] - - # update the preview image - #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') - - # update the canvas image - screen.canvas.draw() - -screen.preview = preview(table) - class masks_available: def __init__(self, parent): # create a TreeStore with one string column to use as the model @@ -53,7 +40,7 @@ self.treeview.show() # connect the functions - self.treeview.connect('cursor-changed', screen.preview.refresh) + self.treeview.connect('cursor-changed', screen.canvas.update) self.treeview.connect('row-activated', self.remove) # show "available masks:" @@ -65,50 +52,46 @@ self.column.pack_start(self.cell, true) self.column.add_attribute(self.cell, 'text', 0) - # refresh the list - self.refresh(true) + # update the list + self.update() - def create(self, nonsence1 = none): + def create(self, widget): # get the new mask number window.mask_number = len(model['masks']) # create the new mask - model['masks'].append({}) + model['masks'].append([]) - # refresh the list - self.refresh(select = (window.mask_number)) + # update the list + self.update(select = (window.mask_number)) + # update the images + screen.canvas.update() + def remove(self, treeview, row_path, column): # get the row index row_index = treeview.get_cursor()[0] - # remove the texture + # remove the mask del(model['masks'][row_index[0]]) - # refresh the list - self.refresh(true) + # update the list + self.update() - # clear the preview image - screen.preview.preview.clear() + # update the images + screen.canvas.update() - # clear the canvas image - screen.canvas.drawing_area.clear() - - def refresh(self, fast = false, select = none): + def update(self, select = none): # clear the list self.treestore.clear() # add the masks to the treestore - for mask_index, mask_content in enumerate(model['masks']): + for mask_index in range(0, len(model['masks'])): self.treestore.append(none, ['mask #' + str(mask_index)]) if select!=none: self.treeview.set_cursor(select) - if fast==false: - # update the preview image - screen.preview.refresh(self.treeview) - screen.masks_available = masks_available(table) class tools: @@ -130,8 +113,4 @@ # add the "create mask" button self.bar.append_item('create mask', 'create a new mask', '', image, screen.masks_available.create) -tools(table) - -# initialize textures -if model.has_key('textures')==false: - textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file +tools(table) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-29 08:43:58 UTC (rev 1119) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-29 10:42:30 UTC (rev 1120) @@ -2,7 +2,7 @@ # show the frame frame = gtk.Frame('view the mask:') -screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +screen.frame_table.attach(frame, 0, 1, 0, 2, xpadding = 3) frame.show() # show a table @@ -50,6 +50,32 @@ # get the planes of the triangles #self.get_planes() + def update(self, treeview = none): + # get the row index of the mask list + row_index = screen.masks_available.treeview.get_cursor()[0] + + if row_index==none: + # update the mask number + window.mask_number = none + + # clear the preview image + screen.mask_preview.preview.clear() + + # clear the canvas image + screen.canvas.drawing_area.clear() + else: + # update the mask number + window.mask_number = row_index[0] + + # update the preview image + #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + + # update the canvas image + self.draw() + + # update the triangle list + screen.triangles_available.update() + def draw(self, widget = none, event = none): # clear the drawing area self.drawing_area.clear() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py 2009-03-29 08:43:58 UTC (rev 1119) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py 2009-03-29 10:42:30 UTC (rev 1120) @@ -9,4 +9,7 @@ execfile(path[0] + '/scripts/screens/project/mask_editor/frames/view_the_mask.py') # load frame: "masks:" -execfile(path[0] + '/scripts/screens/project/mask_editor/frames/masks.py') \ No newline at end of file +execfile(path[0] + '/scripts/screens/project/mask_editor/frames/masks.py') + +# load frame: "triangles:" +execfile(path[0] + '/scripts/screens/project/mask_editor/frames/triangles.py') \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_triangle.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 08:44:02
|
Revision: 1119 http://opengate.svn.sourceforge.net/opengate/?rev=1119&view=rev Author: Ultrasick Date: 2009-03-29 08:43:58 +0000 (Sun, 29 Mar 2009) Log Message: ----------- removing an unused button image Modified Paths: -------------- templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.pspimage Added Paths: ----------- templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.pspimage Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_mask.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_mask.pspimage Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_mask.png =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_mask.pspimage =================================================================== (Binary files differ) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.pspimage =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-29 08:15:49
|
Revision: 1118 http://opengate.svn.sourceforge.net/opengate/?rev=1118&view=rev Author: Ultrasick Date: 2009-03-29 08:15:36 +0000 (Sun, 29 Mar 2009) Log Message: ----------- simplifying some code Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-03-28 18:37:25 UTC (rev 1117) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-03-29 08:15:36 UTC (rev 1118) @@ -25,12 +25,22 @@ frame.add(self.preview) self.preview.show() - def refresh(self, source): - row_index = source.get_cursor()[0] + def refresh(self, treeview): + # get the path to the selected row + row_path = treeview.get_cursor()[0] + # get the treestore + treestore = screen.layers_used.treestore + + # get the "iter" to the selected row + row_iter = treestore.get_iter(row_path) + # get the caption of the selected row - row_caption = source.get_model().rows[row_index[0]].split(' - ') + row_caption = treestore.get_value(row_iter, 0) + # split the caption + row_caption = row_caption.split(' - ') + # get the category name and the texture name self.category_name = row_caption[0] self.texture_name = row_caption[1] @@ -48,9 +58,6 @@ # create a TreeStore with one string column to use as the model self.treestore = gtk.TreeStore(str) - # create an array for the rows - self.treestore.rows = [] - # create the TreeView self.treeview = gtk.TreeView(self.treestore) self.treeview.set_size_request(-1, 155) @@ -63,38 +70,40 @@ self.treeview.connect('row-activated', self.remove) # show "used layers:" - self.tvcolumn = gtk.TreeViewColumn('used layers:') - self.treeview.append_column(self.tvcolumn) + self.column = gtk.TreeViewColumn('used layers:') + self.treeview.append_column(self.column) # create a CellRendererText to render the data self.cell = gtk.CellRendererText() - self.tvcolumn.pack_start(self.cell, true) - self.tvcolumn.add_attribute(self.cell, 'text', 0) + self.column.pack_start(self.cell, true) + self.column.add_attribute(self.cell, 'text', 0) # refresh the list self.refresh(true) - def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): - # get the row index - row_index = self.treeview.get_cursor()[0] + def remove(self, treeview, row_path, column): + # get the "iter" to the selected row + row_iter = self.treestore.get_iter(row_path) - if row_index!=none: - # remove the texture - del(self.face['textures'][row_index[0]]) + # get the caption of the selected row + row_caption = self.treestore.get_value(row_iter, 0) - # refresh the list - self.refresh() + # get the index of the texture + texture_index = self.face['textures'].index(row_caption) - # clear the preview image - screen.layer_preview.preview.clear() + # remove the texture + del(self.face['textures'][texture_index]) + # refresh the list + self.refresh() + + # clear the preview image + screen.layer_preview.preview.clear() + def refresh(self, fast = false): # clear the list self.treestore.clear() - # redefine the rows array - self.treestore.rows = self.face['textures'] - # add the texture categories and the textures to the treestore for texture in self.face['textures']: self.treestore.append(none, [texture]) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-28 18:37:25 UTC (rev 1117) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-29 08:15:36 UTC (rev 1118) @@ -57,30 +57,30 @@ self.treeview.connect('row-activated', self.remove) # show "available masks:" - self.tvcolumn = gtk.TreeViewColumn('available masks:') - self.treeview.append_column(self.tvcolumn) + self.column = gtk.TreeViewColumn('available masks:') + self.treeview.append_column(self.column) # create a CellRendererText to render the data self.cell = gtk.CellRendererText() - self.tvcolumn.pack_start(self.cell, true) - self.tvcolumn.add_attribute(self.cell, 'text', 0) + self.column.pack_start(self.cell, true) + self.column.add_attribute(self.cell, 'text', 0) # refresh the list self.refresh(true) def create(self, nonsence1 = none): + # get the new mask number + window.mask_number = len(model['masks']) + # create the new mask model['masks'].append({}) - # get the new mask number - window.mask_number = len(model['masks']) - # refresh the list - self.refresh(select = (window.mask_number - 1)) + self.refresh(select = (window.mask_number)) - def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + def remove(self, treeview, row_path, column): # get the row index - row_index = self.treeview.get_cursor()[0] + row_index = treeview.get_cursor()[0] # remove the texture del(model['masks'][row_index[0]]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-28 18:37:43
|
Revision: 1117 http://opengate.svn.sourceforge.net/opengate/?rev=1117&view=rev Author: Ultrasick Date: 2009-03-28 18:37:25 +0000 (Sat, 28 Mar 2009) Log Message: ----------- adding the basic structure of a mask selector and a mask editor Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.png branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/ branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.png branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/ branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.png branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.pspimage Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.png =================================================================== (Binary files differ) Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-28 11:44:36 UTC (rev 1116) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -628,6 +628,10 @@ # update the texture model['textures']['Tauseti'][texture_name] = texture_content + # create an array for the masks (if it doesn't already exist) + if model.has_key('masks')==false: + model['masks'] = [] + return model def save(self): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-28 11:44:36 UTC (rev 1116) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -205,9 +205,6 @@ return (x, y) - def exit_screen(self, widget): - show_screen('project/face_selector') - screen.preview = preview(table) class tools: @@ -219,9 +216,9 @@ # create the "exit screen" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') + image.set_from_file(path[0] + '/graphic/buttons/exit_screen.png') # add the "exit screen" button - self.bar.append_item('exit screen', 'exit the editing screen', none, image, screen.preview.exit_screen) + self.bar.append_item('exit screen', 'exit the face editor', none, image, show_screen, 'project/face_selector') tools(table) \ No newline at end of file Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -0,0 +1,137 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('masks:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class preview: + def __init__(self, parent): + # show the frame + frame = gtk.Frame('preview the mask:') + parent.attach(frame, 0, 1, 3, 4, xpadding = 3) + frame.show() + + # show the preview image + self.preview = gtk.Image() + self.preview.set_size_request(150, 150) + frame.add(self.preview) + self.preview.show() + + def refresh(self, source): + # get the row index + row_index = source.get_cursor()[0] + + # update the mask number + window.mask_number = row_index[0] + + # update the preview image + #self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + + # update the canvas image + screen.canvas.draw() + +screen.preview = preview(table) + +class masks_available: + def __init__(self, parent): + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # create the TreeView + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) + self.treeview.set_reorderable(true) + self.treeview.show() + + # connect the functions + self.treeview.connect('cursor-changed', screen.preview.refresh) + self.treeview.connect('row-activated', self.remove) + + # show "available masks:" + self.tvcolumn = gtk.TreeViewColumn('available masks:') + self.treeview.append_column(self.tvcolumn) + + # create a CellRendererText to render the data + self.cell = gtk.CellRendererText() + self.tvcolumn.pack_start(self.cell, true) + self.tvcolumn.add_attribute(self.cell, 'text', 0) + + # refresh the list + self.refresh(true) + + def create(self, nonsence1 = none): + # create the new mask + model['masks'].append({}) + + # get the new mask number + window.mask_number = len(model['masks']) + + # refresh the list + self.refresh(select = (window.mask_number - 1)) + + def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + # get the row index + row_index = self.treeview.get_cursor()[0] + + # remove the texture + del(model['masks'][row_index[0]]) + + # refresh the list + self.refresh(true) + + # clear the preview image + screen.preview.preview.clear() + + # clear the canvas image + screen.canvas.drawing_area.clear() + + def refresh(self, fast = false, select = none): + # clear the list + self.treestore.clear() + + # add the masks to the treestore + for mask_index, mask_content in enumerate(model['masks']): + self.treestore.append(none, ['mask #' + str(mask_index)]) + + if select!=none: + self.treeview.set_cursor(select) + + if fast==false: + # update the preview image + screen.preview.refresh(self.treeview) + +screen.masks_available = masks_available(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 1, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "create mask" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/mask_editor/create_mask.png') + + # add the "create mask" button + self.bar.append_item('create mask', 'create a new mask', '', image, screen.masks_available.create) + +tools(table) + +# initialize textures +if model.has_key('textures')==false: + textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -0,0 +1,235 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('view the mask:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +# define the mask number +window.mask_number = none + +class canvas: + def __init__(self, parent): + # show preview image + self.preview = gtk.DrawingArea() + self.preview.set_size_request(view_size * 2, view_size * 2) + parent.attach(self.preview, 0, 1, 1, 2, xpadding = 3, ypadding = 3) + self.preview.show() + + # set autoredraw + self.refresh_id = self.preview.connect('expose_event', self.draw) + + # select the right object as the drawing area + self.drawing_area = self.preview.window + + # define the colors + self.preview.window.colors = {} + + for color_name, color_content in colors.items(): + self.drawing_area.colors[color_name] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(color_content)) + + # create the base line + self.base_line = (1, 0, 0) + + # get the offset + self.offset = (0, 0, 0) + + # get the border + self.get_border() + + # get the triangles + #self.triangles = geometry.get_triangles(self.face['vertices']) + + # get the planes of the triangles + #self.get_planes() + + def draw(self, widget = none, event = none): + # clear the drawing area + self.drawing_area.clear() + + if window.mask_number!=none: + # draw the pink border + self.draw_border() + + # grab the mask + self.mask = model['masks'][window.mask_number] + + # insert the textures + '''for texture in self.face['textures']: + self.draw_texture(texture)''' + + def draw_border(self): + # create an array for the points of the polygon + points = [] + + # center the coordinates + for i in range(0, len(self.border_x)): + points.append(self.center_position(self.border_x[i], self.border_y[i])) + + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) + + def draw_texture(self, texture): + texture = texture.split(' - ') + + texture_category = texture[0] + texture_name = texture[1] + + for plane in self.planes: + # define a safety factor (otherwise some pixels stay transparent) + safety_factor = 1.5 + + # calculate the end values + x_end = int(round(geometry.get_distance(plane['vectors'][0]) * 100 * resolution_texture_map * safety_factor)) + y_end = int(round(geometry.get_distance(plane['vectors'][1]) * 100 * resolution_texture_map * safety_factor)) + + for x_pixel_number in range(0, x_end): + # get the relative x coordinate + x_relative = x_pixel_number/x_end + + for y_pixel_number in range(0, y_end): + # get the relative y coordinate + y_relative = (y_pixel_number * 1.01)/y_end + + if (x_relative + y_relative)>1.01: + break + + # create/reset the array for the absolute position + absolute = [] + + # get the absolute position in the room + absolute.append(plane['offset'][0] + plane['vectors'][0][0] * x_relative + plane['vectors'][1][0] * y_relative) + absolute.append(plane['offset'][1] + plane['vectors'][0][1] * x_relative + plane['vectors'][1][1] * y_relative) + absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) + + if absolute==self.offset: + x = 0 + y = 0 + else: + # get the relative position on the drawing area + x, y = self.get_relative_position(absolute) + + # center the position on the drawing area + x, y = self.center_position(x, y) + + # draw the pixel + self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute, self.face), x, y) + + def get_border(self): + # define arrays for the coordinates + self.border_x = [] + self.border_y = [] + + # add 1. vertice of the border + self.border_x.append(0) + self.border_y.append(0) + + # add 2. vertice of the border + self.border_x.append(view_size) + self.border_y.append(0) + + # add 3. vertice of the border + self.border_x.append(view_size) + self.border_y.append(view_size) + + # add 4. vertice of the border + self.border_x.append(0) + self.border_y.append(view_size) + + # define lengths + self.x_length = view_size + self.y_length = view_size + + # calculate the center for the x-axis + self.x_center = view_size * 2 + self.x_center -= self.x_length + self.x_center /= 2 + self.x_center -= min(self.border_x) + + # calculate the center for the y-axis + self.y_center = view_size * 2 + self.y_center -= self.y_length + self.y_center /= 2 + self.y_center -= min(self.border_y) + + def get_planes(self): + # create an array for the planes of the triangles + self.planes = [] + + # define planes for the triangles + for triangle in self.triangles: + # get the offset + offset = triangle[0] + + # calculate the vectors + vector_1 = geometry.get_vector(offset, triangle[1]) + vector_2 = geometry.get_vector(offset, triangle[2]) + + # get the plane + plane = geometry.get_plane(offset, vector_1, vector_2) + + # store the plane + self.planes.append(plane) + + def get_relative_position(self, vertice): + if vertice==self.offset: + return (0, 0) + + # get the vector + vector = geometry.get_vector(self.offset, vertice) + + # get the angle of the vector + angle = geometry.get_angle(self.base_line, vector) + + # get the length of the vector + length = geometry.get_distance(vector) + + # calculate the x- and y-coordinate of the vector + vector_x = cos(angle) * length + vector_y = sin(angle) * length + + # multiply the coordinates with 100 to get the coordinates in meters (because 0.01 blender units are 1 meter) + vector_x *= 100 + vector_y *= 100 + + # multiply the coordinates with the amount of pixels per meter + vector_x *= resolution_texture_map + vector_y *= resolution_texture_map + + return (vector_x, vector_y) + + def center_position(self, x, y): + # center the coordinates + x += self.x_center + y += self.y_center + + # round the coordinates + x = int(round(x)) + y = int(round(y)) + + return (x, y) + +screen.canvas = canvas(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 1, 0, 1) + self.bar.show() + + # create the "exit screen" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/exit_screen.png') + + # add the "exit screen" button + self.bar.append_item('exit screen', 'exit the mask editor', none, image, show_screen, 'project/mask_selector') + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -0,0 +1,12 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "view the mask:" +execfile(path[0] + '/scripts/screens/project/mask_editor/frames/view_the_mask.py') + +# load frame: "masks:" +execfile(path[0] + '/scripts/screens/project/mask_editor/frames/masks.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/index.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-28 11:44:36 UTC (rev 1116) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -70,11 +70,18 @@ parent.attach(self.bar, 0, 1, 0, 1) self.bar.show() + # create the "mask editor" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/mask_selector/mask_editor.png') + + # add the "mask editor" button + self.bar.append_item('mask editor', 'open the mask editor', none, image, show_screen, 'project/mask_editor') + # create the "exit screen" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') + image.set_from_file(path[0] + '/graphic/buttons/exit_screen.png') # add the "exit screen" button - self.bar.append_item('exit screen', 'exit the editing screen', none, image, show_screen, 'project/face_editor') + self.bar.append_item('exit screen', 'exit the mask selector', none, image, show_screen, 'project/face_editor') tools(table) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-28 11:44:36 UTC (rev 1116) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-28 18:37:25 UTC (rev 1117) @@ -84,9 +84,9 @@ # create the "exit screen" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') + image.set_from_file(path[0] + '/graphic/buttons/exit_screen.png') # add the "exit screen" button - self.bar.append_item('exit screen', 'exit the editing screen', none, image, show_screen, 'project/face_editor') + self.bar.append_item('exit screen', 'exit the texture selector', none, image, show_screen, 'project/face_editor') tools(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/exit_screen.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.pspimage =================================================================== (Binary files differ) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_editor/create_mask.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/mask_selector/mask_editor.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-28 11:44:40
|
Revision: 1116 http://opengate.svn.sourceforge.net/opengate/?rev=1116&view=rev Author: Ultrasick Date: 2009-03-28 11:44:36 +0000 (Sat, 28 Mar 2009) Log Message: ----------- preparing the texturizer for masks Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/index.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.pspimage Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_texture.png branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_texture.pspimage Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_texture.png =================================================================== (Binary files differ) Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-03-25 17:37:28 UTC (rev 1115) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -24,7 +24,10 @@ # show global widgets execfile(path[0] + '/scripts/screens/global/index.py') -def show_screen(screen_name): +def show_screen(screen_name, screen_name2 = none): + if screen_name2!=none: + screen_name = screen_name2 + # set screen container global global screen Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -0,0 +1,138 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('layers:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class layer_preview: + def __init__(self, parent): + # show the frame + frame = gtk.Frame('preview the layer:') + parent.attach(frame, 0, 1, 3, 4, xpadding = 3) + frame.show() + + # show the preview image + self.preview = gtk.Image() + self.preview.set_size_request(150, 150) + frame.add(self.preview) + self.preview.show() + + def refresh(self, source): + row_index = source.get_cursor()[0] + + # get the caption of the selected row + row_caption = source.get_model().rows[row_index[0]].split(' - ') + + # get the category name and the texture name + self.category_name = row_caption[0] + self.texture_name = row_caption[1] + + # update the preview image + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + +screen.layer_preview = layer_preview(table) + +class layers_used: + def __init__(self, parent): + # grab the face + self.face = model['faces'][window.face_number] + + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # create an array for the rows + self.treestore.rows = [] + + # create the TreeView + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) + self.treeview.set_reorderable(true) + self.treeview.show() + + # connect the functions + self.treeview.connect('cursor-changed', screen.layer_preview.refresh) + self.treeview.connect('row-activated', self.remove) + + # show "used layers:" + self.tvcolumn = gtk.TreeViewColumn('used layers:') + self.treeview.append_column(self.tvcolumn) + + # create a CellRendererText to render the data + self.cell = gtk.CellRendererText() + self.tvcolumn.pack_start(self.cell, true) + self.tvcolumn.add_attribute(self.cell, 'text', 0) + + # refresh the list + self.refresh(true) + + def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + # get the row index + row_index = self.treeview.get_cursor()[0] + + if row_index!=none: + # remove the texture + del(self.face['textures'][row_index[0]]) + + # refresh the list + self.refresh() + + # clear the preview image + screen.layer_preview.preview.clear() + + def refresh(self, fast = false): + # clear the list + self.treestore.clear() + + # redefine the rows array + self.treestore.rows = self.face['textures'] + + # add the texture categories and the textures to the treestore + for texture in self.face['textures']: + self.treestore.append(none, [texture]) + + if fast==false: + # update the big preview image + screen.preview.draw() + +screen.layers_used = layers_used(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 1, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "add mask" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_mask.png') + + # add the "add mask" button + self.bar.append_item('add mask', 'add a mask to the textures', '', image, show_screen, 'project/mask_selector') + + # create the "add texture" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_texture.png') + + # add the "add texture" button + self.bar.append_item('add texture', 'add the selected texture to the face', '', image, show_screen, 'project/texture_selector') + +tools(table) + +# initialize textures +if model.has_key('textures')==false: + textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py ___________________________________________________________________ Added: svn:eol-style + native Deleted: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py 2009-03-25 17:37:28 UTC (rev 1115) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -1,53 +0,0 @@ -# -*- coding: cp1252 -*- - -# show the frame -frame = gtk.Frame('masks:') -screen.frame_table.attach(frame, 1, 2, 1, 2, xpadding = 3) -frame.show() - -# show a table -table = gtk.Table() -table.set_col_spacings(3) -table.set_row_spacings(3) -frame.add(table) -table.show() - -class masks: - def __init__(self, parent): - pass - - def add(self): - pass - - def remove(self): - pass - -screen.masks = masks(table) - -class tools: - def __init__(self, parent): - # create an container to limit the height of the toolbar - container = gtk.Alignment(xscale = 1) - parent.attach(container, 0, 1, 0, 1) - container.show() - - # create an empty toolbar - self.bar = gtk.Toolbar() - container.add(self.bar) - self.bar.show() - - # create the "remove mask" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/remove_mask.png') - - # add the "remove mask" button - self.bar.append_item('remove mask', 'remove the mask from the textures', '', image, screen.masks.remove) - - # create the "add mask" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_mask.png') - - # add the "add mask" button - self.bar.append_item('add mask', 'add a mask to the textures', '', image, screen.masks.add) - -tools(table) \ No newline at end of file Deleted: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py 2009-03-25 17:37:28 UTC (rev 1115) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -1,194 +0,0 @@ -# -*- coding: cp1252 -*- - -# show the frame -frame = gtk.Frame('textures:') -screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) -frame.show() - -# show a table -table = gtk.Table() -table.set_col_spacings(3) -table.set_row_spacings(3) -frame.add(table) -table.show() - -class texture_preview: - def __init__(self, parent): - # show the frame - frame = gtk.Frame('preview the texture:') - parent.attach(frame, 0, 1, 3, 4, xpadding = 3) - frame.show() - - # show the preview image - self.preview = gtk.Image() - self.preview.set_size_request(150, 150) - frame.add(self.preview) - self.preview.show() - - def refresh(self, source): - row_index = source.get_cursor()[0] - - # get the caption of the selected row - row_caption = source.get_model().rows[row_index[0]].split(' - ') - - # get the category name and the texture name - self.category_name = row_caption[0] - self.texture_name = row_caption[1] - - # update the preview image - self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') - -screen.texture_preview = texture_preview(table) - -class textures_used: - def __init__(self, parent): - # grab the face - self.face = model['faces'][window.face_number] - - # create a TreeStore with one string column to use as the model - self.treestore = gtk.TreeStore(str) - - # create an array for the rows - self.treestore.rows = [] - - # create the TreeView - self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(-1, 155) - parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) - self.treeview.set_reorderable(true) - self.treeview.show() - - # connect the functions - self.treeview.connect('cursor-changed', screen.texture_preview.refresh) - self.treeview.connect('row-activated', self.remove) - - # show "used textures:" - self.tvcolumn = gtk.TreeViewColumn('used textures:') - self.treeview.append_column(self.tvcolumn) - - # create a CellRendererText to render the data - self.cell = gtk.CellRendererText() - self.tvcolumn.pack_start(self.cell, true) - self.tvcolumn.add_attribute(self.cell, 'text', 0) - - # refresh the list - self.refresh(true) - - def add(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): - try: - screen.texture_preview.category_name - except: - # no texture has been selected jet, return - return - - # add the texture - self.face['textures'].append(screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name) - - # refresh the list - self.refresh() - - def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): - try: - screen.texture_preview.category_name - except: - # no texture has been selected jet, return - return - - # get the row index - row_index = self.treeview.get_cursor()[0] - - if row_index!=none: - # remove the texture - del(self.face['textures'][row_index[0]]) - - # refresh the list - self.refresh() - - # clear the preview image - screen.texture_preview.preview.clear() - - def refresh(self, fast = false): - # clear the list - self.treestore.clear() - - # redefine the rows array - self.treestore.rows = self.face['textures'] - - # add the texture categories and the textures to the treestore - for texture in self.face['textures']: - self.treestore.append(none, [texture]) - - if fast==false: - # update the big preview image - screen.preview.draw() - -screen.textures_used = textures_used(table) - -class textures_available: - def __init__(self, parent): - # create a TreeStore with one string column to use as the model - self.treestore = gtk.TreeStore(str) - - # create an array for the rows - self.treestore.rows = [] - - # add the texture categories and the textures - for category_name, category_textures in textures.items(): - for texture_name, texture_function in category_textures.items(): - self.treestore.append(none, [category_name + ' - ' + texture_name]) - - # add the texture to the array - self.treestore.rows.append(category_name + ' - ' + texture_name) - - # create the TreeView - self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(-1, 155) - parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) - self.treeview.show() - - # connect the functions - self.treeview.connect('cursor-changed', screen.texture_preview.refresh) - self.treeview.connect('row-activated', screen.textures_used.add) - - # show "available textures:" - self.tvcolumn = gtk.TreeViewColumn('available textures:') - self.treeview.append_column(self.tvcolumn) - - # create a CellRendererText to render the data - self.cell = gtk.CellRendererText() - self.tvcolumn.pack_start(self.cell, true) - self.tvcolumn.add_attribute(self.cell, 'text', 0) - -screen.textures_available = textures_available(table) - -class tools: - def __init__(self, parent): - # create an container to limit the height of the toolbar - container = gtk.Alignment(xscale = 1) - parent.attach(container, 0, 1, 0, 1) - container.show() - - # create an empty toolbar - self.bar = gtk.Toolbar() - container.add(self.bar) - self.bar.show() - - # create the "remove texture" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/remove_texture.png') - - # add the "remove texture" button - self.bar.append_item('remove texture', 'remove the selected texture from the face', '', image, screen.textures_used.remove) - - # create the "add texture" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_texture.png') - - # add the "add texture" button - self.bar.append_item('add texture', 'add the selected texture to the face', '', image, screen.textures_used.add) - -tools(table) - -# initialize textures -if model.has_key('textures')==false: - textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-25 17:37:28 UTC (rev 1115) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -2,7 +2,7 @@ # show the frame frame = gtk.Frame('view the face:') -screen.frame_table.attach(frame, 0, 1, 0, 2, xpadding = 3) +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) frame.show() # show a table Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py 2009-03-25 17:37:28 UTC (rev 1115) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -8,8 +8,5 @@ # load frame: "view the face:" execfile(path[0] + '/scripts/screens/project/face_editor/frames/view_the_face.py') -# load frame: "textures:" -execfile(path[0] + '/scripts/screens/project/face_editor/frames/textures.py') - -# load frame: "masks:" -execfile(path[0] + '/scripts/screens/project/face_editor/frames/masks.py') \ No newline at end of file +# load frame: "layers:" +execfile(path[0] + '/scripts/screens/project/face_editor/frames/layers.py') \ No newline at end of file Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -0,0 +1,80 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('select the mask:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class texture_selector: + def __init__(self, parent): + # show a table + table = gtk.Table() + table.set_col_spacings(3) + table.set_row_spacings(3) + parent.attach(table, 0, 1, 1, 2) + table.show() + + # define the radio button variable + '''button = none + + # add the texture categories and the textures + for category_name, category_textures in textures.items(): + # show the category name + text = gtk.Label() + text.set_markup('<b>' + category_name + ':</b>') + table.attach(text, category_number * 2, (category_number * 2) + 1, 0, 1) + text.show() + + # define the texture number + texture_number = 0 + + for texture_name, texture_function in category_textures.items(): + # show the preview image + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/textures/preview/' + category_name.lower().replace(' ', '_') + '/' + texture_name.lower().replace(' ', '_') + '.png') + table.attach(image, category_number * 2, (category_number * 2) + 1, texture_number + 1, texture_number + 2) + image.show() + + # show the radio button + button = gtk.RadioButton(button, texture_name) + button.connect('toggled', self.add, (category_name, texture_name)) + table.attach(button, (category_number * 2) + 1, (category_number * 2) + 2, texture_number + 1, texture_number + 2) + button.show() + + # increase the texture number + texture_number += 1 + + # increase the category number + category_number += 1''' + + def add(self, widget, mask): + '''# add the mask + model['faces'][window.face_number]['textures'].append(texture[0] + ' - ' + texture[1]) + + # go back to the face editor screen + show_screen('project/face_editor')''' + +texture_selector(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 1, 0, 1) + self.bar.show() + + # create the "exit screen" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') + + # add the "exit screen" button + self.bar.append_item('exit screen', 'exit the editing screen', none, image, show_screen, 'project/face_editor') + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/index.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -0,0 +1,9 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "select the mask:" +execfile(path[0] + '/scripts/screens/project/mask_selector/frames/select_the_mask.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/index.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -0,0 +1,92 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('select the texture:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class texture_selector: + def __init__(self, parent): + # show a table + table = gtk.Table() + table.set_col_spacings(3) + table.set_row_spacings(3) + parent.attach(table, 0, 1, 1, 2, xpadding = 3, ypadding = 3) + table.show() + + # define the category number + category_number = 0 + + # add the texture categories and the textures + for category_name, category_textures in textures.items(): + # show the category name + text = gtk.Label() + text.set_markup('<b>' + category_name + ':</b>') + table.attach(text, category_number * 2, (category_number * 2) + 1, 0, 1) + text.show() + + # define the texture number + texture_number = 0 + + for texture_name, texture_function in category_textures.items(): + # show a table for the button content + button_content_table = gtk.Table() + button_content_table.set_col_spacings(3) + button_content_table.show() + + # show the preview image + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/textures/preview/' + category_name.lower().replace(' ', '_') + '/' + texture_name.lower().replace(' ', '_') + '.png') + button_content_table.attach(image, 0, 1, 0, 1) + image.show() + + # show the texture name + text = gtk.Label() + text.set_markup('<span font_desc="Courier New">' + texture_name.center(15) + '</span>') + button_content_table.attach(text, 1, 2, 0, 1) + text.show() + + # show the button + button = gtk.Button() + button.add(button_content_table) + button.connect('clicked', self.add, (category_name, texture_name)) + table.attach(button, category_number * 2, (category_number * 2) + 1, texture_number + 1, texture_number + 2) + button.show() + + # increase the texture number + texture_number += 1 + + # increase the category number + category_number += 1 + + def add(self, widget, texture): + # add the texture + model['faces'][window.face_number]['textures'].append(texture[0] + ' - ' + texture[1]) + + # go back to the face editor screen + show_screen('project/face_editor') + +texture_selector(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 1, 0, 1) + self.bar.show() + + # create the "exit screen" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') + + # add the "exit screen" button + self.bar.append_item('exit screen', 'exit the editing screen', none, image, show_screen, 'project/face_editor') + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/index.py 2009-03-28 11:44:36 UTC (rev 1116) @@ -0,0 +1,9 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "select the texture:" +execfile(path[0] + '/scripts/screens/project/texture_selector/frames/select_the_texture.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/index.py ___________________________________________________________________ Added: svn:eol-style + native Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_texture.pspimage =================================================================== (Binary files differ) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-25 17:37:36
|
Revision: 1115 http://opengate.svn.sourceforge.net/opengate/?rev=1115&view=rev Author: Ultrasick Date: 2009-03-25 17:37:28 +0000 (Wed, 25 Mar 2009) Log Message: ----------- adding 2 buttons: "add mask" and "remove mask". they have no function jet Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/ branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_mask.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_texture.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/ branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/decrease_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/increase_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_offset.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_zoom.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_mask.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_texture.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/change_size.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/ branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/ branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/ branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/ Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_mask.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_texture.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_mask.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_mask.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_texture.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/remove_texture.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/decrease_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/decrease_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/increase_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/increase_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_offset.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_offset.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_zoom.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset_zoom.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -0,0 +1,53 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('masks:') +screen.frame_table.attach(frame, 1, 2, 1, 2, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class masks: + def __init__(self, parent): + pass + + def add(self): + pass + + def remove(self): + pass + +screen.masks = masks(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 1, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "remove mask" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/remove_mask.png') + + # add the "remove mask" button + self.bar.append_item('remove mask', 'remove the mask from the textures', '', image, screen.masks.remove) + + # create the "add mask" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_mask.png') + + # add the "add mask" button + self.bar.append_item('add mask', 'add a mask to the textures', '', image, screen.masks.add) + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/masks.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py 2009-03-25 11:22:10 UTC (rev 1114) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -175,21 +175,18 @@ # create the "remove texture" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/textures/remove.png') + image.set_from_file(path[0] + '/graphic/buttons/face_editor/remove_texture.png') # add the "remove texture" button self.bar.append_item('remove texture', 'remove the selected texture from the face', '', image, screen.textures_used.remove) # create the "add texture" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/textures/add.png') + image.set_from_file(path[0] + '/graphic/buttons/face_editor/add_texture.png') # add the "add texture" button self.bar.append_item('add texture', 'add the selected texture to the face', '', image, screen.textures_used.add) - # insert a spacer - #self.bar.append_space() - tools(table) # initialize textures Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-25 11:22:10 UTC (rev 1114) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -2,7 +2,7 @@ # show the frame frame = gtk.Frame('view the face:') -screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +screen.frame_table.attach(frame, 0, 1, 0, 2, xpadding = 3) frame.show() # show a table @@ -219,7 +219,7 @@ # create the "exit screen" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/exit_screen.png') + image.set_from_file(path[0] + '/graphic/buttons/face_editor/exit_screen.png') # add the "exit screen" button self.bar.append_item('exit screen', 'exit the editing screen', none, image, screen.preview.exit_screen) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py 2009-03-25 11:22:10 UTC (rev 1114) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -9,4 +9,7 @@ execfile(path[0] + '/scripts/screens/project/face_editor/frames/view_the_face.py') # load frame: "textures:" -execfile(path[0] + '/scripts/screens/project/face_editor/frames/textures.py') \ No newline at end of file +execfile(path[0] + '/scripts/screens/project/face_editor/frames/textures.py') + +# load frame: "masks:" +execfile(path[0] + '/scripts/screens/project/face_editor/frames/masks.py') \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py 2009-03-25 11:22:10 UTC (rev 1114) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -78,7 +78,7 @@ # create the "edit" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/faces/edit.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/edit_face.png') # add the "edit" button self.bar.append_item('edit', 'edit the selected face', '', image, screen.faces.edit) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py 2009-03-25 11:22:10 UTC (rev 1114) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py 2009-03-25 17:37:28 UTC (rev 1115) @@ -226,14 +226,14 @@ # create the "decrease view" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/decrease_size.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/decrease_size.png') # add the "decrease view" button self.bar.append_item('decrease view', 'decrease the size of the 3 views', none, image, screen.views.set_size, -1) # create the "increase view" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/increase_size.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/increase_size.png') # add the "increase view" button self.bar.append_item('increase view', 'increase the size of the 3 views', none, image, screen.views.set_size, 1) @@ -243,21 +243,21 @@ # create the "zoom out" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_out.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/zoom_out.png') # add the "zoom out" button self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', none, image, screen.views.set_zoom, -1) # create the "zoom in" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_in.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/zoom_in.png') # add the "zoom in" button self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', none, image, screen.views.set_zoom, 1) # create the "reset zoom" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_zoom.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/reset_zoom.png') # add the "reset zoom" button self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', none, image, screen.views.reset_zoom) @@ -267,61 +267,37 @@ # create the "move left" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_left.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/move_left.png') # add the "move left" button self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', none, image, screen.views.set_x_position, -1) # create the "move right" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_right.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/move_right.png') # add the "move right" button self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', none, image, screen.views.set_x_position, 1) # create the "move down" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_down.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/move_down.png') # add the "move down" button self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', none, image, screen.views.set_y_position, 1) # create the "move up" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_up.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/move_up.png') # add the "move up" button self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', none, image, screen.views.set_y_position, -1) # create the "reset offset" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_offset.png') + image.set_from_file(path[0] + '/graphic/buttons/face_selector/reset_offset.png') # add the "reset offset" button self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', none, image, screen.views.reset_offset) - # insert a spacer - self.bar.append_space() - - # create the "full covered" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_full.png') - - # add the "full covered" button - self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', none, image, screen.views.set_edge_rendition, 'full') - - # create the "dash covered" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_dashed.png') - - # add the "dash covered" button - self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', none, image, screen.views.set_edge_rendition, 'dashed') - - # create the "hide covered" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_hide.png') - - # add the "hide covered" button - self.bar.append_item('hide covered', 'don\'t draw the covered edges', none, image, screen.views.set_edge_rendition, 'hide') - tools(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_mask.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_mask.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_texture.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/add_and_remove_texture.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_editor/exit_screen.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/change_size.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/change_size.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/edit_face.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/reset.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/face_selector/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-25 11:22:19
|
Revision: 1114 http://opengate.svn.sourceforge.net/opengate/?rev=1114&view=rev Author: Ultrasick Date: 2009-03-25 11:22:10 +0000 (Wed, 25 Mar 2009) Log Message: ----------- simplifying code Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/main/functions.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/index.py Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/ Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-03-25 11:01:03 UTC (rev 1113) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -24,7 +24,7 @@ # show global widgets execfile(path[0] + '/scripts/screens/global/index.py') -def show_screen(screen_name, action = 'default'): +def show_screen(screen_name): # set screen container global global screen Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-25 11:01:03 UTC (rev 1113) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -439,7 +439,7 @@ model = self.reconstruct(file_selection_window.return_value) # load the next screen - show_screen('project/canvas') + show_screen('project/face_selector') def new(self): # make the model array global @@ -449,7 +449,7 @@ model = {} # load the raw faces - file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') + file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/face_selector') def reconstruct(self, model): # create an array for the edges Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,197 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('textures:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class texture_preview: + def __init__(self, parent): + # show the frame + frame = gtk.Frame('preview the texture:') + parent.attach(frame, 0, 1, 3, 4, xpadding = 3) + frame.show() + + # show the preview image + self.preview = gtk.Image() + self.preview.set_size_request(150, 150) + frame.add(self.preview) + self.preview.show() + + def refresh(self, source): + row_index = source.get_cursor()[0] + + # get the caption of the selected row + row_caption = source.get_model().rows[row_index[0]].split(' - ') + + # get the category name and the texture name + self.category_name = row_caption[0] + self.texture_name = row_caption[1] + + # update the preview image + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + +screen.texture_preview = texture_preview(table) + +class textures_used: + def __init__(self, parent): + # grab the face + self.face = model['faces'][window.face_number] + + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # create an array for the rows + self.treestore.rows = [] + + # create the TreeView + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) + self.treeview.set_reorderable(true) + self.treeview.show() + + # connect the functions + self.treeview.connect('cursor-changed', screen.texture_preview.refresh) + self.treeview.connect('row-activated', self.remove) + + # show "used textures:" + self.tvcolumn = gtk.TreeViewColumn('used textures:') + self.treeview.append_column(self.tvcolumn) + + # create a CellRendererText to render the data + self.cell = gtk.CellRendererText() + self.tvcolumn.pack_start(self.cell, true) + self.tvcolumn.add_attribute(self.cell, 'text', 0) + + # refresh the list + self.refresh(true) + + def add(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + try: + screen.texture_preview.category_name + except: + # no texture has been selected jet, return + return + + # add the texture + self.face['textures'].append(screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name) + + # refresh the list + self.refresh() + + def remove(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + try: + screen.texture_preview.category_name + except: + # no texture has been selected jet, return + return + + # get the row index + row_index = self.treeview.get_cursor()[0] + + if row_index!=none: + # remove the texture + del(self.face['textures'][row_index[0]]) + + # refresh the list + self.refresh() + + # clear the preview image + screen.texture_preview.preview.clear() + + def refresh(self, fast = false): + # clear the list + self.treestore.clear() + + # redefine the rows array + self.treestore.rows = self.face['textures'] + + # add the texture categories and the textures to the treestore + for texture in self.face['textures']: + self.treestore.append(none, [texture]) + + if fast==false: + # update the big preview image + screen.preview.draw() + +screen.textures_used = textures_used(table) + +class textures_available: + def __init__(self, parent): + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # create an array for the rows + self.treestore.rows = [] + + # add the texture categories and the textures + for category_name, category_textures in textures.items(): + for texture_name, texture_function in category_textures.items(): + self.treestore.append(none, [category_name + ' - ' + texture_name]) + + # add the texture to the array + self.treestore.rows.append(category_name + ' - ' + texture_name) + + # create the TreeView + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) + self.treeview.show() + + # connect the functions + self.treeview.connect('cursor-changed', screen.texture_preview.refresh) + self.treeview.connect('row-activated', screen.textures_used.add) + + # show "available textures:" + self.tvcolumn = gtk.TreeViewColumn('available textures:') + self.treeview.append_column(self.tvcolumn) + + # create a CellRendererText to render the data + self.cell = gtk.CellRendererText() + self.tvcolumn.pack_start(self.cell, true) + self.tvcolumn.add_attribute(self.cell, 'text', 0) + +screen.textures_available = textures_available(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 1, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "remove texture" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/textures/remove.png') + + # add the "remove texture" button + self.bar.append_item('remove texture', 'remove the selected texture from the face', '', image, screen.textures_used.remove) + + # create the "add texture" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/textures/add.png') + + # add the "add texture" button + self.bar.append_item('add texture', 'add the selected texture to the face', '', image, screen.textures_used.add) + + # insert a spacer + #self.bar.append_space() + +tools(table) + +# initialize textures +if model.has_key('textures')==false: + textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/textures.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,227 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('view the face:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class preview: + def __init__(self, parent): + # show preview image + self.preview = gtk.DrawingArea() + self.preview.set_size_request(view_size * 2, view_size * 2) + parent.attach(self.preview, 0, 1, 1, 2, xpadding = 3, ypadding = 3) + self.preview.show() + + # set autoredraw + self.refresh_id = self.preview.connect('expose_event', self.draw) + + # select the right object as the drawing area + self.drawing_area = self.preview.window + + # define the colors + self.preview.window.colors = {} + + for color_name, color_content in colors.items(): + self.drawing_area.colors[color_name] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(color_content)) + + # grab the face + self.face = model['faces'][window.face_number] + + # create the base line + self.base_line = geometry.get_vector(self.face['vertices'][0], self.face['vertices'][1]) + + # get the offset + self.offset = self.face['vertices'][0] + + # get the border + self.get_border() + + # get the triangles + self.triangles = geometry.get_triangles(self.face['vertices']) + + # get the planes of the triangles + self.get_planes() + + def draw(self, widget = none, event = none): + # clear the drawing area + self.drawing_area.clear() + + if len(self.face['textures'])==0: + # draw the pink border + self.draw_border() + else: + # insert the textures + for texture in self.face['textures']: + self.draw_texture(texture) + + def draw_border(self): + # create an array for the points of the polygon + points = [] + + # center the coordinates + for i in range(0, len(self.border_x)): + points.append(self.center_position(self.border_x[i], self.border_y[i])) + + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) + + def draw_texture(self, texture): + texture = texture.split(' - ') + + texture_category = texture[0] + texture_name = texture[1] + + for plane in self.planes: + # define a safety factor (otherwise some pixels stay transparent) + safety_factor = 1.5 + + # calculate the end values + x_end = int(round(geometry.get_distance(plane['vectors'][0]) * 100 * resolution_texture_map * safety_factor)) + y_end = int(round(geometry.get_distance(plane['vectors'][1]) * 100 * resolution_texture_map * safety_factor)) + + for x_pixel_number in range(0, x_end): + # get the relative x coordinate + x_relative = x_pixel_number/x_end + + for y_pixel_number in range(0, y_end): + # get the relative y coordinate + y_relative = (y_pixel_number * 1.01)/y_end + + if (x_relative + y_relative)>1.01: + break + + # create/reset the array for the absolute position + absolute = [] + + # get the absolute position in the room + absolute.append(plane['offset'][0] + plane['vectors'][0][0] * x_relative + plane['vectors'][1][0] * y_relative) + absolute.append(plane['offset'][1] + plane['vectors'][0][1] * x_relative + plane['vectors'][1][1] * y_relative) + absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) + + if absolute==self.offset: + x = 0 + y = 0 + else: + # get the relative position on the drawing area + x, y = self.get_relative_position(absolute) + + # center the position on the drawing area + x, y = self.center_position(x, y) + + # draw the pixel + self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute, self.face), x, y) + + def get_border(self): + # define arrays for the coordinates + self.border_x = [] + self.border_y = [] + + for vertice in self.face['vertices']: + # get the relative position + x, y = self.get_relative_position(vertice) + + # store the x- and y-coordinate + self.border_x.append(x) + self.border_y.append(y) + + # calculate lengths + self.x_length = max(self.border_x) - min(self.border_x) + self.y_length = max(self.border_y) - min(self.border_y) + + # calculate the center for the x-axis + self.x_center = view_size * 2 + self.x_center -= self.x_length + self.x_center /= 2 + self.x_center -= min(self.border_x) + + # calculate the center for the y-axis + self.y_center = view_size * 2 + self.y_center -= self.y_length + self.y_center /= 2 + self.y_center -= min(self.border_y) + + def get_planes(self): + # create an array for the planes of the triangles + self.planes = [] + + # define planes for the triangles + for triangle in self.triangles: + # get the offset + offset = triangle[0] + + # calculate the vectors + vector_1 = geometry.get_vector(offset, triangle[1]) + vector_2 = geometry.get_vector(offset, triangle[2]) + + # get the plane + plane = geometry.get_plane(offset, vector_1, vector_2) + + # store the plane + self.planes.append(plane) + + def get_relative_position(self, vertice): + if vertice==self.offset: + return (0, 0) + + # get the vector + vector = geometry.get_vector(self.offset, vertice) + + # get the angle of the vector + angle = geometry.get_angle(self.base_line, vector) + + # get the length of the vector + length = geometry.get_distance(vector) + + # calculate the x- and y-coordinate of the vector + vector_x = cos(angle) * length + vector_y = sin(angle) * length + + # multiply the coordinates with 100 to get the coordinates in meters (because 0.01 blender units are 1 meter) + vector_x *= 100 + vector_y *= 100 + + # multiply the coordinates with the amount of pixels per meter + vector_x *= resolution_texture_map + vector_y *= resolution_texture_map + + return (vector_x, vector_y) + + def center_position(self, x, y): + # center the coordinates + x += self.x_center + y += self.y_center + + # round the coordinates + x = int(round(x)) + y = int(round(y)) + + return (x, y) + + def exit_screen(self, widget): + show_screen('project/face_selector') + +screen.preview = preview(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 1, 0, 1) + self.bar.show() + + # create the "exit screen" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/exit_screen.png') + + # add the "exit screen" button + self.bar.append_item('exit screen', 'exit the editing screen', none, image, screen.preview.exit_screen) + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,12 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "view the face:" +execfile(path[0] + '/scripts/screens/project/face_editor/frames/view_the_face.py') + +# load frame: "textures:" +execfile(path[0] + '/scripts/screens/project/face_editor/frames/textures.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/index.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,89 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('faces:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class faces: + def __init__(self, parent): + # show "select a face:" + text = gtk.Label('select a face:') + parent.attach(text, 0, 1, 1, 2, xpadding = 3) + text.show() + + try: + window.face_number + + if window.face_number>(len(model['faces']) - 1): + window.face_number = 0 + except: + window.face_number = 0 + + # create adjustment + adjustment = gtk.Adjustment(window.face_number, 0, len(model['faces']) - 1, 1, 10, 0) + + # show face selector + self.face_selector = gtk.SpinButton(adjustment, 0.0, 0) + self.face_selector.set_numeric(true) + self.face_selector.set_wrap(true) + parent.attach(self.face_selector, 1, 2, 1, 2, xpadding = 3) + self.face_selector.show() + + # set function to adjustment + adjustment.connect('value_changed', screen.views.redraw_all) + + def get_edges(self, face): + edges = [] + + for vertice_number, vertice_content in enumerate(face): + first_vertice = vertice_content + + try: + second_vertice = face[vertice_number + 1] + except: + second_vertice = face[0] + + edges.append([first_vertice, second_vertice]) + + return edges + + def edit(self, widget): + # store the face number + window.face_number = self.face_selector.get_value_as_int() + + # load the editing screen + show_screen('project/face_editor') + +screen.faces = faces(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 2, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "edit" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/faces/edit.png') + + # add the "edit" button + self.bar.append_item('edit', 'edit the selected face', '', image, screen.faces.edit) + + # insert a spacer + #self.bar.append_space() + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/faces.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,327 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('view the model:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class views: + def __init__(self, parent): + # show top view + self.top_view = gtk.DrawingArea() + self.top_view.set_size_request(view_size, view_size) + parent.attach(self.top_view, 0, 1, 1, 2) + self.top_view.show() + + # set autoredraw + self.top_view.connect('expose_event', self.draw, 'top_view') + + # show front view + self.front_view = gtk.DrawingArea() + self.front_view.set_size_request(view_size, view_size) + parent.attach(self.front_view, 0, 1, 2, 3) + self.front_view.show() + + # set autoredraw + self.front_view.connect('expose_event', self.draw, 'front_view') + + # show side view + self.side_view = gtk.DrawingArea() + self.side_view.set_size_request(view_size, view_size) + parent.attach(self.side_view, 1, 2, 2, 3) + self.side_view.show() + + # set autoredraw + self.side_view.connect('expose_event', self.draw, 'side_view') + + # define the colors for the top view + self.top_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.top_view.window.colors[color_name] = self.top_view.window.new_gc(foreground = self.top_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the front view + self.front_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.front_view.window.colors[color_name] = self.front_view.window.new_gc(foreground = self.front_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the side view + self.side_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.side_view.window.colors[color_name] = self.side_view.window.new_gc(foreground = self.side_view.window.get_colormap().alloc_color(color_content)) + + def redraw_all(self, widget = none): + old_size = self.top_view.get_size_request()[0] + + if old_size==view_size: + # redraw the views + self.draw(none, none, 'top_view') + self.draw(none, none, 'front_view') + self.draw(none, none, 'side_view') + else: + # update the sizes (which redraws the views automatically) + self.top_view.set_size_request(view_size, view_size) + self.front_view.set_size_request(view_size, view_size) + self.side_view.set_size_request(view_size, view_size) + + def draw(self, widget, event, drawing_area): + try: + screen.views + except: + return + + # choose the right drawing area and axes + if drawing_area=='top_view': + drawing_area = self.top_view.window + + axis_0 = 0 # x + axis_1 = 1 # y + elif drawing_area=='front_view': + drawing_area = self.front_view.window + + axis_0 = 0 # x + axis_1 = 2 # z + elif drawing_area=='side_view': + drawing_area = self.side_view.window + + axis_0 = 1 # y + axis_1 = 2 # z + + # calculate the center for the first axis + axis_0_center = view_size + axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center /= 2 + axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + + # calculate the center for the second axis + axis_1_center = view_size + axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_1_center /= 2 + axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + + # fill the background of the drawing area with white color + drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (view_size, 0), (view_size, view_size), (0, view_size)]) + + # draw the edges + for edge in model['edges']: + # calculate the x position + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + + # calculate the y position + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + + # draw the edge + drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + + # create an array for the highlighted face + highlight = [] + + # grab the coordinates for the highlighted face + for vertice in model['faces'][screen.faces.face_selector.get_value_as_int()]['vertices']: + x = int(round((vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + y = int(round((((vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + + # add the coordinates to the highlight array + highlight.append((x, y)) + + # draw the highlighted face + drawing_area.draw_polygon(drawing_area.colors['red'], true, highlight) + + def set_size(self, widget, direction): + global view_size + + step = 50 + + if direction<0 and view_size<=step: + # cancle, because decreasing the view size would lead to a width of 0 + return + elif direction>0 and (((view_size + step)*2) + 223)>=window.get_screen().get_height(): + # cancle, because increasing the view size would lead to a heigth which is bigger than the screen hight (crash) + return + + # calculate new view size + view_size += step * direction + + # redraw all views + self.redraw_all() + + def set_zoom(self, widget, direction): + global view_zoom + + step = 0.25 + + # check if zooming out the view size would lead to a zoom factor of 0 + if direction<0 and view_zoom<=step: + return + + # calculate new zoom factor + view_zoom += step * direction + + # redraw all views + self.redraw_all() + + def reset_zoom(self, widget = none): + global view_zoom + + # reset the zoom factor + view_zoom = 1 + + # redraw all views + self.redraw_all() + + def set_x_position(self, widget, direction): + global view_x_position + + step = 50 + + # calculate new x position + view_x_position += step * direction + + # redraw all views + self.redraw_all() + + def set_y_position(self, widget, direction): + global view_y_position + + step = 50 + + # calculate new y position + view_y_position += step * direction + + # redraw all views + self.redraw_all() + + def reset_offset(self, widget = none): + global view_x_position, view_y_position + + # reset x- and y-position + view_x_position = 0 + view_y_position = 0 + + # redraw all views + self.redraw_all() + + def set_edge_rendition(self, widget, rendition): + pass + +screen.views = views(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 2, 0, 1) + self.bar.show() + + # create the "decrease view" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/decrease_size.png') + + # add the "decrease view" button + self.bar.append_item('decrease view', 'decrease the size of the 3 views', none, image, screen.views.set_size, -1) + + # create the "increase view" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/increase_size.png') + + # add the "increase view" button + self.bar.append_item('increase view', 'increase the size of the 3 views', none, image, screen.views.set_size, 1) + + # insert a spacer + self.bar.append_space() + + # create the "zoom out" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_out.png') + + # add the "zoom out" button + self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', none, image, screen.views.set_zoom, -1) + + # create the "zoom in" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_in.png') + + # add the "zoom in" button + self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', none, image, screen.views.set_zoom, 1) + + # create the "reset zoom" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_zoom.png') + + # add the "reset zoom" button + self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', none, image, screen.views.reset_zoom) + + # insert a spacer + self.bar.append_space() + + # create the "move left" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_left.png') + + # add the "move left" button + self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', none, image, screen.views.set_x_position, -1) + + # create the "move right" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_right.png') + + # add the "move right" button + self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', none, image, screen.views.set_x_position, 1) + + # create the "move down" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_down.png') + + # add the "move down" button + self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', none, image, screen.views.set_y_position, 1) + + # create the "move up" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_up.png') + + # add the "move up" button + self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', none, image, screen.views.set_y_position, -1) + + # create the "reset offset" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_offset.png') + + # add the "reset offset" button + self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', none, image, screen.views.reset_offset) + + # insert a spacer + self.bar.append_space() + + # create the "full covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_full.png') + + # add the "full covered" button + self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', none, image, screen.views.set_edge_rendition, 'full') + + # create the "dash covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_dashed.png') + + # add the "dash covered" button + self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', none, image, screen.views.set_edge_rendition, 'dashed') + + # create the "hide covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_hide.png') + + # add the "hide covered" button + self.bar.append_item('hide covered', 'don\'t draw the covered edges', none, image, screen.views.set_edge_rendition, 'hide') + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/frames/view_the_model.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/index.py 2009-03-25 11:22:10 UTC (rev 1114) @@ -0,0 +1,12 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "view the model:" +execfile(path[0] + '/scripts/screens/project/face_selector/frames/view_the_model.py') + +# load frame: "faces:" +execfile(path[0] + '/scripts/screens/project/face_selector/frames/faces.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_selector/index.py ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-25 11:01:17
|
Revision: 1113 http://opengate.svn.sourceforge.net/opengate/?rev=1113&view=rev Author: Ultrasick Date: 2009-03-25 11:01:03 +0000 (Wed, 25 Mar 2009) Log Message: ----------- fixed 2 bugs + code simplified Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-24 19:46:51 UTC (rev 1112) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-25 11:01:03 UTC (rev 1113) @@ -26,27 +26,15 @@ self.preview.show() def refresh(self, source): - texture = source.get_cursor()[0] - textures = source.get_model().textures + row_index = source.get_cursor()[0] - if '-' in textures[texture[0]]: - temp = textures[texture[0]].split(' - ') + # get the caption of the selected row + row_caption = source.get_model().rows[row_index[0]].split(' - ') - self.category_name = temp[0] - self.texture_name = temp[1] - else: - try: - texture[1] - except: - # clear the preview image - self.preview.clear() + # get the category name and the texture name + self.category_name = row_caption[0] + self.texture_name = row_caption[1] - # a category has been selected, return - return - - self.category_name = textures[texture[0]]['name'] - self.texture_name = textures[texture[0]]['textures'][texture[1]] - # update the preview image self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') @@ -60,8 +48,8 @@ # create a TreeStore with one string column to use as the model self.treestore = gtk.TreeStore(str) - # create an array for the textures - self.treestore.textures = [] + # create an array for the rows + self.treestore.rows = [] # create the TreeView self.treeview = gtk.TreeView(self.treestore) @@ -106,24 +94,30 @@ # no texture has been selected jet, return return - if (screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name) in self.face['textures']: + # get the row index + row_index = self.treeview.get_cursor()[0] + + if row_index!=none: # remove the texture - del(self.face['textures'][self.face['textures'].index(screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name)]) + del(self.face['textures'][row_index[0]]) # refresh the list self.refresh() + # clear the preview image + screen.texture_preview.preview.clear() + def refresh(self, fast = false): # clear the list self.treestore.clear() - # add the texture categories and the textures + # redefine the rows array + self.treestore.rows = self.face['textures'] + + # add the texture categories and the textures to the treestore for texture in self.face['textures']: self.treestore.append(none, [texture]) - # add the texture to the array - self.treestore.textures.append(texture) - if fast==false: # update the big preview image screen.preview.draw() @@ -135,24 +129,16 @@ # create a TreeStore with one string column to use as the model self.treestore = gtk.TreeStore(str) - # create an array for the textures - self.treestore.textures = [] + # create an array for the rows + self.treestore.rows = [] # add the texture categories and the textures for category_name, category_textures in textures.items(): - category = self.treestore.append(none, [category_name]) - - # insert the category name in the array - self.treestore.textures.append({'name' : category_name, 'textures' : []}) - - # get the category id - category_id = len(self.treestore.textures) - 1 - for texture_name, texture_function in category_textures.items(): - self.treestore.append(category, [texture_name]) + self.treestore.append(none, [category_name + ' - ' + texture_name]) # add the texture to the array - self.treestore.textures[category_id]['textures'].append(texture_name) + self.treestore.rows.append(category_name + ' - ' + texture_name) # create the TreeView self.treeview = gtk.TreeView(self.treestore) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-24 19:46:54
|
Revision: 1112 http://opengate.svn.sourceforge.net/opengate/?rev=1112&view=rev Author: Ultrasick Date: 2009-03-24 19:46:51 +0000 (Tue, 24 Mar 2009) Log Message: ----------- adding texture: "dark background" which is meant to be used to fill the gaps between the panels Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/dark_background.png branches/ogEditor/data/modules/texturizer/textures/tauseti.blend Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/textures/tauseti/ Added: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/dark_background.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/dark_background.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 20:46:39 UTC (rev 1111) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-24 19:46:51 UTC (rev 1112) @@ -97,7 +97,7 @@ file_name += '.py' # open the file - self.file = open(file_name, 'w') + self.file = open(file_name, 'wb') # write the encoding info self.file.write('# -*- coding: cp1252 -*-' + '\n\n' + 'global a' + '\n\n') @@ -121,7 +121,7 @@ global model # open the file - file = open(file_name, 'r') + file = open(file_name, 'rb') # read the content content = file.read() @@ -195,6 +195,7 @@ # show file selection window self.window = gtk.FileSelection(caption) + self.window.set_size_request(600, 550) self.window.set_border_width(2) self.window.show() @@ -402,28 +403,28 @@ # del dimension info del(model['dimensions']) - # check if the panels texture was already initialized - try: - model['textures']['Tauseti']['panels'] + if model.has_key('textures'): + for texture_name, texture_content in model['textures']['Tauseti'].items(): + # compress the texture + for side_name, side_content in texture_content.items(): + # get the image width + width = len(side_content) - compress_panels = true - except: - compress_panels = false + for line_number, line_content in enumerate(side_content): + # join the single color values + colors = ''.join(line_content) - if compress_panels: - for side_name, side_content in model['textures']['Tauseti']['panels'].items(): - for line_number, line_content in enumerate(side_content): - # join the single color values - colors = ''.join(line_content) + # throw out the "#" + colors = colors.replace('#', '') - # throw out the "#" - colors = colors.replace('#', '') + # update the color values + side_content[line_number] = colors - # update the color values - side_content[line_number] = colors + # update the side + texture_content[side_name] = side_content - # update the side - model['textures']['Tauseti']['panels'][side_name] = side_content + # update the texture + model['textures']['Tauseti'][texture_name] = texture_content return model @@ -602,34 +603,31 @@ # update the face model['faces'][face_index] = face_content - # check if the panels texture was already initialized - try: - model['textures']['Tauseti']['panels'] + if model.has_key('textures'): + for texture_name, texture_content in model['textures']['Tauseti'].items(): + # decompress the panels texture + for side_name, side_content in texture_content.items(): + for line_number, colors in enumerate(side_content): + # create/reset the array for the line content + line_content = [] - decompress_panels = true - except: - decompress_panels = false + x = 0 + while x<len(colors): + color = '#' + colors[x : x + 6] - if decompress_panels: - for side_name, side_content in model['textures']['Tauseti']['panels'].items(): - for line_number, colors in enumerate(side_content): - # create/reset the array for the line content - line_content = [] + line_content.append(color) - x = 0 - while x<len(colors): - color = '#' + colors[x : x + 6] + x += 6 - line_content.append(color) + # update the line content + side_content[line_number] = line_content - x += 6 + # update the side + texture_content[side_name] = side_content - # update the line content - side_content[line_number] = line_content + # update the texture + model['textures']['Tauseti'][texture_name] = texture_content - # update the side - model['textures']['Tauseti']['panels'][side_name] = side_content - return model def save(self): @@ -649,7 +647,7 @@ global model # open the file - file = open(file_name, 'r') + file = open(file_name, 'rb') # read the lines lines = file.readlines() @@ -726,7 +724,7 @@ file_name += '.raw' # open the file - file = open(file_name, 'w') + file = open(file_name, 'wb') # write the faces to the file file.write(faces) Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 20:46:39 UTC (rev 1111) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-24 19:46:51 UTC (rev 1112) @@ -31,21 +31,7 @@ textures['Tauseti'] = {} class panels: - def __init__(self): - self.initialized = false - def initialize_step_1(self): - # check if the texture was already initialized (project was loaded) - try: - model['textures']['Tauseti']['panels'] - - self.initialized = true - - # return - return - except: - pass - # don't reload the preview image for now screen.preview.preview.handler_block(screen.preview.refresh_id) @@ -55,11 +41,19 @@ # create an array for the vertices of the face vertices = [] + # define coordinates + x_minus = (model['dimensions'][0]['length'] / 2) * (-1) + x_plus = model['dimensions'][0]['length'] / 2 + y_minus = (model['dimensions'][1]['length'] / 2) * (-1) + y_plus = model['dimensions'][1]['length'] / 2 + z_minus = (model['dimensions'][2]['length'] / 2) * (-1) + z_plus = model['dimensions'][2]['length'] / 2 + # create the vertices of the "x_min" face - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([x_minus, y_minus, z_minus]) + vertices.append([x_minus, y_plus, z_minus]) + vertices.append([x_minus, y_plus, z_plus]) + vertices.append([x_minus, y_minus, z_plus]) # insert the "x_min" face faces.append(vertices) @@ -68,10 +62,10 @@ vertices = [] # create the vertices of the "x_max" face - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([x_plus, y_minus, z_minus]) + vertices.append([x_plus, y_plus, z_minus]) + vertices.append([x_plus, y_plus, z_plus]) + vertices.append([x_plus, y_minus, z_plus]) # insert the "x_max" face faces.append(vertices) @@ -80,10 +74,10 @@ vertices = [] # create the vertices of the "y_min" face - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([x_minus, y_minus, z_minus]) + vertices.append([x_plus, y_minus, z_minus]) + vertices.append([x_plus, y_minus, z_plus]) + vertices.append([x_minus, y_minus, z_plus]) # insert the "y_min" face faces.append(vertices) @@ -92,10 +86,10 @@ vertices = [] # create the vertices of the "y_max" face - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([x_minus, y_plus, z_minus]) + vertices.append([x_plus, y_plus, z_minus]) + vertices.append([x_plus, y_plus, z_plus]) + vertices.append([x_minus, y_plus, z_plus]) # insert the "y_max" face faces.append(vertices) @@ -104,10 +98,10 @@ vertices = [] # create the vertices of the "z_min" face - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([x_minus, y_minus, z_minus]) + vertices.append([x_plus, y_minus, z_minus]) + vertices.append([x_plus, y_plus, z_minus]) + vertices.append([x_minus, y_plus, z_minus]) # insert the "z_min" face faces.append(vertices) @@ -116,10 +110,10 @@ vertices = [] # create the vertices of the "z_max" face - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) - vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([x_minus, y_minus, z_plus]) + vertices.append([x_plus, y_minus, z_plus]) + vertices.append([x_plus, y_plus, z_plus]) + vertices.append([x_minus, y_plus, z_plus]) # insert the "z_max" face faces.append(vertices) @@ -139,12 +133,12 @@ VBox.show() # show instructions - text = gtk.Label('Step 1 (creating the raw faces) is done. Step 2:\n\n') - text.set_text(text.get_text() + '1.) Open "data/modules/texturizer/textures/tauseti/panels.blend"\n') - text.set_text(text.get_text() + '2.) Delete the selected cube (move the mouse over the pink cube and press the [del] key and [enter] afterwards).\n') + text = gtk.Label() + text.set_text(text.get_text() + '1.) Open "data/modules/texturizer/textures/tauseti.blend"\n') + text.set_text(text.get_text() + '2.) Delete the selected cube (move the mouse over the pink cube and press the [del] key and then [enter] afterwards).\n') text.set_text(text.get_text() + '3.) Import the just saved raw faces ("File" -> "Import" -> "Raw Faces (.raw)"). Now you should have a small selected box which represents the bounding box of your model.\n') - text.set_text(text.get_text() + '4.) Right click the new box (even if it is already selected) to make the buttons appear on the bottom of the screen.\n') - text.set_text(text.get_text() + '5.) Press [F5] ... just in case you don\'t already see the material buttons.\n') + text.set_text(text.get_text() + '4.) Right click the new box (even if it is already selected). It\'s for working around a bug in blender.\n') + text.set_text(text.get_text() + '5.) Press [F5] to make the material buttons visible.\n') text.set_text(text.get_text() + '6.) Frame: "Links and Pipeline", section: "Link to Object", look for a button labeled "Add New". Left to it should be a smaller button with 2 arrows on it.\n') text.set_text(text.get_text() + '7.) Press this "arrowed" button and select the panels texture.\n') text.set_text(text.get_text() + '8.) Frame: "Texture", click on the button labeled "panels_1" so that it has a dark background.\n') @@ -155,53 +149,51 @@ text.set_text(text.get_text() + '13.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 10) + '\n') text.set_text(text.get_text() + '14.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 10) + '\n') text.set_text(text.get_text() + '15.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 10) + '\n') - text.set_text(text.get_text() + '16.) Press [F9] to switch to the editing section.\n') - text.set_text(text.get_text() + '17.) Frame: "Mesh", look for a button labeled "Center". It\'s near 2 other buttons labeled "Center New" and "Center Cursor"\n') - text.set_text(text.get_text() + '18.) Press the button labeled "Center" to move the bounding box to the center of the axes (maybe you don\'t see anything changing).\n') - text.set_text(text.get_text() + '19.) Right click the camera objects till you found the camera called "x_min" (the name is being displayed on the lower left corner of the 3d view).\n') - text.set_text(text.get_text() + '20.) Press the [ctrl] key and the [0] key on the numeric key pad to change the view to become inside of the camera.\n') - text.set_text(text.get_text() + '21.) Frame: "Camera", section: "Lens", change the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') - text.set_text(text.get_text() + '22.) Press [F10] to enter the rendering options.\n') - text.set_text(text.get_text() + '23.) Frame: "Format", change the value of "SizeX" to ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '.\n') - text.set_text(text.get_text() + '24.) Frame: "Format", change the value of "SizeY" to ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '.\n') - text.set_text(text.get_text() + '25.) Press [F12] to start the rendering and wait untill blender has done it\'s job. Now you should see an image of the panels.\n') - text.set_text(text.get_text() + '26.) Press [F3] to save the *.bmp file as "x_min.bmp" somewhere on your hard disc. Now you should see the panels texture again.\n') - text.set_text(text.get_text() + '27.) Press [Esc] to change the view back to inside the camera called "x_min" and then [0] on the numeric key pad to leave this camera.\n') - text.set_text(text.get_text() + '28.) Right click through the camera objects again till you found the one called "x_max".\n') - text.set_text(text.get_text() + '29.) Press [ctrl] + [0] on the numeric key pad.\n') - text.set_text(text.get_text() + '30.) [F9]\n') - text.set_text(text.get_text() + '31.) Set the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') - text.set_text(text.get_text() + '32.) [F12] and wait till the rendering is done.\n') - text.set_text(text.get_text() + '33.) [F3], file name: "x_max.bmp"\n') - text.set_text(text.get_text() + '34.) [Esc]\n') - text.set_text(text.get_text() + '35.) [0] on the numeric key pad.\n') - text.set_text(text.get_text() + '36.) find the camera called "y_min"\n') - text.set_text(text.get_text() + '37.) [ctrl] + [0] (numeric key pad)\n') - text.set_text(text.get_text() + '38.) scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '.\n') - text.set_text(text.get_text() + '39.) [F10]\n') - text.set_text(text.get_text() + '40.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n') - text.set_text(text.get_text() + '41.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n') - text.set_text(text.get_text() + '42.) [F12] and wait\n') - text.set_text(text.get_text() + '43.) [F3], file name: "y_min.bmp"\n') - text.set_text(text.get_text() + '44.) [Esc] and then [0] (numeric pad)\n') - text.set_text(text.get_text() + '45.) select the "y_max" camera\n') - text.set_text(text.get_text() + '46.) [ctrl] + [0] (num pad)\n') - text.set_text(text.get_text() + '47.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '\n') - text.set_text(text.get_text() + '48.) [F12] and wait, then [F3], file name: "y_max.bmp"\n') - text.set_text(text.get_text() + '49.) [Esc] then [0] (num pad)\n') - text.set_text(text.get_text() + '50.) select camera "z_min" and then press [ctrl] + [0] (num pad), scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') - text.set_text(text.get_text() + '51.) [F10], "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n') - text.set_text(text.get_text() + '52.) [F12] then [F3], file name: "z_min.bmp"\n') - text.set_text(text.get_text() + '53.) [Esc] then [0] (num pad)\n') - text.set_text(text.get_text() + '54.) select the camera "z_max", then [ctrl] + [0] (num pad)\n') - text.set_text(text.get_text() + '55.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') - text.set_text(text.get_text() + '56.) [F12], then [F3], file name: "z_max.bmp"\n') - text.set_text(text.get_text() + '57.) close blender without saving panels.blend') + text.set_text(text.get_text() + '16.) Right click the camera objects till you found the camera called "x_min" (the name is being displayed on the lower left corner of the 3d view).\n') + text.set_text(text.get_text() + '17.) Press the [ctrl] key and the [0] key on the numeric key pad to change the view to become inside of the camera.\n') + text.set_text(text.get_text() + '18.) Press [F9].\n') + text.set_text(text.get_text() + '19.) Frame: "Camera", section: "Lens", change the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '20.) Press [F10] to enter the rendering options.\n') + text.set_text(text.get_text() + '21.) Frame: "Format", change the value of "SizeX" to ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '.\n') + text.set_text(text.get_text() + '22.) Frame: "Format", change the value of "SizeY" to ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '.\n') + text.set_text(text.get_text() + '23.) Press [F12] to start the rendering and wait untill blender has done it\'s job. Now you should see an image of the panels.\n') + text.set_text(text.get_text() + '24.) Press [F3] to save the *.bmp file as "x_min.bmp" somewhere on your hard disc. Now you should see the panels texture again.\n') + text.set_text(text.get_text() + '25.) Press [Esc] to change the view back to inside the camera called "x_min" and then [0] on the numeric key pad to leave this camera.\n') + text.set_text(text.get_text() + '26.) Right click through the camera objects again till you found the one called "x_max".\n') + text.set_text(text.get_text() + '27.) Press [ctrl] + [0] on the numeric key pad.\n') + text.set_text(text.get_text() + '28.) [F9]\n') + text.set_text(text.get_text() + '29.) Set the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '30.) [F12] and wait till the rendering is done.\n') + text.set_text(text.get_text() + '31.) [F3], file name: "x_max.bmp"\n') + text.set_text(text.get_text() + '32.) [Esc]\n') + text.set_text(text.get_text() + '33.) [0] on the numeric key pad.\n') + text.set_text(text.get_text() + '34.) Select the camera called "y_min".\n') + text.set_text(text.get_text() + '35.) [ctrl] + [0] (numeric key pad)\n') + text.set_text(text.get_text() + '36.) scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '37.) [F10]\n') + text.set_text(text.get_text() + '38.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '39.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '40.) [F12] and wait\n') + text.set_text(text.get_text() + '41.) [F3], file name: "y_min.bmp"\n') + text.set_text(text.get_text() + '42.) [Esc] and then [0] (numeric pad)\n') + text.set_text(text.get_text() + '43.) Select the "y_max" camera.\n') + text.set_text(text.get_text() + '44.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '45.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '\n') + text.set_text(text.get_text() + '46.) [F12] and wait, then [F3], file name: "y_max.bmp"\n') + text.set_text(text.get_text() + '47.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '48.) Select camera "z_min" and then press [ctrl] + [0] (num pad), scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') + text.set_text(text.get_text() + '49.) [F10], "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '50.) [F12] then [F3], file name: "z_min.bmp"\n') + text.set_text(text.get_text() + '51.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '52.) Select the camera "z_max", then [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '53.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') + text.set_text(text.get_text() + '54.) [F12], then [F3], file name: "z_max.bmp"\n') + text.set_text(text.get_text() + '55.) That\'s it for now, but don\'t close blender jet.') VBox.add(text) text.show() - # show "step 3 ->"-button - button = gtk.Button('step 3 ->') + # show "next step ->"-button + button = gtk.Button('next step ->') VBox.add(button) button.show() @@ -257,8 +249,183 @@ # store the pixels model['textures']['Tauseti']['panels']['z_max'] = file_selection_window.return_value - self.initialized = true + # initialize the next texture + textures['Tauseti']['dark background'].initialize_step_1() + def get_color(self, vertice, face): + # select the right object as the drawing area + self.drawing_area = screen.preview.preview.window + + # select the color map + self.color_map = self.drawing_area.get_colormap() + + # get the most parallel side of the bounding box to the face + most_parallel_side = face['most_parallel_side'] + + # create an array for the coordinates of the pixel + coordinates = {} + + # get the x-coordinate of the pixel + if most_parallel_side[:1]=='x': + axis_0 = 1 + axis_1 = 2 + else: + coordinates[0] = vertice[0] - model['dimensions'][0]['min'] + coordinates[0] *= 100 * resolution_texture_map + coordinates[0] = int(round(coordinates[0])) + + # get the y-coordinate of the pixel + if most_parallel_side[:1]=='y': + axis_0 = 0 + axis_1 = 2 + else: + coordinates[1] = vertice[1] - model['dimensions'][1]['min'] + coordinates[1] *= 100 * resolution_texture_map + coordinates[1] = int(round(coordinates[1])) + + # get the z-coordinate of the pixel + if most_parallel_side[:1]=='z': + axis_0 = 0 + axis_1 = 1 + else: + coordinates[2] = vertice[2] - model['dimensions'][2]['min'] + coordinates[2] *= 100 * resolution_texture_map + coordinates[2] = int(round(coordinates[2])) + + # get the color + color = model['textures']['Tauseti']['panels'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] + + if self.drawing_area.colors.has_key(color)==false: + # save the color + self.drawing_area.colors[color] = self.drawing_area.new_gc(foreground = self.color_map.alloc_color(gtk.gdk.color_parse(color))) + + return self.drawing_area.colors[color] + +textures['Tauseti']['panels'] = panels() + +class dark_background: + def initialize_step_1(self): + # show window + self.instructions_window = gtk.Window() + self.instructions_window.set_title('ogEditor - manually initializing the dark background texture') + self.instructions_window.show() + + # show a VBox + VBox = gtk.VBox(spacing = 5) + self.instructions_window.add(VBox) + VBox.show() + + # show instructions + text = gtk.Label() + text.set_text(text.get_text() + '1.) Back in blender, press [Esc] and then [0] on the num pad.\n') + text.set_text(text.get_text() + '2.) Select the small box in the middle of the 3d view which represents the bounding box of the model.\n') + text.set_text(text.get_text() + '3.) [F5]\n') + text.set_text(text.get_text() + '4.) Frame: "Links and Pipeline", section: "Link to Object", select the dark background texture.\n') + text.set_text(text.get_text() + '5.) Frame: "Texture", click on the upper button of thouse 2 which are labeled "line" so that it has a dark background.\n') + text.set_text(text.get_text() + '6.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 100) + '\n') + text.set_text(text.get_text() + '7.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 100) + '\n') + text.set_text(text.get_text() + '8.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 100) + '\n') + text.set_text(text.get_text() + '9.) Frame: "Texture", click on the lower button of thouse 2 which are labeled "line" so that it has a dark background.\n') + text.set_text(text.get_text() + '10.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 100 * (-1)) + '\n') + text.set_text(text.get_text() + '11.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 100 * (-1)) + '\n') + text.set_text(text.get_text() + '12.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 100) + '\n') + text.set_text(text.get_text() + '13.) Frame: "Texture", click on the button labeled "mask" so that it has a dark background.\n') + text.set_text(text.get_text() + '14.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 30) + '\n') + text.set_text(text.get_text() + '15.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 30) + '\n') + text.set_text(text.get_text() + '16.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 30) + '\n') + text.set_text(text.get_text() + '17.) Select the camera called "x_min".\n') + text.set_text(text.get_text() + '18.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '19.) [F10]\n') + text.set_text(text.get_text() + '20.) Frame: "Format", "SizeX": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '21.) Frame: "Format", "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '22.) [F12]\n') + text.set_text(text.get_text() + '23.) [F3], file name: "x_min.bmp", overwrite the existing file.\n') + text.set_text(text.get_text() + '24.) [Esc] and then [0] on the num pad to leave this camera.\n') + text.set_text(text.get_text() + '25.) Select the camera called "x_max".\n') + text.set_text(text.get_text() + '26.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '27.) [F12] then [F3], file name: "x_max.bmp", overwrite\n') + text.set_text(text.get_text() + '28.) [Esc]\n') + text.set_text(text.get_text() + '29.) [0] (num pad)\n') + text.set_text(text.get_text() + '30.) Select the camera called "y_min".\n') + text.set_text(text.get_text() + '31.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '32.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '33.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '34.) [F12] then [F3], file name: "y_min.bmp", overwrite\n') + text.set_text(text.get_text() + '35.) [Esc] and then [0] (numeric pad)\n') + text.set_text(text.get_text() + '36.) Select the "y_max" camera.\n') + text.set_text(text.get_text() + '37.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '38.) [F12] then [F3], file name: "y_max.bmp", overwrite\n') + text.set_text(text.get_text() + '39.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '40.) Select the small cube.\n') + text.set_text(text.get_text() + '41.) [F5].\n') + text.set_text(text.get_text() + '42.) Frame: "Texture", click on the lower button of thouse 2 which are labeled "line" so that it has a dark background.\n') + text.set_text(text.get_text() + '43.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 100) + '\n') + text.set_text(text.get_text() + '44.) Select camera "z_min" and then press [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '45.) [F10]') + text.set_text(text.get_text() + '46.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '47.) [F12] then [F3], file name: "z_min.bmp", overwrite\n') + text.set_text(text.get_text() + '48.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '49.) Select the camera "z_max", then [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '50.) [F12], then [F3], file name: "z_max.bmp"\n') + text.set_text(text.get_text() + '51.) Close blender without saving tauseti.blend.') + VBox.add(text) + text.show() + + # show "next step ->"-button + button = gtk.Button('next step ->') + VBox.add(button) + button.show() + + # connect a function to the button + button.connect('clicked', lambda x: self.initialize_step_2()) + + def initialize_step_2(self): + # destroy the instructions window + self.instructions_window.destroy() + + # read "x_min.bmp" + file_selection_window.show('select the file "x_min.bmp":', bmp_file.load, none, self.initialize_step_3) + + def initialize_step_3(self): + # store the pixels + model['textures']['Tauseti']['dark background'] = {} + model['textures']['Tauseti']['dark background']['x_min'] = file_selection_window.return_value + + # read "x_max.bmp" + file_selection_window.show('select the file "x_max.bmp":', bmp_file.load, none, self.initialize_step_4) + + def initialize_step_4(self): + # store the pixels + model['textures']['Tauseti']['dark background']['x_max'] = file_selection_window.return_value + + # read "y_min.bmp" + file_selection_window.show('select the file "y_min.bmp":', bmp_file.load, none, self.initialize_step_5) + + def initialize_step_5(self): + # store the pixels + model['textures']['Tauseti']['dark background']['y_min'] = file_selection_window.return_value + + # read "y_max.bmp" + file_selection_window.show('select the file "y_max.bmp":', bmp_file.load, none, self.initialize_step_6) + + def initialize_step_6(self): + # store the pixels + model['textures']['Tauseti']['dark background']['y_max'] = file_selection_window.return_value + + # read "z_min.bmp" + file_selection_window.show('select the file "z_min.bmp":', bmp_file.load, none, self.initialize_step_7) + + def initialize_step_7(self): + # store the pixels + model['textures']['Tauseti']['dark background']['z_min'] = file_selection_window.return_value + + # read "z_max.bmp" + file_selection_window.show('select the file "z_max.bmp":', bmp_file.load, none, self.initialize_step_8) + + def initialize_step_8(self): + # store the pixels + model['textures']['Tauseti']['dark background']['z_max'] = file_selection_window.return_value + # make the preview image reload again screen.preview.preview.handler_unblock(screen.preview.refresh_id) @@ -303,7 +470,7 @@ coordinates[2] = int(round(coordinates[2])) # get the color - color = model['textures']['Tauseti']['panels'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] + color = model['textures']['Tauseti']['dark background'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] if self.drawing_area.colors.has_key(color)==false: # save the color @@ -311,4 +478,4 @@ return self.drawing_area.colors[color] -textures['Tauseti']['panels'] = panels() \ No newline at end of file +textures['Tauseti']['dark background'] = dark_background() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-22 20:46:39 UTC (rev 1111) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-24 19:46:51 UTC (rev 1112) @@ -48,7 +48,7 @@ self.texture_name = textures[texture[0]]['textures'][texture[1]] # update the preview image - self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower() + '/' + self.texture_name.lower() + '.png') + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') screen.texture_preview = texture_preview(table) @@ -207,5 +207,5 @@ tools(table) # initialize textures -if textures['Tauseti']['panels'].initialized==false: +if model.has_key('textures')==false: textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Added: branches/ogEditor/data/modules/texturizer/textures/tauseti.blend =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/textures/tauseti.blend ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 20:46:47
|
Revision: 1111 http://opengate.svn.sourceforge.net/opengate/?rev=1111&view=rev Author: Ultrasick Date: 2009-03-22 20:46:39 +0000 (Sun, 22 Mar 2009) Log Message: ----------- fixed another scaling bug Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/textures.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 10:20:41 UTC (rev 1110) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 20:46:39 UTC (rev 1111) @@ -390,8 +390,8 @@ # delete the edges del(face_content['edges']) - # delete the nearest side - del(face_content['nearest_side']) + # delete the most parallel side of the bounding box + del(face_content['most_parallel_side']) # store the updated face model['faces'][face_index] = face_content @@ -562,75 +562,43 @@ model['dimensions'][1]['average'] = sum(average_y)/len(average_y) model['dimensions'][2]['average'] = sum(average_z)/len(average_z) - # get the nearest side of the bounding box for each face - for face_index, face_content in enumerate(model['faces']): - # create new arrays for the average coordinates of this face - average_x = [] - average_y = [] - average_z = [] + # create an array for the normal vectors of the bounding box + bounding_box_normal_vectors = {} - # get the coordinates of this face - for vertice_index, coordinates in enumerate(face_content['vertices']): - # store the coordinates - average_x.append(coordinates[0]) - average_y.append(coordinates[1]) - average_z.append(coordinates[2]) + # store the normal vectors + bounding_box_normal_vectors['x_min'] = [-1, 0, 0] + bounding_box_normal_vectors['x_max'] = [1, 0, 0] + bounding_box_normal_vectors['y_min'] = [0, -1, 0] + bounding_box_normal_vectors['y_max'] = [0, 1, 0] + bounding_box_normal_vectors['z_min'] = [0, 0, -1] + bounding_box_normal_vectors['z_max'] = [0, 0, 1] - # calculate the average coordinates - average_x = sum(average_x)/len(average_x) - average_y = sum(average_y)/len(average_y) - average_z = sum(average_z)/len(average_z) + # get the most parallel side of the bounding box + for face_index, face_content in enumerate(model['faces']): + # get the first vector of the face + vector_1 = geometry.get_vector(face_content['edges'][0][0], face_content['edges'][0][1]) - # get the vector from the center of the model (average coordinate) to the vertice - vector = geometry.get_vector([model['dimensions'][0]['average'], model['dimensions'][1]['average'], model['dimensions'][2]['average']], [average_x, average_y, average_z]) + # get the second vector of the face + vector_2 = geometry.get_vector(face_content['edges'][1][0], face_content['edges'][1][1]) - # get the distances to the "x-sides" - x_min = (model['dimensions'][0]['min'] - model['dimensions'][0]['average'])/vector[0] - x_max = (model['dimensions'][0]['max'] - model['dimensions'][0]['average'])/vector[0] + # get the normal vector of the face + face_normal_vector = geometry.get_cross_product(vector_1, vector_2) - # choose the positiv side - if x_min>x_max: - x_side = 'x_min' - x_value = x_min - else: - x_side = 'x_max' - x_value = x_max + # initialize the angle variable with 360\xB0 + angle = 2 * pi - # get the distances to the "y-sides" - y_min = (model['dimensions'][1]['min'] - model['dimensions'][1]['average'])/vector[1] - y_max = (model['dimensions'][1]['max'] - model['dimensions'][1]['average'])/vector[1] + # get the smallest angle between the face and the faces of the bounding box + for bounding_box_side_name, bounding_box_normal_vector in bounding_box_normal_vectors.items(): + this_angle = geometry.get_angle(face_normal_vector, bounding_box_normal_vector) - # choose the positiv side - if y_min>y_max: - y_side = 'y_min' - y_value = y_min - else: - y_side = 'y_max' - y_value = y_max + if this_angle<angle: + angle = this_angle - # get the distances to the "z-sides" - z_min = (model['dimensions'][2]['min'] - model['dimensions'][2]['average'])/vector[2] - z_max = (model['dimensions'][2]['max'] - model['dimensions'][2]['average'])/vector[2] + most_parallel_side = bounding_box_side_name - # choose the positiv side - if z_min>z_max: - z_side = 'z_min' - z_value = z_min - else: - z_side = 'z_max' - z_value = z_max + # store the most parallel side + face_content['most_parallel_side'] = most_parallel_side - # selected the nearest side - if min(x_value, y_value, z_value)==x_value: - nearest_side = x_side - elif min(x_value, y_value, z_value)==y_value: - nearest_side = y_side - elif min(x_value, y_value, z_value)==z_value: - nearest_side = z_side - - # store the nearest side - face_content['nearest_side'] = nearest_side - # update the face model['faces'][face_index] = face_content Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 10:20:41 UTC (rev 1110) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 20:46:39 UTC (rev 1111) @@ -49,7 +49,6 @@ # don't reload the preview image for now screen.preview.preview.handler_block(screen.preview.refresh_id) - # create an array for the faces of the bounding box faces = [] @@ -270,14 +269,14 @@ # select the color map self.color_map = self.drawing_area.get_colormap() - # get the nearest side of the bounding box to the face - nearest_side = face['nearest_side'] + # get the most parallel side of the bounding box to the face + most_parallel_side = face['most_parallel_side'] # create an array for the coordinates of the pixel coordinates = {} # get the x-coordinate of the pixel - if nearest_side[:1]=='x': + if most_parallel_side[:1]=='x': axis_0 = 1 axis_1 = 2 else: @@ -286,7 +285,7 @@ coordinates[0] = int(round(coordinates[0])) # get the y-coordinate of the pixel - if nearest_side[:1]=='y': + if most_parallel_side[:1]=='y': axis_0 = 0 axis_1 = 2 else: @@ -295,7 +294,7 @@ coordinates[1] = int(round(coordinates[1])) # get the z-coordinate of the pixel - if nearest_side[:1]=='z': + if most_parallel_side[:1]=='z': axis_0 = 0 axis_1 = 1 else: @@ -304,7 +303,7 @@ coordinates[2] = int(round(coordinates[2])) # get the color - color = model['textures']['Tauseti']['panels'][nearest_side][coordinates[axis_1]][coordinates[axis_0]] + color = model['textures']['Tauseti']['panels'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] if self.drawing_area.colors.has_key(color)==false: # save the color This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 10:20:51
|
Revision: 1110 http://opengate.svn.sourceforge.net/opengate/?rev=1110&view=rev Author: Ultrasick Date: 2009-03-22 10:20:41 +0000 (Sun, 22 Mar 2009) Log Message: ----------- fixing some scaling problems. there is another known bug about the scaling Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 09:40:27 UTC (rev 1109) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 10:20:41 UTC (rev 1110) @@ -373,6 +373,309 @@ return true +class project: + def deconstruct(self, model): + # coordinates -> vertice number + for face_index, face_content in enumerate(model['faces']): + # get the vertices + vertices = face_content['vertices'] + + for vertice_index, coordinates in enumerate(vertices): + # get the vertice number + vertices[vertice_index] = model['vertices'].index(coordinates) + + # store the updated vertices + face_content['vertices'] = vertices + + # delete the edges + del(face_content['edges']) + + # delete the nearest side + del(face_content['nearest_side']) + + # store the updated face + model['faces'][face_index] = face_content + + # del edges + del(model['edges']) + + # del dimension info + del(model['dimensions']) + + # check if the panels texture was already initialized + try: + model['textures']['Tauseti']['panels'] + + compress_panels = true + except: + compress_panels = false + + if compress_panels: + for side_name, side_content in model['textures']['Tauseti']['panels'].items(): + for line_number, line_content in enumerate(side_content): + # join the single color values + colors = ''.join(line_content) + + # throw out the "#" + colors = colors.replace('#', '') + + # update the color values + side_content[line_number] = colors + + # update the side + model['textures']['Tauseti']['panels'][side_name] = side_content + + return model + + def load(self): + # make the model array global + global model + + # create an new array for the model + model = {} + + # store the content of the model array + model = self.reconstruct(file_selection_window.return_value) + + # load the next screen + show_screen('project/canvas') + + def new(self): + # make the model array global + global model + + # create an new array for the model + model = {} + + # load the raw faces + file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') + + def reconstruct(self, model): + # create an array for the edges + model['edges'] = [] + + # vertice number -> coordinates + for face_index, face_content in enumerate(model['faces']): + # get the vertices + vertices = face_content['vertices'] + + for vertice_index, vertice_number in enumerate(vertices): + # get the coordinates + vertices[vertice_index] = model['vertices'][vertice_number] + + # store the updated vertices + face_content['vertices'] = vertices + + # create an array for the edges + edges = [] + + for vertice_index, coordinates in enumerate(vertices): + first_vertice = coordinates + + # grab the second vertice + try: + second_vertice = vertices[vertice_index + 1] + except: + second_vertice = vertices[0] + + # store the edge + edges.append([first_vertice, second_vertice]) + + # check if the edge is already stored + if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: + # store the edge in the model array + model['edges'].append([first_vertice, second_vertice]) + + # store the edges + face_content['edges'] = edges + + # store the updated face + model['faces'][face_index] = face_content + + # create new arrays for the dimensions + model['dimensions'] = {} + model['dimensions'][0] = {} # x + model['dimensions'][1] = {} # y + model['dimensions'][2] = {} # z + + # define min and max coordinates for the x-axis + model['dimensions'][0]['min'] = 99999999 + model['dimensions'][0]['max'] = -99999999 + + # define min and max coordinates for the y-axis + model['dimensions'][1]['min'] = 99999999 + model['dimensions'][1]['max'] = -99999999 + + # define min and max coordinates for the z-axis + model['dimensions'][2]['min'] = 99999999 + model['dimensions'][2]['max'] = -99999999 + + # create new arrays for the average coordinates + average_x = [] + average_y = [] + average_z = [] + + # get the dimensional information + for vertice in model['vertices']: + # get the coordinates + x = vertice[0] + y = vertice[1] + z = vertice[2] + + # update min coorinate for the x-axis + if x<model['dimensions'][0]['min']: + model['dimensions'][0]['min'] = x + + # update max coorinate for the x-axis + if x>model['dimensions'][0]['max']: + model['dimensions'][0]['max'] = x + + # update min coorinate for the y-axis + if y<model['dimensions'][1]['min']: + model['dimensions'][1]['min'] = y + + # update max coorinate for the y-axis + if y>model['dimensions'][1]['max']: + model['dimensions'][1]['max'] = y + + # update min coorinate for the z-axis + if z<model['dimensions'][2]['min']: + model['dimensions'][2]['min'] = z + + # update max coorinate for the z-axis + if z>model['dimensions'][2]['max']: + model['dimensions'][2]['max'] = z + + # store the coordinates for the average values + average_x.append(x) + average_y.append(y) + average_z.append(z) + + # insert length values + model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] + model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] + model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] + model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) + + # insert the average values + model['dimensions'][0]['average'] = sum(average_x)/len(average_x) + model['dimensions'][1]['average'] = sum(average_y)/len(average_y) + model['dimensions'][2]['average'] = sum(average_z)/len(average_z) + + # get the nearest side of the bounding box for each face + for face_index, face_content in enumerate(model['faces']): + # create new arrays for the average coordinates of this face + average_x = [] + average_y = [] + average_z = [] + + # get the coordinates of this face + for vertice_index, coordinates in enumerate(face_content['vertices']): + # store the coordinates + average_x.append(coordinates[0]) + average_y.append(coordinates[1]) + average_z.append(coordinates[2]) + + # calculate the average coordinates + average_x = sum(average_x)/len(average_x) + average_y = sum(average_y)/len(average_y) + average_z = sum(average_z)/len(average_z) + + # get the vector from the center of the model (average coordinate) to the vertice + vector = geometry.get_vector([model['dimensions'][0]['average'], model['dimensions'][1]['average'], model['dimensions'][2]['average']], [average_x, average_y, average_z]) + + # get the distances to the "x-sides" + x_min = (model['dimensions'][0]['min'] - model['dimensions'][0]['average'])/vector[0] + x_max = (model['dimensions'][0]['max'] - model['dimensions'][0]['average'])/vector[0] + + # choose the positiv side + if x_min>x_max: + x_side = 'x_min' + x_value = x_min + else: + x_side = 'x_max' + x_value = x_max + + # get the distances to the "y-sides" + y_min = (model['dimensions'][1]['min'] - model['dimensions'][1]['average'])/vector[1] + y_max = (model['dimensions'][1]['max'] - model['dimensions'][1]['average'])/vector[1] + + # choose the positiv side + if y_min>y_max: + y_side = 'y_min' + y_value = y_min + else: + y_side = 'y_max' + y_value = y_max + + # get the distances to the "z-sides" + z_min = (model['dimensions'][2]['min'] - model['dimensions'][2]['average'])/vector[2] + z_max = (model['dimensions'][2]['max'] - model['dimensions'][2]['average'])/vector[2] + + # choose the positiv side + if z_min>z_max: + z_side = 'z_min' + z_value = z_min + else: + z_side = 'z_max' + z_value = z_max + + # selected the nearest side + if min(x_value, y_value, z_value)==x_value: + nearest_side = x_side + elif min(x_value, y_value, z_value)==y_value: + nearest_side = y_side + elif min(x_value, y_value, z_value)==z_value: + nearest_side = z_side + + # store the nearest side + face_content['nearest_side'] = nearest_side + + # update the face + model['faces'][face_index] = face_content + + # check if the panels texture was already initialized + try: + model['textures']['Tauseti']['panels'] + + decompress_panels = true + except: + decompress_panels = false + + if decompress_panels: + for side_name, side_content in model['textures']['Tauseti']['panels'].items(): + for line_number, colors in enumerate(side_content): + # create/reset the array for the line content + line_content = [] + + x = 0 + while x<len(colors): + color = '#' + colors[x : x + 6] + + line_content.append(color) + + x += 6 + + # update the line content + side_content[line_number] = line_content + + # update the side + model['textures']['Tauseti']['panels'][side_name] = side_content + + return model + + def save(self): + # check if the model array exists + try: + model + except: + return + + # save the model array + file_selection_window.show('select a directory and file name for the project:', array.save, self.deconstruct(model), exit) + +project = project() + class raw_file: def load(self, file_name): global model Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 09:40:27 UTC (rev 1109) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 10:20:41 UTC (rev 1110) @@ -140,7 +140,64 @@ VBox.show() # show instructions - text = gtk.Label('Step 1 (creating the raw faces) is done. Step 2:\n\n1.) Open "data/modules/texturizer/textures/tauseti/panels.blend"\n2.) Delete the selected cube (move the mouse over the pink cube and press the [del] key and [enter] afterwards).\n3.) Import the just saved raw faces ("File" -> "Import" -> "Raw Faces (.raw)"). Now you should have a small selected box which represents the bounding box of your model.\n4.) Right click the new box (even if it is already selected) to make the buttons appear on the bottom of the screen.\n5.) Press [F5] ... just in case you don\'t already see the material buttons.\n6.) Frame: "Links and Pipeline", section: "Link to Object", there should be a button labeled "Add New". Left to it should be a smaller button with 2 arrows on it. Press this "arrowed" button and select the panels texture.\n7.) Press [F9] to switch to the editing section.\n8.) Frame: "Mesh", look for a button labeled "Center". It\'s near 2 other buttons labeled "Center New" and "Center Cursor"\n9.) Press the button labeled "Center" to move the bounding box to the center of the axes (maybe you don\'t see anything changing).\n10.) Right click the camera objects till you found the camera called "x_min" (the name is being displayed on the lower left corner of the 3d view).\n11.) Press the [ctrl] key and the [0] key on the numeric key pad to change the view to become inside of the camera.\n12.) Frame: "Camera", section: "Lens", change the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n13.) Press [F10] to enter the rendering options.\n14.) Frame: "Format", change the value of "SizeX" to ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '.\n15.) Frame: "Format", change the value of "SizeY" to ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '.\n16.) Press [F12] to start the rendering and wait untill blender has done it\'s job. Now you should see an image of the panels.\n17.) Press [F3] to save the *.bmp file as "x_min.bmp" somewhere on your hard disc. Now you should see the panels texture again.\n18.) Press [Esc] to change the view back to inside the camera called "x_min" and then [0] on the numeric key pad to leave this camera.\n19.) Right click through the camera objects again till you found the one called "x_max".\n20.) Press [ctrl] + [0] on the numeric key pad.\n21.) [F9]\n22.) Set the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n23.) [F12] and wait till the rendering is done.\n24.) [F3], file name: "x_max.bmp"\n25.) [Esc]\n26.) [0] on the numeric key pad.\n27.) find the camera called "y_min"\n28.) [ctrl] + [0] (numeric key pad)\n29.) scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '.\n30.) [F10]\n31.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n32.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n33.) [F12] and wait\n34.) [F3], file name: "y_min.bmp"\n35.) [Esc] and then [0] (numeric pad)\n36.) select the "y_max" camera\n37.) [ctrl] + [0] (num pad)\n37.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '\n38.) [F12] and wait, then [F3], file name: "y_max.bmp"\n39.) [Esc] then [0] (num pad)\n40.) select camera "z_min" and then press [ctrl] + [0] (num pad), scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n41.) [F10], "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n42.) [F12] then [F3], file name: "z_min.bmp"\n43.) [Esc] then [0] (num pad)\n44.) select the camera "z_max", then [ctrl] + [0] (num pad)\n45.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n46.) [F12], then [F3], file name: "z_max.bmp"\n47.) close blender without saving panels.blend') + text = gtk.Label('Step 1 (creating the raw faces) is done. Step 2:\n\n') + text.set_text(text.get_text() + '1.) Open "data/modules/texturizer/textures/tauseti/panels.blend"\n') + text.set_text(text.get_text() + '2.) Delete the selected cube (move the mouse over the pink cube and press the [del] key and [enter] afterwards).\n') + text.set_text(text.get_text() + '3.) Import the just saved raw faces ("File" -> "Import" -> "Raw Faces (.raw)"). Now you should have a small selected box which represents the bounding box of your model.\n') + text.set_text(text.get_text() + '4.) Right click the new box (even if it is already selected) to make the buttons appear on the bottom of the screen.\n') + text.set_text(text.get_text() + '5.) Press [F5] ... just in case you don\'t already see the material buttons.\n') + text.set_text(text.get_text() + '6.) Frame: "Links and Pipeline", section: "Link to Object", look for a button labeled "Add New". Left to it should be a smaller button with 2 arrows on it.\n') + text.set_text(text.get_text() + '7.) Press this "arrowed" button and select the panels texture.\n') + text.set_text(text.get_text() + '8.) Frame: "Texture", click on the button labeled "panels_1" so that it has a dark background.\n') + text.set_text(text.get_text() + '9.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 10) + '\n') + text.set_text(text.get_text() + '10.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 10) + '\n') + text.set_text(text.get_text() + '11.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 10) + '\n') + text.set_text(text.get_text() + '12.) Frame: "Texture", click on the button labeled "panels_2" so that it has a dark background.\n') + text.set_text(text.get_text() + '13.) Frame: "Map Input", set the value of "sizeX" to ' + str(model['dimensions'][0]['length'] * 10) + '\n') + text.set_text(text.get_text() + '14.) Frame: "Map Input", set the value of "sizeY" to ' + str(model['dimensions'][1]['length'] * 10) + '\n') + text.set_text(text.get_text() + '15.) Frame: "Map Input", set the value of "sizeZ" to ' + str(model['dimensions'][2]['length'] * 10) + '\n') + text.set_text(text.get_text() + '16.) Press [F9] to switch to the editing section.\n') + text.set_text(text.get_text() + '17.) Frame: "Mesh", look for a button labeled "Center". It\'s near 2 other buttons labeled "Center New" and "Center Cursor"\n') + text.set_text(text.get_text() + '18.) Press the button labeled "Center" to move the bounding box to the center of the axes (maybe you don\'t see anything changing).\n') + text.set_text(text.get_text() + '19.) Right click the camera objects till you found the camera called "x_min" (the name is being displayed on the lower left corner of the 3d view).\n') + text.set_text(text.get_text() + '20.) Press the [ctrl] key and the [0] key on the numeric key pad to change the view to become inside of the camera.\n') + text.set_text(text.get_text() + '21.) Frame: "Camera", section: "Lens", change the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '22.) Press [F10] to enter the rendering options.\n') + text.set_text(text.get_text() + '23.) Frame: "Format", change the value of "SizeX" to ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '.\n') + text.set_text(text.get_text() + '24.) Frame: "Format", change the value of "SizeY" to ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '.\n') + text.set_text(text.get_text() + '25.) Press [F12] to start the rendering and wait untill blender has done it\'s job. Now you should see an image of the panels.\n') + text.set_text(text.get_text() + '26.) Press [F3] to save the *.bmp file as "x_min.bmp" somewhere on your hard disc. Now you should see the panels texture again.\n') + text.set_text(text.get_text() + '27.) Press [Esc] to change the view back to inside the camera called "x_min" and then [0] on the numeric key pad to leave this camera.\n') + text.set_text(text.get_text() + '28.) Right click through the camera objects again till you found the one called "x_max".\n') + text.set_text(text.get_text() + '29.) Press [ctrl] + [0] on the numeric key pad.\n') + text.set_text(text.get_text() + '30.) [F9]\n') + text.set_text(text.get_text() + '31.) Set the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '32.) [F12] and wait till the rendering is done.\n') + text.set_text(text.get_text() + '33.) [F3], file name: "x_max.bmp"\n') + text.set_text(text.get_text() + '34.) [Esc]\n') + text.set_text(text.get_text() + '35.) [0] on the numeric key pad.\n') + text.set_text(text.get_text() + '36.) find the camera called "y_min"\n') + text.set_text(text.get_text() + '37.) [ctrl] + [0] (numeric key pad)\n') + text.set_text(text.get_text() + '38.) scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '.\n') + text.set_text(text.get_text() + '39.) [F10]\n') + text.set_text(text.get_text() + '40.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '41.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '42.) [F12] and wait\n') + text.set_text(text.get_text() + '43.) [F3], file name: "y_min.bmp"\n') + text.set_text(text.get_text() + '44.) [Esc] and then [0] (numeric pad)\n') + text.set_text(text.get_text() + '45.) select the "y_max" camera\n') + text.set_text(text.get_text() + '46.) [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '47.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '\n') + text.set_text(text.get_text() + '48.) [F12] and wait, then [F3], file name: "y_max.bmp"\n') + text.set_text(text.get_text() + '49.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '50.) select camera "z_min" and then press [ctrl] + [0] (num pad), scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') + text.set_text(text.get_text() + '51.) [F10], "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n') + text.set_text(text.get_text() + '52.) [F12] then [F3], file name: "z_min.bmp"\n') + text.set_text(text.get_text() + '53.) [Esc] then [0] (num pad)\n') + text.set_text(text.get_text() + '54.) select the camera "z_max", then [ctrl] + [0] (num pad)\n') + text.set_text(text.get_text() + '55.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n') + text.set_text(text.get_text() + '56.) [F12], then [F3], file name: "z_max.bmp"\n') + text.set_text(text.get_text() + '57.) close blender without saving panels.blend') VBox.add(text) text.show() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-22 09:40:27 UTC (rev 1109) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-22 10:20:41 UTC (rev 1110) @@ -5,309 +5,6 @@ window.add(window.vbox) window.vbox.show() -class project: - def deconstruct(self, model): - # coordinates -> vertice number - for face_index, face_content in enumerate(model['faces']): - # get the vertices - vertices = face_content['vertices'] - - for vertice_index, coordinates in enumerate(vertices): - # get the vertice number - vertices[vertice_index] = model['vertices'].index(coordinates) - - # store the updated vertices - face_content['vertices'] = vertices - - # delete the edges - del(face_content['edges']) - - # delete the nearest side - del(face_content['nearest_side']) - - # store the updated face - model['faces'][face_index] = face_content - - # del edges - del(model['edges']) - - # del dimension info - del(model['dimensions']) - - # check if the panels texture was already initialized - try: - model['textures']['Tauseti']['panels'] - - compress_panels = true - except: - compress_panels = false - - if compress_panels: - for side_name, side_content in model['textures']['Tauseti']['panels'].items(): - for line_number, line_content in enumerate(side_content): - # join the single color values - colors = ''.join(line_content) - - # throw out the "#" - colors = colors.replace('#', '') - - # update the color values - side_content[line_number] = colors - - # update the side - model['textures']['Tauseti']['panels'][side_name] = side_content - - return model - - def load(self): - # make the model array global - global model - - # create an new array for the model - model = {} - - # store the content of the model array - model = self.reconstruct(file_selection_window.return_value) - - # load the next screen - show_screen('project/canvas') - - def new(self): - # make the model array global - global model - - # create an new array for the model - model = {} - - # load the raw faces - file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') - - def reconstruct(self, model): - # create an array for the edges - model['edges'] = [] - - # vertice number -> coordinates - for face_index, face_content in enumerate(model['faces']): - # get the vertices - vertices = face_content['vertices'] - - for vertice_index, vertice_number in enumerate(vertices): - # get the coordinates - vertices[vertice_index] = model['vertices'][vertice_number] - - # store the updated vertices - face_content['vertices'] = vertices - - # create an array for the edges - edges = [] - - for vertice_index, coordinates in enumerate(vertices): - first_vertice = coordinates - - # grab the second vertice - try: - second_vertice = vertices[vertice_index + 1] - except: - second_vertice = vertices[0] - - # store the edge - edges.append([first_vertice, second_vertice]) - - # check if the edge is already stored - if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: - # store the edge in the model array - model['edges'].append([first_vertice, second_vertice]) - - # store the edges - face_content['edges'] = edges - - # store the updated face - model['faces'][face_index] = face_content - - # create new arrays for the dimensions - model['dimensions'] = {} - model['dimensions'][0] = {} # x - model['dimensions'][1] = {} # y - model['dimensions'][2] = {} # z - - # define min and max coordinates for the x-axis - model['dimensions'][0]['min'] = 99999999 - model['dimensions'][0]['max'] = -99999999 - - # define min and max coordinates for the y-axis - model['dimensions'][1]['min'] = 99999999 - model['dimensions'][1]['max'] = -99999999 - - # define min and max coordinates for the z-axis - model['dimensions'][2]['min'] = 99999999 - model['dimensions'][2]['max'] = -99999999 - - # create new arrays for the average coordinates - average_x = [] - average_y = [] - average_z = [] - - # get the dimensional information - for vertice in model['vertices']: - # get the coordinates - x = vertice[0] - y = vertice[1] - z = vertice[2] - - # update min coorinate for the x-axis - if x<model['dimensions'][0]['min']: - model['dimensions'][0]['min'] = x - - # update max coorinate for the x-axis - if x>model['dimensions'][0]['max']: - model['dimensions'][0]['max'] = x - - # update min coorinate for the y-axis - if y<model['dimensions'][1]['min']: - model['dimensions'][1]['min'] = y - - # update max coorinate for the y-axis - if y>model['dimensions'][1]['max']: - model['dimensions'][1]['max'] = y - - # update min coorinate for the z-axis - if z<model['dimensions'][2]['min']: - model['dimensions'][2]['min'] = z - - # update max coorinate for the z-axis - if z>model['dimensions'][2]['max']: - model['dimensions'][2]['max'] = z - - # store the coordinates for the average values - average_x.append(x) - average_y.append(y) - average_z.append(z) - - # insert length values - model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] - model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] - model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] - model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) - - # insert the average values - model['dimensions'][0]['average'] = sum(average_x)/len(average_x) - model['dimensions'][1]['average'] = sum(average_y)/len(average_y) - model['dimensions'][2]['average'] = sum(average_z)/len(average_z) - - # get the nearest side of the bounding box for each face - for face_index, face_content in enumerate(model['faces']): - # create new arrays for the average coordinates of this face - average_x = [] - average_y = [] - average_z = [] - - # get the coordinates of this face - for vertice_index, coordinates in enumerate(face_content['vertices']): - # store the coordinates - average_x.append(coordinates[0]) - average_y.append(coordinates[1]) - average_z.append(coordinates[2]) - - # calculate the average coordinates - average_x = sum(average_x)/len(average_x) - average_y = sum(average_y)/len(average_y) - average_z = sum(average_z)/len(average_z) - - # get the vector from the center of the model (average coordinate) to the vertice - vector = geometry.get_vector([model['dimensions'][0]['average'], model['dimensions'][1]['average'], model['dimensions'][2]['average']], [average_x, average_y, average_z]) - - # get the distances to the "x-sides" - x_min = (model['dimensions'][0]['min'] - model['dimensions'][0]['average'])/vector[0] - x_max = (model['dimensions'][0]['max'] - model['dimensions'][0]['average'])/vector[0] - - # choose the positiv side - if x_min>x_max: - x_side = 'x_min' - x_value = x_min - else: - x_side = 'x_max' - x_value = x_max - - # get the distances to the "y-sides" - y_min = (model['dimensions'][1]['min'] - model['dimensions'][1]['average'])/vector[1] - y_max = (model['dimensions'][1]['max'] - model['dimensions'][1]['average'])/vector[1] - - # choose the positiv side - if y_min>y_max: - y_side = 'y_min' - y_value = y_min - else: - y_side = 'y_max' - y_value = y_max - - # get the distances to the "z-sides" - z_min = (model['dimensions'][2]['min'] - model['dimensions'][2]['average'])/vector[2] - z_max = (model['dimensions'][2]['max'] - model['dimensions'][2]['average'])/vector[2] - - # choose the positiv side - if z_min>z_max: - z_side = 'z_min' - z_value = z_min - else: - z_side = 'z_max' - z_value = z_max - - # selected the nearest side - if min(x_value, y_value, z_value)==x_value: - nearest_side = x_side - elif min(x_value, y_value, z_value)==y_value: - nearest_side = y_side - elif min(x_value, y_value, z_value)==z_value: - nearest_side = z_side - - # store the nearest side - face_content['nearest_side'] = nearest_side - - # update the face - model['faces'][face_index] = face_content - - # check if the panels texture was already initialized - try: - model['textures']['Tauseti']['panels'] - - decompress_panels = true - except: - decompress_panels = false - - if decompress_panels: - for side_name, side_content in model['textures']['Tauseti']['panels'].items(): - for line_number, colors in enumerate(side_content): - # create/reset the array for the line content - line_content = [] - - x = 0 - while x<len(colors): - color = '#' + colors[x : x + 6] - - line_content.append(color) - - x += 6 - - # update the line content - side_content[line_number] = line_content - - # update the side - model['textures']['Tauseti']['panels'][side_name] = side_content - - return model - - def save(self): - # check if the model array exists - try: - model - except: - return - - # save the model array - file_selection_window.show('select a directory and file name for the project:', array.save, self.deconstruct(model), exit) - -project = project() - class menu: def __init__(self): # show bar Modified: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 09:40:28
|
Revision: 1109 http://opengate.svn.sourceforge.net/opengate/?rev=1109&view=rev Author: Ultrasick Date: 2009-03-22 09:40:27 +0000 (Sun, 22 Mar 2009) Log Message: ----------- changeing mime type to text (instead of application/xml) so svn sends more usefull emails Property Changed: ---------------- trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Property changes on: trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml ___________________________________________________________________ Deleted: svn:mime-type - application/xml This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 09:37:27
|
Revision: 1108 http://opengate.svn.sourceforge.net/opengate/?rev=1108&view=rev Author: Ultrasick Date: 2009-03-22 09:37:18 +0000 (Sun, 22 Mar 2009) Log Message: ----------- corrected width and hight values Modified Paths: -------------- trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Modified: trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 08:59:48
|
Revision: 1107 http://opengate.svn.sourceforge.net/opengate/?rev=1107&view=rev Author: Ultrasick Date: 2009-03-22 08:59:44 +0000 (Sun, 22 Mar 2009) Log Message: ----------- fixed a bug Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-22 08:28:05 UTC (rev 1106) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-22 08:59:44 UTC (rev 1107) @@ -6,13 +6,6 @@ window.vbox.show() class project: - def __init__(self): - # make the model array global - global model - - # create an new array for the model - model = {} - def deconstruct(self, model): # coordinates -> vertice number for face_index, face_content in enumerate(model['faces']): @@ -70,12 +63,25 @@ # make the model array global global model + # create an new array for the model + model = {} + # store the content of the model array model = self.reconstruct(file_selection_window.return_value) # load the next screen show_screen('project/canvas') + def new(self): + # make the model array global + global model + + # create an new array for the model + model = {} + + # load the raw faces + file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') + def reconstruct(self, model): # create an array for the edges model['edges'] = [] @@ -344,8 +350,7 @@ def clicked(self, item, name): if name=='project/new': - # load the raw faces - file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') + project.new() elif name=='project/load': # load the content of the model array file_selection_window.show('select the project file (*.py):', array.load, none, project.load) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 08:28:13
|
Revision: 1106 http://opengate.svn.sourceforge.net/opengate/?rev=1106&view=rev Author: Ultrasick Date: 2009-03-22 08:28:05 +0000 (Sun, 22 Mar 2009) Log Message: ----------- fixed size of the textures Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/textures/tauseti/panels.blend Modified: branches/ogEditor/data/modules/texturizer/textures/tauseti/panels.blend =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-22 06:52:30
|
Revision: 1105 http://opengate.svn.sourceforge.net/opengate/?rev=1105&view=rev Author: Ultrasick Date: 2009-03-22 06:52:20 +0000 (Sun, 22 Mar 2009) Log Message: ----------- adding panels texture Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/ branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/panels.png branches/ogEditor/data/modules/texturizer/textures/ branches/ogEditor/data/modules/texturizer/textures/tauseti/ branches/ogEditor/data/modules/texturizer/textures/tauseti/panels.blend templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z Removed Paths: ------------- templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py Added: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/panels.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/tauseti/panels.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -11,20 +11,18 @@ #from os import listdir #from os import path as check #from os import system - -from os import urandom - -#from string import join +#from os import urandom #from string import replace #import urllib from warnings import simplefilter as ignore_warnings class array: - def parse(self, Array, prefix = ''): + def parse(self, Array, prefix = '', create = true): if type(Array)==type({}): - # create the array - self.output += 'a' + prefix + ' = ' + '{}' + '\n' + if create==true: + # create the array + self.file.write('a' + prefix + ' = ' + '{}' + '\n') for key, value in Array.items(): # get the new prefix @@ -34,40 +32,41 @@ new_prefix = '["' + key + '"]' if isfloat(value) or isint(value): - # if value is numeric, output it - self.output += 'a' + prefix + new_prefix + ' = ' + str(value) + '\n' + # if value is numeric, write it + self.file.write('a' + prefix + new_prefix + ' = ' + str(value) + '\n') elif type(value)==type(''): - # if value is a string, output it - self.output += 'a' + prefix + new_prefix + ' = "' + str(value) + '"' + '\n' + # if value is a string, write it + self.file.write('a' + prefix + new_prefix + ' = "' + str(value) + '"' + '\n') elif type(value)==type([]) or type(value)==type({}): # if value is an array, parse it self.parse(value, prefix + new_prefix) elif type(Array)==type([]): - # create the array - self.output += 'a' + prefix + ' = ' + '[]' + '\n' + if create==true: + # create the array + self.file.write('a' + prefix + ' = ' + '[]' + '\n') for key, value in enumerate(Array): # get the new prefix new_prefix = '[' + str(key) + ']' if isfloat(value) or isint(value): - # if value is numeric, output it - self.output += 'a' + prefix + '.append(' + str(value) + ')\n' + # if value is numeric, write it + self.file.write('a' + prefix + '.append(' + str(value) + ')\n') elif type(value)==type(''): - # if value is a string, output it - self.output += 'a' + prefix + '.append("' + str(value) + '")' + '\n' + # if value is a string, write it + self.file.write('a' + prefix + '.append("' + str(value) + '")' + '\n') elif type(value)==type([]): # if value is a list, create it - self.output += 'a' + prefix + '.append([])' + '\n' + self.file.write('a' + prefix + '.append([])' + '\n') # if value is an array, parse it - self.parse(value, prefix + new_prefix) + self.parse(value, prefix + new_prefix, false) elif type(value)==type({}): # if value is a dictionary, create it - self.output += 'a' + prefix + '.append({})' + '\n' + self.file.write('a' + prefix + '.append({})' + '\n') # if value is an array, parse it - self.parse(value, prefix + new_prefix) + self.parse(value, prefix + new_prefix, false) def Print(self, Array, level = 0): print 'array(' @@ -94,23 +93,20 @@ return '' def save(self, file_name, Array): - # create/reset output string - self.output = '# -*- coding: cp1252 -*-' + '\n\n' + 'global a' + '\n\n' - - # parse the array - self.parse(Array) - if file_name[-3:]!='.py': file_name += '.py' # open the file - file = open(file_name, 'w') + self.file = open(file_name, 'w') - # write the output to the file - file.write(self.output) + # write the encoding info + self.file.write('# -*- coding: cp1252 -*-' + '\n\n' + 'global a' + '\n\n') + # parse the array + self.parse(Array) + # close the file - file.close() + self.file.close() def load(self, file_name): # load the file @@ -120,13 +116,82 @@ array = array() +class bmp_file: + def load(self, file_name): + global model + + # open the file + file = open(file_name, 'r') + + # read the content + content = file.read() + + # close the file + file.close() + + # get the image width + image_width = ord(content[18:19]) + ord(content[19:20]) * 256 + ord(content[20:21]) * 256 * 256 + + ord(content[21:22]) * 256 * 256 * 256 + + # calculate the skip value + skip = 4 - ((image_width * 3) % 4) + + if skip==4: + skip = 0 + + # truncate the content (so only the payload is left) + content = content[54:] + + # create an array for the lines + lines = [] + + y = 0 + while len(content)!=0: + # create an array for this line of pixels + line = [] + + for x in range(0, image_width): + blue = ord(content[x * 3:x * 3 + 1]) + green = ord(content[x * 3 + 1:x * 3 + 2]) + red = ord(content[x * 3 + 2:x * 3 + 3]) + + # calculate hex values + red = hex(red)[2:] + green = hex(green)[2:] + blue = hex(blue)[2:] + + # make length = 2 digits + if len(red)<2: + red = '0' + red + + if len(green)<2: + green = '0' + green + + if len(blue)<2: + blue = '0' + blue + + # calculate final color + color = '#' + red + green + blue + + # store the color value in the line + line.append(color) + + # store the line + lines.insert(0, line) + + # truncate the content + content = content[image_width * 3 + skip:] + + return lines + +bmp_file = bmp_file() + class file_selection_window: - def show(self, caption, process_function, process_parameter = none, return_function = none, return_parameter = none): + def show(self, caption, process_function, process_function_parameter = none, return_function = none, return_function_parameter = none): # save parameters self.process_function = process_function - self.process_parameter = process_parameter + self.process_function_parameter = process_function_parameter self.return_function = return_function - self.return_parameter = return_parameter + self.return_function_parameter = return_function_parameter # show file selection window self.window = gtk.FileSelection(caption) @@ -146,20 +211,148 @@ file_name = self.window.get_filename() # process the file - if self.process_parameter!=none: - self.return_value = self.process_function(file_name, self.process_parameter) + if self.process_function_parameter!=none: + self.return_value = self.process_function(file_name, self.process_function_parameter) else: self.return_value = self.process_function(file_name) # destroy the window self.window.destroy() - if self.return_function: + if self.return_function_parameter!=none: # run the return function - self.return_function(self.return_parameter) + self.return_function(self.return_function_parameter) + elif self.return_function!=none: + # run the return function + self.return_function() file_selection_window = file_selection_window() +class geometry: + def get_angle(self, vector_1, vector_2): + # calculate the numerator + numerator = (vector_1[0] * vector_2[0]) + (vector_1[1] * vector_2[1]) + (vector_1[2] * vector_2[2]) + + # get the distances + distance_1 = self.get_distance(vector_1) + distance_2 = self.get_distance(vector_2) + + # calculate the denominator + denominator = distance_1 * distance_2 + + # calculate the value of the fraction + fraction_value = numerator/denominator + + # compensate rounding errors + if fraction_value>1: + fraction_value = 1 + + return acos(fraction_value) + + def get_area(self, triangle): + # get the vectors + vector_1 = self.get_vector(triangle[0], triangle[1]) + vector_2 = self.get_vector(triangle[0], triangle[2]) + + # calculate the area + area = self.get_distance(self.get_cross_product(vector_1, vector_2))/2 + + return area + + def get_cross_product(self, vector_1, vector_2): + x = vector_1[1] * vector_2[2] - vector_1[2] * vector_2[1] + y = vector_1[2] * vector_2[0] - vector_1[0] * vector_2[2] + z = vector_1[0] * vector_2[1] - vector_1[1] * vector_2[0] + + return [x, y, z] + + def get_distance(self, vector): + return sqrt(vector[0] ** 2 + vector[1] ** 2 + vector[2] ** 2) + + def get_plane(self, offset, vector_1, vector_2): + # create an array for the plane + plane = {} + + # store the offset + plane['offset'] = offset + + # create an array for the vectors + plane['vectors'] = [] + + # store the vectors + plane['vectors'].append(vector_1) + plane['vectors'].append(vector_2) + + # return the plane + return plane + + def get_shortest_combination(self, triangle): + # calculate lengths for each vertice as the offset + combination_1 = self.get_distance(self.get_vector(triangle[0], triangle[1])) + self.get_distance(self.get_vector(triangle[0], triangle[2])) + combination_2 = self.get_distance(self.get_vector(triangle[1], triangle[0])) + self.get_distance(self.get_vector(triangle[1], triangle[2])) + combination_3 = self.get_distance(self.get_vector(triangle[2], triangle[0])) + self.get_distance(self.get_vector(triangle[2], triangle[1])) + + if combination_2==min(combination_1, combination_2, combination_3): + # reorder the vertices + triangle = [triangle[1], triangle[0], triangle[2]] + elif combination_3==min(combination_1, combination_2, combination_3): + # reorder the vertices + triangle = [triangle[2], triangle[0], triangle[1]] + + return triangle + + def get_triangles(self, vertices): + # check if there are only 3 vertices + if len(vertices)==3: + return [self.get_shortest_combination(vertices)] + + # create an array for the triangles + triangles = [] + + # build triangles + triangles.append([vertices[0], vertices[1], vertices[2]]) + triangles.append([vertices[2], vertices[3], vertices[0]]) + triangles.append([vertices[1], vertices[2], vertices[3]]) + triangles.append([vertices[3], vertices[0], vertices[1]]) + + if (self.get_area(triangles[0]) + self.get_area(triangles[1]))<(self.get_area(triangles[2]) + self.get_area(triangles[3])): + # define the first triangle + first_triangle = triangles[0] + + # define the second triangle + second_triangle = triangles[1] + else: + # define the first triangle + first_triangle = triangles[2] + + # define the second triangle + second_triangle = triangles[3] + + triangles = [first_triangle, second_triangle] + + # get the shortest combination + for i, triangle in enumerate(triangles): + # update the triangle + triangles[i] = self.get_shortest_combination(triangle) + + return triangles + + def get_vector(self, vertice_1, vertice_2): + x = vertice_2[0] - vertice_1[0] + y = vertice_2[1] - vertice_1[1] + z = vertice_2[2] - vertice_1[2] + + return [x, y, z] + + def get_vertice(self, offset, vector, Lambda): + x = offset[0] + vector[0] * Lambda + y = offset[1] + vector[1] * Lambda + z = offset[2] + vector[2] * Lambda + + return [x, y, z] + +geometry = geometry() + ignore_warnings('ignore', DeprecationWarning) def isfloat(number): @@ -180,9 +373,98 @@ return true -def random(): - return round(ord(urandom(1))/255, 3) +class raw_file: + def load(self, file_name): + global model + # open the file + file = open(file_name, 'r') + + # read the lines + lines = file.readlines() + + # close the file + file.close() + + # create a new array for the faces + model['faces'] = [] + + # create a new array for the vertices + model['vertices'] = [] + + for line in lines: + # trim whitespaces + line = line.strip() + + # split at the " " + line = line.split(' ') + + # reset/create an array for the vertices + vertices = [] + + while line: + # reset/create an array for a vertice + vertice = [] + + # grab x, y and z coordinate + x = float(line.pop(0)) + y = float(line.pop(0)) + z = float(line.pop(0)) + + # save the coordinates as a vertice + vertice.append(x) + vertice.append(y) + vertice.append(z) + + # save the vertice in the model array + if vertice not in model['vertices']: + model['vertices'].append(vertice) + + # get the vertice number + vertice_number = model['vertices'].index(vertice) + + # add the vertice number to the new face array + vertices.append(vertice_number) + + # store the new face in the model['faces'] array + model['faces'].append({'vertices' : vertices, 'textures' : []}) + + model = project.reconstruct(model) + + def save(self, file_name, faces): + for i, face in enumerate(faces): + # join the coordinates to make this format: "x y z" + for i2, vertice in enumerate(face): + x = vertice[0] + y = vertice[1] + z = vertice[2] + + vertice = str(x) + ' ' + str(y) + ' ' + str(z) + + face[i2] = vertice + + # join the vertices to make this format: "vertice vertice vertice vertice" + face = ' '.join(face) + + faces[i] = face + + # join the faces to make this format: "face\nface\nface\n..." + faces = '\n'.join(faces) + + if file_name[-4:]!='.raw': + file_name += '.raw' + + # open the file + file = open(file_name, 'w') + + # write the faces to the file + file.write(faces) + + # close the file + file.close() + +raw_file = raw_file() + def update_ui(): while gtk.events_pending(): gtk.main_iteration(false) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -1,7 +1,9 @@ +# -*- coding: cp1252 -*- + # define an array for the textures textures = {} -# define an array for the global textures +# create an array for the global textures textures['global'] = {} class glass: @@ -17,10 +19,240 @@ self.initialized = true - def get_color(self, vertice): + def get_color(self, vertice = none, face = none): if self.initialized==false: self.initialize() return self.drawing_area.colors['#00013C'] -textures['global']['glass'] = glass() \ No newline at end of file +textures['global']['glass'] = glass() + +# create and array for the tauseti specific textures +textures['Tauseti'] = {} + +class panels: + def __init__(self): + self.initialized = false + + def initialize_step_1(self): + # check if the texture was already initialized (project was loaded) + try: + model['textures']['Tauseti']['panels'] + + self.initialized = true + + # return + return + except: + pass + + # don't reload the preview image for now + screen.preview.preview.handler_block(screen.preview.refresh_id) + + + # create an array for the faces of the bounding box + faces = [] + + # create an array for the vertices of the face + vertices = [] + + # create the vertices of the "x_min" face + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + + # insert the "x_min" face + faces.append(vertices) + + # reset the array for the vertices of the face + vertices = [] + + # create the vertices of the "x_max" face + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + + # insert the "x_max" face + faces.append(vertices) + + # reset the array for the vertices of the face + vertices = [] + + # create the vertices of the "y_min" face + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + + # insert the "y_min" face + faces.append(vertices) + + # reset the array for the vertices of the face + vertices = [] + + # create the vertices of the "y_max" face + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + + # insert the "y_max" face + faces.append(vertices) + + # reset the array for the vertices of the face + vertices = [] + + # create the vertices of the "z_min" face + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['min']]) + + # insert the "z_min" face + faces.append(vertices) + + # reset the array for the vertices of the face + vertices = [] + + # create the vertices of the "z_max" face + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['min'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['max'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + vertices.append([model['dimensions'][0]['min'], model['dimensions'][1]['max'], model['dimensions'][2]['max']]) + + # insert the "z_max" face + faces.append(vertices) + + # write the raw faces + file_selection_window.show('select a directory and file name somewhere on your hard disc to save the raw faces of the bounding box:', raw_file.save, faces, self.initialize_step_2) + + def initialize_step_2(self): + # show window + self.instructions_window = gtk.Window() + self.instructions_window.set_title('ogEditor - manually initializing the panels texture') + self.instructions_window.show() + + # show a VBox + VBox = gtk.VBox(spacing = 5) + self.instructions_window.add(VBox) + VBox.show() + + # show instructions + text = gtk.Label('Step 1 (creating the raw faces) is done. Step 2:\n\n1.) Open "data/modules/texturizer/textures/tauseti/panels.blend"\n2.) Delete the selected cube (move the mouse over the pink cube and press the [del] key and [enter] afterwards).\n3.) Import the just saved raw faces ("File" -> "Import" -> "Raw Faces (.raw)"). Now you should have a small selected box which represents the bounding box of your model.\n4.) Right click the new box (even if it is already selected) to make the buttons appear on the bottom of the screen.\n5.) Press [F5] ... just in case you don\'t already see the material buttons.\n6.) Frame: "Links and Pipeline", section: "Link to Object", there should be a button labeled "Add New". Left to it should be a smaller button with 2 arrows on it. Press this "arrowed" button and select the panels texture.\n7.) Press [F9] to switch to the editing section.\n8.) Frame: "Mesh", look for a button labeled "Center". It\'s near 2 other buttons labeled "Center New" and "Center Cursor"\n9.) Press the button labeled "Center" to move the bounding box to the center of the axes (maybe you don\'t see anything changing).\n10.) Right click the camera objects till you found the camera called "x_min" (the name is being displayed on the lower left corner of the 3d view).\n11.) Press the [ctrl] key and the [0] key on the numeric key pad to change the view to become inside of the camera.\n12.) Frame: "Camera", section: "Lens", change the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n13.) Press [F10] to enter the rendering options.\n14.) Frame: "Format", change the value of "SizeX" to ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '.\n15.) Frame: "Format", change the value of "SizeY" to ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '.\n16.) Press [F12] to start the rendering and wait untill blender has done it\'s job. Now you should see an image of the panels.\n17.) Press [F3] to save the *.bmp file as "x_min.bmp" somewhere on your hard disc. Now you should see the panels texture again.\n18.) Press [Esc] to change the view back to inside the camera called "x_min" and then [0] on the numeric key pad to leave this camera.\n19.) Right click through the camera objects again till you found the one called "x_max".\n20.) Press [ctrl] + [0] on the numeric key pad.\n21.) [F9]\n22.) Set the scale value to ' + str(max(model['dimensions'][1]['length'], model['dimensions'][2]['length'])) + '.\n23.) [F12] and wait till the rendering is done.\n24.) [F3], file name: "x_max.bmp"\n25.) [Esc]\n26.) [0] on the numeric key pad.\n27.) find the camera called "y_min"\n28.) [ctrl] + [0] (numeric key pad)\n29.) scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '.\n30.) [F10]\n31.) "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + '\n32.) "SizeY": ' + str(int(round(model['dimensions'][2]['length'] * 100 * resolution_texture_map))) + '\n33.) [F12] and wait\n34.) [F3], file name: "y_min.bmp"\n35.) [Esc] and then [0] (numeric pad)\n36.) select the "y_max" camera\n37.) [ctrl] + [0] (num pad)\n37.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][2]['length'])) + '\n38.) [F12] and wait, then [F3], file name: "y_max.bmp"\n39.) [Esc] then [0] (num pad)\n40.) select camera "z_min" and then press [ctrl] + [0] (num pad), scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n41.) [F10], "SizeX": ' + str(int(round(model['dimensions'][0]['length'] * 100 * resolution_texture_map))) + ', "SizeY": ' + str(int(round(model['dimensions'][1]['length'] * 100 * resolution_texture_map))) + '\n42.) [F12] then [F3], file name: "z_min.bmp"\n43.) [Esc] then [0] (num pad)\n44.) select the camera "z_max", then [ctrl] + [0] (num pad)\n45.) [F9], scale value: ' + str(max(model['dimensions'][0]['length'], model['dimensions'][1]['length'])) + '\n46.) [F12], then [F3], file name: "z_max.bmp"\n47.) close blender without saving panels.blend') + VBox.add(text) + text.show() + + # show "step 3 ->"-button + button = gtk.Button('step 3 ->') + VBox.add(button) + button.show() + + # connect a function to the button + button.connect('clicked', lambda x: self.initialize_step_3()) + + def initialize_step_3(self): + # destroy the instructions window + self.instructions_window.destroy() + + # read "x_min.bmp" + file_selection_window.show('select the file "x_min.bmp":', bmp_file.load, none, self.initialize_step_4) + + def initialize_step_4(self): + # store the pixels + model['textures'] = {} + model['textures']['Tauseti'] = {} + model['textures']['Tauseti']['panels'] = {} + model['textures']['Tauseti']['panels']['x_min'] = file_selection_window.return_value + + # read "x_max.bmp" + file_selection_window.show('select the file "x_max.bmp":', bmp_file.load, none, self.initialize_step_5) + + def initialize_step_5(self): + # store the pixels + model['textures']['Tauseti']['panels']['x_max'] = file_selection_window.return_value + + # read "y_min.bmp" + file_selection_window.show('select the file "y_min.bmp":', bmp_file.load, none, self.initialize_step_6) + + def initialize_step_6(self): + # store the pixels + model['textures']['Tauseti']['panels']['y_min'] = file_selection_window.return_value + + # read "y_max.bmp" + file_selection_window.show('select the file "y_max.bmp":', bmp_file.load, none, self.initialize_step_7) + + def initialize_step_7(self): + # store the pixels + model['textures']['Tauseti']['panels']['y_max'] = file_selection_window.return_value + + # read "z_min.bmp" + file_selection_window.show('select the file "z_min.bmp":', bmp_file.load, none, self.initialize_step_8) + + def initialize_step_8(self): + # store the pixels + model['textures']['Tauseti']['panels']['z_min'] = file_selection_window.return_value + + # read "z_max.bmp" + file_selection_window.show('select the file "z_max.bmp":', bmp_file.load, none, self.initialize_step_9) + + def initialize_step_9(self): + # store the pixels + model['textures']['Tauseti']['panels']['z_max'] = file_selection_window.return_value + + self.initialized = true + + # make the preview image reload again + screen.preview.preview.handler_unblock(screen.preview.refresh_id) + + def get_color(self, vertice, face): + # select the right object as the drawing area + self.drawing_area = screen.preview.preview.window + + # select the color map + self.color_map = self.drawing_area.get_colormap() + + # get the nearest side of the bounding box to the face + nearest_side = face['nearest_side'] + + # create an array for the coordinates of the pixel + coordinates = {} + + # get the x-coordinate of the pixel + if nearest_side[:1]=='x': + axis_0 = 1 + axis_1 = 2 + else: + coordinates[0] = vertice[0] - model['dimensions'][0]['min'] + coordinates[0] *= 100 * resolution_texture_map + coordinates[0] = int(round(coordinates[0])) + + # get the y-coordinate of the pixel + if nearest_side[:1]=='y': + axis_0 = 0 + axis_1 = 2 + else: + coordinates[1] = vertice[1] - model['dimensions'][1]['min'] + coordinates[1] *= 100 * resolution_texture_map + coordinates[1] = int(round(coordinates[1])) + + # get the z-coordinate of the pixel + if nearest_side[:1]=='z': + axis_0 = 0 + axis_1 = 1 + else: + coordinates[2] = vertice[2] - model['dimensions'][2]['min'] + coordinates[2] *= 100 * resolution_texture_map + coordinates[2] = int(round(coordinates[2])) + + # get the color + color = model['textures']['Tauseti']['panels'][nearest_side][coordinates[axis_1]][coordinates[axis_0]] + + if self.drawing_area.colors.has_key(color)==false: + # save the color + self.drawing_area.colors[color] = self.drawing_area.new_gc(foreground = self.color_map.alloc_color(gtk.gdk.color_parse(color))) + + return self.drawing_area.colors[color] + +textures['Tauseti']['panels'] = panels() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -5,29 +5,123 @@ window.add(window.vbox) window.vbox.show() -class raw_file: - def load(self, file_name): - # open the file - file = open(file_name, 'r') +class project: + def __init__(self): + # make the model array global + global model - # read the lines - lines = file.readlines() + # create an new array for the model + model = {} - # close the file - file.close() + def deconstruct(self, model): + # coordinates -> vertice number + for face_index, face_content in enumerate(model['faces']): + # get the vertices + vertices = face_content['vertices'] + for vertice_index, coordinates in enumerate(vertices): + # get the vertice number + vertices[vertice_index] = model['vertices'].index(coordinates) + + # store the updated vertices + face_content['vertices'] = vertices + + # delete the edges + del(face_content['edges']) + + # delete the nearest side + del(face_content['nearest_side']) + + # store the updated face + model['faces'][face_index] = face_content + + # del edges + del(model['edges']) + + # del dimension info + del(model['dimensions']) + + # check if the panels texture was already initialized try: - global model + model['textures']['Tauseti']['panels'] + + compress_panels = true except: - pass + compress_panels = false - # create a new array for the model - model = {} + if compress_panels: + for side_name, side_content in model['textures']['Tauseti']['panels'].items(): + for line_number, line_content in enumerate(side_content): + # join the single color values + colors = ''.join(line_content) + # throw out the "#" + colors = colors.replace('#', '') + + # update the color values + side_content[line_number] = colors + + # update the side + model['textures']['Tauseti']['panels'][side_name] = side_content + + return model + + def load(self): + # make the model array global + global model + + # store the content of the model array + model = self.reconstruct(file_selection_window.return_value) + + # load the next screen + show_screen('project/canvas') + + def reconstruct(self, model): + # create an array for the edges + model['edges'] = [] + + # vertice number -> coordinates + for face_index, face_content in enumerate(model['faces']): + # get the vertices + vertices = face_content['vertices'] + + for vertice_index, vertice_number in enumerate(vertices): + # get the coordinates + vertices[vertice_index] = model['vertices'][vertice_number] + + # store the updated vertices + face_content['vertices'] = vertices + + # create an array for the edges + edges = [] + + for vertice_index, coordinates in enumerate(vertices): + first_vertice = coordinates + + # grab the second vertice + try: + second_vertice = vertices[vertice_index + 1] + except: + second_vertice = vertices[0] + + # store the edge + edges.append([first_vertice, second_vertice]) + + # check if the edge is already stored + if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: + # store the edge in the model array + model['edges'].append([first_vertice, second_vertice]) + + # store the edges + face_content['edges'] = edges + + # store the updated face + model['faces'][face_index] = face_content + # create new arrays for the dimensions model['dimensions'] = {} model['dimensions'][0] = {} # x - model['dimensions'][1] = {} # x + model['dimensions'][1] = {} # y model['dimensions'][2] = {} # z # define min and max coordinates for the x-axis @@ -42,68 +136,47 @@ model['dimensions'][2]['min'] = 99999999 model['dimensions'][2]['max'] = -99999999 - # create a new array for the edges - model['edges'] = [] - - # create a new array for the faces - model['faces'] = [] - - # create a new array for the vertices - model['vertices'] = [] - # create new arrays for the average coordinates average_x = [] average_y = [] average_z = [] - for line in lines: - # trim whitespaces - line = line.strip() + # get the dimensional information + for vertice in model['vertices']: + # get the coordinates + x = vertice[0] + y = vertice[1] + z = vertice[2] - # split at the " " - face = line.split(' ') + # update min coorinate for the x-axis + if x<model['dimensions'][0]['min']: + model['dimensions'][0]['min'] = x - # reset/create an array for the new face - face_new = [] + # update max coorinate for the x-axis + if x>model['dimensions'][0]['max']: + model['dimensions'][0]['max'] = x - while face: - # reset/create an array for a vertice - vertice = [] + # update min coorinate for the y-axis + if y<model['dimensions'][1]['min']: + model['dimensions'][1]['min'] = y - # grab x, y and z coordinate - x = float(face.pop(0)) - x /= 10 # debug - y = float(face.pop(0)) - y /= 10 # debug - z = float(face.pop(0)) - z /= 10 # debug + # update max coorinate for the y-axis + if y>model['dimensions'][1]['max']: + model['dimensions'][1]['max'] = y - # save the new min and max values - self.save_min_and_max(x, y, z) + # update min coorinate for the z-axis + if z<model['dimensions'][2]['min']: + model['dimensions'][2]['min'] = z - # store the coordinates for the average values - average_x.append(x) - average_y.append(y) - average_z.append(z) + # update max coorinate for the z-axis + if z>model['dimensions'][2]['max']: + model['dimensions'][2]['max'] = z - # save the coordinates as a vertice - vertice.append(x) - vertice.append(y) - vertice.append(z) + # store the coordinates for the average values + average_x.append(x) + average_y.append(y) + average_z.append(z) - # save the vertice in the model array - if vertice not in model['vertices']: - model['vertices'].append(vertice) - - # add the vertice number to the new face array - face_new.append(vertice) - - # save the edges of the face - edges = self.save_edges(face_new) - - # save the new face in the model['faces'] array - model['faces'].append({'vertices' : face_new, 'edges' : edges, 'textures' : []}) - # insert length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] @@ -115,56 +188,120 @@ model['dimensions'][1]['average'] = sum(average_y)/len(average_y) model['dimensions'][2]['average'] = sum(average_z)/len(average_z) - def save_min_and_max(self, x, y, z): - # update min coorinate for the x-axis - if x<model['dimensions'][0]['min']: - model['dimensions'][0]['min'] = x + # get the nearest side of the bounding box for each face + for face_index, face_content in enumerate(model['faces']): + # create new arrays for the average coordinates of this face + average_x = [] + average_y = [] + average_z = [] - # update max coorinate for the x-axis - if x>model['dimensions'][0]['max']: - model['dimensions'][0]['max'] = x + # get the coordinates of this face + for vertice_index, coordinates in enumerate(face_content['vertices']): + # store the coordinates + average_x.append(coordinates[0]) + average_y.append(coordinates[1]) + average_z.append(coordinates[2]) - # update min coorinate for the y-axis - if y<model['dimensions'][1]['min']: - model['dimensions'][1]['min'] = y + # calculate the average coordinates + average_x = sum(average_x)/len(average_x) + average_y = sum(average_y)/len(average_y) + average_z = sum(average_z)/len(average_z) - # update max coorinate for the y-axis - if y>model['dimensions'][1]['max']: - model['dimensions'][1]['max'] = y + # get the vector from the center of the model (average coordinate) to the vertice + vector = geometry.get_vector([model['dimensions'][0]['average'], model['dimensions'][1]['average'], model['dimensions'][2]['average']], [average_x, average_y, average_z]) - # update min coorinate for the z-axis - if z<model['dimensions'][2]['min']: - model['dimensions'][2]['min'] = z + # get the distances to the "x-sides" + x_min = (model['dimensions'][0]['min'] - model['dimensions'][0]['average'])/vector[0] + x_max = (model['dimensions'][0]['max'] - model['dimensions'][0]['average'])/vector[0] - # update max coorinate for the z-axis - if z>model['dimensions'][2]['max']: - model['dimensions'][2]['max'] = z + # choose the positiv side + if x_min>x_max: + x_side = 'x_min' + x_value = x_min + else: + x_side = 'x_max' + x_value = x_max - def save_edges(self, face): - # create an array for the edges - edges = [] + # get the distances to the "y-sides" + y_min = (model['dimensions'][1]['min'] - model['dimensions'][1]['average'])/vector[1] + y_max = (model['dimensions'][1]['max'] - model['dimensions'][1]['average'])/vector[1] - for i, vertice in enumerate(face): - first_vertice = vertice + # choose the positiv side + if y_min>y_max: + y_side = 'y_min' + y_value = y_min + else: + y_side = 'y_max' + y_value = y_max - # grab the second vertice - try: - second_vertice = face[i + 1] - except: - second_vertice = face[0] + # get the distances to the "z-sides" + z_min = (model['dimensions'][2]['min'] - model['dimensions'][2]['average'])/vector[2] + z_max = (model['dimensions'][2]['max'] - model['dimensions'][2]['average'])/vector[2] - # store the edge in the edges array - edges.append([first_vertice, second_vertice]) + # choose the positiv side + if z_min>z_max: + z_side = 'z_min' + z_value = z_min + else: + z_side = 'z_max' + z_value = z_max - # check if the edge is already stored - if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: - # store the edge in the model array - model['edges'].append([first_vertice, second_vertice]) + # selected the nearest side + if min(x_value, y_value, z_value)==x_value: + nearest_side = x_side + elif min(x_value, y_value, z_value)==y_value: + nearest_side = y_side + elif min(x_value, y_value, z_value)==z_value: + nearest_side = z_side - return edges + # store the nearest side + face_content['nearest_side'] = nearest_side -raw_file = raw_file() + # update the face + model['faces'][face_index] = face_content + # check if the panels texture was already initialized + try: + model['textures']['Tauseti']['panels'] + + decompress_panels = true + except: + decompress_panels = false + + if decompress_panels: + for side_name, side_content in model['textures']['Tauseti']['panels'].items(): + for line_number, colors in enumerate(side_content): + # create/reset the array for the line content + line_content = [] + + x = 0 + while x<len(colors): + color = '#' + colors[x : x + 6] + + line_content.append(color) + + x += 6 + + # update the line content + side_content[line_number] = line_content + + # update the side + model['textures']['Tauseti']['panels'][side_name] = side_content + + return model + + def save(self): + # check if the model array exists + try: + model + except: + return + + # save the model array + file_selection_window.show('select a directory and file name for the project:', array.save, self.deconstruct(model), exit) + +project = project() + class menu: def __init__(self): # show bar @@ -198,7 +335,7 @@ self.project.load.connect('activate', self.clicked, 'project/load') # create menu item "save" - self.project.save = gtk.MenuItem('save') + self.project.save = gtk.MenuItem('save and exit') menu.add(self.project.save) self.project.save.show() @@ -207,40 +344,14 @@ def clicked(self, item, name): if name=='project/new': - self.project_new() + # load the raw faces + file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') elif name=='project/load': - self.project_load() + # load the content of the model array + file_selection_window.show('select the project file (*.py):', array.load, none, project.load) elif name=='project/save': - self.project_save() + project.save() - def project_new(self): - # load the raw faces - file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') - - def project_load(self, loaded = false): - # make the model array global - global model - - if loaded==false: - # load the content of the model array - file_selection_window.show('select the project file (*.py):', array.load, none, self.project_load, true) - else: - # store the content of the model array - model = file_selection_window.return_value - - # load the next screen - show_screen('project/canvas') - - def project_save(self): - # check if the model array exists - try: - model - except: - return - - # save the model array - file_selection_window.show('select a directory and file name for the project:', array.save, model) - window.menu = menu() # show container for the content Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -12,131 +12,6 @@ frame.add(table) table.show() -class geometry: - def get_angle(self, vector_1, vector_2): - # calculate the numerator - numerator = (vector_1[0] * vector_2[0]) + (vector_1[1] * vector_2[1]) + (vector_1[2] * vector_2[2]) - - # get the distances - distance_1 = self.get_distance(vector_1) - distance_2 = self.get_distance(vector_2) - - # calculate the denominator - denominator = distance_1 * distance_2 - - # calculate the value of the fraction - fraction_value = numerator/denominator - - # compensate rounding errors - if fraction_value>1: - fraction_value = 1 - - return acos(fraction_value) - - def get_area(self, triangle): - # get the vectors - vector_1 = self.get_vector(triangle[0], triangle[1]) - vector_2 = self.get_vector(triangle[0], triangle[2]) - - # calculate the area - area = self.get_distance(self.get_cross_product(vector_1, vector_2))/2 - - return area - - def get_cross_product(self, vector_1, vector_2): - x = vector_1[1] * vector_2[2] - vector_1[2] * vector_2[1] - y = vector_1[2] * vector_2[0] - vector_1[0] * vector_2[2] - z = vector_1[0] * vector_2[1] - vector_1[1] * vector_2[0] - - return [x, y, z] - - def get_distance(self, vector): - return sqrt(vector[0] ** 2 + vector[1] ** 2 + vector[2] ** 2) - - def get_plane(self, offset, vector_1, vector_2): - # create an array for the plane - plane = {} - - # store the offset - plane['offset'] = offset - - # create an array for the vectors - plane['vectors'] = [] - - # store the vectors - plane['vectors'].append(vector_1) - plane['vectors'].append(vector_2) - - # return the plane - return plane - - def get_shortest_combination(self, triangle): - # calculate lengths for each vertice as the offset - combination_1 = self.get_distance(self.get_vector(triangle[0], triangle[1])) + self.get_distance(self.get_vector(triangle[0], triangle[2])) - combination_2 = self.get_distance(self.get_vector(triangle[1], triangle[0])) + self.get_distance(self.get_vector(triangle[1], triangle[2])) - combination_3 = self.get_distance(self.get_vector(triangle[2], triangle[0])) + self.get_distance(self.get_vector(triangle[2], triangle[1])) - - if combination_2==min(combination_1, combination_2, combination_3): - # reorder the vertices - triangle = [triangle[1], triangle[0], triangle[2]] - elif combination_3==min(combination_1, combination_2, combination_3): - # reorder the vertices - triangle = [triangle[2], triangle[0], triangle[1]] - - return triangle - - def get_triangles(self, vertices): - # check if there are only 3 vertices - if len(vertices)==3: - return [self.get_shortest_combination(vertices)] - - # create an array for the triangles - triangles = [] - - # build triangles - triangles.append([vertices[0], vertices[1], vertices[2]]) - triangles.append([vertices[2], vertices[3], vertices[0]]) - triangles.append([vertices[1], vertices[2], vertices[3]]) - triangles.append([vertices[3], vertices[0], vertices[1]]) - - if (self.get_area(triangles[0]) + self.get_area(triangles[1]))<(self.get_area(triangles[2]) + self.get_area(triangles[3])): - # define the first triangle - first_triangle = triangles[0] - - # define the second triangle - second_triangle = triangles[1] - else: - # define the first triangle - first_triangle = triangles[2] - - # define the second triangle - second_triangle = triangles[3] - - triangles = [first_triangle, second_triangle] - - # get the shortest combination - for i, triangle in enumerate(triangles): - # update the triangle - triangles[i] = self.get_shortest_combination(triangle) - - return triangles - - def get_vector(self, vertice_1, vertice_2): - x = vertice_2[0] - vertice_1[0] - y = vertice_2[1] - vertice_1[1] - z = vertice_2[2] - vertice_1[2] - - return [x, y, z] - - def get_vertice(self, offset, vector, Lambda): - x = offset[0] + vector[0] * Lambda - y = offset[1] + vector[1] * Lambda - z = offset[2] + vector[2] * Lambda - - return [x, y, z] - -screen.geometry = geometry() - class preview: def __init__(self, parent): # show preview image @@ -146,7 +21,7 @@ self.preview.show() # set autoredraw - self.preview.connect('expose_event', self.draw) + self.refresh_id = self.preview.connect('expose_event', self.draw) # select the right object as the drawing area self.drawing_area = self.preview.window @@ -161,7 +36,7 @@ self.face = model['faces'][window.face_number] # create the base line - self.base_line = screen.geometry.get_vector(self.face['vertices'][0], self.face['vertices'][1]) + self.base_line = geometry.get_vector(self.face['vertices'][0], self.face['vertices'][1]) # get the offset self.offset = self.face['vertices'][0] @@ -170,7 +45,7 @@ self.get_border() # get the triangles - self.triangles = screen.geometry.get_triangles(self.face['vertices']) + self.triangles = geometry.get_triangles(self.face['vertices']) # get the planes of the triangles self.get_planes() @@ -209,8 +84,8 @@ safety_factor = 1.5 # calculate the end values - x_end = int(round(screen.geometry.get_distance(plane['vectors'][0]) * 100 * resolution_texture_map * safety_factor)) - y_end = int(round(screen.geometry.get_distance(plane['vectors'][1]) * 100 * resolution_texture_map * safety_factor)) + x_end = int(round(geometry.get_distance(plane['vectors'][0]) * 100 * resolution_texture_map * safety_factor)) + y_end = int(round(geometry.get_distance(plane['vectors'][1]) * 100 * resolution_texture_map * safety_factor)) for x_pixel_number in range(0, x_end): # get the relative x coordinate @@ -242,7 +117,7 @@ x, y = self.center_position(x, y) # draw the pixel - self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute), x, y) + self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute, self.face), x, y) def get_border(self): # define arrays for the coordinates @@ -283,11 +158,11 @@ offset = triangle[0] # calculate the vectors - vector_1 = screen.geometry.get_vector(offset, triangle[1]) - vector_2 = screen.geometry.get_vector(offset, triangle[2]) + vector_1 = geometry.get_vector(offset, triangle[1]) + vector_2 = geometry.get_vector(offset, triangle[2]) # get the plane - plane = screen.geometry.get_plane(offset, vector_1, vector_2) + plane = geometry.get_plane(offset, vector_1, vector_2) # store the plane self.planes.append(plane) @@ -297,13 +172,13 @@ return (0, 0) # get the vector - vector = screen.geometry.get_vector(self.offset, vertice) + vector = geometry.get_vector(self.offset, vertice) # get the angle of the vector - angle = screen.geometry.get_angle(self.base_line, vector) + angle = geometry.get_angle(self.base_line, vector) # get the length of the vector - length = screen.geometry.get_distance(vector) + length = geometry.get_distance(vector) # calculate the x- and y-coordinate of the vector vector_x = cos(angle) * length Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -48,7 +48,7 @@ self.texture_name = textures[texture[0]]['textures'][texture[1]] # update the preview image - self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name + '/' + self.texture_name + '.png') + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower() + '/' + self.texture_name.lower() + '.png') screen.texture_preview = texture_preview(table) @@ -204,4 +204,8 @@ # insert a spacer #self.bar.append_space() -tools(table) \ No newline at end of file +tools(table) + +# initialize textures +if textures['Tauseti']['panels'].initialized==false: + textures['Tauseti']['panels'].initialize_step_1() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-03-20 17:54:30 UTC (rev 1104) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -16,4 +16,4 @@ execfile(path[0] + '/scripts/screens/project/canvas/frames/edit_the_face.py') # load frame: "textures:" - execfile(path[0] + '/scripts/screens/project/canvas/frames/textures.py') + execfile(path[0] + '/scripts/screens/project/canvas/frames/textures.py') \ No newline at end of file Added: branches/ogEditor/data/modules/texturizer/textures/tauseti/panels.blend =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/textures/tauseti/panels.blend ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z =================================================================== (Binary files differ) Property changes on: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py =================================================================== --- templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py 2009-03-20 17:54:30 UTC (rev 1104) +++ templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py 2009-03-22 06:52:20 UTC (rev 1105) @@ -1,11189 +0,0 @@ -# -*- coding: cp1252 -*- - -global a - -a = {} -a["vertices"] = [] -a["vertices"].append([]) -a["vertices"][0] = [] -a["vertices"][0].append(-0.01405) -a["vertices"][0].append(-0.006476) -a["vertices"][0].append(0.021234) -a["vertices"].append([]) -a["vertices"][1] = [] -a["vertices"][1].append(-0.027911) -a["vertices"][1].append(-0.006476) -a["vertices"][1].append(0.015323) -a["vertices"].append([]) -a["vertices"][2] = [] -a["vertices"][2].append(-0.035278) -a["vertices"][2].append(-0.011043) -a["vertices"][2].append(0.009523) -a["vertices"].append([]) -a["vertices"][3] = [] -a["vertices"][3].append(-0.020774) -a["vertices"][3].append(-0.01569) -a["vertices"][3].append(0.013658) -a["vertices"].append([]) -a["vertices"][4] = [] -a["vertices"][4].append(-0.0) -a["vertices"][4].append(-0.052962) -a["vertices"][4].append(-0.016081) -a["vertices"].append([]) -a["vertices"][5] = [] -a["vertices"][5].append(0.031524) -a["vertices"][5].append(-0.054037) -a["vertices"][5].append(-0.016081) -a["vertices"].append([]) -a["vertices"][6] = [] -a["vertices"][6].append(0.031524) -a["vertices"][6].append(-0.055739) -a["vertices"][6].append(-0.010646) -a["vertices"].append([]) -a["vertices"][7] = [] -a["vertices"][7].append(-0.0) -a["vertices"][7].append(-0.055076) -a["vertices"][7].append(-0.010646) -a["vertices"].append([]) -a["vertices"][8] = [] -a["vertices"][8].append(-0.023431) -a["vertices"][8].append(-0.051839) -a["vertices"][8].append(-0.014165) -a["vertices"].append([]) -a["vertices"][9] = [] -a["vertices"][9].append(-0.024352) -a["vertices"][9].append(-0.046838) -a["vertices"][9].append(-0.014127) -a["vertices"].append([]) -a["vertices"][10] = [] -a["vertices"][10].append(-0.0) -a["vertices"][10].append(-0.044808) -a["vertices"][10].append(-0.01602) -a["vertices"].append([]) -a["vertices"][11] = [] -a["vertices"][11].append(-0.020774) -a["vertices"][11].append(7.1e-05) -a["vertices"][11].append(-0.009933) -a["vertices"].append([]) -a["vertices"][12] = [] -a["vertices"][12].append(0.025938) -a["vertices"][12].append(7.1e-05) -a["vertices"][12].append(-0.007337) -a["vertices"].append([]) -a["vertices"][13] = [] -a["vertices"][13].append(0.025753) -a["vertices"][13].append(-0.00685) -a["vertices"][13].append(-0.007189) -a["vertices"].append([]) -a["vertices"][14] = [] -a["vertices"][14].append(-0.020774) -a["vertices"][14].append(-0.00685) -a["vertices"][14].append(-0.010018) -a["vertices"].append([]) -a["vertices"][15] = [] -a["vertices"][15].append(-0.020774) -a["vertices"][15].append(0.006992) -a["vertices"][15].append(-0.010018) -a["vertices"].append([]) -a["vertices"][16] = [] -a["vertices"][16].append(0.025753) -a["vertices"][16].append(0.006992) -a["vertices"][16].append(-0.007189) -a["vertices"].append([]) -a["vertices"][17] = [] -a["vertices"][17].append(0.015456) -a["vertices"][17].append(-0.006476) -a["vertices"][17].append(0.020678) -a["vertices"].append([]) -a["vertices"][18] = [] -a["vertices"][18].append(0.013924) -a["vertices"][18].append(-0.01569) -a["vertices"][18].append(0.013658) -a["vertices"].append([]) -a["vertices"][19] = [] -a["vertices"][19].append(-0.038107) -a["vertices"][19].append(-0.014583) -a["vertices"][19].append(0.00438) -a["vertices"].append([]) -a["vertices"][20] = [] -a["vertices"][20].append(-0.025345) -a["vertices"][20].append(-0.021374) -a["vertices"][20].append(0.003548) -a["vertices"].append([]) -a["vertices"][21] = [] -a["vertices"][21].append(-0.026982) -a["vertices"][21].append(-0.021614) -a["vertices"][21].append(3.8e-05) -a["vertices"].append([]) -a["vertices"][22] = [] -a["vertices"][22].append(-0.0) -a["vertices"][22].append(-0.040286) -a["vertices"][22].append(-0.011412) -a["vertices"].append([]) -a["vertices"][23] = [] -a["vertices"][23].append(-0.0) -a["vertices"][23].append(-0.04201) -a["vertices"][23].append(-0.005292) -a["vertices"].append([]) -a["vertices"][24] = [] -a["vertices"][24].append(0.013924) -a["vertices"][24].append(-0.022131) -a["vertices"][24].append(0.003548) -a["vertices"].append([]) -a["vertices"][25] = [] -a["vertices"][25].append(-0.039006) -a["vertices"][25].append(-0.016195) -a["vertices"][25].append(3.8e-05) -a["vertices"].append([]) -a["vertices"][26] = [] -a["vertices"][26].append(0.016622) -a["vertices"][26].append(-0.043511) -a["vertices"][26].append(-0.005203) -a["vertices"].append([]) -a["vertices"][27] = [] -a["vertices"][27].append(-0.0) -a["vertices"][27].append(-0.05115) -a["vertices"][27].append(-0.005152) -a["vertices"].append([]) -a["vertices"][28] = [] -a["vertices"][28].append(-0.023636) -a["vertices"][28].append(-0.050728) -a["vertices"][28].append(-0.00735) -a["vertices"].append([]) -a["vertices"][29] = [] -a["vertices"][29].append(-0.025947) -a["vertices"][29].append(-0.053136) -a["vertices"][29].append(-0.011293) -a["vertices"].append([]) -a["vertices"][30] = [] -a["vertices"][30].append(0.027955) -a["vertices"][30].append(-0.052163) -a["vertices"][30].append(-0.005152) -a["vertices"].append([]) -a["vertices"][31] = [] -a["vertices"][31].append(0.031524) -a["vertices"][31].append(-0.046893) -a["vertices"][31].append(-0.01602) -a["vertices"].append([]) -a["vertices"][32] = [] -a["vertices"][32].append(-0.027619) -a["vertices"][32].append(-0.044065) -a["vertices"][32].append(-0.011254) -a["vertices"].append([]) -a["vertices"][33] = [] -a["vertices"][33].append(-0.024669) -a["vertices"][33].append(-0.045122) -a["vertices"][33].append(-0.007437) -a["vertices"].append([]) -a["vertices"][34] = [] -a["vertices"][34].append(0.019232) -a["vertices"][34].append(-0.012933) -a["vertices"][34].append(-0.005823) -a["vertices"].append([]) -a["vertices"][35] = [] -a["vertices"][35].append(0.021852) -a["vertices"][35].append(-0.041362) -a["vertices"][35].append(-0.011338) -a["vertices"].append([]) -a["vertices"][36] = [] -a["vertices"][36].append(-0.03841) -a["vertices"][36].append(-0.00685) -a["vertices"][36].append(-0.007613) -a["vertices"].append([]) -a["vertices"][37] = [] -a["vertices"][37].append(0.024045) -a["vertices"][37].append(-0.012648) -a["vertices"][37].append(0.009014) -a["vertices"].append([]) -a["vertices"][38] = [] -a["vertices"][38].append(0.025125) -a["vertices"][38].append(-0.006663) -a["vertices"][38].append(0.011236) -a["vertices"].append([]) -a["vertices"][39] = [] -a["vertices"][39].append(0.029773) -a["vertices"][39].append(-0.016388) -a["vertices"][39].append(0.001074) -a["vertices"].append([]) -a["vertices"][40] = [] -a["vertices"][40].append(0.031524) -a["vertices"][40].append(-0.042783) -a["vertices"][40].append(-0.011412) -a["vertices"].append([]) -a["vertices"][41] = [] -a["vertices"][41].append(0.027955) -a["vertices"][41].append(-0.045655) -a["vertices"][41].append(-0.005292) -a["vertices"].append([]) -a["vertices"][42] = [] -a["vertices"][42].append(0.033927) -a["vertices"][42].append(7.1e-05) -a["vertices"][42].append(0.002309) -a["vertices"].append([]) -a["vertices"][43] = [] -a["vertices"][43].append(0.033734) -a["vertices"][43].append(-0.006808) -a["vertices"][43].append(0.002445) -a["vertices"].append([]) -a["vertices"][44] = [] -a["vertices"][44].append(0.033734) -a["vertices"][44].append(0.006949) -a["vertices"][44].append(0.002445) -a["vertices"].append([]) -a["vertices"][45] = [] -a["vertices"][45].append(-0.035758) -a["vertices"][45].append(-0.009536) -a["vertices"][45].append(0.011655) -a["vertices"].append([]) -a["vertices"][46] = [] -a["vertices"][46].ap... [truncated message content] |
From: <Ult...@us...> - 2009-03-20 17:54:40
|
Revision: 1104 http://opengate.svn.sourceforge.net/opengate/?rev=1104&view=rev Author: Ultrasick Date: 2009-03-20 17:54:30 +0000 (Fri, 20 Mar 2009) Log Message: ----------- removing some unnecessary stuff Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/ Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-15 10:08:00 UTC (rev 1103) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-20 17:54:30 UTC (rev 1104) @@ -11,72 +11,15 @@ #from os import listdir #from os import path as check #from os import system -#from os import urandom + +from os import urandom + #from string import join #from string import replace #import urllib + from warnings import simplefilter as ignore_warnings -class file_selection_window: - def show(self, process_function, process_parameter = none, return_function = none, return_parameter = none): - # save parameters - self.process_function = process_function - self.process_parameter = process_parameter - self.return_function = return_function - self.return_parameter = return_parameter - - # show file selection window - self.window = gtk.FileSelection() - self.window.set_border_width(2) - self.window.show() - - # add functions to the buttons of the window - self.window.ok_button.connect('clicked', lambda x: self.exit_with_processing()) - self.window.cancel_button.connect('clicked', lambda x: self.exit_without_processing()) - - def exit_without_processing(self): - # destroy the window - self.window.destroy() - - def exit_with_processing(self): - # get the file name - file_name = self.window.get_filename() - - # process the file - if self.process_parameter!=none: - self.return_value = self.process_function(file_name, self.process_parameter) - else: - self.return_value = self.process_function(file_name) - - # destroy the window - self.window.destroy() - - if self.return_function: - # run the return function - self.return_function(self.return_parameter) - -file_selection_window = file_selection_window() - -ignore_warnings('ignore', DeprecationWarning) - -def isfloat(number): - legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e'] - - for character in str(number): - if character not in legal: - return false - - return true - -def isint(number): - legal = ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] - - for character in str(number): - if character not in legal: - return false - - return true - class array: def parse(self, Array, prefix = ''): if type(Array)==type({}): @@ -148,7 +91,7 @@ print '\t' * level + ')' - return + return '' def save(self, file_name, Array): # create/reset output string @@ -177,6 +120,69 @@ array = array() +class file_selection_window: + def show(self, caption, process_function, process_parameter = none, return_function = none, return_parameter = none): + # save parameters + self.process_function = process_function + self.process_parameter = process_parameter + self.return_function = return_function + self.return_parameter = return_parameter + + # show file selection window + self.window = gtk.FileSelection(caption) + self.window.set_border_width(2) + self.window.show() + + # add functions to the buttons of the window + self.window.ok_button.connect('clicked', lambda x: self.exit_with_processing()) + self.window.cancel_button.connect('clicked', lambda x: self.exit_without_processing()) + + def exit_without_processing(self): + # destroy the window + self.window.destroy() + + def exit_with_processing(self): + # get the file name + file_name = self.window.get_filename() + + # process the file + if self.process_parameter!=none: + self.return_value = self.process_function(file_name, self.process_parameter) + else: + self.return_value = self.process_function(file_name) + + # destroy the window + self.window.destroy() + + if self.return_function: + # run the return function + self.return_function(self.return_parameter) + +file_selection_window = file_selection_window() + +ignore_warnings('ignore', DeprecationWarning) + +def isfloat(number): + legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e'] + + for character in str(number): + if character not in legal: + return false + + return true + +def isint(number): + legal = ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + + for character in str(number): + if character not in legal: + return false + + return true + +def random(): + return round(ord(urandom(1))/255, 3) + def update_ui(): while gtk.events_pending(): gtk.main_iteration(false) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-15 10:08:00 UTC (rev 1103) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-20 17:54:30 UTC (rev 1104) @@ -5,6 +5,166 @@ window.add(window.vbox) window.vbox.show() +class raw_file: + def load(self, file_name): + # open the file + file = open(file_name, 'r') + + # read the lines + lines = file.readlines() + + # close the file + file.close() + + try: + global model + except: + pass + + # create a new array for the model + model = {} + + # create new arrays for the dimensions + model['dimensions'] = {} + model['dimensions'][0] = {} # x + model['dimensions'][1] = {} # x + model['dimensions'][2] = {} # z + + # define min and max coordinates for the x-axis + model['dimensions'][0]['min'] = 99999999 + model['dimensions'][0]['max'] = -99999999 + + # define min and max coordinates for the y-axis + model['dimensions'][1]['min'] = 99999999 + model['dimensions'][1]['max'] = -99999999 + + # define min and max coordinates for the z-axis + model['dimensions'][2]['min'] = 99999999 + model['dimensions'][2]['max'] = -99999999 + + # create a new array for the edges + model['edges'] = [] + + # create a new array for the faces + model['faces'] = [] + + # create a new array for the vertices + model['vertices'] = [] + + # create new arrays for the average coordinates + average_x = [] + average_y = [] + average_z = [] + + for line in lines: + # trim whitespaces + line = line.strip() + + # split at the " " + face = line.split(' ') + + # reset/create an array for the new face + face_new = [] + + while face: + # reset/create an array for a vertice + vertice = [] + + # grab x, y and z coordinate + x = float(face.pop(0)) + x /= 10 # debug + y = float(face.pop(0)) + y /= 10 # debug + z = float(face.pop(0)) + z /= 10 # debug + + # save the new min and max values + self.save_min_and_max(x, y, z) + + # store the coordinates for the average values + average_x.append(x) + average_y.append(y) + average_z.append(z) + + # save the coordinates as a vertice + vertice.append(x) + vertice.append(y) + vertice.append(z) + + # save the vertice in the model array + if vertice not in model['vertices']: + model['vertices'].append(vertice) + + # add the vertice number to the new face array + face_new.append(vertice) + + # save the edges of the face + edges = self.save_edges(face_new) + + # save the new face in the model['faces'] array + model['faces'].append({'vertices' : face_new, 'edges' : edges, 'textures' : []}) + + # insert length values + model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] + model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] + model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] + model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) + + # insert the average values + model['dimensions'][0]['average'] = sum(average_x)/len(average_x) + model['dimensions'][1]['average'] = sum(average_y)/len(average_y) + model['dimensions'][2]['average'] = sum(average_z)/len(average_z) + + def save_min_and_max(self, x, y, z): + # update min coorinate for the x-axis + if x<model['dimensions'][0]['min']: + model['dimensions'][0]['min'] = x + + # update max coorinate for the x-axis + if x>model['dimensions'][0]['max']: + model['dimensions'][0]['max'] = x + + # update min coorinate for the y-axis + if y<model['dimensions'][1]['min']: + model['dimensions'][1]['min'] = y + + # update max coorinate for the y-axis + if y>model['dimensions'][1]['max']: + model['dimensions'][1]['max'] = y + + # update min coorinate for the z-axis + if z<model['dimensions'][2]['min']: + model['dimensions'][2]['min'] = z + + # update max coorinate for the z-axis + if z>model['dimensions'][2]['max']: + model['dimensions'][2]['max'] = z + + def save_edges(self, face): + # create an array for the edges + edges = [] + + for i, vertice in enumerate(face): + first_vertice = vertice + + # grab the second vertice + try: + second_vertice = face[i + 1] + except: + second_vertice = face[0] + + # store the edge in the edges array + edges.append([first_vertice, second_vertice]) + + # check if the edge is already stored + if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: + # store the edge in the model array + model['edges'].append([first_vertice, second_vertice]) + + return edges + +raw_file = raw_file() + class menu: def __init__(self): # show bar @@ -47,19 +207,23 @@ def clicked(self, item, name): if name=='project/new': - show_screen(name) + self.project_new() elif name=='project/load': self.project_load() elif name=='project/save': self.project_save() + def project_new(self): + # load the raw faces + file_selection_window.show('select a *.raw file containing the raw faces of the model (use the export function in blender):', raw_file.load, none, show_screen, 'project/canvas') + def project_load(self, loaded = false): # make the model array global global model if loaded==false: # load the content of the model array - file_selection_window.show(array.load, none, self.project_load, true) + file_selection_window.show('select the project file (*.py):', array.load, none, self.project_load, true) else: # store the content of the model array model = file_selection_window.return_value @@ -75,7 +239,7 @@ return # save the model array - file_selection_window.show(array.save, model) + file_selection_window.show('select a directory and file name for the project:', array.save, model) window.menu = menu() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-15 10:08:03
|
Revision: 1103 http://opengate.svn.sourceforge.net/opengate/?rev=1103&view=rev Author: Ultrasick Date: 2009-03-15 10:08:00 +0000 (Sun, 15 Mar 2009) Log Message: ----------- The project can now be saved and loaded again. The new file "lady_kickstart.ogeditor.texturizer.py" is a project file which can be loaded and shows the lady kickstart with a glass cockpit. Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py Added Paths: ----------- templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-15 07:35:30 UTC (rev 1102) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-15 10:08:00 UTC (rev 1103) @@ -17,10 +17,50 @@ #import urllib from warnings import simplefilter as ignore_warnings +class file_selection_window: + def show(self, process_function, process_parameter = none, return_function = none, return_parameter = none): + # save parameters + self.process_function = process_function + self.process_parameter = process_parameter + self.return_function = return_function + self.return_parameter = return_parameter + + # show file selection window + self.window = gtk.FileSelection() + self.window.set_border_width(2) + self.window.show() + + # add functions to the buttons of the window + self.window.ok_button.connect('clicked', lambda x: self.exit_with_processing()) + self.window.cancel_button.connect('clicked', lambda x: self.exit_without_processing()) + + def exit_without_processing(self): + # destroy the window + self.window.destroy() + + def exit_with_processing(self): + # get the file name + file_name = self.window.get_filename() + + # process the file + if self.process_parameter!=none: + self.return_value = self.process_function(file_name, self.process_parameter) + else: + self.return_value = self.process_function(file_name) + + # destroy the window + self.window.destroy() + + if self.return_function: + # run the return function + self.return_function(self.return_parameter) + +file_selection_window = file_selection_window() + ignore_warnings('ignore', DeprecationWarning) def isfloat(number): - legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e'] for character in str(number): if character not in legal: @@ -37,30 +77,106 @@ return true -def print_array(Array, level = 0): - print 'array(' +class array: + def parse(self, Array, prefix = ''): + if type(Array)==type({}): + # create the array + self.output += 'a' + prefix + ' = ' + '{}' + '\n' - if type(Array)==list: - for Schlussel, Wert in enumerate(Array): - if type(Wert)==list or type(Wert)==dict: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , - print_array(Wert, level + 1) - else: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) - elif type(Array)==dict: - for Schlussel, Wert in Array.items(): - if type(Wert)==list or type(Wert)==dict: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , - print_array(Wert, level + 1) - else: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) - else: - print 'unbekanntes Format' + for key, value in Array.items(): + # get the new prefix + if isfloat(key) or isint(key): + new_prefix = '[' + str(key) + ']' + else: + new_prefix = '["' + key + '"]' - print '\t' * level + ')' + if isfloat(value) or isint(value): + # if value is numeric, output it + self.output += 'a' + prefix + new_prefix + ' = ' + str(value) + '\n' + elif type(value)==type(''): + # if value is a string, output it + self.output += 'a' + prefix + new_prefix + ' = "' + str(value) + '"' + '\n' + elif type(value)==type([]) or type(value)==type({}): + # if value is an array, parse it + self.parse(value, prefix + new_prefix) + elif type(Array)==type([]): + # create the array + self.output += 'a' + prefix + ' = ' + '[]' + '\n' - return '' + for key, value in enumerate(Array): + # get the new prefix + new_prefix = '[' + str(key) + ']' + if isfloat(value) or isint(value): + # if value is numeric, output it + self.output += 'a' + prefix + '.append(' + str(value) + ')\n' + elif type(value)==type(''): + # if value is a string, output it + self.output += 'a' + prefix + '.append("' + str(value) + '")' + '\n' + elif type(value)==type([]): + # if value is a list, create it + self.output += 'a' + prefix + '.append([])' + '\n' + + # if value is an array, parse it + self.parse(value, prefix + new_prefix) + elif type(value)==type({}): + # if value is a dictionary, create it + self.output += 'a' + prefix + '.append({})' + '\n' + + # if value is an array, parse it + self.parse(value, prefix + new_prefix) + + def Print(self, Array, level = 0): + print 'array(' + + if type(Array)==list: + for Schlussel, Wert in enumerate(Array): + if type(Wert)==list or type(Wert)==dict: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , + self.Print(Wert, level + 1) + else: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + elif type(Array)==dict: + for Schlussel, Wert in Array.items(): + if type(Wert)==list or type(Wert)==dict: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , + self.Print(Wert, level + 1) + else: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + else: + print 'unbekanntes Format' + + print '\t' * level + ')' + + return + + def save(self, file_name, Array): + # create/reset output string + self.output = '# -*- coding: cp1252 -*-' + '\n\n' + 'global a' + '\n\n' + + # parse the array + self.parse(Array) + + if file_name[-3:]!='.py': + file_name += '.py' + + # open the file + file = open(file_name, 'w') + + # write the output to the file + file.write(self.output) + + # close the file + file.close() + + def load(self, file_name): + # load the file + execfile(file_name) + + return a + +array = array() + def update_ui(): while gtk.events_pending(): gtk.main_iteration(false) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-15 07:35:30 UTC (rev 1102) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-15 10:08:00 UTC (rev 1103) @@ -29,10 +29,54 @@ # connect the function to the menu item self.project.new.connect('activate', self.clicked, 'project/new') + # create menu item "load" + self.project.load = gtk.MenuItem('load') + menu.add(self.project.load) + self.project.load.show() + + # connect the function to the menu item + self.project.load.connect('activate', self.clicked, 'project/load') + + # create menu item "save" + self.project.save = gtk.MenuItem('save') + menu.add(self.project.save) + self.project.save.show() + + # connect the function to the menu item + self.project.save.connect('activate', self.clicked, 'project/save') + def clicked(self, item, name): if name=='project/new': show_screen(name) + elif name=='project/load': + self.project_load() + elif name=='project/save': + self.project_save() + def project_load(self, loaded = false): + # make the model array global + global model + + if loaded==false: + # load the content of the model array + file_selection_window.show(array.load, none, self.project_load, true) + else: + # store the content of the model array + model = file_selection_window.return_value + + # load the next screen + show_screen('project/canvas') + + def project_save(self): + # check if the model array exists + try: + model + except: + return + + # save the model array + file_selection_window.show(array.save, model) + window.menu = menu() # show container for the content Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-15 07:35:30 UTC (rev 1102) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-15 10:08:00 UTC (rev 1103) @@ -21,38 +21,11 @@ button.show() # add function to show the file selection window - button.connect('clicked', lambda x: self.show_file_selection_window()) + button.connect('clicked', lambda x: file_selection_window.show(self.load, none, show_screen, 'project/canvas')) - def show_file_selection_window(self): - # show file selection window - self.file_selection_window = gtk.FileSelection() - self.file_selection_window.set_border_width(2) - self.file_selection_window.show() - - # add functions to the buttons of the file selection window - self.file_selection_window.ok_button.connect('clicked', lambda x: self.save_file_name()) - self.file_selection_window.cancel_button.connect('clicked', lambda x: self.destroy_file_selection_window()) - - def destroy_file_selection_window(self): - # destroy the window - self.file_selection_window.destroy() - - def save_file_name(self): - # save the file name - self.name = self.file_selection_window.get_filename() - - # load the file - self.load() - - # destroy the window - self.destroy_file_selection_window() - - # show next screen - show_screen('project/canvas') - - def load(self): + def load(self, file_name): # open the file - file = open(self.name, 'r') + file = open(file_name, 'r') # read the lines lines = file.readlines() Added: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py =================================================================== --- templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py (rev 0) +++ templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.py 2009-03-15 10:08:00 UTC (rev 1103) @@ -0,0 +1,11189 @@ +# -*- coding: cp1252 -*- + +global a + +a = {} +a["vertices"] = [] +a["vertices"].append([]) +a["vertices"][0] = [] +a["vertices"][0].append(-0.01405) +a["vertices"][0].append(-0.006476) +a["vertices"][0].append(0.021234) +a["vertices"].append([]) +a["vertices"][1] = [] +a["vertices"][1].append(-0.027911) +a["vertices"][1].append(-0.006476) +a["vertices"][1].append(0.015323) +a["vertices"].append([]) +a["vertices"][2] = [] +a["vertices"][2].append(-0.035278) +a["vertices"][2].append(-0.011043) +a["vertices"][2].append(0.009523) +a["vertices"].append([]) +a["vertices"][3] = [] +a["vertices"][3].append(-0.020774) +a["vertices"][3].append(-0.01569) +a["vertices"][3].append(0.013658) +a["vertices"].append([]) +a["vertices"][4] = [] +a["vertices"][4].append(-0.0) +a["vertices"][4].append(-0.052962) +a["vertices"][4].append(-0.016081) +a["vertices"].append([]) +a["vertices"][5] = [] +a["vertices"][5].append(0.031524) +a["vertices"][5].append(-0.054037) +a["vertices"][5].append(-0.016081) +a["vertices"].append([]) +a["vertices"][6] = [] +a["vertices"][6].append(0.031524) +a["vertices"][6].append(-0.055739) +a["vertices"][6].append(-0.010646) +a["vertices"].append([]) +a["vertices"][7] = [] +a["vertices"][7].append(-0.0) +a["vertices"][7].append(-0.055076) +a["vertices"][7].append(-0.010646) +a["vertices"].append([]) +a["vertices"][8] = [] +a["vertices"][8].append(-0.023431) +a["vertices"][8].append(-0.051839) +a["vertices"][8].append(-0.014165) +a["vertices"].append([]) +a["vertices"][9] = [] +a["vertices"][9].append(-0.024352) +a["vertices"][9].append(-0.046838) +a["vertices"][9].append(-0.014127) +a["vertices"].append([]) +a["vertices"][10] = [] +a["vertices"][10].append(-0.0) +a["vertices"][10].append(-0.044808) +a["vertices"][10].append(-0.01602) +a["vertices"].append([]) +a["vertices"][11] = [] +a["vertices"][11].append(-0.020774) +a["vertices"][11].append(7.1e-05) +a["vertices"][11].append(-0.009933) +a["vertices"].append([]) +a["vertices"][12] = [] +a["vertices"][12].append(0.025938) +a["vertices"][12].append(7.1e-05) +a["vertices"][12].append(-0.007337) +a["vertices"].append([]) +a["vertices"][13] = [] +a["vertices"][13].append(0.025753) +a["vertices"][13].append(-0.00685) +a["vertices"][13].append(-0.007189) +a["vertices"].append([]) +a["vertices"][14] = [] +a["vertices"][14].append(-0.020774) +a["vertices"][14].append(-0.00685) +a["vertices"][14].append(-0.010018) +a["vertices"].append([]) +a["vertices"][15] = [] +a["vertices"][15].append(-0.020774) +a["vertices"][15].append(0.006992) +a["vertices"][15].append(-0.010018) +a["vertices"].append([]) +a["vertices"][16] = [] +a["vertices"][16].append(0.025753) +a["vertices"][16].append(0.006992) +a["vertices"][16].append(-0.007189) +a["vertices"].append([]) +a["vertices"][17] = [] +a["vertices"][17].append(0.015456) +a["vertices"][17].append(-0.006476) +a["vertices"][17].append(0.020678) +a["vertices"].append([]) +a["vertices"][18] = [] +a["vertices"][18].append(0.013924) +a["vertices"][18].append(-0.01569) +a["vertices"][18].append(0.013658) +a["vertices"].append([]) +a["vertices"][19] = [] +a["vertices"][19].append(-0.038107) +a["vertices"][19].append(-0.014583) +a["vertices"][19].append(0.00438) +a["vertices"].append([]) +a["vertices"][20] = [] +a["vertices"][20].append(-0.025345) +a["vertices"][20].append(-0.021374) +a["vertices"][20].append(0.003548) +a["vertices"].append([]) +a["vertices"][21] = [] +a["vertices"][21].append(-0.026982) +a["vertices"][21].append(-0.021614) +a["vertices"][21].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][22] = [] +a["vertices"][22].append(-0.0) +a["vertices"][22].append(-0.040286) +a["vertices"][22].append(-0.011412) +a["vertices"].append([]) +a["vertices"][23] = [] +a["vertices"][23].append(-0.0) +a["vertices"][23].append(-0.04201) +a["vertices"][23].append(-0.005292) +a["vertices"].append([]) +a["vertices"][24] = [] +a["vertices"][24].append(0.013924) +a["vertices"][24].append(-0.022131) +a["vertices"][24].append(0.003548) +a["vertices"].append([]) +a["vertices"][25] = [] +a["vertices"][25].append(-0.039006) +a["vertices"][25].append(-0.016195) +a["vertices"][25].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][26] = [] +a["vertices"][26].append(0.016622) +a["vertices"][26].append(-0.043511) +a["vertices"][26].append(-0.005203) +a["vertices"].append([]) +a["vertices"][27] = [] +a["vertices"][27].append(-0.0) +a["vertices"][27].append(-0.05115) +a["vertices"][27].append(-0.005152) +a["vertices"].append([]) +a["vertices"][28] = [] +a["vertices"][28].append(-0.023636) +a["vertices"][28].append(-0.050728) +a["vertices"][28].append(-0.00735) +a["vertices"].append([]) +a["vertices"][29] = [] +a["vertices"][29].append(-0.025947) +a["vertices"][29].append(-0.053136) +a["vertices"][29].append(-0.011293) +a["vertices"].append([]) +a["vertices"][30] = [] +a["vertices"][30].append(0.027955) +a["vertices"][30].append(-0.052163) +a["vertices"][30].append(-0.005152) +a["vertices"].append([]) +a["vertices"][31] = [] +a["vertices"][31].append(0.031524) +a["vertices"][31].append(-0.046893) +a["vertices"][31].append(-0.01602) +a["vertices"].append([]) +a["vertices"][32] = [] +a["vertices"][32].append(-0.027619) +a["vertices"][32].append(-0.044065) +a["vertices"][32].append(-0.011254) +a["vertices"].append([]) +a["vertices"][33] = [] +a["vertices"][33].append(-0.024669) +a["vertices"][33].append(-0.045122) +a["vertices"][33].append(-0.007437) +a["vertices"].append([]) +a["vertices"][34] = [] +a["vertices"][34].append(0.019232) +a["vertices"][34].append(-0.012933) +a["vertices"][34].append(-0.005823) +a["vertices"].append([]) +a["vertices"][35] = [] +a["vertices"][35].append(0.021852) +a["vertices"][35].append(-0.041362) +a["vertices"][35].append(-0.011338) +a["vertices"].append([]) +a["vertices"][36] = [] +a["vertices"][36].append(-0.03841) +a["vertices"][36].append(-0.00685) +a["vertices"][36].append(-0.007613) +a["vertices"].append([]) +a["vertices"][37] = [] +a["vertices"][37].append(0.024045) +a["vertices"][37].append(-0.012648) +a["vertices"][37].append(0.009014) +a["vertices"].append([]) +a["vertices"][38] = [] +a["vertices"][38].append(0.025125) +a["vertices"][38].append(-0.006663) +a["vertices"][38].append(0.011236) +a["vertices"].append([]) +a["vertices"][39] = [] +a["vertices"][39].append(0.029773) +a["vertices"][39].append(-0.016388) +a["vertices"][39].append(0.001074) +a["vertices"].append([]) +a["vertices"][40] = [] +a["vertices"][40].append(0.031524) +a["vertices"][40].append(-0.042783) +a["vertices"][40].append(-0.011412) +a["vertices"].append([]) +a["vertices"][41] = [] +a["vertices"][41].append(0.027955) +a["vertices"][41].append(-0.045655) +a["vertices"][41].append(-0.005292) +a["vertices"].append([]) +a["vertices"][42] = [] +a["vertices"][42].append(0.033927) +a["vertices"][42].append(7.1e-05) +a["vertices"][42].append(0.002309) +a["vertices"].append([]) +a["vertices"][43] = [] +a["vertices"][43].append(0.033734) +a["vertices"][43].append(-0.006808) +a["vertices"][43].append(0.002445) +a["vertices"].append([]) +a["vertices"][44] = [] +a["vertices"][44].append(0.033734) +a["vertices"][44].append(0.006949) +a["vertices"][44].append(0.002445) +a["vertices"].append([]) +a["vertices"][45] = [] +a["vertices"][45].append(-0.035758) +a["vertices"][45].append(-0.009536) +a["vertices"][45].append(0.011655) +a["vertices"].append([]) +a["vertices"][46] = [] +a["vertices"][46].append(-0.053625) +a["vertices"][46].append(-0.003659) +a["vertices"][46].append(0.008726) +a["vertices"].append([]) +a["vertices"][47] = [] +a["vertices"][47].append(-0.054886) +a["vertices"][47].append(-0.005068) +a["vertices"][47].append(0.007674) +a["vertices"].append([]) +a["vertices"][48] = [] +a["vertices"][48].append(-0.032285) +a["vertices"][48].append(-0.005442) +a["vertices"][48].append(0.015401) +a["vertices"].append([]) +a["vertices"][49] = [] +a["vertices"][49].append(-0.056047) +a["vertices"][49].append(-0.00685) +a["vertices"][49].append(-0.005209) +a["vertices"].append([]) +a["vertices"][50] = [] +a["vertices"][50].append(-0.054376) +a["vertices"][50].append(-0.010775) +a["vertices"][50].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][51] = [] +a["vertices"][51].append(-0.073569) +a["vertices"][51].append(-0.002459) +a["vertices"][51].append(-0.001718) +a["vertices"].append([]) +a["vertices"][52] = [] +a["vertices"][52].append(-0.073512) +a["vertices"][52].append(7.1e-05) +a["vertices"][52].append(-0.002222) +a["vertices"].append([]) +a["vertices"][53] = [] +a["vertices"][53].append(-0.05633) +a["vertices"][53].append(7.1e-05) +a["vertices"][53].append(-0.005284) +a["vertices"].append([]) +a["vertices"][54] = [] +a["vertices"][54].append(-0.07508) +a["vertices"][54].append(7.1e-05) +a["vertices"][54].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][55] = [] +a["vertices"][55].append(-0.073378) +a["vertices"][55].append(-0.003033) +a["vertices"][55].append(0.001739) +a["vertices"].append([]) +a["vertices"][56] = [] +a["vertices"][56].append(-0.073442) +a["vertices"][56].append(7.1e-05) +a["vertices"][56].append(0.002558) +a["vertices"].append([]) +a["vertices"][57] = [] +a["vertices"][57].append(-0.073563) +a["vertices"][57].append(0.003903) +a["vertices"][57].append(2.2e-05) +a["vertices"].append([]) +a["vertices"][58] = [] +a["vertices"][58].append(-0.073569) +a["vertices"][58].append(0.002601) +a["vertices"][58].append(-0.001718) +a["vertices"].append([]) +a["vertices"][59] = [] +a["vertices"][59].append(-0.073378) +a["vertices"][59].append(0.003175) +a["vertices"][59].append(0.001739) +a["vertices"].append([]) +a["vertices"][60] = [] +a["vertices"][60].append(-0.0548) +a["vertices"][60].append(-0.009159) +a["vertices"][60].append(0.005409) +a["vertices"].append([]) +a["vertices"][61] = [] +a["vertices"][61].append(-0.056047) +a["vertices"][61].append(0.006992) +a["vertices"][61].append(-0.005209) +a["vertices"].append([]) +a["vertices"][62] = [] +a["vertices"][62].append(-0.073563) +a["vertices"][62].append(-0.003762) +a["vertices"][62].append(2.2e-05) +a["vertices"].append([]) +a["vertices"][63] = [] +a["vertices"][63].append(-0.01405) +a["vertices"][63].append(0.006618) +a["vertices"][63].append(0.021234) +a["vertices"].append([]) +a["vertices"][64] = [] +a["vertices"][64].append(0.015456) +a["vertices"][64].append(0.006618) +a["vertices"][64].append(0.020678) +a["vertices"].append([]) +a["vertices"][65] = [] +a["vertices"][65].append(0.013924) +a["vertices"][65].append(0.015832) +a["vertices"][65].append(0.013658) +a["vertices"].append([]) +a["vertices"][66] = [] +a["vertices"][66].append(-0.020774) +a["vertices"][66].append(0.015832) +a["vertices"][66].append(0.013658) +a["vertices"].append([]) +a["vertices"][67] = [] +a["vertices"][67].append(-0.0) +a["vertices"][67].append(0.053104) +a["vertices"][67].append(-0.016081) +a["vertices"].append([]) +a["vertices"][68] = [] +a["vertices"][68].append(0.031524) +a["vertices"][68].append(0.054178) +a["vertices"][68].append(-0.016081) +a["vertices"].append([]) +a["vertices"][69] = [] +a["vertices"][69].append(0.031524) +a["vertices"][69].append(0.047035) +a["vertices"][69].append(-0.01602) +a["vertices"].append([]) +a["vertices"][70] = [] +a["vertices"][70].append(-0.0) +a["vertices"][70].append(0.044949) +a["vertices"][70].append(-0.01602) +a["vertices"].append([]) +a["vertices"][71] = [] +a["vertices"][71].append(-0.023431) +a["vertices"][71].append(0.051981) +a["vertices"][71].append(-0.014165) +a["vertices"].append([]) +a["vertices"][72] = [] +a["vertices"][72].append(-0.025947) +a["vertices"][72].append(0.053278) +a["vertices"][72].append(-0.011293) +a["vertices"].append([]) +a["vertices"][73] = [] +a["vertices"][73].append(-0.0) +a["vertices"][73].append(0.055218) +a["vertices"][73].append(-0.010646) +a["vertices"].append([]) +a["vertices"][74] = [] +a["vertices"][74].append(0.013924) +a["vertices"][74].append(0.022273) +a["vertices"][74].append(0.003548) +a["vertices"].append([]) +a["vertices"][75] = [] +a["vertices"][75].append(-0.025345) +a["vertices"][75].append(0.021515) +a["vertices"][75].append(0.003548) +a["vertices"].append([]) +a["vertices"][76] = [] +a["vertices"][76].append(-0.035278) +a["vertices"][76].append(0.011184) +a["vertices"][76].append(0.009523) +a["vertices"].append([]) +a["vertices"][77] = [] +a["vertices"][77].append(-0.027911) +a["vertices"][77].append(0.006618) +a["vertices"][77].append(0.015323) +a["vertices"].append([]) +a["vertices"][78] = [] +a["vertices"][78].append(0.016622) +a["vertices"][78].append(0.043652) +a["vertices"][78].append(-0.005203) +a["vertices"].append([]) +a["vertices"][79] = [] +a["vertices"][79].append(-0.0) +a["vertices"][79].append(0.042152) +a["vertices"][79].append(-0.005292) +a["vertices"].append([]) +a["vertices"][80] = [] +a["vertices"][80].append(-0.038107) +a["vertices"][80].append(0.014725) +a["vertices"][80].append(0.00438) +a["vertices"].append([]) +a["vertices"][81] = [] +a["vertices"][81].append(-0.0) +a["vertices"][81].append(0.040428) +a["vertices"][81].append(-0.011412) +a["vertices"].append([]) +a["vertices"][82] = [] +a["vertices"][82].append(-0.026982) +a["vertices"][82].append(0.021756) +a["vertices"][82].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][83] = [] +a["vertices"][83].append(-0.024669) +a["vertices"][83].append(0.045264) +a["vertices"][83].append(-0.007437) +a["vertices"].append([]) +a["vertices"][84] = [] +a["vertices"][84].append(-0.027619) +a["vertices"][84].append(0.044207) +a["vertices"][84].append(-0.011254) +a["vertices"].append([]) +a["vertices"][85] = [] +a["vertices"][85].append(-0.0) +a["vertices"][85].append(0.051292) +a["vertices"][85].append(-0.005152) +a["vertices"].append([]) +a["vertices"][86] = [] +a["vertices"][86].append(0.027955) +a["vertices"][86].append(0.052305) +a["vertices"][86].append(-0.005152) +a["vertices"].append([]) +a["vertices"][87] = [] +a["vertices"][87].append(0.031524) +a["vertices"][87].append(0.055881) +a["vertices"][87].append(-0.010646) +a["vertices"].append([]) +a["vertices"][88] = [] +a["vertices"][88].append(-0.023636) +a["vertices"][88].append(0.05087) +a["vertices"][88].append(-0.00735) +a["vertices"].append([]) +a["vertices"][89] = [] +a["vertices"][89].append(-0.024352) +a["vertices"][89].append(0.04698) +a["vertices"][89].append(-0.014127) +a["vertices"].append([]) +a["vertices"][90] = [] +a["vertices"][90].append(0.021852) +a["vertices"][90].append(0.041504) +a["vertices"][90].append(-0.011338) +a["vertices"].append([]) +a["vertices"][91] = [] +a["vertices"][91].append(0.019232) +a["vertices"][91].append(0.013074) +a["vertices"][91].append(-0.005823) +a["vertices"].append([]) +a["vertices"][92] = [] +a["vertices"][92].append(-0.039006) +a["vertices"][92].append(0.016336) +a["vertices"][92].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][93] = [] +a["vertices"][93].append(-0.03841) +a["vertices"][93].append(0.006992) +a["vertices"][93].append(-0.007613) +a["vertices"].append([]) +a["vertices"][94] = [] +a["vertices"][94].append(0.025125) +a["vertices"][94].append(0.006805) +a["vertices"][94].append(0.011236) +a["vertices"].append([]) +a["vertices"][95] = [] +a["vertices"][95].append(0.024045) +a["vertices"][95].append(0.01279) +a["vertices"][95].append(0.009014) +a["vertices"].append([]) +a["vertices"][96] = [] +a["vertices"][96].append(0.029773) +a["vertices"][96].append(0.01653) +a["vertices"][96].append(0.001074) +a["vertices"].append([]) +a["vertices"][97] = [] +a["vertices"][97].append(0.027955) +a["vertices"][97].append(0.045797) +a["vertices"][97].append(-0.005292) +a["vertices"].append([]) +a["vertices"][98] = [] +a["vertices"][98].append(0.031524) +a["vertices"][98].append(0.042925) +a["vertices"][98].append(-0.011412) +a["vertices"].append([]) +a["vertices"][99] = [] +a["vertices"][99].append(-0.035758) +a["vertices"][99].append(0.009678) +a["vertices"][99].append(0.011655) +a["vertices"].append([]) +a["vertices"][100] = [] +a["vertices"][100].append(-0.032285) +a["vertices"][100].append(0.005584) +a["vertices"][100].append(0.015401) +a["vertices"].append([]) +a["vertices"][101] = [] +a["vertices"][101].append(-0.0548) +a["vertices"][101].append(0.009301) +a["vertices"][101].append(0.005409) +a["vertices"].append([]) +a["vertices"][102] = [] +a["vertices"][102].append(-0.054376) +a["vertices"][102].append(0.010917) +a["vertices"][102].append(3.8e-05) +a["vertices"].append([]) +a["vertices"][103] = [] +a["vertices"][103].append(-0.054886) +a["vertices"][103].append(0.00521) +a["vertices"][103].append(0.007674) +a["vertices"].append([]) +a["vertices"][104] = [] +a["vertices"][104].append(-0.053625) +a["vertices"][104].append(0.003801) +a["vertices"][104].append(0.008726) +a["vertices"].append([]) +a["vertices"][105] = [] +a["vertices"][105].append(-0.054911) +a["vertices"][105].append(7.1e-05) +a["vertices"][105].append(0.00768) +a["edges"] = [] +a["edges"].append([]) +a["edges"][0] = [] +a["edges"][0].append([]) +a["edges"][0][0] = [] +a["edges"][0][0].append(-0.01405) +a["edges"][0][0].append(-0.006476) +a["edges"][0][0].append(0.021234) +a["edges"][0].append([]) +a["edges"][0][1] = [] +a["edges"][0][1].append(-0.027911) +a["edges"][0][1].append(-0.006476) +a["edges"][0][1].append(0.015323) +a["edges"].append([]) +a["edges"][1] = [] +a["edges"][1].append([]) +a["edges"][1][0] = [] +a["edges"][1][0].append(-0.027911) +a["edges"][1][0].append(-0.006476) +a["edges"][1][0].append(0.015323) +a["edges"][1].append([]) +a["edges"][1][1] = [] +a["edges"][1][1].append(-0.035278) +a["edges"][1][1].append(-0.011043) +a["edges"][1][1].append(0.009523) +a["edges"].append([]) +a["edges"][2] = [] +a["edges"][2].append([]) +a["edges"][2][0] = [] +a["edges"][2][0].append(-0.035278) +a["edges"][2][0].append(-0.011043) +a["edges"][2][0].append(0.009523) +a["edges"][2].append([]) +a["edges"][2][1] = [] +a["edges"][2][1].append(-0.020774) +a["edges"][2][1].append(-0.01569) +a["edges"][2][1].append(0.013658) +a["edges"].append([]) +a["edges"][3] = [] +a["edges"][3].append([]) +a["edges"][3][0] = [] +a["edges"][3][0].append(-0.020774) +a["edges"][3][0].append(-0.01569) +a["edges"][3][0].append(0.013658) +a["edges"][3].append([]) +a["edges"][3][1] = [] +a["edges"][3][1].append(-0.01405) +a["edges"][3][1].append(-0.006476) +a["edges"][3][1].append(0.021234) +a["edges"].append([]) +a["edges"][4] = [] +a["edges"][4].append([]) +a["edges"][4][0] = [] +a["edges"][4][0].append(-0.0) +a["edges"][4][0].append(-0.052962) +a["edges"][4][0].append(-0.016081) +a["edges"][4].append([]) +a["edges"][4][1] = [] +a["edges"][4][1].append(0.031524) +a["edges"][4][1].append(-0.054037) +a["edges"][4][1].append(-0.016081) +a["edges"].append([]) +a["edges"][5] = [] +a["edges"][5].append([]) +a["edges"][5][0] = [] +a["edges"][5][0].append(0.031524) +a["edges"][5][0].append(-0.054037) +a["edges"][5][0].append(-0.016081) +a["edges"][5].append([]) +a["edges"][5][1] = [] +a["edges"][5][1].append(0.031524) +a["edges"][5][1].append(-0.055739) +a["edges"][5][1].append(-0.010646) +a["edges"].append([]) +a["edges"][6] = [] +a["edges"][6].append([]) +a["edges"][6][0] = [] +a["edges"][6][0].append(0.031524) +a["edges"][6][0].append(-0.055739) +a["edges"][6][0].append(-0.010646) +a["edges"][6].append([]) +a["edges"][6][1] = [] +a["edges"][6][1].append(-0.0) +a["edges"][6][1].append(-0.055076) +a["edges"][6][1].append(-0.010646) +a["edges"].append([]) +a["edges"][7] = [] +a["edges"][7].append([]) +a["edges"][7][0] = [] +a["edges"][7][0].append(-0.0) +a["edges"][7][0].append(-0.055076) +a["edges"][7][0].append(-0.010646) +a["edges"][7].append([]) +a["edges"][7][1] = [] +a["edges"][7][1].append(-0.0) +a["edges"][7][1].append(-0.052962) +a["edges"][7][1].append(-0.016081) +a["edges"].append([]) +a["edges"][8] = [] +a["edges"][8].append([]) +a["edges"][8][0] = [] +a["edges"][8][0].append(-0.0) +a["edges"][8][0].append(-0.052962) +a["edges"][8][0].append(-0.016081) +a["edges"][8].append([]) +a["edges"][8][1] = [] +a["edges"][8][1].append(-0.023431) +a["edges"][8][1].append(-0.051839) +a["edges"][8][1].append(-0.014165) +a["edges"].append([]) +a["edges"][9] = [] +a["edges"][9].append([]) +a["edges"][9][0] = [] +a["edges"][9][0].append(-0.023431) +a["edges"][9][0].append(-0.051839) +a["edges"][9][0].append(-0.014165) +a["edges"][9].append([]) +a["edges"][9][1] = [] +a["edges"][9][1].append(-0.024352) +a["edges"][9][1].append(-0.046838) +a["edges"][9][1].append(-0.014127) +a["edges"].append([]) +a["edges"][10] = [] +a["edges"][10].append([]) +a["edges"][10][0] = [] +a["edges"][10][0].append(-0.024352) +a["edges"][10][0].append(-0.046838) +a["edges"][10][0].append(-0.014127) +a["edges"][10].append([]) +a["edges"][10][1] = [] +a["edges"][10][1].append(-0.0) +a["edges"][10][1].append(-0.044808) +a["edges"][10][1].append(-0.01602) +a["edges"].append([]) +a["edges"][11] = [] +a["edges"][11].append([]) +a["edges"][11][0] = [] +a["edges"][11][0].append(-0.0) +a["edges"][11][0].append(-0.044808) +a["edges"][11][0].append(-0.01602) +a["edges"][11].append([]) +a["edges"][11][1] = [] +a["edges"][11][1].append(-0.0) +a["edges"][11][1].append(-0.052962) +a["edges"][11][1].append(-0.016081) +a["edges"].append([]) +a["edges"][12] = [] +a["edges"][12].append([]) +a["edges"][12][0] = [] +a["edges"][12][0].append(-0.020774) +a["edges"][12][0].append(7.1e-05) +a["edges"][12][0].append(-0.009933) +a["edges"][12].append([]) +a["edges"][12][1] = [] +a["edges"][12][1].append(0.025938) +a["edges"][12][1].append(7.1e-05) +a["edges"][12][1].append(-0.007337) +a["edges"].append([]) +a["edges"][13] = [] +a["edges"][13].append([]) +a["edges"][13][0] = [] +a["edges"][13][0].append(0.025938) +a["edges"][13][0].append(7.1e-05) +a["edges"][13][0].append(-0.007337) +a["edges"][13].append([]) +a["edges"][13][1] = [] +a["edges"][13][1].append(0.025753) +a["edges"][13][1].append(-0.00685) +a["edges"][13][1].append(-0.007189) +a["edges"].append([]) +a["edges"][14] = [] +a["edges"][14].append([]) +a["edges"][14][0] = [] +a["edges"][14][0].append(0.025753) +a["edges"][14][0].append(-0.00685) +a["edges"][14][0].append(-0.007189) +a["edges"][14].append([]) +a["edges"][14][1] = [] +a["edges"][14][1].append(-0.020774) +a["edges"][14][1].append(-0.00685) +a["edges"][14][1].append(-0.010018) +a["edges"].append([]) +a["edges"][15] = [] +a["edges"][15].append([]) +a["edges"][15][0] = [] +a["edges"][15][0].append(-0.020774) +a["edges"][15][0].append(-0.00685) +a["edges"][15][0].append(-0.010018) +a["edges"][15].append([]) +a["edges"][15][1] = [] +a["edges"][15][1].append(-0.020774) +a["edges"][15][1].append(7.1e-05) +a["edges"][15][1].append(-0.009933) +a["edges"].append([]) +a["edges"][16] = [] +a["edges"][16].append([]) +a["edges"][16][0] = [] +a["edges"][16][0].append(-0.020774) +a["edges"][16][0].append(7.1e-05) +a["edges"][16][0].append(-0.009933) +a["edges"][16].append([]) +a["edges"][16][1] = [] +a["edges"][16][1].append(-0.020774) +a["edges"][16][1].append(0.006992) +a["edges"][16][1].append(-0.010018) +a["edges"].append([]) +a["edges"][17] = [] +a["edges"][17].append([]) +a["edges"][17][0] = [] +a["edges"][17][0].append(-0.020774) +a["edges"][17][0].append(0.006992) +a["edges"][17][0].append(-0.010018) +a["edges"][17].append([]) +a["edges"][17][1] = [] +a["edges"][17][1].append(0.025753) +a["edges"][17][1].append(0.006992) +a["edges"][17][1].append(-0.007189) +a["edges"].append([]) +a["edges"][18] = [] +a["edges"][18].append([]) +a["edges"][18][0] = [] +a["edges"][18][0].append(0.025753) +a["edges"][18][0].append(0.006992) +a["edges"][18][0].append(-0.007189) +a["edges"][18].append([]) +a["edges"][18][1] = [] +a["edges"][18][1].append(0.025938) +a["edges"][18][1].append(7.1e-05) +a["edges"][18][1].append(-0.007337) +a["edges"].append([]) +a["edges"][19] = [] +a["edges"][19].append([]) +a["edges"][19][0] = [] +a["edges"][19][0].append(0.015456) +a["edges"][19][0].append(-0.006476) +a["edges"][19][0].append(0.020678) +a["edges"][19].append([]) +a["edges"][19][1] = [] +a["edges"][19][1].append(-0.01405) +a["edges"][19][1].append(-0.006476) +a["edges"][19][1].append(0.021234) +a["edges"].append([]) +a["edges"][20] = [] +a["edges"][20].append([]) +a["edges"][20][0] = [] +a["edges"][20][0].append(-0.020774) +a["edges"][20][0].append(-0.01569) +a["edges"][20][0].append(0.013658) +a["edges"][20].append([]) +a["edges"][20][1] = [] +a["edges"][20][1].append(0.013924) +a["edges"][20][1].append(-0.01569) +a["edges"][20][1].append(0.013658) +a["edges"].append([]) +a["edges"][21] = [] +a["edges"][21].append([]) +a["edges"][21][0] = [] +a["edges"][21][0].append(0.013924) +a["edges"][21][0].append(-0.01569) +a["edges"][21][0].append(0.013658) +a["edges"][21].append([]) +a["edges"][21][1] = [] +a["edges"][21][1].append(0.015456) +a["edges"][21][1].append(-0.006476) +a["edges"][21][1].append(0.020678) +a["edges"].append([]) +a["edges"][22] = [] +a["edges"][22].append([]) +a["edges"][22][0] = [] +a["edges"][22][0].append(-0.035278) +a["edges"][22][0].append(-0.011043) +a["edges"][22][0].append(0.009523) +a["edges"][22].append([]) +a["edges"][22][1] = [] +a["edges"][22][1].append(-0.038107) +a["edges"][22][1].append(-0.014583) +a["edges"][22][1].append(0.00438) +a["edges"].append([]) +a["edges"][23] = [] +a["edges"][23].append([]) +a["edges"][23][0] = [] +a["edges"][23][0].append(-0.038107) +a["edges"][23][0].append(-0.014583) +a["edges"][23][0].append(0.00438) +a["edges"][23].append([]) +a["edges"][23][1] = [] +a["edges"][23][1].append(-0.025345) +a["edges"][23][1].append(-0.021374) +a["edges"][23][1].append(0.003548) +a["edges"].append([]) +a["edges"][24] = [] +a["edges"][24].append([]) +a["edges"][24][0] = [] +a["edges"][24][0].append(-0.025345) +a["edges"][24][0].append(-0.021374) +a["edges"][24][0].append(0.003548) +a["edges"][24].append([]) +a["edges"][24][1] = [] +a["edges"][24][1].append(-0.020774) +a["edges"][24][1].append(-0.01569) +a["edges"][24][1].append(0.013658) +a["edges"].append([]) +a["edges"][25] = [] +a["edges"][25].append([]) +a["edges"][25][0] = [] +a["edges"][25][0].append(-0.025345) +a["edges"][25][0].append(-0.021374) +a["edges"][25][0].append(0.003548) +a["edges"][25].append([]) +a["edges"][25][1] = [] +a["edges"][25][1].append(-0.026982) +a["edges"][25][1].append(-0.021614) +a["edges"][25][1].append(3.8e-05) +a["edges"].append([]) +a["edges"][26] = [] +a["edges"][26].append([]) +a["edges"][26][0] = [] +a["edges"][26][0].append(-0.026982) +a["edges"][26][0].append(-0.021614) +a["edges"][26][0].append(3.8e-05) +a["edges"][26].append([]) +a["edges"][26][1] = [] +a["edges"][26][1].append(-0.0) +a["edges"][26][1].append(-0.040286) +a["edges"][26][1].append(-0.011412) +a["edges"].append([]) +a["edges"][27] = [] +a["edges"][27].append([]) +a["edges"][27][0] = [] +a["edges"][27][0].append(-0.0) +a["edges"][27][0].append(-0.040286) +a["edges"][27][0].append(-0.011412) +a["edges"][27].append([]) +a["edges"][27][1] = [] +a["edges"][27][1].append(-0.0) +a["edges"][27][1].append(-0.04201) +a["edges"][27][1].append(-0.005292) +a["edges"].append([]) +a["edges"][28] = [] +a["edges"][28].append([]) +a["edges"][28][0] = [] +a["edges"][28][0].append(-0.0) +a["edges"][28][0].append(-0.04201) +a["edges"][28][0].append(-0.005292) +a["edges"][28].append([]) +a["edges"][28][1] = [] +a["edges"][28][1].append(-0.025345) +a["edges"][28][1].append(-0.021374) +a["edges"][28][1].append(0.003548) +a["edges"].append([]) +a["edges"][29] = [] +a["edges"][29].append([]) +a["edges"][29][0] = [] +a["edges"][29][0].append(-0.025345) +a["edges"][29][0].append(-0.021374) +a["edges"][29][0].append(0.003548) +a["edges"][29].append([]) +a["edges"][29][1] = [] +a["edges"][29][1].append(0.013924) +a["edges"][29][1].append(-0.022131) +a["edges"][29][1].append(0.003548) +a["edges"].append([]) +a["edges"][30] = [] +a["edges"][30].append([]) +a["edges"][30][0] = [] +a["edges"][30][0].append(0.013924) +a["edges"][30][0].append(-0.022131) +a["edges"][30][0].append(0.003548) +a["edges"][30].append([]) +a["edges"][30][1] = [] +a["edges"][30][1].append(0.013924) +a["edges"][30][1].append(-0.01569) +a["edges"][30][1].append(0.013658) +a["edges"].append([]) +a["edges"][31] = [] +a["edges"][31].append([]) +a["edges"][31][0] = [] +a["edges"][31][0].append(-0.038107) +a["edges"][31][0].append(-0.014583) +a["edges"][31][0].append(0.00438) +a["edges"][31].append([]) +a["edges"][31][1] = [] +a["edges"][31][1].append(-0.039006) +a["edges"][31][1].append(-0.016195) +a["edges"][31][1].append(3.8e-05) +a["edges"].append([]) +a["edges"][32] = [] +a["edges"][32].append([]) +a["edges"][32][0] = [] +a["edges"][32][0].append(-0.039006) +a["edges"][32][0].append(-0.016195) +a["edges"][32][0].append(3.8e-05) +a["edges"][32].append([]) +a["edges"][32][1] = [] +a["edges"][32][1].append(-0.026982) +a["edges"][32][1].append(-0.021614) +a["edges"][32][1].append(3.8e-05) +a["edges"].append([]) +a["edges"][33] = [] +a["edges"][33].append([]) +a["edges"][33][0] = [] +a["edges"][33][0].append(-0.0) +a["edges"][33][0].append(-0.04201) +a["edges"][33][0].append(-0.005292) +a["edges"][33].append([]) +a["edges"][33][1] = [] +a["edges"][33][1].append(0.016622) +a["edges"][33][1].append(-0.043511) +a["edges"][33][1].append(-0.005203) +a["edges"].append([]) +a["edges"][34] = [] +a["edges"][34].append([]) +a["edges"][34][0] = [] +a["edges"][34][0].append(0.016622) +a["edges"][34][0].append(-0.043511) +a["edges"][34][0].append(-0.005203) +a["edges"][34].append([]) +a["edges"][34][1] = [] +a["edges"][34][1].append(0.013924) +a["edges"][34][1].append(-0.022131) +a["edges"][34][1].append(0.003548) +a["edges"].append([]) +a["edges"][35] = [] +a["edges"][35].append([]) +a["edges"][35][0] = [] +a["edges"][35][0].append(-0.0) +a["edges"][35][0].append(-0.05115) +a["edges"][35][0].append(-0.005152) +a["edges"][35].append([]) +a["edges"][35][1] = [] +a["edges"][35][1].append(-0.023636) +a["edges"][35][1].append(-0.050728) +a["edges"][35][1].append(-0.00735) +a["edges"].append([]) +a["edges"][36] = [] +a["edges"][36].append([]) +a["edges"][36][0] = [] +a["edges"][36][0].append(-0.023636) +a["edges"][36][0].append(-0.050728) +a["edges"][36][0].append(-0.00735) +a["edges"][36].append([]) +a["edges"][36][1] = [] +a["edges"][36][1].append(-0.025947) +a["edges"][36][1].append(-0.053136) +a["edges"][36][1].append(-0.011293) +a["edges"].append([]) +a["edges"][37] = [] +a["edges"][37].append([]) +a["edges"][37][0] = [] +a["edges"][37][0].append(-0.025947) +a["edges"][37][0].append(-0.053136) +a["edges"][37][0].append(-0.011293) +a["edges"][37].append([]) +a["edges"][37][1] = [] +a["edges"][37][1].append(-0.0) +a["edges"][37][1].append(-0.055076) +a["edges"][37][1].append(-0.010646) +a["edges"].append([]) +a["edges"][38] = [] +a["edges"][38].append([]) +a["edges"][38][0] = [] +a["edges"][38][0].append(-0.0) +a["edges"][38][0].append(-0.055076) +a["edges"][38][0].append(-0.010646) +a["edges"][38].append([]) +a["edges"][38][1] = [] +a["edges"][38][1].append(-0.0) +a["edges"][38][1].append(-0.05115) +a["edges"][38][1].append(-0.005152) +a["edges"].append([]) +a["edges"][39] = [] +a["edges"][39].append([]) +a["edges"][39][0] = [] +a["edges"][39][0].append(0.031524) +a["edges"][39][0].append(-0.055739) +a["edges"][39][0].append(-0.010646) +a["edges"][39].append([]) +a["edges"][39][1] = [] +a["edges"][39][1].append(0.027955) +a["edges"][39][1].append(-0.052163) +a["edges"][39][1].append(-0.005152) +a["edges"].append([]) +a["edges"][40] = [] +a["edges"][40].append([]) +a["edges"][40][0] = [] +a["edges"][40][0].append(0.027955) +a["edges"][40][0].append(-0.052163) +a["edges"][40][0].append(-0.005152) +a["edges"][40].append([]) +a["edges"][40][1] = [] +a["edges"][40][1].append(-0.0) +a["edges"][40][1].append(-0.05115) +a["edges"][40][1].append(-0.005152) +a["edges"].append([]) +a["edges"][41] = [] +a["edges"][41].append([]) +a["edges"][41][0] = [] +a["edges"][41][0].append(-0.025947) +a["edges"][41][0].append(-0.053136) +a["edges"][41][0].append(-0.011293) +a["edges"][41].append([]) +a["edges"][41][1] = [] +a["edges"][41][1].append(-0.023431) +a["edges"][41][1].append(-0.051839) +a["edges"][41][1].append(-0.014165) +a["edges"].append([]) +a["edges"][42] = [] +a["edges"][42].append([]) +a["edges"][42][0] = [] +a["edges"][42][0].append(-0.0) +a["edges"][42][0].append(-0.044808) +a["edges"][42][0].append(-0.01602) +a["edges"][42].append([]) +a["edges"][42][1] = [] +a["edges"][42][1].append(0.031524) +a["edges"][42][1].append(-0.046893) +a["edges"][42][1].append(-0.01602) +a["edges"].append([]) +a["edges"][43] = [] +a["edges"][43].append([]) +a["edges"][43][0] = [] +a["edges"][43][0].append(0.031524) +a["edges"][43][0].append(-0.046893) +a["edges"][43][0].append(-0.01602) +a["edges"][43].append([]) +a["edges"][43][1] = [] +a["edges"][43][1].append(0.031524) +a["edges"][43][1].append(-0.054037) +a["edges"][43][1].append(-0.016081) +a["edges"].append([]) +a["edges"][44] = [] +a["edges"][44].append([]) +a["edges"][44][0] = [] +a["edges"][44][0].append(-0.0) +a["edges"][44][0].append(-0.040286) +a["edges"][44][0].append(-0.011412) +a["edges"][44].append([]) +a["edges"][44][1] = [] +a["edges"][44][1].append(-0.027619) +a["edges"][44][1].append(-0.044065) +a["edges"][44][1].append(-0.011254) +a["edges"].append([]) +a["edges"][45] = [] +a["edges"][45].append([]) +a["edges"][45][0] = [] +a["edges"][45][0].append(-0.027619) +a["edges"][45][0].append(-0.044065) +a["edges"][45][0].append(-0.011254) +a["edges"][45].append([]) +a["edges"][45][1] = [] +a["edges"][45][1].append(-0.024669) +a["edges"][45][1].append(-0.045122) +a["edges"][45][1].append(-0.007437) +a["edges"].append([]) +a["edges"][46] = [] +a["edges"][46].append([]) +a["edges"][46][0] = [] +a["edges"][46][0].append(-0.024669) +a["edges"][46][0].append(-0.045122) +a["edges"][46][0].append(-0.007437) +a["edges"][46].append([]) +a["edges"][46][1] = [] +a["edges"][46][1].append(-0.0) +a["edges"][46][1].append(-0.04201) +a["edges"][46][1].append(-0.005292) +a["edges"].append([]) +a["edges"][47] = [] +a["edges"][47].append([]) +a["edges"][47][0] = [] +a["edges"][47][0].append(-0.026982) +a["edges"][47][0].append(-0.021614) +a["edges"][47][0].append(3.8e-05) +a["edges"][47].append([]) +a["edges"][47][1] = [] +a["edges"][47][1].append(0.019232) +a["edges"][47][1].append(-0.012933) +a["edges"][47][1].append(-0.005823) +a["edges"].append([]) +a["edges"][48] = [] +a["edges"][48].append([]) +a["edges"][48][0] = [] +a["edges"][48][0].append(0.019232) +a["edges"][48][0].append(-0.012933) +a["edges"][48][0].append(-0.005823) +a["edges"][48].append([]) +a["edges"][48][1] = [] +a["edges"][48][1].append(0.021852) +a["edges"][48][1].append(-0.041362) +a["edges"][48][1].append(-0.011338) +a["edges"].append([]) +a["edges"][49] = [] +a["edges"][49].append([]) +a["edges"][49][0] = [] +a["edges"][49][0].append(0.021852) +a["edges"][49][0].append(-0.041362) +a["edges"][49][0].append(-0.011338) +a["edges"][49].append([]) +a["edges"][49][1] = [] +a["edges"][49][1].append(-0.0) +a["edges"][49][1].append(-0.040286) +a["edges"][49][1].append(-0.011412) +a["edges"].append([]) +a["edges"][50] = [] +a["edges"][50].append([]) +a["edges"][50][0] = [] +a["edges"][50][0].append(-0.039006) +a["edges"][50][0].append(-0.016195) +a["edges"][50][0].append(3.8e-05) +a["edges"][50].append([]) +a["edges"][50][1] = [] +a["edges"][50][1].append(-0.03841) +a["edges"][50][1].append(-0.00685) +a["edges"][50][1].append(-0.007613) +a["edges"].append([]) +a["edges"][51] = [] +a["edges"][51].append([]) +a["edges"][51][0] = [] +a["edges"][51][0].append(-0.03841) +a["edges"][51][0].append(-0.00685) +a["edges"][51][0].append(-0.007613) +a["edges"][51].append([]) +a["edges"][51][1] = [] +a["edges"][51][1].append(-0.020774) +a["edges"][51][1].append(-0.00685) +a["edges"][51][1].append(-0.010018) +a["edges"].append([]) +a["edges"][52] = [] +a["edges"][52].append([]) +a["edges"][52][0] = [] +a["edges"][52][0].append(-0.020774) +a["edges"][52][0].append(-0.00685) +a["edges"][52][0].append(-0.010018) +a["edges"][52].append([]) +a["edges"][52][1] = [] +a["edges"][52][1].append(-0.026982) +a["edges"][52][1].append(-0.021614) +a["edges"][52][1].append(3.8e-05) +a["edges"].append([]) +a["edges"][53] = [] +a["edges"][53].append([]) +a["edges"][53][0] = [] +a["edges"][53][0].append(0.025753) +a["edges"][53][0].append(-0.00685) +a["edges"][53][0].append(-0.007189) +a["edges"][53].append([]) +a["edges"][53][1] = [] +a["edges"][53][1].append(0.019232) +a["edges"][53][1].append(-0.012933) +a["edges"][53][1].append(-0.005823) +a["edges"].append([]) +a["edges"][54] = [] +a["edges"][54].append([]) +a["edges"][54][0] = [] +a["edges"][54][0].append(0.013924) +a["edges"][54][0].append(-0.01569) +a["edges"][54][0].append(0.013658) +a["edges"][54].append([]) +a["edges"][54][1] = [] +a["edges"][54][1].append(0.024045) +a["edges"][54][1].append(-0.012648) +a["edges"][54][1].append(0.009014) +a["edges"].append([]) +a["edges"][55] = [] +a["edges"][55].append([]) +a["edges"][55][0] = [] +a["edges"][55][0].append(0.024045) +a["edges"][55][0].append(-0.012648) +a["edges"][55][0].append(0.009014) +a["edges"][55].append([]) +a["edges"][55][1] = [] +a["edges"][55][1].append(0.025125) +a["edges"][55][1].append(-0.006663) +a["edges"][55][1].append(0.011236) +a["edges"].append([]) +a["edges"][56] = [] +a["edges"][56].append([]) +a["edges"][56][0] = [] +a["edges"][56][0].append(0.025125) +a["edges"][56][0].append(-0.006663) +a["edges"][56][0].append(0.011236) +a["edges"][56].append([]) +a["edges"][56][1] = [] +a["edges"][56][1].append(0.015456) +a["edges"][56][1].append(-0.006476) +a["edges"][56][1].append(0.020678) +a["edges"].append([]) +a["edges"][57] = [] +a["edges"][57].append([]) +a["edges"][57][0] = [] +a["edges"][57][0].append(0.013924) +a["edges"][57][0].append(-0.022131) +a["edges"][57][0].append(0.003548) +a["edges"][57].append([]) +a["edges"][57][1] = [] +a["edges"][57][1].append(0.029773) +a["edges"][57][1].append(-0.016388) +a["edges"][57][1].append(0.001074) +a["edges"].append([]) +a["edges"][58] = [] +a["edges"][58].append([]) +a["edges"][58][0] = [] +a["edges"][58][0].append(0.029773) +a["edges"][58][0].append(-0.016388) +a["edges"][58][0].append(0.001074) +a["edges"][58].append([]) +a["edges"][58][1] = [] +a["edges"][58][1].append(0.024045) +a["edges"][58][1].append(-0.012648) +a["edges"][58][1].append(0.009014) +a["edges"].append([]) +a["edges"][59] = [] +a["edges"][59].append([]) +a["edges"][59][0] = [] +a["edges"][59][0].append(0.031524) +a["edges"][59][0].append(-0.055739) +a["edges"][59][0].append(-0.010646) +a["edges"][59].append([]) +a["edges"][59][1] = [] +a["edges"][59][1].append(0.031524) +a["edges"][59][1].append(-0.042783) +a["edges"][59][1].append(-0.011412) +a["edges"].append([]) +a["edges"][60] = [] +a["edges"][60].append([]) +a["edges"][60][0] = [] +a["edges"][60][0].append(0.031524) +a["edges"][60][0].append(-0.042783) +a["edges"][60][0].append(-0.011412) +a["edges"][60].append([]) +a["edges"][60][1] = [] +a["edges"][60][1].append(0.027955) +a["edges"][60][1].append(-0.045655) +a["edges"][60][1].append(-0.005292) +a["edges"].append([]) +a["edges"][61] = [] +a["edges"][61].append([]) +a["edges"][61][0] = [] +a["edges"][61][0].append(0.027955) +a["edges"][61][0].append(-0.045655) +a["edges"][61][0].append(-0.005292) +a["edges"][61].append([]) +a["edges"][61][1] = [] +a["edges"][61][1].append(0.027955) +a["edges"][61][1].append(-0.052163) +a["edges"][61][1].append(-0.005152) +a["edges"].append([]) +a["edges"][62] = [] +a["edges"][62].append([]) +a["edges"][62][0] = [] +a["edges"][62][0].append(0.031524) +a["edges"][62][0].append(-0.046893) +a["edges"][62][0].append(-0.01602) +a["edges"][62].append([]) +a["edges"][62][1] = [] +a["edges"][62][1].append(0.031524) +a["edges"][62][1].append(-0.042783) +a["edges"][62][1].append(-0.011412) +a["edges"].append([]) +a["edges"][63] = [] +a["edges"][63].append([]) +a["edges"][63][0] = [] +a["edges"][63][0].append(0.031524) +a["edges"][63][0].append(-0.042783) +a["edges"][63][0].append(-0.011412) +a["edges"][63].append([]) +a["edges"][63][1] = [] +a["edges"][63][1].append(0.021852) +a["edges"][63][1].append(-0.041362) +a["edges"][63][1].append(-0.011338) +a["edges"].append([]) +a["edges"][64] = [] +a["edges"][64].append([]) +a["edges"][64][0] = [] +a["edges"][64][0].append(0.021852) +a["edges"][64][0].append(-0.041362) +a["edges"][64][0].append(-0.011338) +a["edges"][64].append([]) +a["edges"][64][1] = [] +a["edges"][64][1].append(0.016622) +a["edges"][64][1].append(-0.043511) +a["edges"][64][1].append(-0.005203) +a["edges"].append([]) +a["edges"][65] = [] +a["edges"][65].append([]) +a["edges"][65][0] = [] +a["edges"][65][0].append(0.016622) +a["edges"][65][0].append(-0.043511) +a["edges"][65][0].append(-0.005203) +a["edges"][65].append([]) +a["edges"][65][1] = [] +a["edges"][65][1].append(0.027955) +a["edges"][65][1].append(-0.045655) +a["edges"][65][1].append(-0.005292) +a["edges"].append([]) +a["edges"][66] = [] +a["edges"][66].append([]) +a["edges"][66][0] = [] +a["edges"][66][0].append(0.025938) +a["edges"][66][0].append(7.1e-05) +a["edges"][66][0].append(-0.007337) +a["edges"][66].append([]) +a["edges"][66][1] = [] +a["edges"][66][1].append(0.033927) +a["edges"][66][1].append(7.1e-05) +a["edges"][66][1].append(0.002309) +a["edges"].append([]) +a["edges"][67] = [] +a["edges"][67].append([]) +a["edges"][67][0] = [] +a["edges"][67][0].append(0.033927) +a["edges"][67][0].append(7.1e-05) +a["edges"][67][0].append(0.002309) +a["edges"][67].append([]) +a["edges"][67][1] = [] +a["edges"][67][1].append(0.033734) +a["edges"][67][1].append(-0.006808) +a["edges"][67][1].append(0.002445) +a["edges"].append([]) +a["edges"][68] = [] +a["edges"][68].append([]) +a["edges"][68][0] = [] +a["edges"][68][0].append(0.033734) +a["edges"][68][0].append(-0.006808) +a["edges"][68][0].append(0.002445) +a["edges"][68].append([]) +a["edges"][68][1] = [] +a["edges"][68][1].append(0.025753) +a["edges"][68][1].append(-0.00685) +a["edges"][68][1].append(-0.007189) +a["edges"].append([]) +a["edges"][69] = [] +a["edges"][69].append([]) +a["edges"][69][0] = [] +a["edges"][69][0].append(0.025753) +a["edges"][69][0].append(0.006992) +a["edges"][69][0].append(-0.007189) +a["edges"][69].append([]) +a["edges"][69][1] = [] +a["edges"][69][1].append(0.033734) +a["edges"][69][1].append(0.006949) +a["edges"][69][1].append(0.002445) +a["edges"].append([]) +a["edges"][70] = [] +a["edges"][70].append([]) +a["edges"][70][0] = [] +a["edges"][70][0].append(0.033734) +a["edges"][70][0].append(0.006949) +a["edges"][70][0].append(0.002445) +a["edges"][70].append([]) +a["edges"][70][1] = [] +a["edges"][70][1].append(0.033927) +a["edges"][70][1].append(7.1e-05) +a["edges"][70][1].append(0.002309) +a["edges"].append([]) +a["edges"][71] = [] +a["edges"][71].append([]) +a["edges"][71][0] = [] +a["edges"][71][0].append(-0.023636) +a["edges"][71][0].append(-0.050728) +a["edges"][71][0].append(-0.00735) +a["edges"][71].append([]) +a["edges"][71][1] = [] +a["edges"][71][1].append(-0.024669) +a["edges"][71][1].append(-0.045122) +a["edges"][71][1].append(-0.007437) +a["edges"].append([]) +a["edges"][72] = [] +a["edges"][72].append([]) +a["edges"][72][0] = [] +a["edges"][72][0].append(-0.027619) +a["edges"][72][0].append(-0.044065) +a["edges"][72][0].append(-0.011254) +a["edges"][72].append([]) +a["edges"][72][1] = [] +a["edges"][72][1].append(-0.025947) +a["edges"][72][1].append(-0.053136) +a["edges"][72][1].append(-0.011293) +a["edges"].append([]) +a["edges"][73] = [] +a["edges"][73].append([]) +a["edges"][73][0] = [] +a["edges"][73][0].append(-0.027619) +a["edges"][73][0].append(-0.044065) +a["edges"][73][0].append(-0.011254) +a["edges"][73].append([]) +a["edges"][73][1] = [] +a["edges"][73][1].append(-0.024352) +a["edges"][73][1].append(-0.046838) +a["edges"][73][1].append(-0.014127) +a["edges"].append([]) +a["edges"][74] = [] +a["edges"][74].append([]) +a["edges"][74][0] = [] +a["edges"][74][0].append(0.019232) +a["edges"][74][0].append(-0.012933) +a["edges"][74][0].append(-0.005823) +a["edges"][74].append([]) +a["edges"][74][1] = [] +a["edges"][74][1].append(0.013924) +a["edges"][74][1].append(-0.022131) +a["edges"][74][1].append(0.003548) +a["edges"].append([]) +a["edges"][75] = [] +a["edges"][75].append([]) +a["edges"][75][0] = [] +a["edges"][75][0].append(0.033734) +a["edges"][75][0].append(-0.006808) +a["edges"][75][0].append(0.002445) +a["edges"][75].append([]) +a["edges"][75][1] = [] +a["edges"][75][1].append(0.029773) +a["edges"][75][1].append(-0.016388) +a["edges"][75][1].append(0.001074) +a["edges"].append([]) +a["edges"][76] = [] +a["edges"][76].append([]) +a["edges"][76][0] = [] +a["edges"][76][0].append(0.029773) +a["edges"][76][0].append(-0.016388) +a["edges"][76][0].append(0.001074) +a["edges"][76].append([]) +a["edges"][76][1] = [] +a["edges"][76][1].append(0.019232) +a["edges"][76][1].append(-0.012933) +a["edges"][76][1].append(-0.005823) +a["edges"].append([]) +a["edges"][77] = [] +a["edges"][77].append([]) +a["edges"][77][0] = [] +a["edges"][77][0].append(0.033734) +a["edges"][77][0].append(-0.006808) +a["edges"][77][0].append(0.002445) +a["edges"][77].append([]) +a["edges"][77][1] = [] +a["edges"][77][1].append(0.025125) +a["edges"][77][1].append(-0.006663) +a["edges"][77][1].append(0.011236) +a["edges"].append([]) +a["edges"][78] = [] +a["edges"][78].append([]) +a["edges"][78][0] = [] +a["edges"][78][0].append(-0.035278) +a["edges"][78][0].append(-0.011043) +a["edges"][78][0].append(0.009523) +a["edges"][78].append([]) +a["edges"][78][1] = [] +a["edges"][78][1].append(-0.035758) +a["edges"][78][1].append(-0.009536) +a["edges"][78][1].append(0.011655) +a["edges"].append([]) +a["edges"][79] = [] +a["edges"][79].append([]) +a["edges"][79][0] = [] +a["edges"][79][0].append(-0.035758) +a["edges"][79][0].append(-0.009536) +a["edges"][79][0].append(0.011655) +a["edges"][79].append([]) +a["edges"][79][1] = [] +a["edges"][79][1].append(-0.053625) +a["edges"][79][1].append(-0.003659) +a["edges"][79][1].append(0.008726) +a["edges"].append([]) +a["edges"][80] = [] +a["edges"][80].append([]) +a["edges"][80][0] = [] +a["edges"][80][0].append(-0.053625) +a["edges"][80][0].append(-0.003659) +a["edges"][80][0].append(0.008726) +a["edges"][80].append([]) +a["edges"][80][1] = [] +a["edges"][80][1].append(-0.054886) +a["edges"][80][1].append(-0.005068) +a["edges"][80][1].append(0.007674) +a["edges"].append([]) +a["edges"][81] = [] +a["edges"][81].append([]) +a["edges"][81][0] = [] +a["edges"][81][0].append(-0.054886) +a["edges"][81][0].append(-0.005068) +a["edges"][81][0].append(0.007674) +a["edges"][81].append([]) +a["edges"][81][1] = [] +a["edges"][81][1].append(-0.035278) +a["edges"][81][1].append(-0.011043) +a["edges"][81][1].append(0.009523) +a["edges"].append([]) +a["edges"][82] = [] +a["edges"][82].append([]) +a["edges"][82][0] = [] +a["edges"][82][0].append(-0.027911) +a["edges"][82][0].append(-0.006476) +a["edges"][82][0].append(0.015323) +a["edges"][82].append([]) +a["edges"][82][1] = [] +a["edges"][82][1].append(-0.032285) +a["edges"][82][1].append(-0.005442) +a["edges"][82][1].append(0.015401) +a["edges"].append([]) +a["edges"][83] = [] +a["edges"][83].append([]) +a["edges"][83][0] = [] +a["edges"][83][0].append(-0.032285) +a["edges"][83][0].append(-0.005442) +a["edges"][83][0].append(0.015401) +a["edges"][83].append([]) +a["edges"][83][1] = [] +a["edges"][83][1].append(-0.035758) +a["edges"][83][1].append(-0.009536) +a["edges"][83][1].append(0.011655) +a["edges"].append([]) +a["edges"][84] = [] +a["edges"][84].append([]) +a["edges"][84][0] = [] +a["edges"][84][0].append(-0.056047) +a["edges"][84][0].append(-0.00685) +a["edges"][84][0].append(-0.005209) +a["edges"][84].append([]) +a["edges"][84][1] = [] +a["edges"][84][1].append(-0.03841) +a["edges"][84][1].append(-0.00685) +a["edges"][84][1].append(-0.007613) +a["edges"].append([]) +a["edges"][85] = [] +a["edges"][85].append([]) +a["edges"][85][0] = [] +a["edges"][85][0].append(-0.039006) +a["edges"][85][0].append(-0.016195) +a["edges"][85][0].append(3.8e-05) +a["edges"][85].append([]) +a["edges"][85][1] = [] +a["edges"][85][1].append(-0.054376) +a["edges"][85][1].append(-0.010775) +a["edges"][85][1].append(3.8e-05) +a["edges"].append([]) +a["edges"][86] = [] +a["edges"][86].append([]) +a["edges"][86][0] = [] +a["edges"][86][0].append(-0.054376) +a["edges"][86][0].append(-0.010775) +a["edges"][86][0].append(3.8e-05) +a["edges"][86].append([]) +a["edges"][86][1] = [] +a["edges"][86][1].append(-0.056047) +a["edges"][86][1].append(-0.00685) +a["edges"][86][1].append(-0.005209) +a["edges"].append([]) +a["edges"][87] = [] +a["edges"][87].append([]) +a["edges"][87][0] = [] +a["edges"][87][0].append(-0.056047) +a["edges"][87][0].append(-0.00685) +a["edges"][87][0].append(-0.005209) +a["edges"][87].append([]) +a["edges"][87][1] = [] +a["edges"][87][1].append(-0.073569) +a["edges"][87][1].append(-0.002459) +a["edges"][87][1].append(-0.001718) +a["edges"].append([]) +a["edges"][88] = [] +a["edges"][88].append([]) +a["edges"][88][0] = [] +a["edges"][88][0].append(-0.073569) +a["edges"][88][0].append(-0.002459) +a["edges"][88][0].append(-0.001718) +a["edges"][88].append([]) +a["edges"][88][1] = [] +a["edges"][88][1].append(-0.073512) +a["edges"][88][1].append(7.1e-05) +a["edges"][88][1].append(-0.002222) +a["edges"].append([]) +a["edges"][89] = [] +a["edges"][89].append([]) +a["edges"][89][0] = [] +a["edges"][89][0].append(-0.073512) +a["edges"][89][0].append(7.1e-05) +a["edges"][89][0].append(-0.002222) +a["edges"][89].append([]) +a["edges"][89][1] = [] +a["edges"][89][1].append(-0.05633) +a["edges"][89][1].append(7.1e-05) +a["edges"][89][1].append(-0.005284) +a["edges"].append([]) +a["edges"][90] = [] +a["edges"][90].append([]) +a["edges"][90][0] = [] +a["edges"][90][0].append(-0.05633) +a["edges"][90][0].append(7.1e-05) +a["edges"][90][0].append(-0.005284) +a["edges"][90].append([]) +a["edges"][90][1] = [] +a["edges"][90][1].append(-0.056047) +a["edges"][90][1].append(-0.00685) +a["edges"][90][1].append(-0.005209) +a["edges"].append([]) +a["edges"][91] = [] +a["edges"][91].append([]) +a["edges"][91][0] = [] +a["edges"][91][0].append(-0.... [truncated message content] |
From: <Ult...@us...> - 2009-03-15 07:35:31
|
Revision: 1102 http://opengate.svn.sourceforge.net/opengate/?rev=1102&view=rev Author: Ultrasick Date: 2009-03-15 07:35:30 +0000 (Sun, 15 Mar 2009) Log Message: ----------- oops, removing debug code Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-15 07:34:21 UTC (rev 1101) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-15 07:35:30 UTC (rev 1102) @@ -204,7 +204,7 @@ texture_category = texture[0] texture_name = texture[1] - for i, plane in enumerate(self.planes): + for plane in self.planes: # define a safety factor (otherwise some pixels stay transparent) safety_factor = 1.5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |