Blender V5.3
blender::bke::ProjectVariable Class Reference

#include <BKE_blender_project.hh>

Inherits blender::IDProperty.

Public Member Functions

 ProjectVariable (StringRef name, ProjectVariableType type)
 ~ProjectVariable ()
 ProjectVariable (const ProjectVariable &other)=delete
ProjectVariable & operator= (const ProjectVariable &other)=delete
 ProjectVariable (ProjectVariable &&other) noexcept
ProjectVariable & operator= (ProjectVariable &&other) noexcept
IDProperty & prop ()
const IDProperty & prop () const
StringRefNull name_get () const
ProjectVariableType type_get () const
ProjectVariableStringSubtype string_subtype_get () const
void string_subtype_set (ProjectVariableStringSubtype type)
StringRefNull value_string_get () const
int value_int_get () const
float value_float_get () const
void value_set (StringRefNull value)
void value_set (int value)
void value_set (float value)
StringRefNull description_get () const
void description_set (StringRef description)

Detailed Description

A variable in a project.

A project variable is a named value (like a string or integer) that is shared across all blend files in a project.

Definition at line 68 of file BKE_blender_project.hh.

Constructor & Destructor Documentation

◆ ProjectVariable() [1/3]

◆ ~ProjectVariable()

blender::bke::ProjectVariable::~ProjectVariable ( )

Definition at line 116 of file blender_project.cc.

References blender::IDP_ClearProperty().

◆ ProjectVariable() [2/3]

blender::bke::ProjectVariable::ProjectVariable ( const ProjectVariable & other)
delete

References ProjectVariable().

◆ ProjectVariable() [3/3]

blender::bke::ProjectVariable::ProjectVariable ( ProjectVariable && other)
noexcept

Definition at line 121 of file blender_project.cc.

References ProjectVariable(), and prop().

Member Function Documentation

◆ description_get()

StringRefNull blender::bke::ProjectVariable::description_get ( ) const

◆ description_set()

void blender::bke::ProjectVariable::description_set ( StringRef description)

◆ name_get()

StringRefNull blender::bke::ProjectVariable::name_get ( ) const

Get the variable's name.

Note that renaming a variable requires access to project data (to ensure name uniqueness), and therefore variable renaming is done via rename_variable() on Project rather than by a method on the variable itself.

See also
Project::rename_variable()

Definition at line 137 of file blender_project.cc.

References blender::IDProperty::name, and blender::StringRefNull::StringRefNull().

Referenced by blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), and blender::bke::tests::TEST_F().

◆ operator=() [1/2]

ProjectVariable & blender::bke::ProjectVariable::operator= ( const ProjectVariable & other)
delete

References operator=(), and ProjectVariable().

Referenced by operator=().

◆ operator=() [2/2]

ProjectVariable & blender::bke::ProjectVariable::operator= ( ProjectVariable && other)
noexcept

Definition at line 127 of file blender_project.cc.

References blender::IDP_ClearProperty(), ProjectVariable(), and prop().

◆ prop() [1/2]

IDProperty & blender::bke::ProjectVariable::prop ( )
inline

Get the underlying ID property of the variable.

NOTE: typically you shouldn't use this, especially outside of this source file.

We inherit privately from IDProperty because we're only using a specific subset of what it does, and we don't want people accidentally putting it in invalid states for this type. This method bypasses those protections, and should only be used in narrow specific cases.

Definition at line 89 of file BKE_blender_project.hh.

Referenced by operator=(), ProjectVariable(), and ProjectVariable().

◆ prop() [2/2]

const IDProperty & blender::bke::ProjectVariable::prop ( ) const
inline

Definition at line 93 of file BKE_blender_project.hh.

◆ string_subtype_get()

ProjectVariableStringSubtype blender::bke::ProjectVariable::string_subtype_get ( ) const

◆ string_subtype_set()

void blender::bke::ProjectVariable::string_subtype_set ( ProjectVariableStringSubtype type)

◆ type_get()

ProjectVariableType blender::bke::ProjectVariable::type_get ( ) const

Get the variable's type.

Note that the variable's type is determined at construction time, and cannot be changed after.

See also
Project::new_variable()

Definition at line 142 of file blender_project.cc.

References blender::IDProperty::type.

Referenced by blender::bke::tests::TEST_F().

◆ value_float_get()

float blender::bke::ProjectVariable::value_float_get ( ) const

Definition at line 167 of file blender_project.cc.

References IDP_float_get.

Referenced by blender::bke::tests::TEST_F(), and blender::bke::tests::TEST_F().

◆ value_int_get()

int blender::bke::ProjectVariable::value_int_get ( ) const

Definition at line 162 of file blender_project.cc.

References IDP_int_get.

Referenced by blender::bke::tests::TEST_F(), and blender::bke::tests::TEST_F().

◆ value_set() [1/3]

void blender::bke::ProjectVariable::value_set ( float value)

Definition at line 182 of file blender_project.cc.

References IDP_float_set.

◆ value_set() [2/3]

void blender::bke::ProjectVariable::value_set ( int value)

Definition at line 177 of file blender_project.cc.

References IDP_int_set.

◆ value_set() [3/3]

void blender::bke::ProjectVariable::value_set ( StringRefNull value)

◆ value_string_get()

StringRefNull blender::bke::ProjectVariable::value_string_get ( ) const

The documentation for this class was generated from the following files: