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-15 07:34:27
|
Revision: 1101 http://opengate.svn.sourceforge.net/opengate/?rev=1101&view=rev Author: Ultrasick Date: 2009-03-15 07:34:21 +0000 (Sun, 15 Mar 2009) Log Message: ----------- fixed a bug 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-14 20:21:06 UTC (rev 1100) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-15 07:34:21 UTC (rev 1101) @@ -30,8 +30,6 @@ # compensate rounding errors if fraction_value>1: fraction_value = 1 - elif fraction_value<0: - fraction_value = 0 return acos(fraction_value) @@ -203,10 +201,10 @@ def draw_texture(self, texture): texture = texture.split(' - ') - texture_group = texture[0] + texture_category = texture[0] texture_name = texture[1] - for plane in self.planes: + for i, plane in enumerate(self.planes): # define a safety factor (otherwise some pixels stay transparent) safety_factor = 1.5 @@ -218,10 +216,13 @@ # get the relative x coordinate x_relative = x_pixel_number/x_end - for y_pixel_number in range(0, y_end * (1 - x_relative) + 10): + for y_pixel_number in range(0, y_end): # get the relative y coordinate - y_relative = y_pixel_number/y_end + 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 = [] @@ -241,18 +242,14 @@ x, y = self.center_position(x, y) # draw the pixel - self.drawing_area.draw_point(textures[texture_group][texture_name].get_color(absolute), x, y) + self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute), x, y) def get_border(self): # define arrays for the coordinates self.border_x = [] self.border_y = [] - # store the x- and y-coordinate of the offset - self.border_x.append(0) - self.border_y.append(0) - - for vertice in self.face['vertices'][1:]: + for vertice in self.face['vertices']: # get the relative position x, y = self.get_relative_position(vertice) @@ -296,6 +293,9 @@ self.planes.append(plane) def get_relative_position(self, vertice): + if vertice==self.offset: + return (0, 0) + # get the vector vector = screen.geometry.get_vector(self.offset, vertice) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 20:21:10
|
Revision: 1100 http://opengate.svn.sourceforge.net/opengate/?rev=1100&view=rev Author: Ultrasick Date: 2009-03-14 20:21:06 +0000 (Sat, 14 Mar 2009) Log Message: ----------- simplifying 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-14 20:08:08 UTC (rev 1099) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 20:21:06 UTC (rev 1100) @@ -168,17 +168,7 @@ # get the offset self.offset = self.face['vertices'][0] - # get the angle between the offset and the base line - angle = screen.geometry.get_angle(self.base_line, self.offset) - - # get the length of the offset - length = screen.geometry.get_distance(self.offset) - - # calculate the x- and y-coordinate of the offset - self.offset_x = cos(angle) * length - self.offset_y = sin(angle) * length - - # create the border + # get the border self.get_border() # get the triangles @@ -241,8 +231,8 @@ absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) if absolute==self.offset: - x = self.offset_x * 100 * resolution_texture_map - y = self.offset_y * 100 * resolution_texture_map + x = 0 + y = 0 else: # get the relative position on the drawing area x, y = self.get_relative_position(absolute) @@ -258,9 +248,9 @@ self.border_x = [] self.border_y = [] - # store the x- and y-coordinate - self.border_x.append(self.offset_x * 100 * resolution_texture_map) - self.border_y.append(self.offset_y * 100 * resolution_texture_map) + # store the x- and y-coordinate of the offset + self.border_x.append(0) + self.border_y.append(0) for vertice in self.face['vertices'][1:]: # get the relative position @@ -319,10 +309,6 @@ vector_x = cos(angle) * length vector_y = sin(angle) * length - # add the x and y-coordinate of the offset - vector_x += self.offset_x - vector_y += self.offset_y - # 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 20:08:09
|
Revision: 1099 http://opengate.svn.sourceforge.net/opengate/?rev=1099&view=rev Author: Ultrasick Date: 2009-03-14 20:08:08 +0000 (Sat, 14 Mar 2009) Log Message: ----------- renaming/simplifying some functions 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-14 20:00:54 UTC (rev 1098) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 20:08:08 UTC (rev 1099) @@ -179,11 +179,14 @@ self.offset_y = sin(angle) * length # create the border - self.create_border() + self.get_border() - # create the triangles - self.create_triangles() + # get the triangles + self.triangles = screen.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() @@ -194,9 +197,20 @@ else: # insert the textures for texture in self.face['textures']: - self.insert_texture(texture) + self.draw_texture(texture) - def insert_texture(self, 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_group = texture[0] @@ -239,7 +253,7 @@ # draw the pixel self.drawing_area.draw_point(textures[texture_group][texture_name].get_color(absolute), x, y) - def create_border(self): + def get_border(self): # define arrays for the coordinates self.border_x = [] self.border_y = [] @@ -272,31 +286,12 @@ self.y_center /= 2 self.y_center -= min(self.border_y) - 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 create_triangles(self): - # get the triangles - try: - model['faces'][window.face_number]['triangles'] - except: - model['faces'][window.face_number]['triangles'] = screen.geometry.get_triangles(self.face['vertices']) - - triangles = model['faces'][window.face_number]['triangles'] - + def get_planes(self): # create an array for the planes of the triangles self.planes = [] # define planes for the triangles - for triangle in triangles: + for triangle in self.triangles: # get the offset offset = triangle[0] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 20:00:59
|
Revision: 1098 http://opengate.svn.sourceforge.net/opengate/?rev=1098&view=rev Author: Ultrasick Date: 2009-03-14 20:00:54 +0000 (Sat, 14 Mar 2009) Log Message: ----------- removing background processes, now everything is done directly 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/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/frames/view_the_model.py Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/ Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-14 17:47:09 UTC (rev 1097) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-14 20:00:54 UTC (rev 1098) @@ -17,53 +17,6 @@ #import urllib from warnings import simplefilter as ignore_warnings -class background_processes: - def __init__(self): - # create an array for the background processes - self.processes = [] - - # store none run id - self.run_id = none - - def add(self, caption, function, function_parameter1 = none, function_parameter2 = none): - # add process to the queue - self.processes.append({'caption' : caption, 'function' : function, 'function_parameter1' : function_parameter1, 'function_parameter2' : function_parameter2}) - - if self.run_id==none: - # add the run function to the idle functions - self.run_id = gobject.idle_add(self.run) - - def run(self): - if len(self.processes)>0: - process = self.processes.pop(0) - else: - self.run_id = none - - return false - - # set caption - window.status_bar.set_text(process['caption'] + ' ...') - - # update the GUI - update_ui() - - if process['function_parameter2']!=none: - # run the function - process['function'](process['function_parameter1'], process['function_parameter2']) - elif process['function_parameter1']!=none: - # run the function - process['function'](process['function_parameter1']) - else: - # run the function - process['function']() - - # reset the status bar - window.status_bar.set_text('(there is no background process running)') - - return true - -background_processes = background_processes() - ignore_warnings('ignore', DeprecationWarning) def isfloat(number): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-14 17:47:09 UTC (rev 1097) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-03-14 20:00:54 UTC (rev 1098) @@ -40,9 +40,6 @@ window.vbox.pack_start(window.content, false, true) window.content.show() -# load frame: "background processes:" -execfile(path[0] + '/scripts/screens/global/frames/background_processes.py') - def handle_keyboard(widget, event): keyname = gtk.gdk.keyval_name(event.keyval) 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-14 17:47:09 UTC (rev 1097) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 20:00:54 UTC (rev 1098) @@ -148,7 +148,7 @@ self.preview.show() # set autoredraw - self.preview.connect('expose_event', self.redraw) + self.preview.connect('expose_event', self.draw) # select the right object as the drawing area self.drawing_area = self.preview.window @@ -184,11 +184,7 @@ # create the triangles self.create_triangles() - def redraw(self, widget = none, event = none): - # add the drawing to the background processes - background_processes.add('drawing the preview image', self.draw) - - def draw(self): + def draw(self, widget = none, event = none): # clear the drawing area self.drawing_area.clear() 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-14 17:47:09 UTC (rev 1097) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 20:00:54 UTC (rev 1098) @@ -126,7 +126,7 @@ if fast==false: # update the big preview image - screen.preview.redraw() + screen.preview.draw() screen.textures_used = textures_used(table) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-03-14 17:47:09 UTC (rev 1097) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-03-14 20:00:54 UTC (rev 1098) @@ -21,7 +21,7 @@ self.top_view.show() # set autoredraw - self.top_view.connect('expose_event', self.redraw, 'top_view') + self.top_view.connect('expose_event', self.draw, 'top_view') # show front view self.front_view = gtk.DrawingArea() @@ -30,7 +30,7 @@ self.front_view.show() # set autoredraw - self.front_view.connect('expose_event', self.redraw, 'front_view') + self.front_view.connect('expose_event', self.draw, 'front_view') # show side view self.side_view = gtk.DrawingArea() @@ -39,7 +39,7 @@ self.side_view.show() # set autoredraw - self.side_view.connect('expose_event', self.redraw, 'side_view') + self.side_view.connect('expose_event', self.draw, 'side_view') # define the colors for the top view self.top_view.window.colors = {} @@ -59,32 +59,21 @@ 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(self, widget, event, drawing_area): - if drawing_area=='top_view': - # add the drawing of the top view to the background processes - background_processes.add('drawing the top view', self.draw, 'top_view') - elif drawing_area=='front_view': - # add the drawing of the front view to the background processes - background_processes.add('drawing the front view', self.draw, 'front_view') - elif drawing_area=='side_view': - # add the drawing of the side view to the background processes - background_processes.add('drawing the side view', self.draw, 'side_view') - def redraw_all(self, widget = none): old_size = self.top_view.get_size_request()[0] if old_size==view_size: # redraw the views - self.redraw(none, none, 'top_view') - self.redraw(none, none, 'front_view') - self.redraw(none, none, 'side_view') + 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, drawing_area): + def draw(self, widget, event, drawing_area): try: screen.views except: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 17:47:20
|
Revision: 1097 http://opengate.svn.sourceforge.net/opengate/?rev=1097&view=rev Author: Ultrasick Date: 2009-03-14 17:47:09 +0000 (Sat, 14 Mar 2009) Log Message: ----------- now only drawing the pink border when there are no textures 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-14 10:37:50 UTC (rev 1096) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 17:47:09 UTC (rev 1097) @@ -178,6 +178,12 @@ self.offset_x = cos(angle) * length self.offset_y = sin(angle) * length + # create the border + self.create_border() + + # create the triangles + self.create_triangles() + def redraw(self, widget = none, event = none): # add the drawing to the background processes background_processes.add('drawing the preview image', self.draw) @@ -186,16 +192,14 @@ # clear the drawing area self.drawing_area.clear() - # create the border - self.create_border() + if len(self.face['textures'])==0: + # draw the pink border + self.draw_border() + else: + # insert the textures + for texture in self.face['textures']: + self.insert_texture(texture) - # create the triangles - self.create_triangles() - - # insert the textures - for texture in self.face['textures']: - self.insert_texture(texture) - def insert_texture(self, texture): texture = texture.split(' - ') @@ -272,6 +276,7 @@ self.y_center /= 2 self.y_center -= min(self.border_y) + def draw_border(self): # create an array for the points of the polygon points = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 10:37:54
|
Revision: 1096 http://opengate.svn.sourceforge.net/opengate/?rev=1096&view=rev Author: Ultrasick Date: 2009-03-14 10:37:50 +0000 (Sat, 14 Mar 2009) Log Message: ----------- fixed a bug: not always the fastest way to draw the texture had been chosen (especially when the face was a triangle) fixed a bug: the textures were drawn twice Modified Paths: -------------- 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 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-14 10:19:14 UTC (rev 1095) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 10:37:50 UTC (rev 1096) @@ -72,10 +72,25 @@ # 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 [vertices] + return [self.get_shortest_combination(vertices)] # create an array for the triangles triangles = [] @@ -103,25 +118,9 @@ # get the shortest combination for i, triangle in enumerate(triangles): - # 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])) + # update the triangle + triangles[i] = self.get_shortest_combination(triangle) - if combination_2==min(combination_1, combination_2, combination_3): - # reorder the vertices - triangle = [triangle[1], triangle[0], triangle[2]] - - # update the triangle - triangles[i] = triangle - - elif combination_3==min(combination_1, combination_2, combination_3): - # reorder the vertices - triangle = [triangle[2], triangle[0], triangle[1]] - - # update the triangle - triangles[i] = triangle - return triangles def get_vector(self, vertice_1, vertice_2): 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-14 10:19:14 UTC (rev 1095) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 10:37:50 UTC (rev 1096) @@ -84,7 +84,7 @@ self.tvcolumn.add_attribute(self.cell, 'text', 0) # refresh the list - self.refresh() + self.refresh(true) def add(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): try: @@ -113,7 +113,7 @@ # refresh the list self.refresh() - def refresh(self): + def refresh(self, fast = false): # clear the list self.treestore.clear() @@ -124,8 +124,9 @@ # add the texture to the array self.treestore.textures.append(texture) - # update the big preview image - screen.preview.redraw() + if fast==false: + # update the big preview image + screen.preview.redraw() screen.textures_used = textures_used(table) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 10:19:24
|
Revision: 1095 http://opengate.svn.sourceforge.net/opengate/?rev=1095&view=rev Author: Ultrasick Date: 2009-03-14 10:19:14 +0000 (Sat, 14 Mar 2009) Log Message: ----------- fixed a bug which appeared when entering the face number manually Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-03-14 10:13:07 UTC (rev 1094) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-03-14 10:19:14 UTC (rev 1095) @@ -85,6 +85,11 @@ self.side_view.set_size_request(view_size, view_size) def draw(self, 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 10:13:22
|
Revision: 1094 http://opengate.svn.sourceforge.net/opengate/?rev=1094&view=rev Author: Ultrasick Date: 2009-03-14 10:13:07 +0000 (Sat, 14 Mar 2009) Log Message: ----------- now only drawing the added textures Modified Paths: -------------- 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 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-14 10:09:04 UTC (rev 1093) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 10:13:07 UTC (rev 1094) @@ -193,8 +193,9 @@ # create the triangles self.create_triangles() - # insert a dummy texture - self.insert_texture('global - glass') + # insert the textures + for texture in self.face['textures']: + self.insert_texture(texture) def insert_texture(self, texture): texture = texture.split(' - ') 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-14 10:09:04 UTC (rev 1093) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 10:13:07 UTC (rev 1094) @@ -124,6 +124,9 @@ # add the texture to the array self.treestore.textures.append(texture) + # update the big preview image + screen.preview.redraw() + screen.textures_used = textures_used(table) class textures_available: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 10:09:26
|
Revision: 1093 http://opengate.svn.sourceforge.net/opengate/?rev=1093&view=rev Author: Ultrasick Date: 2009-03-14 10:09:04 +0000 (Sat, 14 Mar 2009) Log Message: ----------- oops, adding +10 pixels again to paint some transparent pixels in the middle of the face Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 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-14 10:08:03 UTC (rev 1092) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-14 10:09:04 UTC (rev 1093) @@ -133,7 +133,7 @@ edges = self.save_edges(face_new) # save the new face in the model['faces'] array - model['faces'].append({'vertices' : face_new, 'edges' : edges, 'textures' : {}}) + model['faces'].append({'vertices' : face_new, 'edges' : edges, 'textures' : []}) # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 10:08:21
|
Revision: 1092 http://opengate.svn.sourceforge.net/opengate/?rev=1092&view=rev Author: Ultrasick Date: 2009-03-14 10:08:03 +0000 (Sat, 14 Mar 2009) Log Message: ----------- adding function to add and remove textures to a face Modified Paths: -------------- 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 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-14 09:27:32 UTC (rev 1091) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 10:08:03 UTC (rev 1092) @@ -214,7 +214,7 @@ # get the relative x coordinate x_relative = x_pixel_number/x_end - for y_pixel_number in range(0, y_end * (1 - x_relative)): + for y_pixel_number in range(0, y_end * (1 - x_relative) + 10): # get the relative y coordinate y_relative = y_pixel_number/y_end 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-14 09:27:32 UTC (rev 1091) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 10:08:03 UTC (rev 1092) @@ -27,61 +27,55 @@ def refresh(self, source): texture = source.get_cursor()[0] + textures = source.get_model().textures - try: - texture[1] - except: - # clear the preview image - self.preview.clear() + if '-' in textures[texture[0]]: + temp = textures[texture[0]].split(' - ') - # a category has been selected, return - return + self.category_name = temp[0] + self.texture_name = temp[1] + else: + try: + texture[1] + except: + # clear the preview image + self.preview.clear() - textures = source.get_model().textures + # a category has been selected, return + return - self.category_name = textures[texture[0]]['name'] - self.texture_name = textures[texture[0]]['textures'][texture[1]] + 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 + '/' + self.texture_name + '.png') screen.texture_preview = texture_preview(table) -class textures_available: +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 textures self.treestore.textures = [] - # 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]) - - # add the texture to the array - self.treestore.textures[category_id]['textures'].append(texture_name) - # create the TreeView self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(-1, 100) - parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) + 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 function to refresh the preview image + # connect the functions self.treeview.connect('cursor-changed', screen.texture_preview.refresh) + self.treeview.connect('row-activated', self.remove) - # show "available textures:" - self.tvcolumn = gtk.TreeViewColumn('available textures:') + # show "used textures:" + self.tvcolumn = gtk.TreeViewColumn('used textures:') self.treeview.append_column(self.tvcolumn) # create a CellRendererText to render the data @@ -89,16 +83,51 @@ self.tvcolumn.pack_start(self.cell, true) self.tvcolumn.add_attribute(self.cell, 'text', 0) - def add(self, widget): - pass + # refresh the list + self.refresh() -screen.textures_available = textures_available(table) + def add(self, nonsence1 = none, nonsence2 = none, nonsence3 = none): + try: + screen.texture_preview.category_name + except: + # no texture has been selected jet, return + return -class textures_used: + # 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 + + if (screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name) in self.face['textures']: + # remove the texture + del(self.face['textures'][self.face['textures'].index(screen.texture_preview.category_name + ' - ' + screen.texture_preview.texture_name)]) + + # refresh the list + self.refresh() + + def refresh(self): + # clear the list + self.treestore.clear() + + # add the texture categories and the textures + for texture in self.face['textures']: + self.treestore.append(none, [texture]) + + # add the texture to the array + self.treestore.textures.append(texture) + +screen.textures_used = textures_used(table) + +class textures_available: 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) @@ -106,7 +135,7 @@ self.treestore.textures = [] # add the texture categories and the textures - for category_name, category_textures in self.face['textures'].items(): + for category_name, category_textures in textures.items(): category = self.treestore.append(none, [category_name]) # insert the category name in the array @@ -123,16 +152,16 @@ # create the TreeView self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(-1, 100) - parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) - self.treeview.set_reorderable(true) + self.treeview.set_size_request(-1, 155) + parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) self.treeview.show() - # connect the function to refresh the preview image + # 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('used textures:') + self.tvcolumn = gtk.TreeViewColumn('available textures:') self.treeview.append_column(self.tvcolumn) # create a CellRendererText to render the data @@ -140,11 +169,8 @@ self.tvcolumn.pack_start(self.cell, true) self.tvcolumn.add_attribute(self.cell, 'text', 0) - def remove(self, widget): - pass +screen.textures_available = textures_available(table) -screen.textures_used = textures_used(table) - class tools: def __init__(self, parent): # create an container to limit the height of the toolbar @@ -169,7 +195,7 @@ 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_available.add) + 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() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 09:27:44
|
Revision: 1091 http://opengate.svn.sourceforge.net/opengate/?rev=1091&view=rev Author: Ultrasick Date: 2009-03-14 09:27:32 +0000 (Sat, 14 Mar 2009) Log Message: ----------- removing the +/- 10 pixel drawing. I will use something smarter in the future Modified Paths: -------------- 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 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-14 09:11:26 UTC (rev 1090) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-14 09:27:32 UTC (rev 1091) @@ -210,11 +210,11 @@ 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)) - for x_pixel_number in range(-10, x_end + 10): + 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(-10, y_end * (1 - x_relative) + 10): + for y_pixel_number in range(0, y_end * (1 - x_relative)): # get the relative y coordinate y_relative = y_pixel_number/y_end 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-14 09:11:26 UTC (rev 1090) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 09:27:32 UTC (rev 1091) @@ -39,11 +39,11 @@ textures = source.get_model().textures - category_name = textures[texture[0]]['name'] - texture_name = textures[texture[0]]['textures'][texture[1]] + 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/' + category_name + '/' + texture_name + '.png') + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name + '/' + self.texture_name + '.png') screen.texture_preview = texture_preview(table) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 09:11:39
|
Revision: 1090 http://opengate.svn.sourceforge.net/opengate/?rev=1090&view=rev Author: Ultrasick Date: 2009-03-14 09:11:26 +0000 (Sat, 14 Mar 2009) Log Message: ----------- adding a preview frame Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/textures/ branches/ogEditor/data/modules/texturizer/graphic/textures/preview/ branches/ogEditor/data/modules/texturizer/graphic/textures/preview/global/ branches/ogEditor/data/modules/texturizer/graphic/textures/preview/global/glass.png Added: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/global/glass.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/textures/preview/global/glass.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream 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-14 08:04:38 UTC (rev 1089) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 09:11:26 UTC (rev 1090) @@ -12,24 +12,74 @@ 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): + texture = source.get_cursor()[0] + + try: + texture[1] + except: + # clear the preview image + self.preview.clear() + + # a category has been selected, return + return + + textures = source.get_model().textures + + category_name = textures[texture[0]]['name'] + texture_name = textures[texture[0]]['textures'][texture[1]] + + # update the preview image + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + category_name + '/' + texture_name + '.png') + +screen.texture_preview = texture_preview(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 textures + self.treestore.textures = [] + # 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]) - # create the TreeView using treestore + # add the texture to the array + self.treestore.textures[category_id]['textures'].append(texture_name) + + # create the TreeView self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(150, 200) + self.treeview.set_size_request(-1, 100) parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) self.treeview.show() + # connect the function to refresh the preview image + self.treeview.connect('cursor-changed', screen.texture_preview.refresh) + # show "available textures:" self.tvcolumn = gtk.TreeViewColumn('available textures:') self.treeview.append_column(self.tvcolumn) @@ -46,26 +96,41 @@ 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) - # grab the face - self.face = model['faces'][window.face_number] + # create an array for the textures + self.treestore.textures = [] # add the texture categories and the textures for category_name, category_textures in self.face['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]) - # create the TreeView using treestore + # add the texture to the array + self.treestore.textures[category_id]['textures'].append(texture_name) + + # create the TreeView self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_size_request(150, 200) + self.treeview.set_size_request(-1, 100) parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) self.treeview.set_reorderable(true) self.treeview.show() + # connect the function to refresh the preview image + self.treeview.connect('cursor-changed', screen.texture_preview.refresh) + # show "available textures:" self.tvcolumn = gtk.TreeViewColumn('used textures:') self.treeview.append_column(self.tvcolumn) @@ -84,7 +149,7 @@ 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) + parent.attach(container, 0, 1, 0, 1) container.show() # create an empty toolbar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-14 08:04:44
|
Revision: 1089 http://opengate.svn.sourceforge.net/opengate/?rev=1089&view=rev Author: Ultrasick Date: 2009-03-14 08:04:38 +0000 (Sat, 14 Mar 2009) Log Message: ----------- adding 2 buttons to add and remove textures to the face (the buttons have no function jet) Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/ branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add.png branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/remove.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add_and_remove.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/remove.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/remove.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream 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-14 07:42:29 UTC (rev 1088) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 08:04:38 UTC (rev 1089) @@ -12,30 +12,6 @@ frame.add(table) table.show() -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) - class textures_available: def __init__(self, parent): # create a TreeStore with one string column to use as the model @@ -63,8 +39,11 @@ self.tvcolumn.pack_start(self.cell, true) self.tvcolumn.add_attribute(self.cell, 'text', 0) -textures_available(table) + def add(self, widget): + pass +screen.textures_available = textures_available(table) + class textures_used: def __init__(self, parent): # create a TreeStore with one string column to use as the model @@ -96,4 +75,38 @@ self.tvcolumn.pack_start(self.cell, true) self.tvcolumn.add_attribute(self.cell, 'text', 0) -screen.textures_used = textures_used(table) \ No newline at end of file + def remove(self, widget): + pass + +screen.textures_used = textures_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, 2, 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_available.add) + + # insert a spacer + #self.bar.append_space() + +tools(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add_and_remove.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/textures/add_and_remove.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-14 07:42:41
|
Revision: 1088 http://opengate.svn.sourceforge.net/opengate/?rev=1088&view=rev Author: Ultrasick Date: 2009-03-14 07:42:29 +0000 (Sat, 14 Mar 2009) Log Message: ----------- adding a widget to view the used textures of the face Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.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-13 19:30:11 UTC (rev 1087) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-14 07:42:29 UTC (rev 1088) @@ -12,25 +12,45 @@ frame.add(table) table.show() -class available_textures: +class tools: def __init__(self, parent): - # show "available textures:" - text = gtk.Label('') - parent.attach(text, 0, 1, 1, 2, xpadding = 3) - text.show() + # 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) + +class textures_available: + def __init__(self, parent): # create a TreeStore with one string column to use as the model self.treestore = gtk.TreeStore(str) # add the texture categories and the textures for category_name, category_textures in textures.items(): - category = self.treestore.append(None, [category_name]) + category = self.treestore.append(none, [category_name]) for texture_name, texture_function in category_textures.items(): self.treestore.append(category, [texture_name]) # create the TreeView using treestore self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(150, 200) parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) self.treeview.show() @@ -43,28 +63,37 @@ self.tvcolumn.pack_start(self.cell, true) self.tvcolumn.add_attribute(self.cell, 'text', 0) -available_textures(table) +textures_available(table) -class tools: +class textures_used: 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 a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) - # create an empty toolbar - self.bar = gtk.Toolbar() - container.add(self.bar) - self.bar.show() + # grab the face + self.face = model['faces'][window.face_number] - # create the "edit" icon - '''image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/faces/edit.png') + # add the texture categories and the textures + for category_name, category_textures in self.face['textures'].items(): + category = self.treestore.append(none, [category_name]) - # add the "edit" button - self.bar.append_item('edit', 'edit the selected face', '', image, screen.faces.edit)''' + for texture_name, texture_function in category_textures.items(): + self.treestore.append(category, [texture_name]) - # insert a spacer - #self.bar.append_space() + # create the TreeView using treestore + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_size_request(150, 200) + parent.attach(self.treeview, 0, 1, 2, 3, xpadding = 3) + self.treeview.set_reorderable(true) + self.treeview.show() -tools(table) \ No newline at end of file + # show "available 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) + +screen.textures_used = textures_used(table) \ No newline at end of file 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-13 19:30:11 UTC (rev 1087) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-14 07:42:29 UTC (rev 1088) @@ -133,7 +133,7 @@ edges = self.save_edges(face_new) # save the new face in the model['faces'] array - model['faces'].append({'vertices' : face_new, 'edges' : edges}) + model['faces'].append({'vertices' : face_new, 'edges' : edges, 'textures' : {}}) # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-13 19:30:21
|
Revision: 1087 http://opengate.svn.sourceforge.net/opengate/?rev=1087&view=rev Author: Ultrasick Date: 2009-03-13 19:30:11 +0000 (Fri, 13 Mar 2009) Log Message: ----------- adding a widget to view the available textures and select one (to add it to the face later) Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/textures.py 2009-03-13 19:30:11 UTC (rev 1087) @@ -0,0 +1,70 @@ +# -*- 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 available_textures: + def __init__(self, parent): + # show "available textures:" + text = gtk.Label('') + parent.attach(text, 0, 1, 1, 2, xpadding = 3) + text.show() + + # create a TreeStore with one string column to use as the model + self.treestore = gtk.TreeStore(str) + + # add the texture categories and the textures + for category_name, category_textures in textures.items(): + category = self.treestore.append(None, [category_name]) + + for texture_name, texture_function in category_textures.items(): + self.treestore.append(category, [texture_name]) + + # create the TreeView using treestore + self.treeview = gtk.TreeView(self.treestore) + parent.attach(self.treeview, 0, 1, 1, 2, xpadding = 3) + self.treeview.show() + + # 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) + +available_textures(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/canvas/frames/textures.py ___________________________________________________________________ Added: svn:eol-style + native 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-07 20:29:07 UTC (rev 1086) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-03-13 19:30:11 UTC (rev 1087) @@ -13,4 +13,7 @@ execfile(path[0] + '/scripts/screens/project/canvas/frames/faces.py') elif action=='edit the face': # load frame: "edit the face:" - execfile(path[0] + '/scripts/screens/project/canvas/frames/edit_the_face.py') \ No newline at end of file + 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') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-07 20:29:12
|
Revision: 1086 http://opengate.svn.sourceforge.net/opengate/?rev=1086&view=rev Author: Ultrasick Date: 2009-03-07 20:29:07 +0000 (Sat, 07 Mar 2009) Log Message: ----------- adding a simple glass texture Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-03-07 17:36:45 UTC (rev 1085) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-03-07 20:29:07 UTC (rev 1086) @@ -10,6 +10,9 @@ # load different functions execfile(path[0] + '/scripts/main/functions.py') +# load different procedural textures +execfile(path[0] + '/scripts/main/textures.py') + # show window window = gtk.Window() window.set_title('ogEditor - texturizer') Added: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-03-07 20:29:07 UTC (rev 1086) @@ -0,0 +1,26 @@ +# define an array for the textures +textures = {} + +# define an array for the global textures +textures['global'] = {} + +class glass: + def __init__(self): + self.initialized = false + + def initialize(self): + # select the right object as the drawing area + self.drawing_area = screen.preview.preview.window + + # save the blue + self.drawing_area.colors['#00013C'] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse('#00013C'))) + + self.initialized = true + + def get_color(self, vertice): + if self.initialized==false: + self.initialize() + + return self.drawing_area.colors['#00013C'] + +textures['global']['glass'] = glass() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py ___________________________________________________________________ Added: svn:eol-style + native 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-07 17:36:45 UTC (rev 1085) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-07 20:29:07 UTC (rev 1086) @@ -194,9 +194,14 @@ self.create_triangles() # insert a dummy texture - self.insert_texture() + self.insert_texture('global - glass') - def insert_texture(self): + def insert_texture(self, texture): + texture = texture.split(' - ') + + texture_group = texture[0] + texture_name = texture[1] + for plane in self.planes: # define a safety factor (otherwise some pixels stay transparent) safety_factor = 1.5 @@ -232,7 +237,7 @@ x, y = self.center_position(x, y) # draw the pixel - self.drawing_area.draw_point(self.drawing_area.colors['red'], x, y) + self.drawing_area.draw_point(textures[texture_group][texture_name].get_color(absolute), x, y) def create_border(self): # define arrays for the coordinates This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-07 17:37:05
|
Revision: 1085 http://opengate.svn.sourceforge.net/opengate/?rev=1085&view=rev Author: Ultrasick Date: 2009-03-07 17:36:45 +0000 (Sat, 07 Mar 2009) Log Message: ----------- fixed some bugs 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-07 16:12:52 UTC (rev 1084) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-07 17:36:45 UTC (rev 1085) @@ -27,8 +27,11 @@ # calculate the value of the fraction fraction_value = numerator/denominator + # compensate rounding errors if fraction_value>1: fraction_value = 1 + elif fraction_value<0: + fraction_value = 0 return acos(fraction_value) @@ -84,10 +87,43 @@ 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])): - return triangles[0:2] + # define the first triangle + first_triangle = triangles[0] + + # define the second triangle + second_triangle = triangles[1] else: - return triangles[2:4] + # 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): + # 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]] + + # update the triangle + triangles[i] = triangle + + elif combination_3==min(combination_1, combination_2, combination_3): + # reorder the vertices + triangle = [triangle[2], triangle[0], triangle[1]] + + # update the triangle + triangles[i] = 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] @@ -162,21 +198,20 @@ def insert_texture(self): for plane in self.planes: - # get vector lengths - length_1 = screen.geometry.get_distance(plane['vectors'][0]) - length_2 = screen.geometry.get_distance(plane['vectors'][1]) + # define a safety factor (otherwise some pixels stay transparent) + safety_factor = 1.5 - # calculate end values - end_1 = (length_1/0.01) * resolution_texture_map - end_2 = (length_2/0.01) * resolution_texture_map + # 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)) - for x_pixel_number in range(0, end_1): + for x_pixel_number in range(-10, x_end + 10): # get the relative x coordinate - x_relative = x_pixel_number/end_1 + x_relative = x_pixel_number/x_end - for y_pixel_number in range(0, end_2 * (1 - x_relative)): + for y_pixel_number in range(-10, y_end * (1 - x_relative) + 10): # get the relative y coordinate - y_relative = y_pixel_number/end_2 + y_relative = y_pixel_number/y_end # create/reset the array for the absolute position absolute = [] @@ -187,14 +222,14 @@ absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) if absolute==self.offset: - x = self.offset_x - y = self.offset_y + x = self.offset_x * 100 * resolution_texture_map + y = self.offset_y * 100 * resolution_texture_map else: # get the relative position on the drawing area x, y = self.get_relative_position(absolute) - # get the absolute position on the drawing area - x, y = self.get_absolute_position(x, y) + # center the position on the drawing area + x, y = self.center_position(x, y) # draw the pixel self.drawing_area.draw_point(self.drawing_area.colors['red'], x, y) @@ -205,8 +240,8 @@ self.border_y = [] # store the x- and y-coordinate - self.border_x.append(self.offset_x) - self.border_y.append(self.offset_y) + self.border_x.append(self.offset_x * 100 * resolution_texture_map) + self.border_y.append(self.offset_y * 100 * resolution_texture_map) for vertice in self.face['vertices'][1:]: # get the relative position @@ -219,38 +254,25 @@ # calculate lengths self.x_length = max(self.border_x) - min(self.border_x) self.y_length = max(self.border_y) - min(self.border_y) - self.max_length = max(self.x_length, self.y_length) - # create a copy of the coordinates - temp_x = self.border_x[:] - temp_y = self.border_y[:] - - # scale the x coordinates to become values between -1 and 1 - for i in range(0 , len(temp_x)): - temp_x[i] /= self.max_length - - # scale the y coordinates to become values between -1 and 1 - for i in range(0 , len(temp_x)): - temp_y[i] /= self.max_length - # calculate the center for the x-axis - self.x_center = 1 - self.x_center -= self.x_length/self.max_length + self.x_center = view_size * 2 + self.x_center -= self.x_length self.x_center /= 2 - self.x_center -= min(temp_x) + self.x_center -= min(self.border_x) # calculate the center for the y-axis - self.y_center = 1 - self.y_center -= self.y_length/self.max_length + self.y_center = view_size * 2 + self.y_center -= self.y_length self.y_center /= 2 - self.y_center -= min(temp_y) + self.y_center -= min(self.border_y) # create an array for the points of the polygon points = [] - # position the coordinates + # center the coordinates for i in range(0, len(self.border_x)): - points.append(self.get_absolute_position(self.border_x[i], self.border_y[i])) + 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) @@ -300,21 +322,21 @@ vector_x += self.offset_x vector_y += self.offset_y + # 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 get_absolute_position(self, x, y): - # scale the coordinates to become values between -1 and 1 - x /= self.max_length - y /= self.max_length - + def center_position(self, x, y): # center the coordinates x += self.x_center y += self.y_center - # scale the coordinates to fit on the drawing area - x *= (view_size * 2) - 1 - y *= (view_size * 2) - 1 - # round the coordinates x = int(round(x)) y = int(round(y)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-03-07 16:13:06
|
Revision: 1084 http://opengate.svn.sourceforge.net/opengate/?rev=1084&view=rev Author: spom_spom Date: 2009-03-07 16:12:52 +0000 (Sat, 07 Mar 2009) Log Message: ----------- try to fix an annoying networking bug Modified Paths: -------------- trunk/src/GameStateManager.cpp trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/networkClient.cpp trunk/src/networkClient.h trunk/src/networkServerUser.cpp Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/GameStateManager.cpp 2009-03-07 16:12:52 UTC (rev 1084) @@ -474,7 +474,7 @@ } break; case PROTO_SHIP_REGISTER: if ( sector ) sector->receiveVesselRegister( &msgs[ i ][ 0 ] ); break; case PROTO_SHIP_DEREGISTER: if ( sector ) sector->receiveVesselDeRegister( &msgs[ i ][ 0 ] ); break; -// case PROTO_SHIP_DIED: if ( sector ) sector->receiveVesselDied( &msgs[ i ][ 0 ] ); break; + case PROTO_SHIP_DIED: if ( sector ) sector->receiveVesselDied( &msgs[ i ][ 0 ] ); break; case PROTO_SHIP_STATUS: if ( sector ) sector->receiveVesselStatus( &msgs[ i ][ 0 ] ); break; case PROTO_SHIP_MOVEMENT:{ // //** we handle that in sum, so we can ignore dups because of packet loss Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/Sector.cpp 2009-03-07 16:12:52 UTC (rev 1084) @@ -163,8 +163,7 @@ break; case SECTOR_AVATAR_OBJECT_RTTI: objectHeap_[ dynamic_cast< SectorVesselObject * >( obj )->vessel()->name() ].push_back( obj ); - if ( avatar_->isRegistered() ) sendVesselDeRegister( dynamic_cast< SectorAvatarObject * >( obj ) ); - avatar_->setRegistered( false ); + if ( avatar_->isRegistered() ) sendVesselDied( dynamic_cast< SectorAvatarObject * >( obj ) ); listener_->avatarDeathSequence( true ); avatarDeathSequenceTime_ = 2.0; break; @@ -478,13 +477,13 @@ void Sector::sendAllVesselMovements( ){ if ( avatarObject_ ) { - sendVesselMovement( avatarObject_ ); + if ( avatar_->isRegistered() ) sendVesselMovement( avatarObject_ ); } } void Sector::sendAllVesselInfos( ){ if ( avatarObject_ ){ - sendVesselStatus( avatarObject_ ); + if ( avatar_->isRegistered() ) sendVesselStatus( avatarObject_ ); } // for ( std::map< long, SectorObjectMoveableAi * >::iterator it = localAiObjects_.begin(); it != localAiObjects_.end(); it ++ ){ @@ -587,6 +586,28 @@ } } +void Sector::sendVesselDied( SectorVesselObject * obj ){ + MessageBodyShipDied msg( 0, 0 ); + network_->send( msg ); +} + +void Sector::receiveVesselDied( const MessageBodyShipDied & msg ){ + log_->info( std::string( "Receive vessel died: " ) + toStr( msg.senderID() ) ) ; + + ClientUserObject * user( network_->user( msg.senderID() ) ); + if ( user ){ + SectorMovableObject * obj = user->sectorObject(); + if ( obj ){ + user->setSectorObject( NULL ); + obj->explode(); + } else { + log_->fatal( "no sectorObject for user: " + user->name() ) ; + } + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; + } +} + void Sector::sendVesselMovement( SectorVesselObject * obj ){ if ( obj ){ MessageBodyShipMovement msg( 0, Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/Sector.h 2009-03-07 16:12:52 UTC (rev 1084) @@ -113,6 +113,9 @@ void sendVesselDeRegister( SectorVesselObject * obj ); void receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ); + void sendVesselDied( SectorVesselObject * obj ); + void receiveVesselDied( const MessageBodyShipDied & msg ); + void sendVesselMovement( SectorVesselObject * obj ); void receiveVesselMovement( const std::vector < MessageBodyShipMovement * > & movements ); Modified: trunk/src/networkClient.cpp =================================================================== --- trunk/src/networkClient.cpp 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/networkClient.cpp 2009-03-07 16:12:52 UTC (rev 1084) @@ -230,31 +230,42 @@ } void NetworkClient::handleSendMsg_( MessageBodyBase & body ) { - if ( online_ ){ - // std::cout << "Send to server, type: " << (int)body.type() << std::endl; - +boost::mutex::scoped_lock lock( sendMsgMutex_ ); + if ( online_ ){ +// std::cout << "handleSendMsg_:A:" << (int)body.type() << " " << &outMessageQueue_ << " " << outMessageQueue_.size() << std::endl; bool write_in_progress = !outMessageQueue_.empty(); + outMessageQueue_.push_back( Message( body ) ); - + //if ( body.type() == PROTO_SHIP_AMMOHIT ) std::cout << "handleSendMsg_::ammo " << write_in_progress << " " << outMessageQueue_.size() << std::endl; + // std::cout << "handleSendMsg_:B:" << (int)body.type() << " " << write_in_progress << " " << &outMessageQueue_ << " " << outMessageQueue_.size() << std::endl; //! initial write call if ( !write_in_progress ) { boost::asio::async_write( socket_, boost::asio::buffer( outMessageQueue_.front().data(), outMessageQueue_.front().length() ), - boost::bind( & NetworkClient::handleWrite_, this, boost::asio::placeholders::error ) ); + boost::bind( &NetworkClient::handleWrite_, this, boost::asio::placeholders::error ) ); } } } void NetworkClient::handleWrite_( const boost::system::error_code & e ) { + boost::mutex::scoped_lock lock( sendMsgMutex_ ); if ( online_ ){ if ( !e ){ - outMessageQueue_.pop_front(); - //! write untile queue is empty + //! write until queue is empty if ( !outMessageQueue_.empty() ) { - boost::asio::async_write( socket_, + // std::cout << " handleWrite_: pop-1: " << outMessageQueue_.size() << " " << &outMessageQueue_ << std::endl; + outMessageQueue_.pop_front(); + } + // std::cout << " handleWrite_: pop-2: " << outMessageQueue_.size() << " " << &outMessageQueue_ << std::endl; + if ( !outMessageQueue_.empty() ) { + + // std::cout << " handleWrite_: "<< outMessageQueue_.size() << " " << &outMessageQueue_ << std::endl; + + boost::asio::async_write( socket_, boost::asio::buffer( outMessageQueue_.front().data(), outMessageQueue_.front().length() ), boost::bind( &NetworkClient::handleWrite_, this, boost::asio::placeholders::error ) ); } + } else { log_->fatal( "NetworkClient::handleWrite: " + e.message() ); closeConnection_(); Modified: trunk/src/networkClient.h =================================================================== --- trunk/src/networkClient.h 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/networkClient.h 2009-03-07 16:12:52 UTC (rev 1084) @@ -30,6 +30,7 @@ #include "networkProtocol.h" #include "SectorMovableObject.h" +#include <boost/thread.hpp> using boost::asio::ip::tcp; namespace OpenGate{ @@ -137,6 +138,7 @@ float pingTime_; LogManager *log_; + boost::mutex sendMsgMutex_; }; } //namespace OpenGate Modified: trunk/src/networkServerUser.cpp =================================================================== --- trunk/src/networkServerUser.cpp 2009-03-01 18:52:51 UTC (rev 1083) +++ trunk/src/networkServerUser.cpp 2009-03-07 16:12:52 UTC (rev 1084) @@ -146,7 +146,7 @@ } break; case PROTO_SHIP_AMMOHIT:{ MessageBodyShipAmmoHit msg( readMsg_.body() ); - // std::cout << msg << std::endl; + // std::cout << msg << std::endl; sendToRange( msg ); } break; case PROTO_SHIP_PROJECTILEFIRED:{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-01 18:52:59
|
Revision: 1083 http://opengate.svn.sourceforge.net/opengate/?rev=1083&view=rev Author: Ultrasick Date: 2009-03-01 18:52:51 +0000 (Sun, 01 Mar 2009) Log Message: ----------- fixed a bug which lead to an division through zero error 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-01 16:51:03 UTC (rev 1082) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-01 18:52:51 UTC (rev 1083) @@ -14,6 +14,9 @@ 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) @@ -21,9 +24,6 @@ # calculate the denominator denominator = distance_1 * distance_2 - # calculate the numerator - numerator = (vector_1[0] * vector_2[0]) + (vector_1[1] * vector_2[1]) + (vector_1[2] * vector_2[2]) - # calculate the value of the fraction fraction_value = numerator/denominator @@ -186,8 +186,12 @@ 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) - # get the relative position on the drawing area - x, y = self.get_relative_position(absolute) + if absolute==self.offset: + x = self.offset_x + y = self.offset_y + else: + # get the relative position on the drawing area + x, y = self.get_relative_position(absolute) # get the absolute position on the drawing area x, y = self.get_absolute_position(x, y) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-01 16:51:12
|
Revision: 1082 http://opengate.svn.sourceforge.net/opengate/?rev=1082&view=rev Author: Ultrasick Date: 2009-03-01 16:51:03 +0000 (Sun, 01 Mar 2009) Log Message: ----------- removing rotation buttons which showed up to be quite useless + adding functionality to draw a dummy texture there are still bugs Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_clockwise.png branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_counterclockwise.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate.pspimage Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_clockwise.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_counterclockwise.png =================================================================== (Binary files differ) Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-01 16:02:46 UTC (rev 1081) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-01 16:51:03 UTC (rev 1082) @@ -1,7 +1,13 @@ # -*- coding: cp1252 -*- import gobject +from math import acos +from math import cos +from math import pi +from math import sin from math import sqrt +from math import tan + #from os import listdir #from os import path as check #from os import system Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-03-01 16:02:46 UTC (rev 1081) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-03-01 16:51:03 UTC (rev 1082) @@ -16,4 +16,8 @@ view_size = 250 view_x_position = 0 view_y_position = 0 -view_zoom = 1 \ No newline at end of file +view_zoom = 1 + +# resolutions (in pixels per meter) +resolution_texture_map = 100 +resolution_normal_map = 100 \ No newline at end of file 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-01 16:02:46 UTC (rev 1081) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-01 16:51:03 UTC (rev 1082) @@ -12,6 +12,98 @@ frame.add(table) table.show() +class geometry: + def get_angle(self, vector_1, vector_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 numerator + numerator = (vector_1[0] * vector_2[0]) + (vector_1[1] * vector_2[1]) + (vector_1[2] * vector_2[2]) + + # calculate the value of the fraction + fraction_value = numerator/denominator + + 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_triangles(self, vertices): + # check if there are only 3 vertices + if len(vertices)==3: + return [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])): + return triangles[0:2] + else: + return triangles[2:4] + + 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 @@ -23,181 +115,213 @@ # set autoredraw self.preview.connect('expose_event', self.redraw) + # 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.preview.window.colors[color_name] = self.preview.window.new_gc(foreground = self.preview.window.get_colormap().alloc_color(color_content)) + 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 = screen.geometry.get_vector(self.face['vertices'][0], self.face['vertices'][1]) + + # get the offset + self.offset = self.face['vertices'][0] + + # get the angle between the offset and the base line + angle = screen.geometry.get_angle(self.base_line, self.offset) + + # get the length of the offset + length = screen.geometry.get_distance(self.offset) + + # calculate the x- and y-coordinate of the offset + self.offset_x = cos(angle) * length + self.offset_y = sin(angle) * length + def redraw(self, widget = none, event = none): # add the drawing to the background processes background_processes.add('drawing the preview image', self.draw) def draw(self): - # select the right object as the drawing area - drawing_area = self.preview.window - # clear the drawing area - drawing_area.clear() + self.drawing_area.clear() - # grab the face - face = model['faces'][window.face_number] + # create the border + self.create_border() - # create an array for the base line - base_line = {} + # create the triangles + self.create_triangles() - # grab the edge of the base line - base_line['edge'] = face['edges'][face['base_line']] + # insert a dummy texture + self.insert_texture() - # calculate distance between the 2 vertices of the base line - base_line['length'] = screen.geometry.get_distance(base_line['edge'][0], base_line['edge'][1]) + def insert_texture(self): + for plane in self.planes: + # get vector lengths + length_1 = screen.geometry.get_distance(plane['vectors'][0]) + length_2 = screen.geometry.get_distance(plane['vectors'][1]) - # calculate the normal vector of the base line - base_line['vector'] = screen.geometry.get_vector(base_line['edge'][0], base_line['edge'][1]) + # calculate end values + end_1 = (length_1/0.01) * resolution_texture_map + end_2 = (length_2/0.01) * resolution_texture_map - # create a temporary array for the planes - planes = [] + for x_pixel_number in range(0, end_1): + # get the relative x coordinate + x_relative = x_pixel_number/end_1 - for vertice in face['vertices']: - # create/reset the array for the plane - plane = {} + for y_pixel_number in range(0, end_2 * (1 - x_relative)): + # get the relative y coordinate + y_relative = y_pixel_number/end_2 - # create a plane with the normal vector of the base line and the offset of the vertice - plane['parameters'] = screen.geometry.get_plane(vertice, base_line['vector']) + # create/reset the array for the absolute position + absolute = [] - # store the vertice in the plane - plane['vertice'] = vertice + # 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) - # store the plane in the planes array - planes.append(plane) + # get the relative position on the drawing area + x, y = self.get_relative_position(absolute) - for plane in planes: - # calculate lambda with the plane and the offset of the first vertice of the base line - plane['lambda'] = screen.geometry.get_lambda(base_line['edge'][0], plane['parameters']) + # get the absolute position on the drawing area + x, y = self.get_absolute_position(x, y) - for plane in planes: - # calculate the point of intersection - plane['intersection'] = screen.geometry.get_vertice(base_line['edge'][0], base_line['vector'], plane['lambda']) + # draw the pixel + self.drawing_area.draw_point(self.drawing_area.colors['red'], x, y) - # create arrays for the coordinates - x = [] - y = [] + def create_border(self): + # define arrays for the coordinates + self.border_x = [] + self.border_y = [] - # get the coordinates - for plane in planes: - # store the x-coordinate - x.append(plane['lambda'] * base_line['length']) + # store the x- and y-coordinate + self.border_x.append(self.offset_x) + self.border_y.append(self.offset_y) - # store the y-coordinate - y.append(screen.geometry.get_distance(plane['vertice'], plane['intersection'])) + for vertice in self.face['vertices'][1:]: + # 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 - x_length = max(x) - min(x) - y_length = max(y) - min(y) - max_length = max(x_length, y_length) + self.x_length = max(self.border_x) - min(self.border_x) + self.y_length = max(self.border_y) - min(self.border_y) + self.max_length = max(self.x_length, self.y_length) + # create a copy of the coordinates + temp_x = self.border_x[:] + temp_y = self.border_y[:] + # scale the x coordinates to become values between -1 and 1 - for i in range(0 , len(x)): - x[i] /= max_length + for i in range(0 , len(temp_x)): + temp_x[i] /= self.max_length # scale the y coordinates to become values between -1 and 1 - for i in range(0 , len(y)): - y[i] /= max_length + for i in range(0 , len(temp_x)): + temp_y[i] /= self.max_length # calculate the center for the x-axis - x_center = 1 - x_center -= x_length/max_length - x_center /= 2 - x_center -= min(x) + self.x_center = 1 + self.x_center -= self.x_length/self.max_length + self.x_center /= 2 + self.x_center -= min(temp_x) # calculate the center for the y-axis - y_center = 1 - y_center -= y_length/max_length - y_center /= 2 - y_center -= min(y) + self.y_center = 1 + self.y_center -= self.y_length/self.max_length + self.y_center /= 2 + self.y_center -= min(temp_y) - # center the x coordinates - for i in range(0 , len(x)): - x[i] += x_center + # create an array for the points of the polygon + points = [] - # center the y coordinates - for i in range(0 , len(y)): - y[i] += y_center + # position the coordinates + for i in range(0, len(self.border_x)): + points.append(self.get_absolute_position(self.border_x[i], self.border_y[i])) - # scale the x coordinates to fit on the drawing area - for i in range(0 , len(x)): - x[i] *= view_size * 2 + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) - # scale the y coordinates to fit on the drawing area - for i in range(0 , len(y)): - y[i] *= view_size * 2 + def create_triangles(self): + # get the triangles + try: + model['faces'][window.face_number]['triangles'] + except: + model['faces'][window.face_number]['triangles'] = screen.geometry.get_triangles(self.face['vertices']) - # round the x coordinates - for i in range(0 , len(x)): - x[i] = int(round(x[i])) + triangles = model['faces'][window.face_number]['triangles'] - # round the y coordinates - for i in range(0 , len(y)): - y[i] = int(round(y[i])) + # create an array for the planes of the triangles + self.planes = [] - # create an array for the points of the polygon - points = [] + # define planes for the triangles + for triangle in triangles: + # get the offset + offset = triangle[0] - # insert the coordinates to the points array - for i in range(0 , len(x)): - points.append((x[i], y[i])) + # calculate the vectors + vector_1 = screen.geometry.get_vector(offset, triangle[1]) + vector_2 = screen.geometry.get_vector(offset, triangle[2]) - # draw the highlighted face - drawing_area.draw_polygon(drawing_area.colors['pink'], false, points) + # get the plane + plane = screen.geometry.get_plane(offset, vector_1, vector_2) - def rotate(self, widget, direction): - model['faces'][window.face_number]['base_line'] += 1 * direction + # store the plane + self.planes.append(plane) - if model['faces'][window.face_number]['base_line']<0: - model['faces'][window.face_number]['base_line'] = len(model['faces'][window.face_number]['edges']) - 1 - elif model['faces'][window.face_number]['base_line']>(len(model['faces'][window.face_number]['edges']) - 1): - model['faces'][window.face_number]['base_line'] = 0 + def get_relative_position(self, vertice): + # get the vector + vector = screen.geometry.get_vector(self.offset, vertice) - # redraw the face - self.redraw() + # get the angle of the vector + angle = screen.geometry.get_angle(self.base_line, vector) - def exit_screen(self, widget): - show_screen('project/canvas') + # get the length of the vector + length = screen.geometry.get_distance(vector) -screen.preview = preview(table) + # calculate the x- and y-coordinate of the vector + vector_x = cos(angle) * length + vector_y = sin(angle) * length -class geometry: - def get_distance(self, vertice_1, vertice_2): - return sqrt((vertice_1[0] - vertice_2[0]) ** 2 + (vertice_1[1] - vertice_2[1]) ** 2 + (vertice_1[2] - vertice_2[2]) ** 2) + # add the x and y-coordinate of the offset + vector_x += self.offset_x + vector_y += self.offset_y - 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 (vector_x, vector_y) - return [x, y, z] + def get_absolute_position(self, x, y): + # scale the coordinates to become values between -1 and 1 + x /= self.max_length + y /= self.max_length - def get_plane(self, vertice, vector): - a = vector[0] - b = vector[1] - c = vector[2] + # center the coordinates + x += self.x_center + y += self.y_center - d = (vertice[0] * vector[0]) + (vertice[1] * vector[1]) + (vertice[2] * vector[2]) + # scale the coordinates to fit on the drawing area + x *= (view_size * 2) - 1 + y *= (view_size * 2) - 1 - return [a, b, c, d] + # round the coordinates + x = int(round(x)) + y = int(round(y)) - def get_lambda(self, vertice, plane): - return ((plane[3] - plane[0]*vertice[0] - plane[1]*vertice[1] - plane[2]*vertice[2])/(plane[0]**2 + plane[1]**2 + plane[2]**2)) + return (x, y) - 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 + def exit_screen(self, widget): + show_screen('project/canvas') - return [x, y, z] +screen.preview = preview(table) -screen.geometry = geometry() - class tools: def __init__(self, parent): # create an empty toolbar @@ -205,20 +329,6 @@ parent.attach(self.bar, 0, 1, 0, 1) self.bar.show() - # create the "rotate counterclockwise" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_counterclockwise.png') - - # add the "rotate counterclockwise" button - self.bar.append_item('rotate', 'rotate the model counterclockwise', none, image, screen.preview.rotate, 1) - - # create the "rotate clockwise" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_clockwise.png') - - # add the "rotate clockwise" button - self.bar.append_item('rotate', 'rotate the model clockwise', none, image, screen.preview.rotate, -1) - # create the "exit screen" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/exit_screen.png') 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-01 16:02:46 UTC (rev 1081) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-01 16:51:03 UTC (rev 1082) @@ -133,7 +133,7 @@ edges = self.save_edges(face_new) # save the new face in the model['faces'] array - model['faces'].append({'vertices' : face_new, 'edges' : edges, 'base_line' : 0}) + model['faces'].append({'vertices' : face_new, 'edges' : edges}) # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate.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-01 16:03:01
|
Revision: 1081 http://opengate.svn.sourceforge.net/opengate/?rev=1081&view=rev Author: Ultrasick Date: 2009-03-01 16:02:46 +0000 (Sun, 01 Mar 2009) Log Message: ----------- moving scaling info file into the doc dir Added Paths: ----------- doc/scaling.txt Removed Paths: ------------- templates/data/misc/scaling.txt Added: doc/scaling.txt =================================================================== --- doc/scaling.txt (rev 0) +++ doc/scaling.txt 2009-03-01 16:02:46 UTC (rev 1081) @@ -0,0 +1,3 @@ +1.) multiply 1.0022 with the length of Netdevils direct x models to recieve the length in meters + +2.) multiply 0.01 with the length in meters to recieve the length in blender units for the Opengate files \ No newline at end of file Property changes on: doc/scaling.txt ___________________________________________________________________ Added: svn:eol-style + native Deleted: templates/data/misc/scaling.txt =================================================================== --- templates/data/misc/scaling.txt 2009-03-01 10:16:15 UTC (rev 1080) +++ templates/data/misc/scaling.txt 2009-03-01 16:02:46 UTC (rev 1081) @@ -1,3 +0,0 @@ -1.) multiply 1.0022 with the length of Netdevils direct x models to recieve the length in meters - -2.) multiply 0.01 with the length in meters to recieve the length in blender units for the Opengate files \ 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-01 10:16:22
|
Revision: 1080 http://opengate.svn.sourceforge.net/opengate/?rev=1080&view=rev Author: Ultrasick Date: 2009-03-01 10:16:15 +0000 (Sun, 01 Mar 2009) Log Message: ----------- splitting calculation in several steps to make it easier to understand 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-01 09:24:27 UTC (rev 1079) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-01 10:16:15 UTC (rev 1080) @@ -79,58 +79,76 @@ # calculate the point of intersection plane['intersection'] = screen.geometry.get_vertice(base_line['edge'][0], base_line['vector'], plane['lambda']) - # create an array for the real positions on the preview image - positions = [] - - for plane in planes: - # create/reset the array for the real position of the vertice on the preview image - position = [] - - # store the x-coordinate in the position array - position.append(plane['lambda'] * base_line['length']) - - # store the y-coordinate in the position array - position.append(screen.geometry.get_distance(plane['vertice'], plane['intersection'])) - - # store the position in the positions array - positions.append(position) - # create arrays for the coordinates x = [] y = [] # get the coordinates - for position in positions: - x.append(position[0]) - y.append(position[1]) + for plane in planes: + # store the x-coordinate + x.append(plane['lambda'] * base_line['length']) + # store the y-coordinate + y.append(screen.geometry.get_distance(plane['vertice'], plane['intersection'])) + # calculate lengths x_length = max(x) - min(x) y_length = max(y) - min(y) max_length = max(x_length, y_length) + # scale the x coordinates to become values between -1 and 1 + for i in range(0 , len(x)): + x[i] /= max_length + + # scale the y coordinates to become values between -1 and 1 + for i in range(0 , len(y)): + y[i] /= max_length + # calculate the center for the x-axis - x_center = view_size * 2 - x_center -= (x_length/max_length) * (view_size * 2) + x_center = 1 + x_center -= x_length/max_length x_center /= 2 - x_center -= (min(x)/max_length) * (view_size * 2) + x_center -= min(x) # calculate the center for the y-axis - y_center = view_size * 2 - y_center -= (y_length/max_length) * (view_size * 2) + y_center = 1 + y_center -= y_length/max_length y_center /= 2 - y_center -= (min(y)/max_length) * (view_size * 2) + y_center -= min(y) - # calculate the real coordinates for the polygon - for i, position in enumerate(positions): - x = int(round((position[0]/max_length) * (view_size * 2) + x_center)) - y = int(round((position[1]/max_length) * (view_size * 2) + y_center)) + # center the x coordinates + for i in range(0 , len(x)): + x[i] += x_center - # add the coordinates to the positions array - positions[i] = (x, y) + # center the y coordinates + for i in range(0 , len(y)): + y[i] += y_center + # scale the x coordinates to fit on the drawing area + for i in range(0 , len(x)): + x[i] *= view_size * 2 + + # scale the y coordinates to fit on the drawing area + for i in range(0 , len(y)): + y[i] *= view_size * 2 + + # round the x coordinates + for i in range(0 , len(x)): + x[i] = int(round(x[i])) + + # round the y coordinates + for i in range(0 , len(y)): + y[i] = int(round(y[i])) + + # create an array for the points of the polygon + points = [] + + # insert the coordinates to the points array + for i in range(0 , len(x)): + points.append((x[i], y[i])) + # draw the highlighted face - drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) + drawing_area.draw_polygon(drawing_area.colors['pink'], false, points) def rotate(self, widget, direction): model['faces'][window.face_number]['base_line'] += 1 * direction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-01 09:24:41
|
Revision: 1079 http://opengate.svn.sourceforge.net/opengate/?rev=1079&view=rev Author: Ultrasick Date: 2009-03-01 09:24:27 +0000 (Sun, 01 Mar 2009) Log Message: ----------- Now using the full size of the drawing area by using padding instead of not used pixels. This makes calculation a little easier. 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-01 09:17:19 UTC (rev 1078) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-01 09:24:27 UTC (rev 1079) @@ -17,7 +17,7 @@ # 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) + parent.attach(self.preview, 0, 1, 1, 2, xpadding = 3, ypadding = 3) self.preview.show() # set autoredraw @@ -110,21 +110,21 @@ max_length = max(x_length, y_length) # calculate the center for the x-axis - axis_x_center = view_size * 2 - axis_x_center -= (x_length/max_length) * ((view_size * 2) - 10) - axis_x_center /= 2 - axis_x_center -= (min(x)/max_length) * ((view_size * 2) - 10) + x_center = view_size * 2 + x_center -= (x_length/max_length) * (view_size * 2) + x_center /= 2 + x_center -= (min(x)/max_length) * (view_size * 2) # calculate the center for the y-axis - axis_y_center = view_size * 2 - axis_y_center -= (y_length/max_length) * ((view_size * 2) - 10) - axis_y_center /= 2 - axis_y_center -= (min(y)/max_length) * ((view_size * 2) - 10) + y_center = view_size * 2 + y_center -= (y_length/max_length) * (view_size * 2) + y_center /= 2 + y_center -= (min(y)/max_length) * (view_size * 2) # calculate the real coordinates for the polygon for i, position in enumerate(positions): - x = int(round((position[0]/max_length) * ((view_size * 2) - 10) + axis_x_center)) - y = int(round((position[1]/max_length) * ((view_size * 2) - 10) + axis_y_center)) + x = int(round((position[0]/max_length) * (view_size * 2) + x_center)) + y = int(round((position[1]/max_length) * (view_size * 2) + y_center)) # add the coordinates to the positions array positions[i] = (x, y) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-01 09:17:28
|
Revision: 1078 http://opengate.svn.sourceforge.net/opengate/?rev=1078&view=rev Author: Ultrasick Date: 2009-03-01 09:17:19 +0000 (Sun, 01 Mar 2009) Log Message: ----------- small fixes, no real code change 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-01 09:16:38 UTC (rev 1077) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-03-01 09:17:19 UTC (rev 1078) @@ -34,12 +34,12 @@ background_processes.add('drawing the preview image', self.draw) def draw(self): - # clear the drawing area - self.preview.window.clear() - # select the right object as the drawing area drawing_area = self.preview.window + # clear the drawing area + drawing_area.clear() + # grab the face face = model['faces'][window.face_number] @@ -47,7 +47,7 @@ base_line = {} # grab the edge of the base line - base_line['edge'] = face['edges'][face['base line']] + base_line['edge'] = face['edges'][face['base_line']] # calculate distance between the 2 vertices of the base line base_line['length'] = screen.geometry.get_distance(base_line['edge'][0], base_line['edge'][1]) @@ -133,12 +133,12 @@ drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) def rotate(self, widget, direction): - model['faces'][window.face_number]['base line'] += 1 * direction + model['faces'][window.face_number]['base_line'] += 1 * direction - if model['faces'][window.face_number]['base line']<0: - model['faces'][window.face_number]['base line'] = len(model['faces'][window.face_number]['edges']) - 1 - elif model['faces'][window.face_number]['base line']>(len(model['faces'][window.face_number]['edges']) - 1): - model['faces'][window.face_number]['base line'] = 0 + if model['faces'][window.face_number]['base_line']<0: + model['faces'][window.face_number]['base_line'] = len(model['faces'][window.face_number]['edges']) - 1 + elif model['faces'][window.face_number]['base_line']>(len(model['faces'][window.face_number]['edges']) - 1): + model['faces'][window.face_number]['base_line'] = 0 # redraw the face self.redraw() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-01 09:16:49
|
Revision: 1077 http://opengate.svn.sourceforge.net/opengate/?rev=1077&view=rev Author: Ultrasick Date: 2009-03-01 09:16:38 +0000 (Sun, 01 Mar 2009) Log Message: ----------- increasing some values to avoid problems ... just in case that I use a multiplicator on the vertice coordinates in future Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 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-02-28 14:58:07 UTC (rev 1076) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-03-01 09:16:38 UTC (rev 1077) @@ -75,16 +75,16 @@ model['dimensions'][2] = {} # z # define min and max coordinates for the x-axis - model['dimensions'][0]['min'] = 999999 - model['dimensions'][0]['max'] = -999999 + model['dimensions'][0]['min'] = 99999999 + model['dimensions'][0]['max'] = -99999999 # define min and max coordinates for the y-axis - model['dimensions'][1]['min'] = 999999 - model['dimensions'][1]['max'] = -999999 + model['dimensions'][1]['min'] = 99999999 + model['dimensions'][1]['max'] = -99999999 # define min and max coordinates for the z-axis - model['dimensions'][2]['min'] = 999999 - model['dimensions'][2]['max'] = -999999 + model['dimensions'][2]['min'] = 99999999 + model['dimensions'][2]['max'] = -99999999 # create a new array for the edges model['edges'] = [] @@ -133,7 +133,7 @@ edges = self.save_edges(face_new) # save the new face in the model['faces'] array - model['faces'].append({'vertices' : face_new, 'edges' : edges, 'base line' : 0}) + model['faces'].append({'vertices' : face_new, 'edges' : edges, 'base_line' : 0}) # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |