Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_modifier.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 1,595 Lines • ▼ Show 20 Lines | |||||
| * value. | * value. | ||||
| */ | */ | ||||
| static bool rna_Modifier_show_expanded_get(PointerRNA *ptr) | static bool rna_Modifier_show_expanded_get(PointerRNA *ptr) | ||||
| { | { | ||||
| ModifierData *md = ptr->data; | ModifierData *md = ptr->data; | ||||
| return md->ui_expand_flag & UI_PANEL_DATA_EXPAND_ROOT; | return md->ui_expand_flag & UI_PANEL_DATA_EXPAND_ROOT; | ||||
| } | } | ||||
| static int rna_MeshSequenceCacheModifier_has_velocity_get(PointerRNA *ptr) | |||||
| { | |||||
| # ifdef WITH_ALEMBIC | |||||
| MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data; | |||||
| return ABC_has_vec3_array_property_named(mcmd->reader, mcmd->cache_file->velocity_name); | |||||
| # else | |||||
| return false; | |||||
| UNUSED_VARS(ptr); | |||||
| # endif | |||||
| } | |||||
| static int rna_MeshSequenceCacheModifier_read_velocity_get(PointerRNA *ptr) | |||||
| { | |||||
| # ifdef WITH_ALEMBIC | |||||
| MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data; | |||||
| if (mcmd->num_vertices == 0) { | |||||
| return 0; | |||||
| } | |||||
| if (mcmd->vertex_velocities) { | |||||
| MEM_freeN(mcmd->vertex_velocities); | |||||
| } | |||||
| mcmd->vertex_velocities = MEM_mallocN(sizeof(MeshCacheVertexVelocity) * mcmd->num_vertices, | |||||
| "Mesh Cache Velocities"); | |||||
| int num_read = ABC_read_velocity_cache(mcmd->reader, | |||||
| mcmd->cache_file->velocity_name, | |||||
| mcmd->last_lookup_time, | |||||
| mcmd->velocity_scale * mcmd->velocity_delta, | |||||
| mcmd->num_vertices, | |||||
| (float *)mcmd->vertex_velocities); | |||||
| if (num_read == -1 || num_read != mcmd->num_vertices) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| # else | |||||
| return false; | |||||
| UNUSED_VARS(ptr); | |||||
| # endif | |||||
| } | |||||
| static bool rna_NodesModifier_node_group_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | static bool rna_NodesModifier_node_group_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | ||||
| { | { | ||||
| bNodeTree *ntree = value.data; | bNodeTree *ntree = value.data; | ||||
| return ntree->type == NTREE_GEOMETRY; | return ntree->type == NTREE_GEOMETRY; | ||||
| } | } | ||||
| static void rna_NodesModifier_node_group_update(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_NodesModifier_node_group_update(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 4,456 Lines • ▼ Show 20 Lines | static void rna_def_modifier_meshcache(BlenderRNA *brna) | ||||
| RNA_def_property_float_sdna(prop, NULL, "eval_factor"); | RNA_def_property_float_sdna(prop, NULL, "eval_factor"); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds"); | RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds"); | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| RNA_define_lib_overridable(false); | RNA_define_lib_overridable(false); | ||||
| } | } | ||||
| static void rna_def_mesh_cache_velocities(BlenderRNA *brna) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| srna = RNA_def_struct(brna, "MeshCacheVertexVelocity", NULL); | |||||
| RNA_def_struct_ui_text(srna, "Mesh Cache Velocity", "Velocity attribute of an Alembic mesh"); | |||||
| RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); | |||||
| prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); | |||||
| RNA_def_property_array(prop, 3); | |||||
| RNA_def_property_float_sdna(prop, NULL, "vel"); | |||||
| RNA_def_property_ui_text(prop, "Velocity", ""); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| } | |||||
| static void rna_def_modifier_meshseqcache(BlenderRNA *brna) | static void rna_def_modifier_meshseqcache(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "MeshSequenceCacheModifier", "Modifier"); | srna = RNA_def_struct(brna, "MeshSequenceCacheModifier", "Modifier"); | ||||
| RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh"); | RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh"); | ||||
| RNA_def_struct_sdna(srna, "MeshSeqCacheModifierData"); | RNA_def_struct_sdna(srna, "MeshSeqCacheModifierData"); | ||||
| Show All 40 Lines | static void rna_def_modifier_meshseqcache(BlenderRNA *brna) | ||||
| RNA_def_property_float_sdna(prop, NULL, "velocity_scale"); | RNA_def_property_float_sdna(prop, NULL, "velocity_scale"); | ||||
| RNA_def_property_range(prop, 0.0f, FLT_MAX); | RNA_def_property_range(prop, 0.0f, FLT_MAX); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, | prop, | ||||
| "Velocity Scale", | "Velocity Scale", | ||||
| "Multiplier used to control the magnitude of the velocity vectors for time effects"); | "Multiplier used to control the magnitude of the velocity vectors for time effects"); | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| /* -------------------------- Velocity Vectors -------------------------- */ | |||||
| prop = RNA_def_property(srna, "vertex_velocities", PROP_COLLECTION, PROP_NONE); | |||||
| RNA_def_property_collection_sdna(prop, NULL, "vertex_velocities", "num_vertices"); | |||||
| RNA_def_property_struct_type(prop, "MeshCacheVertexVelocity"); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); | |||||
| rna_def_mesh_cache_velocities(brna); | |||||
| prop = RNA_def_property(srna, "has_velocity", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_ui_text(prop, "Has Velocity Cache", ""); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_MeshSequenceCacheModifier_has_velocity_get", NULL); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "read_velocity", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_ui_text(prop, "Read Velocity Cache", ""); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_MeshSequenceCacheModifier_read_velocity_get", NULL); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_define_lib_overridable(false); | RNA_define_lib_overridable(false); | ||||
| } | } | ||||
| static void rna_def_modifier_laplaciandeform(BlenderRNA *brna) | static void rna_def_modifier_laplaciandeform(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 1,179 Lines • Show Last 20 Lines | |||||