forked from bartvdbraak/blender
RNA
* DNA_cloth_types.h, patch by Roelf de Kock. The gravity[3] member is not being parsed correct by makesdna.c and will give issues even when trying to fix it. Worked around it for now in RNA by wrapping it manually, but this should really be fixed in the DNA genetics code, added a comment about it in DNA_cloth_types.h. * Handle vertex groups and uv layers more consistent now. They are all exposed as strings now. Reason is that indices don't really say much, and a direct pointer is not always possible because for example a uv layer in a material can be used for multiple objects and so there is no single pointer. In python it is not too hard to use either since the strings works as a key for lookups. For the user interface we can later think of some method to generate popup menus in a way that works for vertex groups, uv layers, bones etc. * This also fixes the XXX's in rna_modifier.c, I think that can be marked done.
This commit is contained in:
parent
df6caaed1e
commit
6ec52fc1b5
@ -41,7 +41,7 @@ struct Image;
|
||||
struct MTFace;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct View3d;
|
||||
struct View3D;
|
||||
|
||||
/* OpenGL drawing functions related to shading. These are also
|
||||
* shared with the game engine, where there were previously
|
||||
|
@ -47,6 +47,9 @@ typedef struct ClothSimSettings
|
||||
float mingoal; /* see SB */
|
||||
float Cdis; /* Mechanical damping of springs. */
|
||||
float Cvi; /* Viscous/fluid damping. */
|
||||
/* XXX the extra space here results in wrong DNA parsing,
|
||||
* and reconstruct fails and gives corrupt settings when
|
||||
* removing it because the old dna is wrong ... */
|
||||
float gravity [3]; /* Gravity/external force vector. */
|
||||
float dt; /* This is the duration of our time step, computed. */
|
||||
float mass; /* The mass of the entire cloth. */
|
||||
@ -74,8 +77,8 @@ typedef struct ClothSimSettings
|
||||
short vgroup_mass; /* optional vertexgroup name for assigning weight.*/
|
||||
short vgroup_struct; /* vertex group for scaling structural stiffness */
|
||||
short presets; /* used for presets on GUI */
|
||||
short pad;
|
||||
int pad2;
|
||||
short pad;
|
||||
int pad2;
|
||||
} ClothSimSettings;
|
||||
|
||||
|
||||
|
@ -55,6 +55,8 @@ extern StructRNA RNA_Camera;
|
||||
extern StructRNA RNA_CastModifier;
|
||||
extern StructRNA RNA_CharInfo;
|
||||
extern StructRNA RNA_ClothModifier;
|
||||
extern StructRNA RNA_ClothCollisionSettings;
|
||||
extern StructRNA RNA_ClothSettings;
|
||||
extern StructRNA RNA_CollectionProperty;
|
||||
extern StructRNA RNA_CollisionModifier;
|
||||
extern StructRNA RNA_CollisionSensor;
|
||||
|
@ -30,6 +30,7 @@ SET(SRC
|
||||
rna_armature.c
|
||||
rna_brush.c
|
||||
rna_camera.c
|
||||
rna_cloth.c
|
||||
rna_color.c
|
||||
rna_constraint.c
|
||||
rna_controller.c
|
||||
|
@ -902,6 +902,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
|
||||
{"rna_armature.c", RNA_def_armature},
|
||||
{"rna_brush.c", RNA_def_brush},
|
||||
{"rna_camera.c", RNA_def_camera},
|
||||
{"rna_cloth.c", RNA_def_cloth},
|
||||
{"rna_color.c", RNA_def_color},
|
||||
{"rna_constraint.c", RNA_def_constraint},
|
||||
{"rna_controller.c", RNA_def_controller},
|
||||
|
343
source/blender/makesrna/intern/rna_cloth.c
Normal file
343
source/blender/makesrna/intern/rna_cloth.c
Normal file
@ -0,0 +1,343 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Contributor(s): Blender Foundation (2008)
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "rna_internal.h"
|
||||
|
||||
#include "BKE_cloth.h"
|
||||
#include "DNA_cloth_types.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value)
|
||||
{
|
||||
ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
|
||||
|
||||
/* check for clipping */
|
||||
if(value < settings->bending)
|
||||
value = settings->bending;
|
||||
|
||||
settings->max_bend = value;
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_max_struct_set(struct PointerRNA *ptr, float value)
|
||||
{
|
||||
ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
|
||||
|
||||
/* check for clipping */
|
||||
if(value < settings->structural)
|
||||
value = settings->structural;
|
||||
|
||||
settings->max_struct = value;
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass);
|
||||
}
|
||||
|
||||
static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass);
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass);
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct);
|
||||
}
|
||||
|
||||
static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct);
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct);
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend);
|
||||
}
|
||||
|
||||
static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend);
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
|
||||
}
|
||||
|
||||
static float rna_ClothSettings_gravity_get(PointerRNA *ptr, int index)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
return sim->gravity[index];
|
||||
}
|
||||
|
||||
static void rna_ClothSettings_gravity_set(PointerRNA *ptr, int index, float value)
|
||||
{
|
||||
ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
|
||||
sim->gravity[index]= value;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "ClothSettings", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object.");
|
||||
RNA_def_struct_sdna(srna, "ClothSimSettings");
|
||||
|
||||
/* goal */
|
||||
|
||||
prop= RNA_def_property(srna, "goal_minimum", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "mingoal");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range.");
|
||||
|
||||
prop= RNA_def_property(srna, "goal_maximum", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "maxgoal");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range.");
|
||||
|
||||
prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "defgoal");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used.");
|
||||
|
||||
prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "goalspring");
|
||||
RNA_def_property_range(prop, 0.0f, 0.999f);
|
||||
RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness.");
|
||||
|
||||
prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "goalfrict");
|
||||
RNA_def_property_range(prop, 0.0f, 50.0f);
|
||||
RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction.");
|
||||
|
||||
/* mass */
|
||||
|
||||
prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material.");
|
||||
|
||||
prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set");
|
||||
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex group for fine control over mass distribution.");
|
||||
|
||||
prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_VECTOR);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_range(prop, -100.0, 100.0);
|
||||
RNA_def_property_float_funcs(prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector.");
|
||||
|
||||
/* various */
|
||||
|
||||
prop= RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "Cvi");
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Air Damping", "Air has normaly some thickness which slows falling things down.");
|
||||
|
||||
prop= RNA_def_property(srna, "pin_cloth", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL);
|
||||
RNA_def_property_ui_text(prop, "Pin Cloth", "Define forces for vertices to stick to animated position.");
|
||||
|
||||
prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "goalspring");
|
||||
RNA_def_property_range(prop, 0.0f, 0.50);
|
||||
RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness.");
|
||||
|
||||
prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame");
|
||||
RNA_def_property_range(prop, 4, 80);
|
||||
RNA_def_property_ui_text(prop, "Quality", "Quality of the simulation in steps per frame (higher is better quality but slower).");
|
||||
|
||||
/* springs */
|
||||
|
||||
prop= RNA_def_property(srna, "stiffness_scaling", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING);
|
||||
RNA_def_property_ui_text(prop, "Stiffness Scaling", "If enabled, stiffness can be scaled along a weight painted vertex group.");
|
||||
|
||||
prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "Cdis");
|
||||
RNA_def_property_range(prop, 0.0f, 50.0f);
|
||||
RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity (higher = more smooth, less jiggling)");
|
||||
|
||||
prop= RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "structural");
|
||||
RNA_def_property_range(prop, 1.0f, 10000.0f);
|
||||
RNA_def_property_ui_text(prop, "Structural Stiffness", "Overall stiffness of structure.");
|
||||
|
||||
prop= RNA_def_property(srna, "structural_stiffness_maximum", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "max_struct");
|
||||
RNA_def_property_range(prop, 0.0f, 10000.0f);
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_struct_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "Structural Stiffness Maximum", "Maximum structural stiffness value.");
|
||||
|
||||
prop= RNA_def_property(srna, "structural_stiffness_vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", "rna_ClothSettings_struct_vgroup_set");
|
||||
RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", "Vertex group for fine control over structural stiffness.");
|
||||
|
||||
prop= RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bending");
|
||||
RNA_def_property_range(prop, 0.0f, 10000.0f);
|
||||
RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient (higher = less smaller but more big wrinkles).");
|
||||
|
||||
prop= RNA_def_property(srna, "bending_stiffness_maximum", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "max_bend");
|
||||
RNA_def_property_range(prop, 0.0f, 10000.0f);
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value.");
|
||||
|
||||
prop= RNA_def_property(srna, "bending_vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", "rna_ClothSettings_bend_vgroup_set");
|
||||
RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness.");
|
||||
|
||||
/* unused */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "shear");
|
||||
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
||||
RNA_def_property_ui_text(prop, "Shear Stiffness", "Shear spring stiffness."); */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "shear_stiffness_maximum", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "max_shear");
|
||||
RNA_def_property_range(prop, 0.0f, upperLimitf);
|
||||
RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value."); */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "eff_force_scale");
|
||||
RNA_def_property_range(prop, 0.0f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Effector Force Scale", ""); */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale");
|
||||
RNA_def_property_range(prop, 0.0f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Effector Wind Scale", ""); */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "preroll");
|
||||
RNA_def_property_range(prop, 10, 80;
|
||||
RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame."); */
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING);
|
||||
RNA_def_property_ui_text(prop, "Tearing", "");*/
|
||||
|
||||
/* unused still
|
||||
prop= RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "maxspringlen");
|
||||
RNA_def_property_range(prop, 1.0, 1000.0);
|
||||
RNA_def_property_ui_text(prop, "Maximum Spring Extension", "Maximum extension before spring gets cut."); */
|
||||
}
|
||||
|
||||
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Cloth Collision Settings", "DOC_BROKEN");
|
||||
RNA_def_struct_sdna(srna, "ClothCollSettings");
|
||||
|
||||
/* general collision */
|
||||
|
||||
prop= RNA_def_property(srna, "enable_collision", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_ENABLED);
|
||||
RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects.");
|
||||
|
||||
prop= RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "epsilon");
|
||||
RNA_def_property_range(prop, 0.001f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance between collision objects before collision response takes in, can be changed for each frame.");
|
||||
|
||||
prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 80.0f);
|
||||
RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened (0=movement not changed, 100=no movement left)");
|
||||
|
||||
prop= RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "loop_count");
|
||||
RNA_def_property_range(prop, 1, 20);
|
||||
RNA_def_property_ui_text(prop, "Collision Quality", "How many collision iterations should be done. (higher is better quality but slower)");
|
||||
|
||||
/* self collision */
|
||||
|
||||
prop= RNA_def_property(srna, "enable_self_collision", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_SELF);
|
||||
RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions.");
|
||||
|
||||
prop= RNA_def_property(srna, "self_minimum_distance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
|
||||
RNA_def_property_range(prop, 0.5f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Self Minimum Distance", "0.5 means no distance at all, 1.0 is maximum distance");
|
||||
|
||||
prop= RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 80.0f);
|
||||
RNA_def_property_ui_text(prop, "Self Friction", "Friction/damping with self contact.");
|
||||
|
||||
prop= RNA_def_property(srna, "self_collision_quality", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "self_loop_count");
|
||||
RNA_def_property_range(prop, 1, 10);
|
||||
RNA_def_property_ui_text(prop, "Self Collision Quality", "How many self collision iterations should be done. (higher is better quality but slower), can be changed for each frame.");
|
||||
}
|
||||
|
||||
void RNA_def_cloth(BlenderRNA *brna)
|
||||
{
|
||||
rna_def_cloth_sim_settings(brna);
|
||||
rna_def_cloth_collision_settings(brna);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -567,7 +567,6 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type,
|
||||
if (rna_validate_identifier(identifier, error) == 0) {
|
||||
fprintf(stderr, "RNA_def_property: property identifier \"%s\" - %s\n", identifier, error);
|
||||
DefRNA.error= 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ds= DefRNA.structs.last;
|
||||
|
@ -99,6 +99,7 @@ void RNA_def_actuator(struct BlenderRNA *brna);
|
||||
void RNA_def_brush(struct BlenderRNA *brna);
|
||||
void RNA_def_brushclone(struct BlenderRNA *brna);
|
||||
void RNA_def_camera(struct BlenderRNA *brna);
|
||||
void RNA_def_cloth(struct BlenderRNA *brna);
|
||||
void RNA_def_color(struct BlenderRNA *brna);
|
||||
void RNA_def_constraint(struct BlenderRNA *brna);
|
||||
void RNA_def_controller(struct BlenderRNA *brna);
|
||||
@ -139,6 +140,13 @@ void RNA_def_world(struct BlenderRNA *brna);
|
||||
void rna_def_ipo_common(struct StructRNA *srna);
|
||||
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
|
||||
|
||||
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
|
||||
int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index);
|
||||
void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index);
|
||||
void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
|
||||
void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
|
||||
void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
|
||||
|
||||
/* ID Properties */
|
||||
|
||||
extern StringPropertyRNA rna_IDProperty_string;
|
||||
|
@ -472,7 +472,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
|
||||
/* mtex */
|
||||
prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MappingTexture");
|
||||
RNA_def_property_struct_type(prop, "TextureSlot");
|
||||
RNA_def_property_collection_funcs(prop, "rna_Material_mtex_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0);
|
||||
RNA_def_property_ui_text(prop, "Textures", "");
|
||||
|
||||
|
@ -121,6 +121,114 @@ static void rna_Modifier_update(bContext *C, PointerRNA *ptr)
|
||||
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
|
||||
}
|
||||
|
||||
static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
|
||||
}
|
||||
|
||||
static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
|
||||
{
|
||||
ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
|
||||
return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
|
||||
}
|
||||
|
||||
static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
|
||||
}
|
||||
|
||||
static void rna_SimpleDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
SimpleDeformModifierData *smd= (SimpleDeformModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
|
||||
}
|
||||
|
||||
static void rna_ShrinkwrapModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ShrinkwrapModifierData *smd= (ShrinkwrapModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
|
||||
}
|
||||
|
||||
static void rna_LatticeModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
LatticeModifierData *lmd= (LatticeModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
|
||||
}
|
||||
|
||||
static void rna_ArmatureModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
ArmatureModifierData *lmd= (ArmatureModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_CurveModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
CurveModifierData *lmd= (CurveModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
|
||||
}
|
||||
|
||||
static void rna_DisplaceModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
DisplaceModifierData *lmd= (DisplaceModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_HookModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
HookModifierData *lmd= (HookModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
|
||||
}
|
||||
|
||||
static void rna_MaskModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
MaskModifierData *lmd= (MaskModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->vgroup, sizeof(lmd->vgroup));
|
||||
}
|
||||
|
||||
static void rna_MeshDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
MeshDeformModifierData *lmd= (MeshDeformModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_SmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
SmoothModifierData *lmd= (SmoothModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_WaveModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
WaveModifierData *lmd= (WaveModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_CastModifier_vgroup_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
CastModifierData *lmd= (CastModifierData*)ptr->data;
|
||||
rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
|
||||
}
|
||||
|
||||
static void rna_DisplaceModifier_uvlayer_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
DisplaceModifierData *smd= (DisplaceModifierData*)ptr->data;
|
||||
rna_object_uvlayer_name_set(ptr, value, smd->uvlayer_name, sizeof(smd->uvlayer_name));
|
||||
}
|
||||
|
||||
static void rna_UVProjectModifier_uvlayer_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
UVProjectModifierData *umd= (UVProjectModifierData*)ptr->data;
|
||||
rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name));
|
||||
}
|
||||
|
||||
static void rna_WaveModifier_uvlayer_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
WaveModifierData *wmd= (WaveModifierData*)ptr->data;
|
||||
rna_object_uvlayer_name_set(ptr, value, wmd->uvlayer_name, sizeof(wmd->uvlayer_name));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_modifier_subsurf(BlenderRNA *brna)
|
||||
@ -183,6 +291,7 @@ static void rna_def_modifier_lattice(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
@ -213,6 +322,7 @@ static void rna_def_modifier_curve(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
|
||||
@ -428,6 +538,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
|
||||
@ -441,7 +552,11 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used for modulating input.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
/* XXX: Not sure how to handle WaveModifierData.uvlayer_tmp. It should be a menu of this object's UV customdata layers. */
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_uvlayer_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "texture_coordinates_object", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "map_object");
|
||||
@ -493,6 +608,7 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
|
||||
@ -549,6 +665,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
@ -725,8 +842,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
|
||||
{MOD_DISP_DIR_Y, "DIR_Y", "Y", ""},
|
||||
{MOD_DISP_DIR_Z, "DIR_Z", "Z", ""},
|
||||
{MOD_DISP_DIR_NOR, "DIR_NORMAL", "Normal", ""},
|
||||
/* XXX: Correct name? */
|
||||
{MOD_DISP_DIR_RGB_XYZ, "DIR_RGB_TO_XYZ", "RGB To XYZ", ""},
|
||||
{MOD_DISP_DIR_RGB_XYZ, "DIR_RGB_TO_XYZ", "RGB to XYZ", ""},
|
||||
{0, NULL, NULL, NULL}};
|
||||
|
||||
static EnumPropertyItem prop_texture_coordinates_items[] = {
|
||||
@ -743,6 +859,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
|
||||
@ -773,7 +890,11 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Texture Coordinates", "");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
/* XXX: not sure how to handle uvlayer_tmp (for setting the UV layer if UV mapping is used.) */
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_uvlayer_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "texture_coordinate_object", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "map_object");
|
||||
@ -791,7 +912,11 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_text(srna, "UVProject Modifier", "UVProject Modifier.");
|
||||
RNA_def_struct_sdna(srna, "UVProjectModifierData");
|
||||
|
||||
/* XXX: not sure how to handle uvlayer_tmp */
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Object");
|
||||
@ -862,6 +987,7 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
@ -923,6 +1049,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
@ -949,6 +1076,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
|
||||
@ -1034,7 +1162,9 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_text(srna, "Explode Modifier", "Explode Modifier.");
|
||||
RNA_def_struct_sdna(srna, "ExplodeModifierData");
|
||||
|
||||
/* XXX: vgroup */
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length", "rna_ExplodeModifier_vgroup_set");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "");
|
||||
|
||||
prop= RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
@ -1065,10 +1195,25 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
|
||||
static void rna_def_modifier_cloth(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna= RNA_def_struct(brna, "ClothModifier", "Modifier");
|
||||
RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth Modifier.");
|
||||
RNA_def_struct_sdna(srna, "ClothModifierData");
|
||||
|
||||
prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
|
||||
RNA_def_property_struct_type(prop, "ClothSettings");
|
||||
RNA_def_property_ui_text(prop, "Cloth Settings", "");
|
||||
|
||||
prop= RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
|
||||
RNA_def_property_struct_type(prop, "ClothCollisionSettings");
|
||||
RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
|
||||
|
||||
prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "PointCache");
|
||||
RNA_def_property_ui_text(prop, "Point Cache", "");
|
||||
}
|
||||
|
||||
static void rna_def_modifier_collision(BlenderRNA *brna)
|
||||
@ -1167,6 +1312,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
|
||||
@ -1267,6 +1413,7 @@ static void rna_def_modifier_mask(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "vgroup");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "inverse", PROP_BOOLEAN, PROP_NONE);
|
||||
@ -1299,6 +1446,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name.");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_set");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "Origin", PROP_POINTER, PROP_NONE);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_material.h"
|
||||
|
||||
static void rna_Object_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
@ -47,24 +48,137 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr)
|
||||
|
||||
static int rna_VertexGroup_index_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= ptr->id.data;
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
|
||||
return BLI_findindex(&ob->defbase, ptr->data);
|
||||
}
|
||||
|
||||
static void *rna_Object_active_vertex_group_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= ptr->id.data;
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
return BLI_findlink(&ob->defbase, ob->actdef);
|
||||
}
|
||||
|
||||
static void rna_Object_active_material_range(PointerRNA *ptr, int *min, int *max)
|
||||
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bDeformGroup *dg;
|
||||
|
||||
dg= BLI_findlink(&ob->defbase, index-1);
|
||||
|
||||
if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
|
||||
else BLI_strncpy(value, "", sizeof(dg->name));
|
||||
}
|
||||
|
||||
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bDeformGroup *dg;
|
||||
|
||||
dg= BLI_findlink(&ob->defbase, index-1);
|
||||
return (dg)? strlen(dg->name): 0;
|
||||
}
|
||||
|
||||
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bDeformGroup *dg;
|
||||
int a;
|
||||
|
||||
for(a=1, dg=ob->defbase.first; dg; dg=dg->next, a++) {
|
||||
if(strcmp(dg->name, value) == 0) {
|
||||
*index= a;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*index= 0;
|
||||
}
|
||||
|
||||
void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bDeformGroup *dg;
|
||||
|
||||
for(dg=ob->defbase.first; dg; dg=dg->next) {
|
||||
if(strcmp(dg->name, value) == 0) {
|
||||
BLI_strncpy(result, value, maxlen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_strncpy(result, "", maxlen);
|
||||
}
|
||||
|
||||
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
Mesh *me;
|
||||
CustomDataLayer *layer;
|
||||
int a;
|
||||
|
||||
if(ob->type == OB_MESH && ob->data) {
|
||||
me= (Mesh*)ob->data;
|
||||
|
||||
for(a=0; a<me->fdata.totlayer; a++) {
|
||||
layer= &me->fdata.layers[a];
|
||||
|
||||
if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
|
||||
BLI_strncpy(result, value, maxlen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BLI_strncpy(result, "", maxlen);
|
||||
}
|
||||
|
||||
void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
Mesh *me;
|
||||
CustomDataLayer *layer;
|
||||
int a;
|
||||
|
||||
if(ob->type == OB_MESH && ob->data) {
|
||||
me= (Mesh*)ob->data;
|
||||
|
||||
for(a=0; a<me->fdata.totlayer; a++) {
|
||||
layer= &me->fdata.layers[a];
|
||||
|
||||
if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
|
||||
BLI_strncpy(result, value, maxlen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BLI_strncpy(result, "", maxlen);
|
||||
}
|
||||
|
||||
static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
*min= 0;
|
||||
*max= ob->totcol-1;
|
||||
}
|
||||
|
||||
static void *rna_Object_active_material_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
|
||||
return give_current_material(ob, ob->actcol);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void rna_Object_active_material_set(PointerRNA *ptr, void *value)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
|
||||
assign_material(ob, value, ob->actcol);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int rna_Object_active_material_link_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
@ -419,10 +533,16 @@ static void rna_def_object(BlenderRNA *brna)
|
||||
RNA_def_property_struct_type(prop, "Material");
|
||||
RNA_def_property_ui_text(prop, "Materials", "");
|
||||
|
||||
prop= RNA_def_property(srna, "active_material", PROP_INT, PROP_UNSIGNED);
|
||||
prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_struct_type(prop, "Material");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed.");
|
||||
|
||||
prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "actcol");
|
||||
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Object_active_material_range");
|
||||
RNA_def_property_ui_text(prop, "Active Material", "Index of active material.");
|
||||
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Object_active_material_index_range");
|
||||
RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material.");
|
||||
|
||||
prop= RNA_def_property(srna, "active_material_link", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, material_link_items);
|
||||
|
@ -85,9 +85,9 @@ void rna_def_mapping_texture(BlenderRNA *brna)
|
||||
{MTEX_NSPACE_TANGENT, "TANGENT", "Tangent", ""},
|
||||
{0, NULL, NULL, NULL}};
|
||||
|
||||
srna= RNA_def_struct(brna, "MappingTexture", NULL);
|
||||
srna= RNA_def_struct(brna, "TextureSlot", NULL);
|
||||
RNA_def_struct_sdna(srna, "MTex");
|
||||
RNA_def_struct_ui_text(srna, "MappingTexture", "DOC_BROKEN");
|
||||
RNA_def_struct_ui_text(srna, "TextureSlot", "DOC_BROKEN");
|
||||
|
||||
prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "texco");
|
||||
@ -310,11 +310,11 @@ void RNA_def_texture(BlenderRNA *brna)
|
||||
RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
|
||||
RNA_def_property_ui_text(prop, "Noise Size", "");
|
||||
|
||||
prop= RNA_def_property(srna, "turbulance", PROP_FLOAT, PROP_NONE);
|
||||
prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "turbul");
|
||||
RNA_def_property_range(prop, 0, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0, 200, 10, 2);
|
||||
RNA_def_property_ui_text(prop, "Turbulance", "");
|
||||
RNA_def_property_ui_text(prop, "Turbulence", "");
|
||||
|
||||
prop= RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bright");
|
||||
|
Loading…
Reference in New Issue
Block a user