Skip to content

Cannot link member variables from CocosBuilder #52

Description

@codynguyen

Hi,

I'm working on a project with CocosBuilder integration. Code connection from a CCBI file to a ruby class is OK.
The only problem is CCBReader cannot link variable from CCBI files to the ruby class: CCBReader: Couldn't find member variable: nodeCredit

The code that failed

class HomeLayer < Joybox::Core::Layer
  attr_accessor :nodeCredit

  # The below callback is OK
  def didLoadFromCCB
    load_audio
  end
end

I suspect the problem comes from how CCBReader retrieve Ivar from another class: Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);. Below is the suspected code:

      if (memberVarAssignmentType)
        {
            id target = NULL;
            if (memberVarAssignmentType == kCCBTargetTypeDocumentRoot) target = actionManager.rootNode;
            else if (memberVarAssignmentType == kCCBTargetTypeOwner) target = owner;

            if (target)
            {
                Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);
                NSLOG("class: %@", [target class]);
                if (ivar)
                {
                    object_setIvar(target,ivar,node);
                }
                else
                {
                    NSLog(@"CCBReader: Couldn't find member variable: %@", memberVarAssignmentName);
                }
            }
        }

Kindly help with this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions