Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
ModuleObject Class Reference
Inheritance diagram for ModuleObject:
OfModule ResourceUser EventObject CoreCustomData CoreBaseObject CoreBaseType ModuleLanguage ModuleProjectItem ModuleScripting ModuleTool ModuleWidget ModuleAovSet ModuleAovStore ModuleConstraint ModuleDeformer ModuleDisplacement ModuleGlObject ModuleGroup ModuleImage ModuleImageFilter ModuleIntegrator ModuleLayer ModuleLpe ModuleLpeConstant ModuleMaterial ModuleProcess ModuleProjectSearchPath ModuleRenderer ModuleRenderScene ModuleRuleSet ModuleSceneAssemblyExtract ModuleSceneAssemblySwitch ModuleScriptedClass ModuleSearchPath ModuleShadingLayer ModuleShot ModuleSubPixelFilter ModuleUnknown ModuleUvSlot

Classes

class  ResourceVariation
 Wrapper allowing to configure a resource variation. More...
 

Public Member Functions

virtual bool is_protected () const override
 
bool add_resource (const int &resource_id, const CoreBasicArray< OfAttrDirtiness > &attributes, OfResourceCustom *resource_custom=0)
 
bool add_shared_resource (const int &resource_id, const int &source_resource_id)
 
bool remove_resource (const int &resource_id)
 
bool set_resource_attrs (const int &resource_id, const CoreBasicArray< OfAttr * > &attributes)
 
bool set_resource_attrs (const int &resource_id, const CoreBasicArray< OfAttrDirtiness > &attributes)
 
bool get_resource_attrs (const int &resource_id, CoreVector< OfAttr * > &attributes) const
 
bool get_resource_attrs (const int &resource_id, CoreVector< OfAttrDirtiness > &attributes) const
 
bool set_resource_deps (const int &resource_id, const CoreBasicArray< ResourceID > &deps)
 
bool get_resource_deps (const int &resource_id, CoreVector< int > &deps) const
 
CoreString get_resource_key (ResourceID resource_id, GeometryResourceOverride *resource_override=nullptr)
 
bool set_resource_user_key (ResourceID resource_id, bool user_key)
 
bool get_resource_user_key (ResourceID resource_id, bool &user_key) const
 
bool share_resource (const int &resource_id, const int &source_resource_id)
 Make resource_id a "clone" of source_resource_id.
 
int get_shared_resource (const int &resource_id) const
 Get the source resource ID for a resource ID that has been shared.
 
void clear_resource (const int &resource_id)
 If this resource ID exists clear it, otherwise does nothing.
 
void update_resource (const int &resource_id)
 
void clear_unused_variations (void)
 
virtual const ResourceDataget_resource (const int &resource_id, void *data=0) const
 
virtual const ResourceDatatry_get_resource (const int &resource_id) const
 
bool is_resource_created (const int &resource_id) const
 
bool is_resource_exists (const int &resource_id) const
 
bool is_sharing_resource (const ModuleObject &other, const int &resource_id) const
 
GuiWidgetdeclare_custom_ui (const CoreVector< OfAttrHandle > &attrs, GuiWidget &parent_widget, void *info)
 
GuiSpreadsheetCellget_custom_table_cell_ui (const OfAttrTable &table, GuiSpreadsheetRow &parent, unsigned int column, unsigned int cell, bool enabled)
 
CoreString get_custom_attribute_label (const OfAttr &attribute) const
 
bool update_resource_key (const int &resource_id)
 Update the key for the given resource ID and return true if it has changed.
 
virtual void update_resource_keys () override
 Update the keys of all resource IDs for this object.
 
bool get_resource_link_id (const ResourceConnection &connection, int &resource_id) const
 Get the resource ID used by a given connection.
 
bool get_resource_link_tag (const ResourceConnection &connection, CoreString &resource_tag) const
 Like get_resource_link_id but get the resource tag (e.g. name)
 
bool get_resource_tag (ResourceObject &resource, CoreString &resource_tag) const
 Get the resource tag (name) of a given resource object.
 
virtual void post_render (const CtxEval &eval_ctx) const
 
bool has_resources () const
 
