From 10cce9cec6e425dd375b4b142f1c88d02ea3c776 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 3 Jan 2009 08:08:44 +0000 Subject: Started RNA for MTex --- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_texture.c | 63 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) (limited to 'source') diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 7f299221247..dcf23be34cd 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -113,6 +113,7 @@ extern StructRNA RNA_Lattice; extern StructRNA RNA_LatticeModifier; extern StructRNA RNA_LatticePoint; extern StructRNA RNA_Library; +extern StructRNA RNA_MappingTexture; extern StructRNA RNA_MCol; extern StructRNA RNA_MColLayer; extern StructRNA RNA_MFloatProperty; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 77bcd23ae14..7abf5c0e41a 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -30,12 +30,74 @@ #include "rna_internal.h" +#include "DNA_material_types.h" #include "DNA_texture_types.h" #ifdef RNA_RUNTIME #else +void rna_def_mapping_texture(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_texture_coordinates_items[] = { + {TEXCO_ORCO, "ORIGINAL_COORDINATES", "Original Coordinates", ""}, + {TEXCO_REFL, "REFLECTION_VECTOR", "Reflection Vector", ""}, + {TEXCO_NORM, "NORMAL_VECTOR", "Normal Vector", ""}, + {TEXCO_GLOB, "GLOBAL", "Global", ""}, + {TEXCO_UV, "UV", "UV", ""}, + {TEXCO_OBJECT, "LINKED_OBJECT", "Linked Object", ""}, + {TEXCO_STRAND, "STRAND", "Strand", ""}, + {TEXCO_STRESS, "STRESS", "Stress", ""}, + {TEXCO_SPEED, "TANGENT", "Tangent", ""}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem prop_blend_type_items[] = { + {MTEX_BLEND, "MIX", "Mix", ""}, + {MTEX_ADD, "ADD", "Add", ""}, + {MTEX_SUB, "SUBTRACT", "Subtract", ""}, + {MTEX_MUL, "MULTIPLY", "Multiply", ""}, + {MTEX_SCREEN, "SCREEN", "Screen", ""}, + {MTEX_OVERLAY, "OVERLAY", "Overlay", ""}, + {MTEX_DIFF, "DIFFERENCE", "Difference", ""}, + {MTEX_DIV, "DIVIDE", "Divide", ""}, + {MTEX_DARK, "DARKEN", "Darken", ""}, + {MTEX_LIGHT, "LIGHTEN", "Lighten", ""}, + {MTEX_BLEND_HUE, "HUE", "Hue", ""}, + {MTEX_BLEND_SAT, "SATURATION", "Saturation", ""}, + {MTEX_BLEND_VAL, "VALUE", "Value", ""}, + {MTEX_BLEND_COLOR, "COLOR", "Color", ""}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MappingTexture", NULL); + RNA_def_struct_sdna(srna, "MTex"); + RNA_def_struct_ui_text(srna, "MappingTexture", "DOC_BROKEN"); + + prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "texco"); + RNA_def_property_enum_items(prop, prop_texture_coordinates_items); + RNA_def_property_ui_text(prop, "Texture Coordinates", ""); + + /* XXX: MTex.mapto and MTex.maptoneg */ + + prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "blendtype"); + RNA_def_property_enum_items(prop, prop_blend_type_items); + RNA_def_property_ui_text(prop, "Blend Type", ""); + + prop= RNA_def_property(srna, "mapping_object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_ui_text(prop, "Mapping Object", ""); + + prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "tex"); + RNA_def_property_struct_type(prop, "Texture"); + RNA_def_property_ui_text(prop, "Texture", ""); +} + void rna_def_environment_map(BlenderRNA *brna) { StructRNA *srna; @@ -153,6 +215,7 @@ void RNA_def_texture(BlenderRNA *brna) {TEX_CELLNOISE, "CELL_NOISE", "Cell Noise", ""}, {0, NULL, NULL, NULL}}; + rna_def_mapping_texture(brna); rna_def_environment_map(brna); srna= RNA_def_struct(brna, "Texture", "ID"); -- cgit v1.2.3