engine/gamesys/src/gamesys/scripts/script_spine_model.cpp
/** DEPRECATED! set a shader constant for a spine model
     * Sets a shader constant for a spine model component.
     * The constant must be defined in the material assigned to the spine model.
     * Setting a constant through this function will override the value set for that constant in the material.
     * The value will be overridden until spine.reset_constant is called.
     * Which spine model to set a constant for is identified by the URL.
     *
     * @name spine.set_constant
     * @param url [type:string|hash|url] the spine model that should have a constant set
     * @param constant [type:string|hash] name of the constant
     * @param value [type:vector4] value of the constant
     * @examples
     *
     * The following examples assumes that the spine model has id "spinemodel" and that the default-material in builtins is used, which defines the constant "tint".
     * If you assign a custom material to the sprite, you can reset the constants defined there in the same manner.
     *
     * How to tint a spine model to red:
     *
     * ```lua
     * function init(self)
     *   spine.set_constant("#spinemodel", "tint", vmath.vector4(1, 0, 0, 1))
     * end
     * ```
     */




The following examples assumes that the spine model has id "spinemodel" and that the default-material in builtins is used, which defines the constant "tint".
If you assign a custom material to the sprite, you can reset the constants defined there in the same manner.




The following examples assumes that the spine model has id " spinemodel " and that the default - material in builtins is used which defines the constant " tint " . If you assign a custom material to the sprite you can reset the constants defined there in the same manner .
int SpineComp_SetConstant(lua_State* L)
    {
        int top = lua_gettop(L);
        dmGameObject::HInstance instance = CheckGoInstance(L);
        dmhash_t name_hash = dmScript::CheckHashOrString(L, 2);
        Vectormath::Aos::Vector4* value = dmScript::CheckVector4(L, 3);
        dmGameSystemDDF::SetConstantSpineModel msg;
        msg.m_NameHash = name_hash;
        msg.m_Value = *value;
        dmMessage::URL receiver;
        dmMessage::URL sender;
        dmScript::ResolveURL(L, 1, &receiver, &sender);
        dmMessage::Post(&sender, &receiver, dmGameSystemDDF::SetConstantSpineModel::m_DDFDescriptor->m_NameHash, (uintptr_t)instance, (uintptr_t)dmGameSystemDDF::SetConstantSpineModel::m_DDFDescriptor, &msg, sizeof(msg), 0);
        assert(top == lua_gettop(L));
        return 0;
    }
int SpineComp_SetConstant ( lua_State * L ) { int top = lua_gettop ( L ) ; dmGameObject :: HInstance instance = CheckGoInstance ( L ) ; dmhash_t name_hash = dmScript :: CheckHashOrString ( L , 2 ) ; Vectormath :: Aos :: Vector4 * value = dmScript :: CheckVector4 ( L , 3 ) ; dmGameSystemDDF :: SetConstantSpineModel msg ; msg . m_NameHash = name_hash ; msg . m_Value = * value ; dmMessage :: URL receiver ; dmMessage :: URL sender ; dmScript :: ResolveURL ( L , 1 , & receiver , & sender ) ; dmMessage :: Post ( & sender , & receiver , dmGameSystemDDF :: SetConstantSpineModel :: m_DDFDescriptor -> m_NameHash , ( uintptr_t ) instance , ( uintptr_t ) dmGameSystemDDF :: SetConstantSpineModel :: m_DDFDescriptor , & msg , sizeof ( msg ) , 0 ) ; assert ( top == lua_gettop ( L ) ) ; return 0 ; }
DEPRECATED!
DEPRECATED!