void dump_resources () const
 Log all resources + variations (overrides) used by this object.
 
const ResourceHandler & get_resource_handler () const
 
ResourceHandler & get_resource_handler ()
 
virtual void register_variable (CoreBasicArray< OfObjectVariableValue * > &variables, CoreVector< unsigned int > &unknown_variable_indices) override
 register_variable method is called by the OfObject to inform the module about the variables defined in the OfObject, then module have the responsibility to update the OfObject variable values
 
virtual void unregister_variable (CoreBasicArray< OfObjectVariableValue * > &variables) override
 unregister_variable method is called by the OfObject to inform the module about the no longer used variables
 
void udpate_variables_status (CoreBasicArray< unsigned int > &known_variables, CoreBasicArray< unsigned int > &unknown_variables)
 informs the module that some variables can be resolved or not.
 
virtual OfAttrget_master_input_value () const
 
virtual OfAttrget_pass_through () const
 
virtual OfAttrget_master_input () const
 
virtual unsigned int get_object_variable (const CoreString &variable_name, long long *values, const unsigned int &value_count) const
 Evaluate the object variable as a natural number.
 
virtual unsigned int get_object_variable (const CoreString &variable_name, double *values, const unsigned int &value_count) const
 Evaluate the object variable as a real number.
 
virtual size_t get_memory_size () const override
 
bool add_variation (unsigned int variation_key, ResourceUser *user)
 Add a new resource variation for the module. This method returns true if a new variation was created, false if it already existed. When the method returns true, you need to get the variation (get_variation), and configure it, otherwise you have nothing to do (the variation is already created and configured)
 
ResourceVariation get_variation (unsigned int variation_key)
 Get a wrapper of the resource variation given its key.
 
void remove_variation (unsigned int variation_key, ResourceUser *user)
 Remove the variation given its key.
 
void clear_resource (unsigned int variation_key, ResourceID resource_id)
 If this resource ID exists in the given variation clear it, otherwise does nothing.
 
unsigned int create_resource_hash (ResourceID resource_id) const
 Return a hash key of the current resource data for this module which can be used as a fingerprint.
 
unsigned int create_resource_hash (unsigned int variation_key, ResourceID resource_id) const
 Return a hash key of the current resource data for this module which can be used as a fingerprint.
 
bool is_resource_connection_for_id (ResourceID resource_id, const ResourceConnection &connection) const
 Return true if the given resource connection corresponds to the resource connection for this resource ID.
 
bool is_resource_connection_for_id (unsigned int variation_key, ResourceID resource_id, const ResourceConnection &connection) const
 Return true if the given resource connection corresponds to the resource connection for this resource ID for this variation.
 
- Public Member Functions inherited from OfModule
OfObjectget_object () const
 
void set_object (OfObject &object)
 
CoreString get_object_name () const
 
OfItemHandle get_traversal_item () const
 Get the "replacement" item of the current module object. Returns get_object() if no replacement item exists.
 
bool is_traversal () const
 
void set_shading_layer_values (const CoreBasicArray< OfObject * > &new_materials, const CoreBasicArray< OfObject * > &new_clip_maps, const CoreBasicArray< OfObject * > &new_displacements) const
 
OfAppget_application () const
 
virtual CoreBasicArray
< OfObject * > 
get_inputs () const
 
bool is_kindof (const OfClass &object) const =delete
 

Static Public Member Functions

static ResourceID declare_resource (const char *tag)
 
static ResourceID declare_resource (const CoreString &tag)
 
static bool declare_resource (ResourceID id, const char *tag)
 
static bool declare_resource (ResourceID id, const CoreString &tag)
 
static ResourceID get_resource_id (const char *tag)
 
static ResourceID get_resource_id (const CoreString &tag)
 
static const char * get_resource_tag (ResourceID id)
 
static void clear_unused_resources (SysThreadManager &thread_manager, const CoreBasicArray< OfObject * > &objects)
 

Static Public Attributes

static constexpr unsigned int null_variation = 0
 Key of the null resource variation.
 

Protected Member Functions

bool get_builtin_variable_value (const CoreString &var_name, CoreVector< CoreVariant > &value) const
 
bool get_builtin_variable_value_at (const CoreString &var_name, CoreVector< CoreVariant > &value, const double &time) const
 
virtual void module_constructor (OfObject &object) override
 
virtual void module_destructor () override
 
virtual void on_attribute_change (const OfAttr &attr, int &dirtiness, const int &dirtiness_flags) override
 
virtual void on_send_event (const CoreString &event) override
 
virtual ResourceDatacreate_resource (const int &id, void *data) const
 
virtual void on_resource_update (const int &id, ResourceData *resource)
 
virtual bool on_new_time (const double &time) override
 
virtual void * create_eval_data (const CtxEval &eval_ctx) const
 
virtual void destroy_eval_data (const CtxEval &eval_ctx, void *eval_data) const
 
virtual void * create_thread_data (const CtxEval &eval_ctx) const
 
virtual void destroy_thread_data (const CtxEval &eval_ctx, void *thread_data) const
 
virtual bool has_thread_data () const
 
virtual ModuleCmacreate_cma (const CtxEval *eval_ctx) const
 
virtual void destroy_cma (ModuleCma *cma) const
 
const bool pre_evaluate_begin (const CtxEval &eval_ctx) const
 
void pre_evaluate_end (const CtxEval &eval_ctx) const
 
virtual ResourceDataset_resource_data (const int &resource_id, ResourceData *data, const CoreString &key) override
 
virtual ResourceDataset_resource_data (const int &resource_id, void *data_serial, const size_t &data_serial_size, const CoreString &key) override
 
virtual unsigned int get_project_resource_count () const override
 
virtual int get_project_resource_id (const unsigned int &index) const override
 
virtual ResourceObject * get_project_resource (const unsigned int &index) const override
 
const OfResourceCustomget_custom_resource (const int &id) const
 
virtual void get_attr_preset_hints (CoreArray< bool > &hints, const OfAttr &attr) override
 
- Protected Member Functions inherited from OfModule
void protect_object (const bool &enable) const
 
virtual void on_deserialize (const CoreVersion &serial_version, const ParserGroup &parser_group, const OfSerialOptions &serial_options)
 
template<class T_Callbacks >
T_Callbacks * get_callbacks () const
 
void set_callbacks (OfClassCallbacks *clbk)
 

Friends

class CtxEval
 

Additional Inherited Members

- Public Types inherited from EventObject
typedef void(* EventInfoFunction )(EventObject &, const EventInfo &, void *)
 event callback signature for free functions / static methods.
 
typedef void(EventObject::* EventInfoMethod )(EventObject &, const EventInfo &, void *)
 event callback signature for methods.
 
typedef void(* EventFunction )(EventObject &, const CoreString &, void *)
 
typedef void(EventObject::* EventMethod )(EventObject &, const CoreString &, void *)
 

Member Function Documentation

void ModuleObject::clear_resource ( const int &  resource_id)

If this resource ID exists clear it, otherwise does nothing.

Note
The next call to get_resource will recreate it.
void ModuleObject::clear_unused_resources ( SysThreadManager thread_manager,
const CoreBasicArray< OfObject * > &  objects 
)
static

This will iterate on all object (it's multithreaded, in the same way OfObjectFactory::protect_objects is) and will clean their unused resources.

void ModuleObject::clear_unused_variations ( void  )

Clear unused variations (overriden) resources on this object

See Also
ResourceHandler::clear_unused_variations.
CoreString ModuleObject::get_custom_attribute_label ( const OfAttr attribute) const

Get the custom label for the specified attribute, to be used in the Attribute Editor or any other display.

Parameters
attributeThe attribute.
Returns
A non-empty string if the module defines a custom label for the attribute. Otherwise an empty string.
GuiSpreadsheetCell * ModuleObject::get_custom_table_cell_ui ( const OfAttrTable table,
GuiSpreadsheetRow parent,
unsigned int  column,
unsigned int  cell,
bool  enabled 
)

Get a custom table cell Ui. This will call the cb_get_custom_table_cell_ui callback of the module, if it's set

Parameters
tableThe table
parentThe parent spreadsheet row. Needed by most spreadsheet cell's constructors
columnThe index of the column
rowThe index of the row
enabledThe enabled state of the cell. It's provided for convenience (depends on the states of the columns and the rows)
Returns
The GuiSpreadsheetCell instance to use
unsigned int ModuleObject::get_object_variable ( const CoreString variable_name,
long long *  values,
const unsigned int &  value_count 
) const
virtual

Evaluate the object variable as a natural number.

Parameters
[in]variable_namename of the variable
[out]valuesoutput values
[in]value_countthe number of values to be returned
Returns
the number of values that have been returned
unsigned int ModuleObject::get_object_variable ( const CoreString variable_name,
double *  values,
const unsigned int &  value_count 
) const
virtual

Evaluate the object variable as a real number.

Parameters
[in]variable_namename of the variable
[out]valuesoutput values
[in]value_countthe number of values to be returned
Returns
the number of values that have been returned
CoreString ModuleObject::get_resource_key ( ResourceID  resource_id,
GeometryResourceOverride resource_override = nullptr 
)

This will call the current cb_get_resource_key callback on this module. This method is needed to let the resource override handler query the key of a resource when the resource hash key is controlled by the user (in which case we don't have any attribute to rely upon)

bool ModuleObject::get_resource_link_id ( const ResourceConnection &  connection,
int &  resource_id 
) const

Get the resource ID used by a given connection.

Parameters
connectionThe resource connection to check.
resource_idThe resource ID will be stored in this reference.
Returns
true if resource_id was found, false otherwise (basically when the connection is unknown to this object)
bool ModuleObject::get_resource_user_key ( ResourceID  resource_id,
bool &  user_key 
) const

Store the "user key" flag in user_key for the resource type resource_id. This method returns true if user_key can be used, false otherwise (in case the resource didn't exit, etc.)

int ModuleObject::get_shared_resource ( const int &  resource_id) const

Get the source resource ID for a resource ID that has been shared.

Parameters
resource_idThe resource ID to check.
Returns
The source resource ID, or -1 if resource_id is not shared.
void ModuleObject::register_variable ( CoreBasicArray< OfObjectVariableValue * > &  variables,
CoreVector< unsigned int > &  unknown_variable_indices 
)
overridevirtual

register_variable method is called by the OfObject to inform the module about the variables defined in the OfObject, then module have the responsibility to update the OfObject variable values

Parameters
variablesis the set of variables defined in the OfObject
unknown_variable_indicesis the list of indices (from variables array) that failed to be resolved

Implements OfModule.

bool ModuleObject::set_resource_user_key ( ResourceID  resource_id,
bool  user_key 
)

Modify the resource idendified by resource_id to set its "user key" flag. If user_key is true, the key of the resources will not be computed automatically. Instead, each time it's required, the cb_get_user_key module's callback will be called. This methods returns true if the resource was correctly updated, false otherwise (the resource wasn't found, etc.)

Note
if user_key is true, the source will be reset to -1 (not shared) and the attributes and dependencies will be cleared.
See Also
GetResourceKeyCallback
bool ModuleObject::share_resource ( const int &  resource_id,
const int &  source_resource_id 
)

Make resource_id a "clone" of source_resource_id.

Note
ModuleObjectCallbacks::cb_create_resource will no longer be called for resources of type resource_id, since source_resource_id will be used in its place.
Returns
true if it succeeded, false otherwise (if either one of resource_id or source_resource_id doesn't exist for instance)
void ModuleObject::udpate_variables_status ( CoreBasicArray< unsigned int > &  known_variables,
CoreBasicArray< unsigned int > &  unknown_variables 
)

informs the module that some variables can be resolved or not.

Parameters
known_variablesis the set of new variables that can be resolved.
unknown_variablesis the set of variables that can no longer be resolved.
Note
each list contains a list of variables identifiers.
void ModuleObject::unregister_variable ( CoreBasicArray< OfObjectVariableValue * > &  variables)
overridevirtual

unregister_variable method is called by the OfObject to inform the module about the no longer used variables

Parameters
variablesis the set of variables defined in the OfObject that will be released

Implements OfModule.