Пример #1
0
Object::~Object() {
    if(mesh && scene->session && scene->session->params.interactive) {
        if(mesh->mesh_type == Mesh::GLOBAL) scene->mesh_manager->tag_global_update();
        else if(particle_id) {
            std::string cur_name(mesh->name.c_str());
            cur_name  = cur_name +  "__part___s__";
            scene->server->deleteScatter(cur_name);
        }
        else {
            std::string cur_name(name.c_str());
            cur_name  = cur_name + "__" + mesh->name.c_str() +  "_s__";
            scene->server->deleteScatter(cur_name);
        }
    }
} //~Object()
Пример #2
0
// static
void LLPanelNetwork::onClickSetDiskCache(void* user_data)
{
	LLPanelNetwork* self = (LLPanelNetwork*)user_data;

	std::string cur_name(gSavedSettings.getString("CacheLocation"));
	std::string proposed_name(cur_name);
	
	LLDirPicker& picker = LLDirPicker::instance();
	if (! picker.getDir(&proposed_name ) )
	{
		return; //Canceled!
	}

	std::string dir_name = picker.getDirName();
	if (!dir_name.empty() && dir_name != cur_name)
	{
		self->childSetText("disk_cache_location", dir_name);
		LLNotifications::instance().add("CacheWillBeMoved");
		gSavedSettings.setString("NewCacheLocation", dir_name);
	}
	else
	{
		std::string cache_location = gDirUtilp->getCacheDir();
		self->childSetText("disk_cache_location", cache_location);
	}
}
void LLFloaterPreference::onClickSetCache()
{
	std::string cur_name(gSavedSettings.getString("CacheLocation"));
//	std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name));
	
	std::string proposed_name(cur_name);

	LLDirPicker& picker = LLDirPicker::instance();
	if (! picker.getDir(&proposed_name ) )
	{
		return; //Canceled!
	}

	std::string dir_name = picker.getDirName();
	if (!dir_name.empty() && dir_name != cur_name)
	{
		std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name));	
		LLNotificationsUtil::add("CacheWillBeMoved");
		gSavedSettings.setString("NewCacheLocation", dir_name);
		gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder);
	}
	else
	{
		std::string cache_location = gDirUtilp->getCacheDir();
		gSavedSettings.setString("CacheLocation", cache_location);
		std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
		gSavedSettings.setString("CacheLocationTopFolder", top_folder);
	}
}
Пример #4
0
static std::vector<meshRenderRegion *> CreateRegions(JsonNode& json_obj,
                                                     const std::string& key,
                                                     glm::uint32 * indices_in,
                                                     glm::float32 * rest_pts_in,
                                                     glm::float32 * uvs_in)
{
    std::vector<meshRenderRegion *> ret_regions;
    JsonNode * base_obj =  GetJSONNodeFromKey(json_obj, key);

    for (JsonIterator it = JsonBegin(base_obj->value);
         it != JsonEnd(base_obj->value);
         ++it)
    {
        JsonNode * cur_node = *it;

        std::string cur_name(cur_node->key);
        
        int cur_id = (int)GetJSONNodeFromKey(*cur_node, "id")->value.toNumber();
        int cur_start_pt_index = (int)GetJSONNodeFromKey(*cur_node, "start_pt_index")->value.toNumber();
        int cur_end_pt_index = (int)GetJSONNodeFromKey(*cur_node, "end_pt_index")->value.toNumber();
        int cur_start_index = (int)GetJSONNodeFromKey(*cur_node, "start_index")->value.toNumber();
        int cur_end_index = (int)GetJSONNodeFromKey(*cur_node, "end_index")->value.toNumber();
     
        meshRenderRegion * new_region = new meshRenderRegion(indices_in,
                                                             rest_pts_in,
                                                             uvs_in,
                                                             cur_start_pt_index,
                                                             cur_end_pt_index,
                                                             cur_start_index,
                                                             cur_end_index);
        
        new_region->setName(cur_name);
        new_region->setTagId(cur_id);
        
        // Read in weights
        std::unordered_map<std::string, std::vector<float> >& weight_map =
            new_region->getWeights();
        JsonNode * weight_obj =  GetJSONNodeFromKey(*cur_node, "weights");
        
        for (JsonIterator w_it = JsonBegin(weight_obj->value);
             w_it != JsonEnd(weight_obj->value);
             ++w_it)
        {
            JsonNode * w_node = *w_it;
            
            const std::string& key(w_node->key);
            std::vector<float> values = ReadFloatArray(*weight_obj, key);
            weight_map[key] = values;
        }
        
        ret_regions.push_back(new_region);
    }
    
    return ret_regions;
}
Пример #5
0
static void FillDeformationCache(JsonNode& json_obj,
                          const std::string& key,
                          int start_time,
                          int end_time,
                          meshDisplacementCacheManager& cache_manager)
{
    JsonNode * base_obj =  GetJSONNodeFromKey(json_obj, key);

    cache_manager.init(start_time, end_time);
    
    for (JsonIterator it = JsonBegin(base_obj->value);
         it != JsonEnd(base_obj->value);
         ++it)
    {
        JsonNode * cur_node = *it;

        int cur_time = atoi(cur_node->key);
        std::vector<meshDisplacementCache> cache_list;
        
        for (JsonIterator mesh_it = JsonBegin(cur_node->value);
             mesh_it != JsonEnd(cur_node->value);
             ++mesh_it)
        {
            JsonNode * mesh_node = *mesh_it;
            
            std::string cur_name(mesh_node->key);
            
            meshDisplacementCache cache_data(cur_name);
            
            bool use_local_displacement = GetJSONNodeFromKey(*mesh_node, "use_local_displacements")->value.toBool();
            bool use_post_displacement = GetJSONNodeFromKey(*mesh_node, "use_post_displacements")->value.toBool();
            
            if(use_local_displacement) {
                std::vector<glm::vec2> read_pts = ReadJSONPoints2DVector(*mesh_node, "local_displacements");
                cache_data.setLocalDisplacements(read_pts);
            }
            
            if(use_post_displacement) {
                std::vector<glm::vec2> read_pts = ReadJSONPoints2DVector(*mesh_node, "post_displacements");
                cache_data.setPostDisplacements(read_pts);
            }
            
            cache_list.push_back(cache_data);
        }
        
        int set_index = cache_manager.getIndexByTime(cur_time);
        cache_manager.getCacheTable()[set_index] = cache_list;
    }
    
    cache_manager.makeAllReady();
}
Пример #6
0
static void FillUVSwapCache(JsonNode& json_obj,
                            const std::string& key,
                            int start_time,
                            int end_time,
                            meshUVWarpCacheManager& cache_manager)
{
    JsonNode * base_obj =  GetJSONNodeFromKey(json_obj, key);

    cache_manager.init(start_time, end_time);
    
    for (JsonIterator it = JsonBegin(base_obj->value);
         it != JsonEnd(base_obj->value);
         ++it)
    {
        JsonNode * cur_node = *it;

        int cur_time = atoi(cur_node->key);
        std::vector<meshUVWarpCache> cache_list;
        
        for (JsonIterator uv_it = JsonBegin(cur_node->value);
             uv_it != JsonEnd(cur_node->value);
             ++uv_it)
        {
            JsonNode * uv_node = *uv_it;
            
            std::string cur_name(uv_node->key);

            meshUVWarpCache cache_data(cur_name);
            bool use_uv = GetJSONNodeFromKey(*uv_node, "enabled")->value.toBool();
            cache_data.setEnabled(use_uv);
            if(use_uv) {
                glm::vec2 local_offset = ReadJSONVec2(*uv_node, "local_offset");
                glm::vec2 global_offset = ReadJSONVec2(*uv_node, "global_offset");
                glm::vec2 scale = ReadJSONVec2(*uv_node, "scale");
                cache_data.setUvWarpLocalOffset(local_offset);
                cache_data.setUvWarpGlobalOffset(global_offset);
                cache_data.setUvWarpScale(scale);
            }
            
            cache_list.push_back(cache_data);
        }
        
        int set_index = cache_manager.getIndexByTime(cur_time);
        cache_manager.getCacheTable()[set_index] = cache_list;
    }
    
    cache_manager.makeAllReady();
}
Пример #7
0
static void FillOpacityCache(JsonNode& json_obj,
	const std::string& key,
	int start_time,
	int end_time,
	meshOpacityCacheManager& cache_manager)
{
	JsonNode * base_obj = GetJSONNodeFromKey(json_obj, key);

	cache_manager.init(start_time, end_time);

	if (base_obj == NULL)
	{
		return;
	}

	for (JsonIterator it = JsonBegin(base_obj->value);
		it != JsonEnd(base_obj->value);
		++it)
	{
		JsonNode * cur_node = *it;

		int cur_time = atoi(cur_node->key);
		std::vector<meshOpacityCache> cache_list;

		for (JsonIterator uv_it = JsonBegin(cur_node->value);
			uv_it != JsonEnd(cur_node->value);
			++uv_it)
		{
			JsonNode * opacity_node = *uv_it;

			std::string cur_name(opacity_node->key);

			meshOpacityCache cache_data(cur_name);
			float cur_opacity = (float)GetJSONNodeFromKey(*opacity_node, "opacity")->value.toNumber();
			cache_data.setOpacity(cur_opacity);

			cache_list.push_back(cache_data);
		}

		int set_index = cache_manager.getIndexByTime(cur_time);
		cache_manager.getCacheTable()[set_index] = cache_list;
	}

	cache_manager.makeAllReady();

}
Пример #8
0
static void FillBoneCache(JsonNode& json_obj,
                          const std::string& key,
                          int start_time,
                          int end_time,
                          meshBoneCacheManager& cache_manager)
{
    JsonNode * base_obj =  GetJSONNodeFromKey(json_obj, key);

    cache_manager.init(start_time, end_time);
    
    for (JsonIterator it = JsonBegin(base_obj->value);
         it != JsonEnd(base_obj->value);
         ++it)
    {
        JsonNode * cur_node = *it;

        int cur_time = atoi(cur_node->key);
        std::vector<meshBoneCache> cache_list;
        
        for (JsonIterator bone_it = JsonBegin(cur_node->value);
             bone_it != JsonEnd(cur_node->value);
             ++bone_it)
        {
            JsonNode * bone_node = *bone_it;
            
            std::string cur_name(bone_node->key);
            glm::vec4 cur_start_pt = ReadJSONVec4_2(*bone_node, "start_pt");
            glm::vec4 cur_end_pt = ReadJSONVec4_2(*bone_node, "end_pt");
            
            meshBoneCache cache_data(cur_name);
            cache_data.setWorldStartPt(cur_start_pt);
            cache_data.setWorldEndPt(cur_end_pt);
            
            cache_list.push_back(cache_data);
        }
        
        int set_index = cache_manager.getIndexByTime(cur_time);
        cache_manager.getCacheTable()[set_index] = cache_list;
    }
    
    cache_manager.makeAllReady();
}
void LLPanelEmerald::onClickSetHDDInclude(void* user_data)
{
	LLPanelEmerald* self = (LLPanelEmerald*)user_data;

	std::string cur_name(gSavedSettings.getString("EmeraldHDDIncludeLocation"));
	std::string proposed_name(cur_name);
	
	LLDirPicker& picker = LLDirPicker::instance();
	if (! picker.getDir(&proposed_name ) )
	{
		return; //Canceled!
	}

	std::string dir_name = picker.getDirName();
	if (!dir_name.empty() && dir_name != cur_name)
	{
		self->childSetText("include_location", dir_name);
		gSavedSettings.setString("EmeraldHDDIncludeLocation", dir_name);
	}
}
Пример #10
0
void LLPanelEmerald::onClickSetXed(void* user_data)
{
	LLPanelEmerald* self = (LLPanelEmerald*)user_data;

	std::string cur_name(gSavedSettings.getString("EmeraldLSLExternalEditor"));
	
	LLFilePicker& picker = LLFilePicker::instance();
	if (! picker.getOpenFile(LLFilePicker::FFLOAD_APP) )
	{
		return; //Canceled!
	}
	std::string file_name = picker.getFirstFile();
	if (!file_name.empty() && file_name != cur_name)
	{
		self->childSetText("xed_location", file_name);
		gSavedSettings.setString("EmeraldLSLExternalEditor", file_name);
		
	} else {
		//self->childSetText("xed_location", " ");
	  gSavedSettings.setString("EmeraldLSLExternalEditor", " ");
	}
}
Пример #11
0
// static
void LLPanelNetwork::onClickSetSoundCache(void* user_data)
{
	LLPanelNetwork* self = (LLPanelNetwork*)user_data;

	std::string cur_name(gSavedSettings.getString("Emeraldmm_sndcacheloc"));
	std::string proposed_name(cur_name);
	
	LLDirPicker& picker = LLDirPicker::instance();
	if (! picker.getDir(&proposed_name ) )
	{
		return; //Canceled!
	}

	std::string dir_name = picker.getDirName();
	if (!dir_name.empty() && dir_name != cur_name)
	{
		self->childSetText("sound_cache_location", dir_name);
		gSavedSettings.setString("Emeraldmm_sndcacheloc", dir_name);
	}
	else
	{
		self->childSetText("sound_cache_location",cur_name);
	}
}
Пример #12
0
int Disp::readin(char *dirname)
{
    /*
     * in order to distinguish the topdir and following subdir,
     * use a static variable, tricky method.
     */
    static int open_cnt = 0;
    open_cnt++;
    DIR *dir = opendir(dirname);
    if (NULL == dir) {
        if (open_cnt == 1) {
            //open topdir failed, should exit program.
            cerr << "error when open topdir: " << dirname << endl;
            exit(-1);
        } else {
            //open subdir failed, no matter, treat it as empty, set the _fail
            _fail = 1;
            cerr << "error when open dir: " << dirname << endl;
            return FALSE;
        }
    }

    struct dirent * entry = NULL;
    while ((entry = readdir(dir)) != NULL)
    {
        if (strcmp(entry->d_name, ".") == 0 ||
            strcmp(entry->d_name, "..") == 0)
        {
            continue;
        }

        struct stat fs;
        mode_t type;
        string cur_name(entry->d_name);
        string path(_path);
        string new_path = path + "/" + cur_name;
        if (0 == stat(new_path.c_str(), &fs)) {
            type = fs.st_mode;
        }
        if (S_ISDIR(type) || S_ISREG(type))
        {
            int level = _level + 1;
            Disp * node = new Disp(new_path.c_str(), entry->d_name, type, level);
            if (NULL == node) {
                cerr << "malloc failed.\n";
                return FALSE;
            }

            insert(node);
        }
    }

    //close the current dir before go into the subdir
    closedir(dir);

    //after read the current dir, we go through the dirs in it
    //so, looks like recursively.
    My570ListElem *it = NULL;
    Disp *dt = NULL;
    int res = 0;
    if (_child == NULL) {
        return TRUE;
    }
    for (it = _child->First(); it != NULL; it = _child->Next(it)) 
    {
        dt = (Disp *)it->Obj();
        if (S_ISDIR(dt->_type)) {
            res = dt->readin();
            if (res == FALSE) {
                cerr << "error readin." << dt->_path << endl;
            }
        }
    }

    return TRUE;
}
Пример #13
0
static meshBone * CreateBones(JsonNode& json_obj,
                              const std::string& key)
{
    meshBone * root_bone = NULL;
    JsonNode * base_obj =  GetJSONLevelNodeFromKey(json_obj, key);
    std::map<int, std::pair<meshBone *, std::vector<int> > > bone_data;
    std::set<int> child_set;

    // layout bones
    for (JsonIterator it = JsonBegin(base_obj->value);
         it != JsonEnd(base_obj->value);
         ++it)
    {
        JsonNode * cur_node = *it;
        
        std::string cur_name(cur_node->key);
        int cur_id =  (int)GetJSONNodeFromKey(*cur_node, "id")->value.toNumber();
        glm::mat4 cur_parent_mat = ReadJSONMat4(*cur_node, "restParentMat");
        glm::vec4 cur_local_rest_start_pt = ReadJSONVec4_2(*cur_node, "localRestStartPt");
        glm::vec4 cur_local_rest_end_pt = ReadJSONVec4_2(*cur_node, "localRestEndPt");
        std::vector<int> cur_children_ids = ReadIntArray(*cur_node, "children");
        
        meshBone * new_bone = new meshBone(cur_name,
                                           glm::vec4(0),
                                           glm::vec4(0),
                                           cur_parent_mat);
        new_bone->getLocalRestStartPt() = cur_local_rest_start_pt;
        new_bone->getLocalRestEndPt() = cur_local_rest_end_pt;
        new_bone->calcRestData();
        new_bone->setTagId(cur_id);
        
        bone_data[cur_id] = std::make_pair(new_bone, cur_children_ids);
        
        for(auto& cur_child_id : cur_children_ids) {
            child_set.insert(cur_child_id);
        }
    }
    
    // Find root
    for(auto& cur_data : bone_data)
    {
        int cur_id = cur_data.first;
        if(child_set.count(cur_id) <= 0) {
            // not a child, so is root
            root_bone = cur_data.second.first;
            break;
        }
    }
    
    // construct hierarchy
    for(auto& cur_data : bone_data)
    {
        meshBone * cur_bone = cur_data.second.first;
        const std::vector<int>& children_ids = cur_data.second.second;
        for(auto& cur_child_id : children_ids)
        {
            meshBone * child_bone = bone_data[cur_child_id].first;
            cur_bone->addChild(child_bone);
        }

    }
    
    return root_bone;
}
Пример #14
0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Update all (already compiled) scene meshes on render-server (finally sends one LOAD_MESH packet for global mesh and one for each scattered mesh)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MeshManager::server_update_mesh(::OctaneEngine::OctaneClient *server, Scene *scene, Progress& progress, uint32_t frame_idx, uint32_t total_frames) {
	if(!need_update) return;
    if(total_frames <= 1)
        need_update = false;
	progress.set_status("Loading Meshes to render-server", "");

    uint64_t ulGlobalCnt    = 0;
    uint64_t ulLocalCnt     = 0;
    uint64_t ulLocalVdbCnt  = 0;
    bool global_update      = false;

    if(need_global_update) {
        global_update       = need_global_update;
        need_global_update  = false;
    }
    vector<Mesh*>::iterator it;
    for(it = scene->meshes.begin(); it != scene->meshes.end(); ++it) {
        Mesh *mesh = *it;
        if(mesh->empty) {
        	if(mesh->need_update) mesh->need_update = false;
            continue;
        }
        else if(scene->meshes_type == Mesh::GLOBAL || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::GLOBAL)) {
            if(mesh->vdb_regular_grid) ++ulLocalVdbCnt;
            else if(total_frames <= 1 && (scene->first_frame || scene->anim_mode == FULL)) {
                ++ulGlobalCnt;
                if(mesh->need_update && !global_update) global_update = true;
            }
            continue;
        }
        if(!mesh->need_update
           || (!scene->first_frame
               && (scene->anim_mode == CAM_ONLY
                   || (scene->anim_mode == MOVABLE_PROXIES
                       && scene->meshes_type != Mesh::RESHAPABLE_PROXY && (scene->meshes_type != Mesh::AS_IS || mesh->mesh_type != Mesh::RESHAPABLE_PROXY)))))
            continue;

        if(mesh->vdb_regular_grid) ++ulLocalVdbCnt;
        else ++ulLocalCnt;

		if(progress.get_cancel()) return;
	}

    bool interrupted = false;

    if(ulLocalCnt) {
        char            **mesh_names                    = new char*[ulLocalCnt];
        uint64_t        *used_shaders_size              = new uint64_t[ulLocalCnt];
        uint64_t        *used_objects_size              = new uint64_t[ulLocalCnt];
        vector<string>  *shader_names                   = new vector<string>[ulLocalCnt];
        vector<string>  *object_names                   = new vector<string>[ulLocalCnt];
        float3          **points                        = new float3*[ulLocalCnt];
        uint64_t        *points_size                    = new uint64_t[ulLocalCnt];
        float3          **normals                       = new float3*[ulLocalCnt];
        uint64_t        *normals_size                   = new uint64_t[ulLocalCnt];
        int             **points_indices                = new int*[ulLocalCnt];
        int             **normals_indices               = new int*[ulLocalCnt];
        uint64_t        *points_indices_size            = new uint64_t[ulLocalCnt];
        uint64_t        *normals_indices_size           = new uint64_t[ulLocalCnt];
        int             **vert_per_poly                 = new int*[ulLocalCnt];
        uint64_t        *vert_per_poly_size             = new uint64_t[ulLocalCnt];
        int             **poly_mat_index                = new int*[ulLocalCnt];
        int             **poly_obj_index                = new int*[ulLocalCnt];
        float3          **uvs                           = new float3*[ulLocalCnt];
        uint64_t        *uvs_size                       = new uint64_t[ulLocalCnt];
        int             **uv_indices                    = new int*[ulLocalCnt];
        uint64_t        *uv_indices_size                = new uint64_t[ulLocalCnt];
        bool            *open_subd_enable               = new bool[ulLocalCnt];
        int32_t         *open_subd_scheme               = new int32_t[ulLocalCnt];
        int32_t         *open_subd_level                = new int32_t[ulLocalCnt];
        float           *open_subd_sharpness            = new float[ulLocalCnt];
        int32_t         *open_subd_bound_interp         = new int32_t[ulLocalCnt];
        uint64_t        *open_subd_crease_indices_cnt   = new uint64_t[ulLocalCnt];
        int             **open_subd_crease_indices      = new int*[ulLocalCnt];
        float           **open_subd_crease_sharpnesses  = new float*[ulLocalCnt];
        float           *general_vis                    = new float[ulLocalCnt];
        bool            *cam_vis                        = new bool[ulLocalCnt];
        bool            *shadow_vis                     = new bool[ulLocalCnt];
        int32_t         *rand_color_seed                = new int32_t[ulLocalCnt];
        bool            *reshapable                     = new bool[ulLocalCnt];
        int32_t         *layer_number                   = new int32_t[ulLocalCnt];
        int32_t         *baking_group_id                = new int32_t[ulLocalCnt];
        float           *max_smooth_angle               = new float[ulLocalCnt];

        float3          **hair_points                   = new float3*[ulLocalCnt];
        uint64_t        *hair_points_size               = new uint64_t[ulLocalCnt];
        uint64_t        *hair_ws_size                   = new uint64_t[ulLocalCnt];
        int32_t         **vert_per_hair                 = new int32_t*[ulLocalCnt];
        uint64_t        *vert_per_hair_size             = new uint64_t[ulLocalCnt];
        float           **hair_thickness                = new float*[ulLocalCnt];
        int32_t         **hair_mat_indices              = new int32_t*[ulLocalCnt];
        float2          **hair_uvs                      = new float2*[ulLocalCnt];
        float2          **hair_ws                       = new float2*[ulLocalCnt];
        int32_t         *hair_interpolation             = new int32_t[ulLocalCnt];

        uint64_t i = 0;
        vector<Mesh*>::iterator it;
        for(it = scene->meshes.begin(); it != scene->meshes.end(); ++it) {
            Mesh *mesh = *it;
            if(mesh->vdb_regular_grid) continue;
            if(mesh->empty || !mesh->need_update
               || (scene->meshes_type == Mesh::GLOBAL || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::GLOBAL))
               || (!scene->first_frame
                   && (scene->anim_mode == CAM_ONLY
                       || (scene->anim_mode == MOVABLE_PROXIES
                           && scene->meshes_type != Mesh::RESHAPABLE_PROXY && (scene->meshes_type != Mesh::AS_IS || mesh->mesh_type != Mesh::RESHAPABLE_PROXY))))) continue;

            if(scene->meshes_type == Mesh::SCATTER || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::SCATTER))
                progress.set_status("Loading Meshes to render-server", string("Scatter: ") + mesh->nice_name.c_str());
            else if(scene->meshes_type == Mesh::MOVABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::MOVABLE_PROXY))
                progress.set_status("Loading Meshes to render-server", string("Movable: ") + mesh->nice_name.c_str());
            else if(scene->meshes_type == Mesh::RESHAPABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::RESHAPABLE_PROXY))
                progress.set_status("Loading Meshes to render-server", string("Reshapable: ") + mesh->nice_name.c_str());

            used_shaders_size[i] = mesh->used_shaders.size();
            for(size_t n=0; n<used_shaders_size[i]; ++n) {
                shader_names[i].push_back(scene->shaders[mesh->used_shaders[n]]->name);
            }

            used_objects_size[i] = 1;
            object_names[i].push_back("__" + mesh->name);

            mesh_names[i]                   = (char*)mesh->name.c_str();
            points[i]                       = &mesh->points[0];
            points_size[i]                  = mesh->points.size();
            normals[i]                      = &mesh->normals[0];
            normals_size[i]                 = mesh->normals.size();
            points_indices[i]               = &mesh->points_indices[0];
            normals_indices[i]              = &mesh->points_indices[0];
            points_indices_size[i]          = mesh->points_indices.size();
            normals_indices_size[i]         = 0;//mesh->points_indices.size();
            vert_per_poly[i]                = &mesh->vert_per_poly[0];
            vert_per_poly_size[i]           = mesh->vert_per_poly.size();
            poly_mat_index[i]               = &mesh->poly_mat_index[0];
            poly_obj_index[i]               = &mesh->poly_obj_index[0];
            uvs[i]                          = &mesh->uvs[0];
            uvs_size[i]                     = mesh->uvs.size();
            uv_indices[i]                   = &mesh->uv_indices[0];
            uv_indices_size[i]              = mesh->uv_indices.size();
            open_subd_enable[i]             = mesh->open_subd_enable;
            open_subd_scheme[i]             = mesh->open_subd_scheme;
            open_subd_level[i]              = mesh->open_subd_level;
            open_subd_sharpness[i]          = mesh->open_subd_sharpness;
            open_subd_bound_interp[i]       = mesh->open_subd_bound_interp;
            open_subd_crease_indices_cnt[i] = mesh->open_subd_crease_indices.size() / 2;
            if(open_subd_crease_indices_cnt[i]) {
                open_subd_crease_indices[i]     = &mesh->open_subd_crease_indices[0];
                open_subd_crease_sharpnesses[i] = &mesh->open_subd_crease_sharpnesses[0];
            }
            else {
                open_subd_crease_indices[i]     = nullptr;
                open_subd_crease_sharpnesses[i] = nullptr;
            }
            general_vis[i]                  = mesh->vis_general;
            cam_vis[i]                      = mesh->vis_cam;
            shadow_vis[i]                   = mesh->vis_shadow;
            rand_color_seed[i]              = mesh->rand_color_seed;
            reshapable[i]                   = (scene->meshes_type == Mesh::RESHAPABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::RESHAPABLE_PROXY));
            layer_number[i]                 = (scene->kernel->oct_node->bLayersEnable ? mesh->layer_number : 1);
            baking_group_id[i]              = mesh->baking_group_id;
            max_smooth_angle[i]             = mesh->max_smooth_angle;

            hair_points_size[i]             = mesh->hair_points.size();
            hair_ws_size[i]                 = mesh->hair_interpolation == (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_NONE ? mesh->hair_ws.size() : 0;
            hair_points[i]                  = hair_points_size[i] ? &mesh->hair_points[0] : 0;
            vert_per_hair_size[i]           = mesh->vert_per_hair.size();
            vert_per_hair[i]                = vert_per_hair_size[i] ? &mesh->vert_per_hair[0] : 0;
            hair_thickness[i]               = hair_points_size[i] ? &mesh->hair_thickness[0] : 0;
            hair_mat_indices[i]             = vert_per_hair_size[i] ? &mesh->hair_mat_indices[0] : 0;
            hair_uvs[i]                     = vert_per_hair_size[i] ? &mesh->hair_uvs[0] : 0;
            hair_ws[i]                      = hair_ws_size[i] ? &mesh->hair_ws[0] : 0;
            hair_interpolation[i]           = mesh->hair_interpolation == (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_NONE ? (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_DEFAULT : mesh->hair_interpolation;

            if(mesh->need_update
               && (total_frames <= 1 || !reshapable[i]))
                mesh->need_update = false;
    		if(progress.get_cancel()) {
                interrupted = true;
                break;
            }
            ++i;
	    }
        if(i && !interrupted) {
            progress.set_status("Loading Meshes to render-server", "Transferring...");
            server->uploadMesh(false, frame_idx, total_frames, ulLocalCnt, mesh_names,
                                        used_shaders_size,
                                        used_objects_size,
                                        shader_names,
                                        object_names,
                                        (::OctaneEngine::float_3**)points,
                                        points_size,
                                        (::OctaneEngine::float_3**)normals,
                                        normals_size,
                                        points_indices,
                                        normals_indices,
                                        points_indices_size,
                                        normals_indices_size,
                                        vert_per_poly,
                                        vert_per_poly_size,
                                        poly_mat_index,
                                        poly_obj_index,
                                        (::OctaneEngine::float_3**)uvs,
                                        uvs_size,
                                        uv_indices,
                                        uv_indices_size,
                                        (::OctaneEngine::float_3**)hair_points, hair_points_size, hair_ws_size,
                                        vert_per_hair, vert_per_hair_size,
                                        hair_thickness, hair_mat_indices, (::OctaneEngine::float_2**)hair_uvs, (::OctaneEngine::float_2**)hair_ws, hair_interpolation,
                                        open_subd_enable,
                                        open_subd_scheme,
                                        open_subd_level,
                                        open_subd_sharpness,
                                        open_subd_bound_interp,
                                        open_subd_crease_indices_cnt,
                                        open_subd_crease_indices,
                                        open_subd_crease_sharpnesses,
                                        layer_number,
                                        baking_group_id,
                                        general_vis,
                                        cam_vis,
                                        shadow_vis,
                                        rand_color_seed,
                                        reshapable,
                                        max_smooth_angle);
        }
        delete[] mesh_names;
        delete[] used_shaders_size;
        delete[] used_objects_size;
        delete[] shader_names;
        delete[] object_names;
        delete[] points;
        delete[] points_size;
        delete[] normals;
        delete[] normals_size;
        delete[] points_indices;
        delete[] normals_indices;
        delete[] points_indices_size;
        delete[] normals_indices_size;
        delete[] vert_per_poly;
        delete[] vert_per_poly_size;
        delete[] poly_mat_index;
        delete[] poly_obj_index;
        delete[] uvs;
        delete[] uvs_size;
        delete[] uv_indices;
        delete[] uv_indices_size;
        delete[] open_subd_enable;
        delete[] open_subd_scheme;
        delete[] open_subd_level;
        delete[] open_subd_sharpness;
        delete[] open_subd_bound_interp;
        delete[] open_subd_crease_indices_cnt;
        delete[] open_subd_crease_indices;
        delete[] open_subd_crease_sharpnesses;
        delete[] general_vis;
        delete[] cam_vis;
        delete[] shadow_vis;
        delete[] rand_color_seed;
        delete[] reshapable;
        delete[] layer_number;
        delete[] baking_group_id;
        delete[] max_smooth_angle;
        delete[] hair_interpolation;

        delete[] hair_points_size;
        delete[] hair_ws_size;
        delete[] vert_per_hair_size;
        delete[] hair_points;
        delete[] vert_per_hair;
        delete[] hair_thickness;
        delete[] hair_mat_indices;
        delete[] hair_uvs;
        delete[] hair_ws;
    }

    if(ulLocalVdbCnt && !interrupted) {
        uint64_t i = 0;
        vector<Mesh*>::iterator it;
        for(it = scene->meshes.begin(); it != scene->meshes.end(); ++it) {
            Mesh *mesh = *it;
            if(!mesh->vdb_regular_grid) continue;
            if(mesh->empty || !mesh->need_update
               //|| (scene->meshes_type == Mesh::GLOBAL || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::GLOBAL))
               || (!scene->first_frame
                   && (scene->anim_mode == CAM_ONLY
                       || (scene->anim_mode == MOVABLE_PROXIES
                           && scene->meshes_type != Mesh::RESHAPABLE_PROXY && (scene->meshes_type != Mesh::AS_IS || mesh->mesh_type != Mesh::RESHAPABLE_PROXY))))) continue;

            if(scene->meshes_type == Mesh::SCATTER || scene->meshes_type == Mesh::GLOBAL || scene->meshes_type == Mesh::GLOBAL || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::SCATTER))
                progress.set_status("Loading Volumes to render-server", string("Scatter: ") + mesh->nice_name.c_str());
            else if(scene->meshes_type == Mesh::MOVABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::MOVABLE_PROXY))
                progress.set_status("Loading Volumes to render-server", string("Movable: ") + mesh->nice_name.c_str());
            else if(scene->meshes_type == Mesh::RESHAPABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::RESHAPABLE_PROXY))
                progress.set_status("Loading Volumes to render-server", string("Reshapable: ") + mesh->nice_name.c_str());

            ::OctaneEngine::OctaneVolume volume;

            volume.sName                = mesh->name;
            volume.pfRegularGrid        = mesh->vdb_regular_grid;
            volume.iGridSize            = mesh->vdb_grid_size;
            volume.f3Resolution         = {mesh->vdb_resolution.x, mesh->vdb_resolution.y, mesh->vdb_resolution.z};
            volume.gridMatrix           = mesh->vdb_grid_matrix;
            volume.fISO                 = mesh->vdb_iso;
            volume.iAbsorptionOffset    = mesh->vdb_absorption_offset;
            volume.fAbsorptionScale     = mesh->vdb_absorption_scale;
            volume.iEmissionOffset      = mesh->vdb_emission_offset;
            volume.fEmissionScale       = mesh->vdb_emission_scale;
            volume.iScatterOffset       = mesh->vdb_scatter_offset;
            volume.fScatterScale        = mesh->vdb_scatter_scale;
            volume.iVelocityOffsetX     = mesh->vdb_velocity_x_offset;
            volume.iVelocityOffsetY     = mesh->vdb_velocity_y_offset;
            volume.iVelocityOffsetZ     = mesh->vdb_velocity_z_offset;
            volume.fVelocityScale       = mesh->vdb_velocity_scale;

            volume.fGenVisibility       = mesh->vis_general;
            volume.bCamVisibility       = mesh->vis_cam;
            volume.bShadowVisibility    = mesh->vis_shadow;
            volume.iRandomColorSeed     = mesh->rand_color_seed;
            volume.iLayerNumber         = (scene->kernel->oct_node->bLayersEnable ? mesh->layer_number : 1);
            volume.iBakingGroupId       = mesh->baking_group_id;

            if(mesh->used_shaders.size())
                volume.sMedium = scene->shaders[mesh->used_shaders[0]]->name;

            if(mesh->need_update && (total_frames <= 1 || !(scene->meshes_type == Mesh::RESHAPABLE_PROXY || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type == Mesh::RESHAPABLE_PROXY))))
                mesh->need_update = false;
    		if(progress.get_cancel()) {
                interrupted = true;
                break;
            }
            ++i;

            progress.set_status("Loading Volumes to render-server", "Transferring...");
            server->uploadVolume(&volume);
        }
    }

    if(global_update && !interrupted) {
        progress.set_status("Loading global Mesh to render-server", "");
        uint64_t obj_cnt = 0;
        for(map<std::string, vector<Object*> >::const_iterator obj_it = scene->objects.begin(); obj_it != scene->objects.end(); ++obj_it) {
            Mesh* mesh = obj_it->second.size() > 0 ? obj_it->second[0]->mesh : 0;
            if(mesh->vdb_regular_grid) continue;

            if(!mesh || mesh->empty
               || (!scene->first_frame && scene->anim_mode != FULL)
               || (scene->meshes_type == Mesh::SCATTER || scene->meshes_type == Mesh::MOVABLE_PROXY || scene->meshes_type == Mesh::RESHAPABLE_PROXY)
               || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type != Mesh::GLOBAL)) continue;

            for(vector<Object*>::const_iterator it = obj_it->second.begin(); it != obj_it->second.end(); ++it) {
    		    Object *mesh_object = *it;
                if(!mesh_object->visibility) continue;
                ++obj_cnt;
            }
        }
        char* name = "__global";
        if(obj_cnt > 0) {
            uint64_t        *used_shaders_size              = new uint64_t[obj_cnt];
            uint64_t        *used_objects_size              = new uint64_t[obj_cnt];
            vector<string>  *shader_names                   = new vector<string>[obj_cnt];
            vector<string>  *object_names                   = new vector<string>[obj_cnt];
            float3          **points                        = new float3*[obj_cnt];
            for(int k = 0; k < obj_cnt; ++k) points[k] = 0;
            uint64_t        *points_size                    = new uint64_t[obj_cnt];
            float3          **normals                       = new float3*[obj_cnt];
            for(int k = 0; k < obj_cnt; ++k) normals[k] = 0;
            uint64_t        *normals_size                   = new uint64_t[obj_cnt];
            int             **points_indices                = new int*[obj_cnt];
            int             **normals_indices               = new int*[obj_cnt];
            uint64_t        *points_indices_size            = new uint64_t[obj_cnt];
            uint64_t        *normals_indices_size           = new uint64_t[obj_cnt];
            int             **vert_per_poly                 = new int*[obj_cnt];
            uint64_t        *vert_per_poly_size             = new uint64_t[obj_cnt];
            int             **poly_mat_index                = new int*[obj_cnt];
            int             **poly_obj_index                = new int*[obj_cnt];
            float3          **uvs                           = new float3*[obj_cnt];
            uint64_t        *uvs_size                       = new uint64_t[obj_cnt];
            int             **uv_indices                    = new int*[obj_cnt];
            uint64_t        *uv_indices_size                = new uint64_t[obj_cnt];
            bool            *open_subd_enable               = new bool[obj_cnt];
            int32_t         *open_subd_scheme               = new int32_t[obj_cnt];
            int32_t         *open_subd_level                = new int32_t[obj_cnt];
            float           *open_subd_sharpness            = new float[obj_cnt];
            int32_t         *open_subd_bound_interp         = new int32_t[obj_cnt];
            uint64_t        *open_subd_crease_indices_cnt   = new uint64_t[obj_cnt];
            int             **open_subd_crease_indices      = new int*[obj_cnt];
            float           **open_subd_crease_sharpnesses  = new float*[obj_cnt];
            float           *general_vis                    = new float[obj_cnt];
            bool            *cam_vis                        = new bool[obj_cnt];
            bool            *shadow_vis                     = new bool[obj_cnt];
            int32_t         *rand_color_seed                = new int32_t[obj_cnt];
            bool            *reshapable                     = new bool[obj_cnt];
            int32_t         *layer_number                   = new int32_t[obj_cnt];
            int32_t         *baking_group_id                = new int32_t[obj_cnt];
            float           *max_smooth_angle               = new float[obj_cnt];

            float3          **hair_points                   = new float3*[obj_cnt];
            uint64_t        *hair_points_size               = new uint64_t[obj_cnt];
            uint64_t        *hair_ws_size                   = new uint64_t[obj_cnt];
            int32_t         **vert_per_hair                 = new int32_t*[obj_cnt];
            uint64_t        *vert_per_hair_size             = new uint64_t[obj_cnt];
            float           **hair_thickness                = new float*[obj_cnt];
            int32_t         **hair_mat_indices              = new int32_t*[obj_cnt];
            float2          **hair_uvs                      = new float2*[obj_cnt];
            int32_t         *hair_interpolation             = new int32_t[obj_cnt];
            float2          **hair_ws                       = new float2*[obj_cnt];

            obj_cnt = 0;
            bool hair_present = false;
            for(map<std::string, vector<Object*> >::const_iterator obj_it = scene->objects.begin(); obj_it != scene->objects.end(); ++obj_it) {
                Mesh* mesh = obj_it->second.size() > 0 ? obj_it->second[0]->mesh : 0;
                if(mesh->vdb_regular_grid) continue;

                if(!mesh || mesh->empty
                   || (!scene->first_frame && scene->anim_mode != FULL)
                   || (scene->meshes_type == Mesh::SCATTER || scene->meshes_type == Mesh::MOVABLE_PROXY || scene->meshes_type == Mesh::RESHAPABLE_PROXY)
                   || (scene->meshes_type == Mesh::AS_IS && mesh->mesh_type != oct::Mesh::GLOBAL)) continue;

                for(vector<Object*>::const_iterator it = obj_it->second.begin(); it != obj_it->second.end(); ++it) {
    		        Object *mesh_object = *it;
                    if(!mesh_object->visibility) continue;

                    Transform &tfm = mesh_object->tfm;

                    used_shaders_size[obj_cnt] = mesh_object->used_shaders.size();
                    for(size_t n=0; n<used_shaders_size[obj_cnt]; ++n) {
                        shader_names[obj_cnt].push_back(scene->shaders[mesh_object->used_shaders[n]]->name);
                    }

                    used_objects_size[obj_cnt] = 1;
                    object_names[obj_cnt].push_back("__" + mesh->name);

                    size_t points_cnt             = mesh->points.size();
                    points[obj_cnt]               = new float3[points_cnt];
                    float3 *p                     = &mesh->points[0];
                    for(size_t k=0; k<points_cnt; ++k) points[obj_cnt][k] = transform_point(&tfm, p[k]);
                    points_size[obj_cnt]          = points_cnt;

                    size_t norm_cnt               = mesh->normals.size();
                    normals[obj_cnt]              = new float3[norm_cnt];
                    float3 *n                     = &mesh->normals[0];
                    for(size_t k=0; k<norm_cnt; ++k) normals[obj_cnt][k] = transform_direction(&tfm, n[k]);
                    normals_size[obj_cnt]         = norm_cnt;

                    points_indices[obj_cnt]                 = &mesh->points_indices[0];
                    normals_indices[obj_cnt]                = &mesh->points_indices[0];
                    points_indices_size[obj_cnt]            = mesh->points_indices.size();
                    normals_indices_size[obj_cnt]           = 0;
                    vert_per_poly[obj_cnt]                  = &mesh->vert_per_poly[0];
                    vert_per_poly_size[obj_cnt]             = mesh->vert_per_poly.size();
                    poly_mat_index[obj_cnt]                 = &mesh->poly_mat_index[0];
                    poly_obj_index[obj_cnt]                 = &mesh->poly_obj_index[0];
                    uvs[obj_cnt]                            = &mesh->uvs[0];
                    uvs_size[obj_cnt]                       = mesh->uvs.size();
                    uv_indices[obj_cnt]                     = &mesh->uv_indices[0];
                    uv_indices_size[obj_cnt]                = mesh->uv_indices.size();
                    open_subd_enable[obj_cnt]               = mesh->open_subd_enable;
                    open_subd_scheme[obj_cnt]               = mesh->open_subd_scheme;
                    open_subd_level[obj_cnt]                = mesh->open_subd_level;
                    open_subd_sharpness[obj_cnt]            = mesh->open_subd_sharpness;
                    open_subd_bound_interp[obj_cnt]         = mesh->open_subd_bound_interp;
                    open_subd_crease_indices_cnt[obj_cnt]   = mesh->open_subd_crease_indices.size() / 2;
                    if(open_subd_crease_indices_cnt[obj_cnt]) {
                        open_subd_crease_indices[obj_cnt]       = &mesh->open_subd_crease_indices[0];
                        open_subd_crease_sharpnesses[obj_cnt]   = &mesh->open_subd_crease_sharpnesses[0];
                    }
                    else {
                        open_subd_crease_indices[obj_cnt]     = nullptr;
                        open_subd_crease_sharpnesses[obj_cnt] = nullptr;
                    }
                    general_vis[obj_cnt]                    = mesh->vis_general;
                    cam_vis[obj_cnt]                        = mesh->vis_cam;
                    shadow_vis[obj_cnt]                     = mesh->vis_shadow;
                    rand_color_seed[obj_cnt]                = mesh->rand_color_seed;
                    reshapable[obj_cnt]                     = false;
                    layer_number[obj_cnt]                   = (scene->kernel->oct_node->bLayersEnable ? mesh->layer_number : 1);
                    baking_group_id[obj_cnt]                = mesh->baking_group_id;
                    max_smooth_angle[obj_cnt]               = mesh->max_smooth_angle;

                    hair_points_size[obj_cnt]               = mesh->hair_points.size();
                    hair_ws_size[obj_cnt]                   = mesh->hair_interpolation == (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_NONE ? mesh->hair_ws.size() : 0;
                    hair_points[obj_cnt]                    = hair_points_size[obj_cnt] ? &mesh->hair_points[0] : 0;
                    vert_per_hair_size[obj_cnt]             = mesh->vert_per_hair.size();
                    vert_per_hair[obj_cnt]                  = vert_per_hair_size[obj_cnt] ? &mesh->vert_per_hair[0] : 0;
                    hair_thickness[obj_cnt]                 = hair_points_size[obj_cnt] ? &mesh->hair_thickness[0] : 0;
                    hair_mat_indices[obj_cnt]               = vert_per_hair_size[obj_cnt] ? &mesh->hair_mat_indices[0] : 0;
                    hair_uvs[obj_cnt]                       = vert_per_hair_size[obj_cnt] ? &mesh->hair_uvs[0] : 0;
                    hair_interpolation[obj_cnt]             = mesh->hair_interpolation == (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_NONE ? (int32_t)::Octane::HairInterpolationType::HAIR_INTERP_DEFAULT : mesh->hair_interpolation;
                    hair_ws[obj_cnt]                        = hair_ws_size[obj_cnt] ? &mesh->hair_ws[0] : 0;

        	        if(mesh->need_update) mesh->need_update = false;
    		        if(progress.get_cancel()) {
                        interrupted = true;
                        break;
                    }
                    ++obj_cnt;

                    if(!hair_present && mesh->hair_points.size()) hair_present = true;
                }
            }
            if(obj_cnt && !interrupted) {
                if(hair_present) fprintf(stderr, "Octane: WARNING: hair can't be rendered on \"Global\" mesh\n");
            
                progress.set_status("Loading global Mesh to render-server", string("Transferring..."));
                server->uploadMesh(true, frame_idx, total_frames, obj_cnt, &name,
                                            used_shaders_size,
                                            used_objects_size,
                                            shader_names,
                                            object_names,
                                            (::OctaneEngine::float_3**)points,
                                            points_size,
                                            (::OctaneEngine::float_3**)normals,
                                            normals_size,
                                            points_indices,
                                            normals_indices,
                                            points_indices_size,
                                            normals_indices_size,
                                            vert_per_poly,
                                            vert_per_poly_size,
                                            poly_mat_index,
                                            poly_obj_index,
                                            (::OctaneEngine::float_3**)uvs,
                                            uvs_size,
                                            uv_indices,
                                            uv_indices_size,
                                            (::OctaneEngine::float_3**)hair_points, hair_points_size, hair_ws_size,
                                            vert_per_hair, vert_per_hair_size,
                                            hair_thickness, hair_mat_indices, (::OctaneEngine::float_2**)hair_uvs, (::OctaneEngine::float_2**)hair_ws, hair_interpolation,
                                            open_subd_enable,
                                            open_subd_scheme,
                                            open_subd_level,
                                            open_subd_sharpness,
                                            open_subd_bound_interp,
                                            open_subd_crease_indices_cnt,
                                            open_subd_crease_indices,
                                            open_subd_crease_sharpnesses,
                                            layer_number,
                                            baking_group_id,
                                            general_vis,
                                            cam_vis,
                                            shadow_vis,
                                            rand_color_seed,
                                            reshapable,
                                            max_smooth_angle);
                server->uploadLayerMap(true, "__global_lm", name, static_cast< ::OctaneEngine::int32_t>(obj_cnt), layer_number, baking_group_id, general_vis, cam_vis, shadow_vis, static_cast< ::OctaneEngine::int32_t*>(rand_color_seed));
            }
            delete[] used_shaders_size;
            delete[] used_objects_size;
            delete[] shader_names;
            delete[] object_names;
            for(int k = 0; k < obj_cnt; ++k) {
                if(points[k]) delete[] points[k];
            }
            delete[] points;
            delete[] points_size;
            for(int k = 0; k < obj_cnt; ++k) {
                if(normals[k]) delete[] normals[k];
            }
            delete[] normals;
            delete[] normals_size;
            delete[] points_indices;
            delete[] normals_indices;
            delete[] points_indices_size;
            delete[] normals_indices_size;
            delete[] vert_per_poly;
            delete[] vert_per_poly_size;
            delete[] poly_mat_index;
            delete[] poly_obj_index;
            delete[] uvs;
            delete[] uvs_size;
            delete[] uv_indices;
            delete[] uv_indices_size;
            delete[] open_subd_enable;
            delete[] open_subd_scheme;
            delete[] open_subd_level;
            delete[] open_subd_sharpness;
            delete[] open_subd_bound_interp;
            delete[] open_subd_crease_indices_cnt;
            delete[] open_subd_crease_indices;
            delete[] open_subd_crease_sharpnesses;
            delete[] general_vis;
            delete[] cam_vis;
            delete[] shadow_vis;
            delete[] rand_color_seed;
            delete[] reshapable;
            delete[] layer_number;
            delete[] baking_group_id;
            delete[] max_smooth_angle;

            delete[] hair_points_size;
            delete[] hair_ws_size;
            delete[] vert_per_hair_size;
            delete[] hair_points;
            delete[] vert_per_hair;
            delete[] hair_thickness;
            delete[] hair_mat_indices;
            delete[] hair_uvs;
            delete[] hair_ws;
            delete[] hair_interpolation;
        }
        else ulGlobalCnt = 0;
    }
    std::string cur_name("__global");
    if(!ulGlobalCnt && scene->anim_mode == FULL) server->deleteMesh(true, cur_name);
	//need_update = false;
} //server_update_mesh()
Пример #15
0
int
main(
	int argc,
	char **argv
)
try
{
	if(
		argc != 2
	)
	{
		fcppt::io::cerr()
			<< FCPPT_TEXT("Usage: ")
			<< argv[0]
			<< FCPPT_TEXT(" <dir1>\n");

		return EXIT_FAILURE;
	}

	boost::filesystem::path const dir(
		fcppt::from_std_string(
			argv[1]
		)
	);

	for(
		boost::filesystem::recursive_directory_iterator dir_it(
			dir
		),
		dir_end;
		dir_it != dir_end;
		++dir_it
	)
	{
		if(
			!needs_header(
				dir_it->path()
			)
		)
			continue;

		boost::filesystem::path const header(
			make_header(
				dir_it->path()
			)
		);

		fcppt::filesystem::ofstream file(
			header,
			std::ios_base::trunc
		);

		string_vector filenames;

		if(
			!file.is_open()
		)
		{
			fcppt::io::cerr()
				<< FCPPT_TEXT("Failed to open ")
				<< header
				<< FCPPT_TEXT('\n');

			return EXIT_FAILURE;
		}

		for(
			boost::filesystem::directory_iterator file_it(
				dir_it->path()
			),
			file_end;
			file_it != file_end;
			++file_it
		)
		{
			if(
				file_it->path()
				== header
			)
				continue;

			if(
				needs_header(
					file_it->path()
				)
			)
				filenames.push_back(
					fcppt::filesystem::path_to_string(
						make_header(
							file_it->path()
						)
					)
				);
			else if(
				!boost::filesystem::is_directory(
					file_it->path()
				)
			)
				filenames.push_back(
					fcppt::filesystem::path_to_string(
						file_it->path()
					)
				);
		}

		std::sort(
			filenames.begin(),
			filenames.end()
		);

		fcppt::string const include_guard_name(
			make_include_guard(
				header
			)
		);

		file
			<< FCPPT_TEXT("#ifndef ")
			<< include_guard_name
			<< FCPPT_TEXT("\n#define ")
			<< include_guard_name
			<< FCPPT_TEXT("\n\n");

		for(
			string_vector::const_iterator cur_name(
				filenames.begin()
			);
			cur_name != filenames.end();
			++cur_name
		)
			file
				<< FCPPT_TEXT("#include <")
				<< *cur_name
				<< FCPPT_TEXT(">\n");

		file
			<< FCPPT_TEXT("\n#endif\n");
	}
}
catch(
	fcppt::exception const &_error
)
{
	fcppt::io::cerr()
		<< _error.string()
		<< FCPPT_TEXT('\n');

	return EXIT_FAILURE;
}
catch(
	std::exception const &_error
)
{
	std::cerr
		<< _error.what()
		<< '\n';

	return EXIT_FAILURE;
}
Пример #16
0
void			GUI_Prefs_Read(const char *app_name)
{
	sPrefs.clear();
	string pref_dir;
	if (!GUI_GetPrefsDir(pref_dir)) return;
	pref_dir += DIR_STR;
    #if LIN
    pref_dir += ".";
    pref_dir +=  app_name;
    #else
	pref_dir += app_name;
    #endif
	pref_dir += ".prefs";
	MFMemFile* f = MemFile_Open(pref_dir.c_str());
	GUI_PrefSection_t * cur=NULL;
	if(f)
	{
		const char * p = MemFile_GetBegin(f);
		const char * e = MemFile_GetEnd(f);
		while(p<e)
		{
			skip_space(p,e);
			if(p<e && *p=='[')
			{
				++p;
				const char * cs = p;
				while(p<e && !is_eol(*p) && *p != ']')
					++p;
				string cur_name(cs,p);
				cur=&sPrefs[cur_name];
			}
			else if(p<e && *p != '\r' && *p != '\n')
			{
				const char * ks = p;
				while(p<e && !is_spc(*p) && !is_eol(*p) && *p != '=')
				{
					if (*p=='\\')	++p;
					if(p<e)			++p;
				}

				const char * ke = p;
				skip_space(p,e);
				if(p<e && *p=='=')
				{
					++p;
					skip_space(p,e);
					if(p<e)
					{
						const char * vs = p;
						while(p<e && !is_spc(*p) && !is_eol(*p) && *p != '=')
						{
							if (*p=='\\')	++p;
							if(p<e)			++p;
						}
						const char * ve = p;
						if(cur)
						{
							string key(ks,ke);
							string val(vs,ve);
							dequote(key);
							dequote(val);
							(*cur)[key] = val;
						}
					}
				}
			}
			skip_eol(p,e);
		}
		MemFile_Close(f);
	}

	#if DEBUG_PREFS
	for(GUI_Prefs_t::iterator s = sPrefs.begin(); s != sPrefs.end(); ++s)
	{
		printf("[%s]" CRLF, s->first.c_str());
		for(GUI_PrefSection_t::iterator p = s->second.begin(); p != s->second.end(); ++p)
			printf("'%s'='%s'" CRLF, p->first.c_str(), p->second.c_str());
	}
	#endif
}