[Bf-committers] Shader node loses Object connection

Smells Like Donkey contact at smellslikedonkey.com
Fri Jul 21 15:41:08 CEST 2017


Oh! the node-id thing is an interesting idea. I’ll try that.

Thanks,
Tod.

> On Jul 21, 2017, at 12:21 AM, Sergey Sharybin <sergey.vfx at gmail.com> wrote:
> 
> Hi,
> 
> For linking you need to make sure expand_nodetree() catches your new ID
> references. But then you'll also need to update all other library
> linking/relinking code in BKE.
> 
> Why not to store your curve object in node->id? Then all the
> linking/expanding/relinking etc will come for "free". At least with minimal
> amount of effort.
> 
> On Thu, Jul 20, 2017 at 10:34 PM, Smells Like Donkey <
> contact at smellslikedonkey.com <mailto:contact at smellslikedonkey.com>> wrote:
> 
>> Alright Sergey, here’s the patch in the Tangent Animation branch (now a
>> public repo as of 5 minutes ago) that I’m referring to. If you have any
>> insight it would be greatly appreciated.
>> 
>> https://github.com/tangent-animation/blender278/compare/ <https://github.com/tangent-animation/blender278/compare/>
>> ReactivateCurveTexture <https://github.com/tangent- <https://github.com/tangent->
>> animation/blender278/compare/ReactivateCurveTexture>
>> 
>> and specifically on line 3088 here for the readfile modification:
>> 
>> https://github.com/tangent-animation/blender278/blob/
>> ReactivateCurveTexture/source/blender/blenloader/intern/readfile.c
>> 
>> Thanks,
>> Tod.
>> 
>> 
>>> On Jul 20, 2017, at 2:17 PM, Smells Like Donkey <
>> contact at smellslikedonkey.com> wrote:
>>> 
>>> Hi Sergey,
>>> 
>>> I added the code to readfile and it seems to work when saving and
>> reloading the files. It’s only during linking that it’s getting lost.
>>> 
>>> Let me see if I can get you a link to the patch. Stay tuned.
>>> 
>>> Tod.
>>> 
>>> P.S. The code added to readfile
>>> 
>>> else if (node->type == SH_NODE_TEX_CURVE) {
>>>      NodeTexCurve *ntc = (NodeTexCurve*)node->storage;
>>>      ntc->object = newlibadr(fd, ntree->id.lib, ntc->object);
>>> }
>>> 
>>> 
>>> 
>>>> On Jul 20, 2017, at 2:10 PM, Sergey Sharybin <sergey.vfx at gmail.com>
>> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> Hard to tell without seeing actual patch, but guess is that you didn't
>> add
>>>> linking code to readfile. You would need to make sure to call
>> newlibadr_us
>>>> for the new node, so the pointer to Curve is not properly restored on
>>>> redo/reload.
>>>> 
>>>> On Thu, Jul 20, 2017 at 9:58 PM, Smells Like Donkey <
>>>> contact at smellslikedonkey.com> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I’m hoping someone here can shed some light on how I can fix this
>> linking
>>>>> issue.
>>>>> 
>>>>> We built a new texture node that can project Bezier curves onto a
>> texture.
>>>>> So it’s a shading node that had a field where you can select a bezier
>>>>> curve. The RNA code is at the end of this if it’s relevant.
>>>>> 
>>>>> It all works and renders fine but there’s a linking issue. If I do
>> these
>>>>> steps...
>>>>> 
>>>>> 1. Create an asset with the shader
>>>>> 2. Link that asset in (still works), save the file
>>>>> 3. Reopen (doesn’t work)
>>>>> 
>>>>> ...the connection to the Curve doesn’t get set and the node is broken.
>>>>> Where should I be looking to fix this issue? Any ideas would be
>> appreciated.
>>>>> 
>>>>> Thanks,
>>>>> Tod.
>>>>> 
>>>>> 
>>>>> /**************** Curve Texture ****************/
>>>>> 
>>>>> class ShaderNodeTexCurve : public ShaderNode {
>>>>> public:
>>>>>      ShaderNodeTexCurve(const PointerRNA &ptr_arg) :
>>>>>              ShaderNode(ptr_arg)
>>>>>              {}
>>>>> 
>>>>>      inline TexMapping texture_mapping(void);
>>>>>      inline ColorMapping color_mapping(void);
>>>>>      inline Object object(void);
>>>>>      enum curve_type_enum {
>>>>>              curve_type_LINE = 0,
>>>>>              curve_type_FILL = 1,
>>>>>              curve_type_GRAD = 2,
>>>>>      };
>>>>>      inline curve_type_enum curve_type(void);
>>>>>      inline void curve_type(curve_type_enum value);
>>>>> 
>>>>>      inline int is_registered_node_type();
>>>>>      inline NodeInternalSocketTemplate input_template(int index);
>>>>>      inline NodeInternalSocketTemplate output_template(int index);
>>>>> };
>>>>> 
>>>>> _______________________________________________
>>>>> Bf-committers mailing list
>>>>> Bf-committers at blender.org
>>>>> https://lists.blender.org/mailman/listinfo/bf-committers
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> With best regards, Sergey Sharybin
>>>> _______________________________________________
>>>> Bf-committers mailing list
>>>> Bf-committers at blender.org
>>>> https://lists.blender.org/mailman/listinfo/bf-committers
>>> 
>>> _______________________________________________
>>> Bf-committers mailing list
>>> Bf-committers at blender.org
>>> https://lists.blender.org/mailman/listinfo/bf-committers
>> 
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org <mailto:Bf-committers at blender.org>
>> https://lists.blender.org/mailman/listinfo/bf-committers <https://lists.blender.org/mailman/listinfo/bf-committers>
>> 
> 
> 
> 
> -- 
> With best regards, Sergey Sharybin
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org <mailto:Bf-committers at blender.org>
> https://lists.blender.org/mailman/listinfo/bf-committers <https://lists.blender.org/mailman/listinfo/bf-committers>


More information about the Bf-committers mailing list