0001 function bm_edit_app_view3d_callback(obj, hObj)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0016 if ~exist('hObj', 'var'), error('hObj is a required parameter.'); end
0017
0018
0019
0020
0021 H = guihandles(obj.h);
0022
0023 switch(hObj)
0024 case H.model_listbox
0025
0026 set(gcf, 'CurrentAxes', H.selected_axes);
0027 cla(H.selected_axes);
0028
0029 if length(obj.patch_handles) <= 0, return; end
0030 selected = get(H.model_listbox, 'Value');
0031 patch_h = obj.patch_handles(selected);
0032
0033 new_patch_h = copyobj(patch_h, H.selected_axes);
0034
0035 alpha(new_patch_h, 1);
0036 lighting phong;
0037 material dull;
0038 axis equal;
0039 axis off;
0040 camlight(-60,0);
0041 camlight(60,0);
0042 camlight(180,0);
0043 set(H.selected_axes, 'View', get(H.model_axes, 'View'));
0044 xlim(H.selected_axes, xlim(H.model_axes));
0045 ylim(H.selected_axes, ylim(H.model_axes));
0046 zlim(H.selected_axes, zlim(H.model_axes));
0047
0048 alpha_val = get(patch_h, 'FaceAlpha');
0049 contents = get(H.tranceparent_popup, 'String');
0050 alpha_val_list = zeros(length(contents), 1);
0051 for k=1:length(contents)
0052 alpha_val_list(k) = str2num(contents{k});
0053 end
0054 ix = find(alpha_val_list == alpha_val);
0055 set(H.tranceparent_popup, 'Value', ix);
0056 case H.color_push
0057
0058 selected = get(H.model_listbox, 'Value');
0059 patch_h = obj.patch_handles(selected);
0060
0061 C = get(patch_h, 'FaceColor');
0062 C = uisetcolor(C);
0063
0064 if length(C) == 1 && C == 0
0065 else
0066 set(patch_h, 'FaceColor', C);
0067 bm_edit_app_view3d_callback(obj, H.model_listbox);
0068 end
0069 case H.tranceparent_popup
0070
0071 selected = get(H.model_listbox, 'Value');
0072 patch_h = obj.patch_handles(selected);
0073
0074 contents = get(H.tranceparent_popup, 'String');
0075 Value = get(H.tranceparent_popup, 'Value');
0076 tranceparent = sscanf(contents{Value}, '%f');
0077
0078 alpha(patch_h, tranceparent);
0079 end
0080
0081 rotate3d(H.model_axes, 'on');
0082
0083 guidata(obj.h, obj);