This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/modifiers/intern/MOD_weightvg_util.h
Hans Goudey 9b099c8612 UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers.
It also moves modifier drawing to a callback in ModifierTypeInfo
in line with the extensible architecture refactoring goal T75724.

This adds a PanelRegister callback and utilities for registering
panels and subpanels. It also adds the callbacks for expansion saving
and drag and drop reordering described in D7490.

These utilities, callbacks, and other common UI elements shared
between modifiers live in MOD_ui_common.c.

Because modifier buttons are now in panels, we can make use of
subpanels for organization. The UI layouts also use the single
column layout style consistently used elsewhere in Blender.
Additionally, the mode-setting buttons are aligned and ordered
consistently with the outliner.

However, the large number of UI changes in this patch may mean
that additional polishing is required in master.

Thanks to William Reynish (@billreynish) who did a fair amount of the
layout work and to Julian Eisel (@Severin) for consistent help.

Differential Revision: https://developer.blender.org/D7498
2020-06-05 10:41:03 -04:00

96 lines
3.3 KiB
C++

/*
* 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) 2011 by Bastien Montagne.
* All rights reserved.
*/
/** \file
* \ingroup modifiers
*/
#ifndef __MOD_WEIGHTVG_UTIL_H__
#define __MOD_WEIGHTVG_UTIL_H__
struct CurveMapping;
struct MDeformVert;
struct MDeformWeight;
struct Mesh;
struct ModifierEvalContext;
struct Object;
struct PointerRNA;
struct RNG;
struct Scene;
struct Tex;
struct uiLayout;
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
* but couldn't figure a way to do this...
* Maybe this will need changes in mesh_calc_modifiers?
* Or the WeightPaint mode code itself?
*/
/**************************************
* Util functions. *
**************************************/
/* We cannot divide by zero (what a surprise...).
* So if -MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR < weightf < MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR,
* we clamp weightf to this value (or its negative version).
* Also used to avoid null power factor.
*/
#define MOD_WVG_ZEROFLOOR 1.0e-32f
void weightvg_do_map(int num,
float *new_w,
short mode,
const bool do_invert,
struct CurveMapping *cmap,
struct RNG *rng);
void weightvg_do_mask(const ModifierEvalContext *ctx,
const int num,
const int *indices,
float *org_w,
const float *new_w,
Object *ob,
struct Mesh *mesh,
const float fact,
const char defgrp_name[MAX_VGROUP_NAME],
struct Scene *scene,
Tex *texture,
const int tex_use_channel,
const int tex_mapping,
Object *tex_map_object,
const char *text_map_bone,
const char *tex_uvlayer_name,
const bool invert_vgroup_mask);
void weightvg_update_vg(struct MDeformVert *dvert,
int defgrp_idx,
struct MDeformWeight **dws,
int num,
const int *indices,
const float *weights,
const bool do_add,
const float add_thresh,
const bool do_rem,
const float rem_thresh,
const bool do_normalize);
void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
#endif /* __MOD_WEIGHTVG_UTIL_H__ */