Removed unused variables (second pass) + dead code

Fixes various gcc 5.4.0 warnings for -Wunused-variable and -Wunused-but-set-variable
This commit is contained in:
Rémi Verschelde 2016-07-06 19:04:21 +02:00
parent b6ac91c0e6
commit 3fcb9b1ec1
35 changed files with 27 additions and 431 deletions

View File

@ -359,7 +359,6 @@ uint8_t CPEnvelope::get_node_count() {
const CPEnvelope::Point& CPEnvelope::get_node(int p_idx) {
static Point errpoint;
if (p_idx<0 || p_idx>=node_count)
return node[node_count-1];

View File

@ -560,8 +560,7 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool
if (s_idx==-1) ABORT_LOAD;
//printf("free sample: %i\n",s_idx);
char auxb;
CPSample& sample=*song->get_sample(s_idx);
int sample_size=file->get_dword();
@ -611,6 +610,7 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool
sm->set_c5_freq( sample_data, CPTables::get_linear_frequency(CPTables::get_linear_period(note_offset<<1,finetune)) );
//printf("NOTE %i,fine %i\n",note_offset,finetune);
char auxb;
auxb=file->get_byte(); //reserved?
file->get_byte_array((uint8_t*)instrname,22);
sample.set_name(instrname);

View File

@ -325,8 +325,6 @@ void CPPlayer::update_mixer() {
printf("cgb %i\n",(int)v.master_channel->channel_global_volume);
*/
int cv=v.master_channel->channel_global_volume;
tmpvol=(uint64_t)v.fadeout_volume; /* max 1024 - 10 bits */
tmpvol*=(uint64_t)v.channel_volume; /* * max 64 - 6 bits */
@ -338,13 +336,9 @@ void CPPlayer::update_mixer() {
tmpvol*=(uint64_t)song->get_mixing_volume(); /* max 128 - 7 bits */
tmpvol*=(uint64_t)control.global_volume; /* max 128 - 7 bits*/
/* total 10+6+8+6+7+7=44 bits */
uint64_t preshift=tmpvol;
tmpvol>>=43; /* Move back to 8 bits range , 44-19+8=43*/
/*
if (!tmpvol && preshift>>35)
tmpvol=1; // even if the volume should be inaudible, some people WANTS to hear this.
*/
if (tmpvol>CP_VOL_MAX)
tmpvol=CP_VOL_MAX;

View File

@ -469,7 +469,6 @@ Error StreamPeerOpenSSL::put_partial_data(const uint8_t* p_data,int p_bytes, int
if (p_bytes==0)
return OK;
int s=0;
Error err = put_data(p_data,p_bytes);
if (err!=OK)
return err;

View File

@ -69,8 +69,7 @@ int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) {
return 0;
};
int eos = 0;
bool reloaded=false;
int eos = 0;
while (todo > page_size) {
@ -100,7 +99,6 @@ int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) {
packets_available=true;
}
/*Extract all available packets*/
//int packet_no=0;
while (todo > page_size && !eos) {
if (ogg_stream_packetout(&os, &op)!=1) {
@ -157,7 +155,6 @@ int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) {
{
int frame_offset = 0;
int new_frame_size = frame_size;
/*printf ("packet %d %d\n", packet_no, skip_samples);*/
@ -165,7 +162,6 @@ int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) {
{
/*printf ("chopping first packet\n");*/
new_frame_size -= skip_samples;
frame_offset = skip_samples;
}
if (packet_no == page_nb_packets && skip_samples < 0)
{
@ -241,10 +237,8 @@ void AudioStreamPlaybackSpeex::unload() {
void *AudioStreamPlaybackSpeex::process_header(ogg_packet *op, int *frame_size, int *rate, int *nframes, int *channels, int *extra_headers) {
void *st;
SpeexHeader *header;
int modeID;
SpeexCallback callback;
header = speex_packet_to_header((char*)op->packet, op->bytes);
if (!header)
@ -353,7 +347,6 @@ void AudioStreamPlaybackSpeex::reload() {
/*Loop for all complete pages we got (most likely only one)*/
while (ogg_sync_pageout(&oy, &og)==1) {
int packet_no;
if (stream_init == 0) {
ogg_stream_init(&os, ogg_page_serialno(&og));
stream_init = 1;
@ -377,7 +370,6 @@ void AudioStreamPlaybackSpeex::reload() {
last_granule = page_granule;
/*Extract all available packets*/
packet_no=0;
while (!eos && ogg_stream_packetout(&os, &op)==1)
{
/*If first packet, process as Speex header*/

View File

@ -81,12 +81,12 @@ int VideoStreamPlaybackTheora::queue_page(ogg_page *page){
void VideoStreamPlaybackTheora::video_write(void){
th_ycbcr_buffer yuv;
int y_offset, uv_offset;
th_decode_ycbcr_out(td,yuv);
/*
int y_offset, uv_offset;
y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1);
/*
{
int pixels = size.x * size.y;
frame_data.resize(pixels * 4);
@ -117,7 +117,7 @@ void VideoStreamPlaybackTheora::video_write(void){
DVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
//uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
if (px_fmt == TH_PF_444) {
@ -543,16 +543,10 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
bool frame_done=false;
bool audio_done=!vorbis_p;
bool theora_done=false;
while (!frame_done || (!audio_done && !vorbis_eos)) {
//a frame needs to be produced
ogg_packet op;
bool audio_pending = false;
bool no_vorbis=false;
bool no_theora=false;
@ -604,8 +598,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
int tr = vorbis_synthesis_read(&vd, ret-to_read);
audio_pending=true;
if (vd.granulepos>=0) {
// print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
@ -627,7 +619,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
}
} else { /* we need more data; break out to suck in another page */
//printf("need moar data\n");
no_vorbis=true;
break;
};
}

View File

@ -714,7 +714,6 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) {
args.push_back("-installApp");
args.push_back("-launchApp");
args.push_back("-device");
int idx = devices[p_device].index;
String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/host");
String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/password");
args.push_back(host);

View File

@ -85,7 +85,6 @@ private:
int points = 48;
if (mode==MODE_MULTIPLE) {
int max_draw = 16;
Color mcolor=color;
mcolor.a*=0.3;
@ -1356,7 +1355,6 @@ void AnimationKeyEditor::_track_editor_draw() {
}
}
Color sep_color=color;
color.a*=0.5;
for(int i=0;i<fit;i++) {
@ -1806,8 +1804,6 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
Ref<Font> font = te->get_font("font","Tree");
int sep = get_constant("vseparation","Tree");
int hsep = get_constant("hseparation","Tree");
Color color = get_color("font_color","Tree");
Color sepcolor = get_color("guide_color","Tree");
Ref<Texture> remove_icon = get_icon("Remove","EditorIcons");
Ref<Texture> move_up_icon = get_icon("MoveUp","EditorIcons");
Ref<Texture> move_down_icon = get_icon("MoveDown","EditorIcons");
@ -3007,7 +3003,6 @@ void AnimationKeyEditor::_update_menu() {
updating=true;
bool empty= !animation.is_valid();
if (animation.is_valid()) {
length->set_val(animation->get_length());

View File

@ -80,8 +80,6 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String
continue;
String path = efsd->get_file_path(i);
Map<String,String> &ss = candidates[file];
for(Map<String,String>::Element *E=candidates[file].front();E;E=E->next()) {
@ -420,7 +418,6 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
exist=false;
owners->clear();
files.clear();
TreeItem *root=owners->create_item();
for(int i=0;i<to_erase.size();i++) {
files[to_erase[i]]=NULL;
}

View File

@ -597,7 +597,6 @@ void EditorNode::save_resource(const Ref<Resource>& p_resource) {
void EditorNode::save_resource_as(const Ref<Resource>& p_resource,const String& p_at_path) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool());
current_option=RESOURCE_SAVE_AS;
List<String> extensions;
@ -1551,9 +1550,10 @@ void EditorNode::_property_editor_back() {
void EditorNode::_imported(Node *p_node) {
Node *scene = editor_data.get_edited_scene_root();
// add_edited_scene(p_node);
/*
Node *scene = editor_data.get_edited_scene_root();
add_edited_scene(p_node);
if (scene) {
String path = scene->get_filename();
p_node->set_filename(path);
@ -2129,7 +2129,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
}
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool());
List<String> extensions;
@ -2210,8 +2209,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
}
bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool());
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file->set_current_path(cpath);
@ -2220,8 +2217,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case FILE_SAVE_OPTIMIZED: {
Node *scene = editor_data.get_edited_scene_root();
#if 0
Node *scene = editor_data.get_edited_scene_root();
if (!scene) {
current_option=-1;
@ -5644,8 +5641,6 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB);
Separator *vs=NULL;
file_menu->set_tooltip(TTR("Operations with scene files."));
p=file_menu->get_popup();
p->add_shortcut(ED_SHORTCUT("editor/new_scene",TTR("New Scene")),FILE_NEW_SCENE);

View File

@ -38,7 +38,6 @@ void EditorPath::_notification(int p_what) {
RID ci=get_canvas_item();
Ref<Font> label_font = get_font("font","Label");
Color label_color = get_color("font_color","Label");
Size2i size = get_size();
Ref<Texture> sn = get_icon("SmallNext","EditorIcons");

View File

@ -36,21 +36,6 @@ void ImportSettingsDialog::_item_pressed(int p_idx) {
return;
String p=edited->get_metadata(0);
#if 0
if (EditorImportDB::get_singleton()->is_image(p)) {
uint32_t flags = EditorImportDB::get_singleton()->get_image_flags(p);
bool pressed = !popup->is_item_checked(p_idx);
if (pressed)
flags|=(1<<p_idx);
else
flags&=~(1<<p_idx);
EditorImportDB::get_singleton()->set_image_flags(p,flags);
edited->set_text(2,_str_from_flags(flags));
}
#endif
}
void ImportSettingsDialog::_item_edited() {
@ -58,38 +43,8 @@ void ImportSettingsDialog::_item_edited() {
if (updating)
return;
TreeItem *it=tree->get_selected();
int ec=tree->get_edited_column();
String p=it->get_metadata(0);
#if 0
if (EditorImportDB::get_singleton()->is_image(p)) {
if (ec==1) {
EditorImportDB::get_singleton()->set_image_format(p,EditorImport::ImageFormat(int(it->get_range(1))));
} else if (ec==2) {
int flags = EditorImportDB::get_singleton()->get_image_flags(p);
for(int i=0;i<popup->get_item_count();i++) {
popup->set_item_checked(i,flags&(1<<i));
}
Rect2 r = tree->get_custom_popup_rect();
popup->set_size(Size2(r.size.width,1));
popup->set_pos(/*tree->get_global_pos()+*/r.pos+Point2(0,r.size.height));
popup->popup();
}
edited=it;
}
#endif
}
@ -167,42 +122,6 @@ bool ImportSettingsDialog::_generate_fs(TreeItem *p_parent,EditorFileSystemDirec
}
#if 0
if (!EditorImportDB::get_singleton()->is_image(path) && !EditorImportDB::get_singleton()->is_scene(path))
continue;
String f = p_dir->get_file(i);
TreeItem *ti = tree->create_item(p_parent);
ti->set_text(0,f);
String type = p_dir->get_file_type(i);
Ref<Texture> icon = get_icon( (has_icon(type,"EditorIcons")?type:String("Object")),"EditorIcons");
if (EditorImportDB::get_singleton()->is_image(path)) {
ti->set_tooltip(0,"Type: Image\nSource: "+EditorImportDB::get_singleton()->get_file_source(path)+"\nSource MD5: "+EditorImportDB::get_singleton()->get_file_md5(path));
ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
ti->set_editable(1,true);
ti->set_range_config(1,0,3,1);
ti->set_range(1,EditorImportDB::get_singleton()->get_image_format(path));
ti->set_text(1,texformat);
ti->set_cell_mode(2,TreeItem::CELL_MODE_CUSTOM);
ti->set_editable(2,true);
ti->set_metadata(0,path);
String txt;
uint32_t flags=EditorImportDB::get_singleton()->get_image_flags(path);
txt=_str_from_flags(flags);
ti->set_text(2,txt);
}
ti->set_icon(0, icon);
valid=true;
#endif
return valid;
}

View File

@ -32,7 +32,6 @@
void OutputStrings::update_scrollbars() {
Size2 size = get_size();
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();

View File

@ -407,7 +407,6 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource>& p_resource) {
void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& p_resource) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool());
List<String> extensions;
ResourceSaver::get_recognized_extensions(p_resource, &extensions);

View File

@ -90,7 +90,6 @@ Size2 AnimationTreeEditor::get_node_size(const StringName& p_node) const {
Ref<StyleBox> style = get_stylebox("panel","PopupMenu");
Ref<Font> font = get_font("font","PopupMenu");
Color font_color = get_color("font_color","PopupMenu");
Size2 size = style->get_minimum_size();
@ -633,7 +632,6 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2&
Ref<StyleBox> style = get_stylebox("panel","PopupMenu");
Ref<Font> font = get_font("font","PopupMenu");
Color font_color = get_color("font_color","PopupMenu");
float h = (font->get_height()+get_constant("vseparation","PopupMenu"));

View File

@ -645,7 +645,6 @@ void BakedLightBaker::_octree_insert(int p_octant,Triangle* p_triangle, int p_de
leaf_list=child_idx;
cell_count++;
int lz = lights.size();
for(int ci=0;ci<8;ci++) {
child->light_accum[ci][0]=0;
child->light_accum[ci][1]=0;
@ -1016,8 +1015,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
//ray_aabb.expand_to(p_end);
const BVH *bvhptr = bvh;
bstack[0]=bvh;
stack[0]=TEST_AABB_BIT;
@ -1693,7 +1690,7 @@ void BakedLightBaker::throw_rays(ThreadStack& thread_stack,int p_amount) {
Vector3 from = dl.pos;
double r1 = double(rand())/RAND_MAX;
double r2 = double(rand())/RAND_MAX;
//double r2 = double(rand())/RAND_MAX;
double r3 = double(rand())/RAND_MAX;
float d=Math::tan(Math::deg2rad(dl.spot_angle));
@ -1994,7 +1991,6 @@ void BakedLightBaker::update_octree_images(DVector<uint8_t> &p_octree,DVector<ui
const double *normptr=norm_arr.ptr();
*/
double norm = 1.0/double(total_rays);
int lz=lights.size();
mult/=multiplier;
double saturation = baked_light->get_saturation();
@ -2261,8 +2257,6 @@ void BakedLightBaker::_plot_pixel_to_lightmap(int x, int y, int width, int heigh
continue;
n/=len;
const BVH *bvhptr = bvh;
bstack[0]=bvh;
stack[0]=TEST_RAY_BIT;
@ -2404,8 +2398,6 @@ Error BakedLightBaker::transfer_to_lightmaps() {
float gamma = baked_light->get_gamma_adjust();
float mult = baked_light->get_energy_multiplier();
const double *normptr=norm_arr.ptr();
for(int i=0;i<triangles.size();i++) {
if (i%200==0) {
@ -2538,7 +2530,6 @@ Error BakedLightBaker::transfer_to_lightmaps() {
Vector<uint8_t> copy_data=bt.data;
uint8_t *data=bt.data.ptr();
uint8_t *src_data=copy_data.ptr();
const int max_radius=8;
const int shadow_radius=2;
const int max_dist=0x7FFFFFFF;

View File

@ -1940,8 +1940,6 @@ void CanvasItemEditor::_viewport_draw() {
Map<Node*,Object*> &selection = editor_selection->get_selection();
CanvasItem *single_item=NULL;
bool pivot_found=false;
for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
@ -1961,15 +1959,6 @@ void CanvasItemEditor::_viewport_draw() {
Matrix32 xform=transform * canvas_item->get_global_transform_with_canvas();
VisualServer::get_singleton()->canvas_item_add_set_transform(ci,xform);
Point2 ofs=Point2();//get_global_pos();
Rect2 draw_rect=rect;
Color light_edit_color=Color(1.0,0.8,0.8);
Color dark_edit_color=Color(0.4,0.1,0.1);
Size2 handle_size=Size2(handle_len,handle_len);
//select_sb->draw(ci,draw_rect.grow(2));
//DRAW_EMPTY_RECT( draw_rect.grow(2), light_edit_color );
//DRAW_EMPTY_RECT( draw_rect.grow(1), dark_edit_color );
Vector2 endpoints[4]={

View File

@ -349,8 +349,6 @@ void CollisionPolygon2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
int len = poly.size();
for(int i=0;i<poly.size();i++) {

View File

@ -381,8 +381,6 @@ void CollisionPolygonEditor::_polygon_draw() {
poly=node->get_polygon();
int len = poly.size();
float depth = node->get_depth()*0.5;
imgeom->clear();

View File

@ -36,6 +36,7 @@
#include "scene/resources/mesh.h"
#include "scene/resources/bit_mask.h"
#include "tools/editor/editor_scale.h"
bool EditorTexturePreviewPlugin::handles(const String& p_type) const {
return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture"));
@ -442,7 +443,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) {
Color keyword_color = EditorSettings::get_singleton()->get("text_editor/keyword_color");
Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color");
Color symbol_color = EditorSettings::get_singleton()->get("text_editor/symbol_color");
Color comment_color = EditorSettings::get_singleton()->get("text_editor/comment_color");
for(int i=0;i<thumbnail_size;i++) {
@ -607,7 +607,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
-1, -1, -1, -1, 2, 4, 6, 8
};
int16_t nibble,signed_nibble,diff,step;
int16_t nibble,diff,step;
ima_adpcm.last_nibble++;
const uint8_t *src_ptr=sdata;
@ -628,10 +628,6 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
if (ima_adpcm.step_index>88)
ima_adpcm.step_index=88;
/*
signed_nibble = (nibble&7) * ((nibble&8)?-1:1);
diff = (2 * signed_nibble + 1) * step / 4; */
diff = step >> 3 ;
if (nibble & 1)
diff += step >> 2 ;
@ -748,15 +744,13 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
for(int j=0;j<h;j++) {
int half,ofs;
int half;
float v;
if (j<(h/2)) {
half=0;
ofs=0;
v = (j/(float)(h/2)) * 2.0 - 1.0;
} else {
half=1;
ofs=h/2;
if( (float)(h/2) != 0 ) {
v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
} else {

View File

@ -364,8 +364,6 @@ void LightOccluder2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
int len = poly.size();
for(int i=0;i<poly.size();i++) {

View File

@ -427,8 +427,6 @@ void NavigationPolygonEditor::_canvas_draw() {
poly = Variant(node->get_navigation_polygon()->get_outline(j));
}
int len = poly.size();
for(int i=0;i<poly.size();i++) {

View File

@ -283,7 +283,6 @@ void ParticlesEditor::_generate_emission_points() {
ofs=(Vector3(1,1,1)-dir)*Vector3(Math::randf(),Math::randf(),Math::randf())*aabb.size;
ofs+=aabb.pos;
Vector3 dirv = -dir;
Vector3 ofsv = ofs + aabb.size * dir;
//space it a little

View File

@ -466,8 +466,6 @@ void Polygon2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
int len = poly.size();
for(int i=0;i<poly.size();i++) {

View File

@ -151,7 +151,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
-1, -1, -1, -1, 2, 4, 6, 8
};
int16_t nibble,signed_nibble,diff,step;
int16_t nibble,diff,step;
ima_adpcm.last_nibble++;
const uint8_t *src_ptr=sdata;
@ -172,10 +172,6 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
if (ima_adpcm.step_index>88)
ima_adpcm.step_index=88;
/*
signed_nibble = (nibble&7) * ((nibble&8)?-1:1);
diff = (2 * signed_nibble + 1) * step / 4; */
diff = step >> 3 ;
if (nibble & 1)
diff += step >> 2 ;
@ -285,15 +281,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
for(int j=0;j<h;j++) {
int half,ofs;
int half;
float v;
if (j<(h/2)) {
half=0;
ofs=0;
v = (j/(float)(h/2)) * 2.0 - 1.0;
} else {
half=1;
ofs=h/2;
v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
}

View File

@ -118,9 +118,10 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_region("/*","*/",comment_color,false);
get_text_edit()->add_color_region("//","",comment_color,false);
//colorize strings
/*//colorize strings
Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff));
/*
List<String> strings;
shader->get_shader_mode()->get_string_delimiters(&strings);

View File

@ -186,9 +186,8 @@ void GraphColorRampEdit::_notification(int p_what){
Point prev;
prev.offset=0;
prev.color=Color(0,0,0);
int w = get_size().x;
int h = get_size().y;
int h = get_size().y;
int total_w = get_size().width-get_size().height-3;
for(int i=-1;i<points.size();i++) {

View File

@ -53,8 +53,6 @@
void SpatialEditorViewport::_update_camera() {
if (orthogonal) {
Size2 size = get_size();
Size2 vpsize = Point2(cursor.distance*size.get_aspect(), cursor.distance / size.get_aspect());
//camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
}
@ -276,10 +274,6 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b
r_includes_current=false;
List<_RayResult> results;
Vector3 cn=_get_camera_normal();
Plane cplane(pos,cn.normalized());
float min_d=1e20;
for (int i=0;i<instances.size();i++) {
@ -649,21 +643,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili
Vector3 ray_pos=_get_ray_pos( Vector2( p_screenpos.x, p_screenpos.y ) );
Vector3 ray=_get_ray( Vector2( p_screenpos.x, p_screenpos.y ) );
Vector3 cn=_get_camera_normal();
Plane cplane(ray_pos,cn.normalized());
Transform gt = spatial_editor->get_gizmo_transform();
float gs=gizmo_scale;
/*
if (orthogonal) {
gs= cursor.distance/surface->get_size().get_aspect();
} else {
gs = cplane.distance_to(gt.origin);
}
gs*=GIZMO_SCALE_DEFAULT;
*/
if (spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_MOVE) {
@ -1268,16 +1249,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (_edit.gizmo.is_valid()) {
Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal());
Vector3 ray_pos=_get_ray_pos( Vector2( m.x, m.y ) );
Vector3 ray=_get_ray( Vector2( m.x, m.y ) );
//Vector3 intersection;
//if (!plane.intersects_ray(ray_pos,ray,&intersection))
// break;
_edit.gizmo->set_handle(_edit.gizmo_handle,camera,Vector2(m.x,m.y));
Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle);
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
@ -1808,16 +1779,6 @@ void SpatialEditorViewport::_notification(int p_what) {
continue;
/*
??
if (!se->poly_instance.is_valid())
continue;
if (!ObjectDB::get_instance( E->key() )) {
VisualServer::get_singleton()->free( se->poly_instance );
se->poly_instance=RID();
continue;
}
*/
VisualInstance *vi=sp->cast_to<VisualInstance>();
@ -1855,35 +1816,6 @@ void SpatialEditorViewport::_notification(int p_what) {
surface->update();
}
//grid
Vector3 grid_cam_axis=_get_camera_normal();
/*
for(int i=0;i<3;i++) {
Vector3 axis;
axis[i]=1;
bool should_be_visible= grid_enabled && (grid_enable[i] || (Math::abs(grid_cam_axis.dot(axis))>0.99 && orthogonal));
if (should_be_visible!=grid_visible[i]) {
VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,should_be_visible);
grid_visible[i]=should_be_visible;
}
}
if (last_grid_snap!=spatial_editor->get_translate_snap()) {
last_grid_snap=spatial_editor->get_translate_snap()
Transform gridt;
gridt.basis.scale(Vector3(last_grid_snap,last_grid_snap,last_grid_snap));
for(int i=0;i<3;i++)
VisualServer::get_singleton()->instance_set_transform(grid_instance[i],gridt);
}*/
}
if (p_what==NOTIFICATION_ENTER_TREE) {
@ -2565,16 +2497,9 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
si->sbox_instance=VisualServer::get_singleton()->instance_create2(selection_box->get_rid(),sp->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF);
RID inst = sp->call("_get_visual_instance_rid");
// if (inst.is_valid())
// si->aabb = VisualServer::get_singleton()->instance_get_base_aabb(inst);
if (get_tree()->is_editor_hint())
editor->call("edit_node",sp);
return si;
}

View File

@ -431,7 +431,6 @@ void ProjectExportDialog::_validate_platform() {
void ProjectExportDialog::_export_mode_changed(int p_idx) {
bool do_all = p_idx==0;
if (EditorImportExport::get_singleton()->get_export_filter()==p_idx)
return;
EditorImportExport::get_singleton()->set_export_filter(EditorImportExport::ExportFilter(p_idx));

View File

@ -823,9 +823,6 @@ void ProjectManager::_bind_methods() {
ProjectManager::ProjectManager() {
int margin = get_constant("margin","Dialogs");
int button_margin = get_constant("button_margin","Dialogs");
// load settings
if (!EditorSettings::get_singleton())
EditorSettings::create();

View File

@ -389,7 +389,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
List<String> names;
names.push_back("value:");
config_value_editors(1,1,50,names);
Vector3 vec=v;
value_editor[0]->set_text( String::num(v) );
}
@ -436,7 +435,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
List<String> names;
names.push_back("string:");
config_value_editors(1,1,50,names);
Vector3 vec=v;
value_editor[0]->set_text( v );
}
@ -3345,7 +3343,6 @@ void PropertyEditor::update_tree() {
String type;
if (p.hint==PROPERTY_HINT_RESOURCE_TYPE)
type=p.hint_string;
bool notnil=false;
if (obj->get( p.name ).get_type() == Variant::NIL || obj->get( p.name ).operator RefPtr().is_null()) {
item->set_text(1,"<null>");
@ -3368,8 +3365,7 @@ void PropertyEditor::update_tree() {
} else {
item->set_text(1,"<"+res->get_type()+">");
};
notnil=true;
}
if (has_icon(res->get_type(),"EditorIcons")) {
type=res->get_type();

View File

@ -382,11 +382,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
ERR_FAIL_COND(!top_node->get_parent());
ERR_FAIL_COND(!bottom_node->get_parent());
int top_node_pos = top_node->get_index();
int bottom_node_pos = bottom_node->get_index();
int top_node_pos_next = top_node_pos + (MOVING_DOWN ? 1 : -1);
int bottom_node_pos_next = bottom_node_pos + (MOVING_DOWN ? 1 : -1);
int top_node_pos_next = top_node->get_index() + (MOVING_DOWN ? 1 : -1);
editor_data->get_undo_redo().add_do_method(top_node->get_parent(), "move_child", top_node, top_node_pos_next);
editor_data->get_undo_redo().add_undo_method(bottom_node->get_parent(), "move_child", bottom_node, bottom_node_pos);
@ -1108,17 +1105,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Node2D>()->get_global_transform());
if (node->cast_to<Spatial>())
editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Spatial>()->get_global_transform());
if (node->cast_to<Control>()) {
bool can_do_it=false;
Control *c=node->cast_to<Control>();
if (c->get_parent()->cast_to<Container>())
can_do_it=false;
for(int i=0;i<4;i++) {
if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN)
can_do_it=false;
}
if (node->cast_to<Control>())
editor_data->get_undo_redo().add_do_method(node,"set_global_pos",node->cast_to<Control>()->get_global_pos());
}
}
editor_data->get_undo_redo().add_do_method(this,"_set_owners",edited_scene,owners);
@ -1161,17 +1149,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Node2D>()->get_transform());
if (node->cast_to<Spatial>())
editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Spatial>()->get_transform());
if (node->cast_to<Control>()) {
bool can_do_it=false;
Control *c=node->cast_to<Control>();
if (c->get_parent()->cast_to<Container>())
can_do_it=false;
for(int i=0;i<4;i++) {
if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN)
can_do_it=false;
}
if (node->cast_to<Control>())
editor_data->get_undo_redo().add_undo_method(node,"set_pos",node->cast_to<Control>()->get_pos());
}
}

View File

@ -37,6 +37,8 @@
#include "editor_settings.h"
#include "scene/main/viewport.h"
bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) {
@ -57,61 +59,6 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di
item->select(0);
}
//item->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
bool has_items=false;
for(int i=0;i<p_dir->get_subdir_count();i++) {
if (_create_tree(item,p_dir->get_subdir(i)))
has_items=true;
}
#if 0
for (int i=0;i<p_dir->get_file_count();i++) {
String file_name = p_dir->get_file(i);
String file_path = p_dir->get_file_path(i);
// ScenesDockFilter::FILTER_PATH
String search_from = file_path.right(6); // trim "res://"
if (file_filter == ScenesDockFilter::FILTER_NAME)
search_from = file_name;
else if (file_filter == ScenesDockFilter::FILTER_FOLDER)
search_from = file_path.right(6).get_base_dir();
if (search_term!="" && search_from.findn(search_term)==-1)
continue;
bool isfave = favorites.has(file_path);
if (button_favorite->is_pressed() && !isfave)
continue;
TreeItem *fitem = tree->create_item(item);
fitem->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
fitem->set_editable(0,true);
fitem->set_checked(0,isfave);
fitem->set_text(0,file_name);
Ref<Texture> icon = get_icon( (has_icon(p_dir->get_file_type(i),"EditorIcons")?p_dir->get_file_type(i):String("Object")),"EditorIcons");
fitem->set_icon(0, icon );
fitem->set_metadata(0,file_path);
//if (p_dir->files[i]->icon.is_valid()) {
// fitem->set_icon(0,p_dir->files[i]->icon);
// }
has_items=true;
}
#endif
/*if (!has_items) {
memdelete(item);
return false;
}*/
return true;
}

View File

@ -819,7 +819,6 @@ void ScriptEditorDebugger::_performance_draw() {
if(which.empty())
return;
Color graph_color=get_color("font_color","TextEdit");
Ref<StyleBox> graph_sb = get_stylebox("normal","TextEdit");
Ref<Font> graph_font = get_font("font","TextEdit");

View File

@ -424,16 +424,11 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
}
Transform ti=t.affine_inverse();
Vector3 ray_from=ti.xform(p_camera->project_ray_origin(p_point));
Vector3 ray_dir=t.basis.xform_inv(p_camera->project_ray_normal(p_point)).normalized();
Vector3 ray_to = ray_from+ray_dir*4096;
float min_d=1e20;
int idx=-1;
for(int i=0;i<secondary_handles.size();i++) {
#if 1
Vector3 hpos = t.xform(secondary_handles[i]);
Vector2 p = p_camera->unproject_position(hpos);
@ -449,31 +444,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
idx=i+handles.size();
}
}
#else
AABB aabb;
aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE;
aabb.size=aabb.pos*-2;
aabb.pos+=secondary_handles[i];
Vector3 rpos,rnorm;
if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) {
real_t dp = ray_dir.dot(rpos);
if (dp<min_d) {
r_pos=t.xform(rpos);
r_normal=ti.basis.xform_inv(rnorm).normalized();
min_d=dp;
idx=i+handles.size();
}
}
#endif
}
if (p_sec_first && idx!=-1) {
@ -486,9 +457,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
for(int i=0;i<handles.size();i++) {
#if 1
Vector3 hpos = t.xform(handles[i]);
Vector2 p = p_camera->unproject_position(hpos);
if (p.distance_to(p_point)<SpatialEditorGizmos::singleton->handle_t->get_width()*0.6) {
@ -503,32 +471,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
idx=i;
}
}
#else
AABB aabb;
aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE;
aabb.size=aabb.pos*-2;
aabb.pos+=handles[i];
Vector3 rpos,rnorm;
if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) {
real_t dp = ray_dir.dot(rpos);
if (dp<min_d) {
r_pos=t.xform(rpos);
r_normal=ti.basis.xform_inv(rnorm).normalized();
min_d=dp;
idx=i;
}
}
#endif
}
if (idx>=0) {
@ -612,9 +555,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
Vector3 ray_dir=ai.basis.xform(p_camera->project_ray_normal(p_point)).normalized();
Vector3 rpos,rnorm;
#if 1
if (collision_mesh->intersect_ray(ray_from,ray_dir,rpos,rnorm)) {
@ -622,16 +562,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
r_normal=gt.basis.xform(rnorm).normalized();
return true;
}
#else
if (collision_mesh->intersect_segment(ray_from,ray_from+ray_dir*4906.0,rpos,rnorm)) {
r_pos=gt.xform(rpos);
r_normal=gt.basis.xform(rnorm).normalized();
return true;
}
#endif
}
return false;
@ -2250,7 +2180,6 @@ void VisibilityNotifierGizmo::set_handle(int p_idx,Camera *p_camera, const Point
if (d<0.001)
d=0.001;
Vector3 he = aabb.size;
aabb.pos[p_idx]=(aabb.pos[p_idx]+aabb.size[p_idx]*0.5)-d;
aabb.size[p_idx]=d*2;
notifier->set_aabb(aabb);
@ -2456,8 +2385,6 @@ void HingeJointSpatialGizmo::redraw() {
if (p3d->get_flag(HingeJoint::FLAG_USE_LIMIT) && ll<ul) {
const int points = 32;
float step = (ul-ll)/points;
for(int i=0;i<points;i++) {
@ -2573,8 +2500,6 @@ void SliderJointSpatialGizmo::redraw() {
if (ll<ul) {
const int points = 32;
float step = (ul-ll)/points;
for(int i=0;i<points;i++) {
@ -2641,7 +2566,6 @@ SliderJointSpatialGizmo::SliderJointSpatialGizmo(SliderJoint* p_p3d) {
void ConeTwistJointSpatialGizmo::redraw() {
clear();
float cs = 0.25;
Vector<Vector3> points;
float r = 1.0;
@ -2837,8 +2761,6 @@ void Generic6DOFJointSpatialGizmo::redraw() {
if (enable_ang && ll<=ul) {
const int points = 32;
float step = (ul-ll)/points;
for(int i=0;i<points;i++) {