From 296c03a389076cf491a94f4d01b629ae335d027a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 18 Sep 2019 15:56:46 +0200 Subject: Subvid: Initial support of subdiv topology query Just some higher level functions to access topology information. --- source/blender/blenkernel/BKE_subdiv_topology.h | 31 ++++++++++++++++++++ source/blender/blenkernel/CMakeLists.txt | 2 ++ source/blender/blenkernel/intern/subdiv_topology.c | 34 ++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 source/blender/blenkernel/BKE_subdiv_topology.h create mode 100644 source/blender/blenkernel/intern/subdiv_topology.c diff --git a/source/blender/blenkernel/BKE_subdiv_topology.h b/source/blender/blenkernel/BKE_subdiv_topology.h new file mode 100644 index 00000000000..dd057d88fb6 --- /dev/null +++ b/source/blender/blenkernel/BKE_subdiv_topology.h @@ -0,0 +1,31 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2019 by Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup bke + */ + +#ifndef __BKE_SUBDIV_TOPOLOGY_H__ +#define __BKE_SUBDIV_TOPOLOGY_H__ + +struct Subdiv; + +int BKE_subdiv_topology_num_fvar_layers_get(const struct Subdiv *subdiv); + +#endif /* __BKE_SUBDIV_TOPOLOGY_H__ */ diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 16074cd3e37..e6360e1b511 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -211,6 +211,7 @@ set(SRC intern/subdiv_foreach.c intern/subdiv_mesh.c intern/subdiv_stats.c + intern/subdiv_topology.c intern/subsurf_ccg.c intern/suggestions.c intern/text.c @@ -342,6 +343,7 @@ set(SRC BKE_subdiv_eval.h BKE_subdiv_foreach.h BKE_subdiv_mesh.h + BKE_subdiv_topology.h BKE_subsurf.h BKE_suggestions.h BKE_text.h diff --git a/source/blender/blenkernel/intern/subdiv_topology.c b/source/blender/blenkernel/intern/subdiv_topology.c new file mode 100644 index 00000000000..455fa2cf28f --- /dev/null +++ b/source/blender/blenkernel/intern/subdiv_topology.c @@ -0,0 +1,34 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2019 by Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup bke + */ + +#include "BKE_subdiv_topology.h" + +#include "BKE_subdiv.h" + +#include "opensubdiv_topology_refiner_capi.h" + +int BKE_subdiv_topology_num_fvar_layers_get(const struct Subdiv *subdiv) +{ + OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner; + return topology_refiner->getNumFVarChannels(topology_refiner); +} -- cgit v1.2.3